Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
[Doc]: Documenting the Rectangle (js doc)
Browse files Browse the repository at this point in the history
  • Loading branch information
201flaviosilva committed Apr 21, 2022
1 parent 7428c56 commit fc55744
Show file tree
Hide file tree
Showing 4 changed files with 339 additions and 15 deletions.
19 changes: 19 additions & 0 deletions src/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@ import { AssetsManagerInstance } from "./State/AssetsManager.js";
import { CanvasStateInstance } from "./State/CanvasState.js";
import CoreGameManager from "./Core/CoreGameManager.js";

/**
* @class Game
* @description The main class of the game.
* @example
* class Game extends Impacto.Scene {
* start() {
* this.rect = new Impacto.GameObjects.Rectangle(400, 300, 100, 100, "#ff0000");
* this.addChild(this.rect);
* }
* }
*
* const game = new Impacto.Game({
* width: 800,
* height: 600,
* backgroundColor: "#f0f0f0",
* scene: Game,
* });
*
*/
export default class Game {
constructor(config) {
// Start Canvas
Expand Down
23 changes: 17 additions & 6 deletions src/GameObjects/GameObjects.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Draw
import GameObjectBase from "./GameObject2D.js";
import AudioPlay from "./AudioPlay/AudioPlay.js";
import Circle from "./Circle/Circle.js";
Expand All @@ -9,14 +8,28 @@ import Sprite from "./Sprite/Sprite.js";
import Text from "./Text/Text.js";
import Triangle from "./Triangle/Triangle.js";


// Others
import Types from "./Types.js";

/**
* @namespace Impacto.GameObjects
*
* @property {Impacto.GameObjects.GameObjectBase} GameObjectBase
*
* @property {Impacto.GameObjects.AudioPlay} AudioPlay
* @property {Impacto.GameObjects.Circle} Circle
* @property {Impacto.GameObjects.Line} Line
* @property {Impacto.GameObjects.Polygon} Polygon
* @property {Impacto.GameObjects.Rectangle} Rectangle
* @property {Impacto.GameObjects.Sprite} Sprite
* @property {Impacto.GameObjects.Text} Text
* @property {Impacto.GameObjects.Triangle} Triangle
*
* @property {Impacto.GameObjects.Types} Types
*/
export default class GameObjects {
constructor() {
// Basic GameObject
this.GameObjectBase = GameObjectBase;

this.AudioPlay = AudioPlay;
this.Circle = Circle;
this.Line = Line;
Expand All @@ -26,9 +39,7 @@ export default class GameObjects {
this.Text = Text;
this.Triangle = Triangle;

// Others
this.Types = Types;
}
}

export const GameObjectsInstance = new GameObjects();
Loading

0 comments on commit fc55744

Please sign in to comment.