X-Git-Url: https://git.r.bdr.sh/rbdr/sumo/blobdiff_plain/0616b3f00653c66b5e34814653e33413b9ec034e..493ec31cb19b4211c703762d14a4e6232c4c2143:/doc/README.md diff --git a/doc/README.md b/doc/README.md index 2d79f30..2d367a5 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,3 +1,268 @@ +## Classes + +
+
AngleComponent ⇐ external:Serpentity.Component
+
+
BodyComponent ⇐ external:Serpentity.Component
+
+
CoupledEntitiesComponent ⇐ external:Serpentity.Component
+
+
PixiContainerComponent ⇐ external:Serpentity.Component
+
+
PhysicalWithAttributesNode ⇐ external:Serpentity.Node
+
+
PhysicalNode ⇐ external:Serpentity.Node
+
+
RenderableCoupleNode ⇐ external:Serpentity.Node
+
+
RenderableWithAttributesNode ⇐ external:Serpentity.Node
+
+
RenderableNode ⇐ external:Serpentity.Node
+
+
Sumo
+
+
AttributesToRenderableSystem ⇐ external:Serpentity.System
+
+
CreateCouplingLineSystem ⇐ external:Serpentity.System
+
+
PhysicsToAttributesSystem ⇐ external:Serpentity.System
+
+
PhysicsWorldControlSystem ⇐ external:Serpentity.System
+
+
RenderSystem ⇐ external:Serpentity.System
+
+
+ +## Members + +
+
PixiFactory : object
+

Factory object that contains many methods to create prefab pixi +objects

+
+
SumoFactory : object
+

Factory object that contains many methods to create prefab entities.

+
+
+ + + +## AngleComponent ⇐ external:Serpentity.Component +**Kind**: global class +**Extends**: external:Serpentity.Component + + +### new AngleComponent(config) +Component that stores an angle + + +| Param | Type | Description | +| --- | --- | --- | +| config | object | a configuration object to extend. | + + + +## BodyComponent ⇐ external:Serpentity.Component +**Kind**: global class +**Extends**: external:Serpentity.Component + + +### new BodyComponent(config) +Component that stores a body for physics calculation + + +| Param | Type | Description | +| --- | --- | --- | +| config | object | a configuration object to extend. | + + + +## CoupledEntitiesComponent ⇐ external:Serpentity.Component +**Kind**: global class +**Extends**: external:Serpentity.Component + + +### new CoupledEntitiesComponent(config) +Component that stores a number of entities coupled to this one. + + +| Param | Type | Description | +| --- | --- | --- | +| config | object | a configuration object to extend. | + + + +## PixiContainerComponent ⇐ external:Serpentity.Component +**Kind**: global class +**Extends**: external:Serpentity.Component + +* [PixiContainerComponent](#PixiContainerComponent) ⇐ external:Serpentity.Component + * [new PixiContainerComponent(config)](#new_PixiContainerComponent_new) + * [.container](#PixiContainerComponent+container) + + + +### new PixiContainerComponent(config) +Component that stores a pixi container + + +| Param | Type | Description | +| --- | --- | --- | +| config | object | a configuration object to extend. | + + + +### pixiContainerComponent.container +The properthy that holds the pixi container + +**Kind**: instance property of [PixiContainerComponent](#PixiContainerComponent) +**Properties** + +| Name | Type | +| --- | --- | +| container | external:PixiJs.Container | + + + +## PhysicalWithAttributesNode ⇐ external:Serpentity.Node +**Kind**: global class +**Extends**: external:Serpentity.Node + +* [PhysicalWithAttributesNode](#PhysicalWithAttributesNode) ⇐ external:Serpentity.Node + * [new PhysicalWithAttributesNode()](#new_PhysicalWithAttributesNode_new) + * [.types](#PhysicalWithAttributesNode.types) + + + +### new PhysicalWithAttributesNode() +Node identifying an entity that can interact with physics and has +components updated from its values + + + +### PhysicalWithAttributesNode.types +Holds the types that are used to identify an entity with a physics +object and external attributes + +**Kind**: static property of [PhysicalWithAttributesNode](#PhysicalWithAttributesNode) +**Properties** + +| Name | Type | +| --- | --- | +| types | object | + + + +## PhysicalNode ⇐ external:Serpentity.Node +**Kind**: global class +**Extends**: external:Serpentity.Node + +* [PhysicalNode](#PhysicalNode) ⇐ external:Serpentity.Node + * [new PhysicalNode()](#new_PhysicalNode_new) + * [.types](#PhysicalNode.types) + + + +### new PhysicalNode() +Node identifying an entity that can interact with physics + + + +### PhysicalNode.types +Holds the types that are used to identify an entity with a physical +body + +**Kind**: static property of [PhysicalNode](#PhysicalNode) +**Properties** + +| Name | Type | +| --- | --- | +| types | object | + + + +## RenderableCoupleNode ⇐ external:Serpentity.Node +**Kind**: global class +**Extends**: external:Serpentity.Node + +* [RenderableCoupleNode](#RenderableCoupleNode) ⇐ external:Serpentity.Node + * [new RenderableCoupleNode()](#new_RenderableCoupleNode_new) + * [.types](#RenderableCoupleNode.types) + + + +### new RenderableCoupleNode() +Node identifying an entity that has coupled entities and can be +rendered + + + +### RenderableCoupleNode.types +Holds the types that are used to identify a renderable couple + +**Kind**: static property of [RenderableCoupleNode](#RenderableCoupleNode) +**Properties** + +| Name | Type | +| --- | --- | +| types | object | + + + +## RenderableWithAttributesNode ⇐ external:Serpentity.Node +**Kind**: global class +**Extends**: external:Serpentity.Node + +* [RenderableWithAttributesNode](#RenderableWithAttributesNode) ⇐ external:Serpentity.Node + * [new RenderableWithAttributesNode()](#new_RenderableWithAttributesNode_new) + * [.types](#RenderableWithAttributesNode.types) + + + +### new RenderableWithAttributesNode() +Node identifying a renderable entity, should have position and a +symbol to render + + + +### RenderableWithAttributesNode.types +Holds the types that are used to identify a renderable with external +attributes + +**Kind**: static property of [RenderableWithAttributesNode](#RenderableWithAttributesNode) +**Properties** + +| Name | Type | +| --- | --- | +| types | object | + + + +## RenderableNode ⇐ external:Serpentity.Node +**Kind**: global class +**Extends**: external:Serpentity.Node + +* [RenderableNode](#RenderableNode) ⇐ external:Serpentity.Node + * [new RenderableNode()](#new_RenderableNode_new) + * [.types](#RenderableNode.types) + + + +### new RenderableNode() +Node identifying a renderable entity, should have a pixi renderable + + + +### RenderableNode.types +Holds the types that are used to identify a renderable entity + +**Kind**: static property of [RenderableNode](#RenderableNode) +**Properties** + +| Name | Type | +| --- | --- | +| types | object | + ## Sumo @@ -40,3 +305,322 @@ live until after you stop and start the loop) Pauses the loop **Kind**: instance method of [Sumo](#Sumo) + + +## AttributesToRenderableSystem ⇐ external:Serpentity.System +**Kind**: global class +**Extends**: external:Serpentity.System + +* [AttributesToRenderableSystem](#AttributesToRenderableSystem) ⇐ external:Serpentity.System + * [new AttributesToRenderableSystem(config)](#new_AttributesToRenderableSystem_new) + * [.added(engine)](#AttributesToRenderableSystem+added) + * [.removed()](#AttributesToRenderableSystem+removed) + * [.update(currentFrameDuration)](#AttributesToRenderableSystem+update) + + + +### new AttributesToRenderableSystem(config) +Updates the renderables based on their attribuets + + +| Param | Type | Description | +| --- | --- | --- | +| config | object | a configuration object to extend. | + + + +### attributesToRenderableSystem.added(engine) +Initializes system when added. Requests renderable nodes and +attaches to event listeners to add / remove them to pixi stage + +**Kind**: instance method of [AttributesToRenderableSystem](#AttributesToRenderableSystem) + +| Param | Type | Description | +| --- | --- | --- | +| engine | external:Serpentity.Engine | the serpentity engine to which we are getting added | + + + +### attributesToRenderableSystem.removed() +Clears system resources when removed. + +**Kind**: instance method of [AttributesToRenderableSystem](#AttributesToRenderableSystem) + + +### attributesToRenderableSystem.update(currentFrameDuration) +Runs on every update of the loop. Updates the graphics so they're +rendered correctly + +**Kind**: instance method of [AttributesToRenderableSystem](#AttributesToRenderableSystem) + +| Param | Type | Description | +| --- | --- | --- | +| currentFrameDuration | Number | the duration of the current frame | + + + +## CreateCouplingLineSystem ⇐ external:Serpentity.System +**Kind**: global class +**Extends**: external:Serpentity.System + +* [CreateCouplingLineSystem](#CreateCouplingLineSystem) ⇐ external:Serpentity.System + * [new CreateCouplingLineSystem(config)](#new_CreateCouplingLineSystem_new) + * [.added(engine)](#CreateCouplingLineSystem+added) + * [.removed()](#CreateCouplingLineSystem+removed) + * [.update(currentFrameDuration)](#CreateCouplingLineSystem+update) + + + +### new CreateCouplingLineSystem(config) +Renders renderable objects using pixi + + +| Param | Type | Description | +| --- | --- | --- | +| config | object | a configuration object to extend. | + + + +### createCouplingLineSystem.added(engine) +Initializes system when added. Requests renderable nodes and + +**Kind**: instance method of [CreateCouplingLineSystem](#CreateCouplingLineSystem) + +| Param | Type | Description | +| --- | --- | --- | +| engine | external:Serpentity.Engine | the serpentity engine to which we are getting added | + + + +### createCouplingLineSystem.removed() +Clears system resources when removed. + +**Kind**: instance method of [CreateCouplingLineSystem](#CreateCouplingLineSystem) + + +### createCouplingLineSystem.update(currentFrameDuration) +Runs on every update of the loop. Does nothing. + +**Kind**: instance method of [CreateCouplingLineSystem](#CreateCouplingLineSystem) + +| Param | Type | Description | +| --- | --- | --- | +| currentFrameDuration | Number | the duration of the current frame | + + + +## PhysicsToAttributesSystem ⇐ external:Serpentity.System +**Kind**: global class +**Extends**: external:Serpentity.System + +* [PhysicsToAttributesSystem](#PhysicsToAttributesSystem) ⇐ external:Serpentity.System + * [new PhysicsToAttributesSystem(config)](#new_PhysicsToAttributesSystem_new) + * [.added(engine)](#PhysicsToAttributesSystem+added) + * [.removed()](#PhysicsToAttributesSystem+removed) + * [.update(currentFrameDuration)](#PhysicsToAttributesSystem+update) + + + +### new PhysicsToAttributesSystem(config) +Distribuets physics data to the related components + + +| Param | Type | Description | +| --- | --- | --- | +| config | object | a configuration object to extend. | + + + +### physicsToAttributesSystem.added(engine) +Initializes system when added. Requests physics nodes + +**Kind**: instance method of [PhysicsToAttributesSystem](#PhysicsToAttributesSystem) + +| Param | Type | Description | +| --- | --- | --- | +| engine | external:Serpentity.Engine | the serpentity engine to which we are getting added | + + + +### physicsToAttributesSystem.removed() +Clears system resources when removed. + +**Kind**: instance method of [PhysicsToAttributesSystem](#PhysicsToAttributesSystem) + + +### physicsToAttributesSystem.update(currentFrameDuration) +Runs on every update of the loop. Updates the other components +based on physics + +**Kind**: instance method of [PhysicsToAttributesSystem](#PhysicsToAttributesSystem) + +| Param | Type | Description | +| --- | --- | --- | +| currentFrameDuration | Number | the duration of the current frame | + + + +## PhysicsWorldControlSystem ⇐ external:Serpentity.System +**Kind**: global class +**Extends**: external:Serpentity.System + +* [PhysicsWorldControlSystem](#PhysicsWorldControlSystem) ⇐ external:Serpentity.System + * [new PhysicsWorldControlSystem(config)](#new_PhysicsWorldControlSystem_new) + * [.added(engine)](#PhysicsWorldControlSystem+added) + * [.removed()](#PhysicsWorldControlSystem+removed) + * [.update(currentFrameDuration)](#PhysicsWorldControlSystem+update) + + + +### new PhysicsWorldControlSystem(config) +Adds and removes objects to the physics world and calls update + + +| Param | Type | Description | +| --- | --- | --- | +| config | object | a configuration object to extend. | + + + +### physicsWorldControlSystem.added(engine) +Initializes system when added. Requests physics nodes and +attaches to event listeners to add / remove them to pixi stage + +**Kind**: instance method of [PhysicsWorldControlSystem](#PhysicsWorldControlSystem) + +| Param | Type | Description | +| --- | --- | --- | +| engine | external:Serpentity.Engine | the serpentity engine to which we are getting added | + + + +### physicsWorldControlSystem.removed() +Clears system resources when removed. + +**Kind**: instance method of [PhysicsWorldControlSystem](#PhysicsWorldControlSystem) + + +### physicsWorldControlSystem.update(currentFrameDuration) +Runs on every update of the loop. Updates the physics + +**Kind**: instance method of [PhysicsWorldControlSystem](#PhysicsWorldControlSystem) + +| Param | Type | Description | +| --- | --- | --- | +| currentFrameDuration | Number | the duration of the current frame | + + + +## RenderSystem ⇐ external:Serpentity.System +**Kind**: global class +**Extends**: external:Serpentity.System + +* [RenderSystem](#RenderSystem) ⇐ external:Serpentity.System + * [new RenderSystem(config)](#new_RenderSystem_new) + * [.added(engine)](#RenderSystem+added) + * [.removed()](#RenderSystem+removed) + * [.update(currentFrameDuration)](#RenderSystem+update) + + + +### new RenderSystem(config) +Renders renderable objects using pixi + + +| Param | Type | Description | +| --- | --- | --- | +| config | object | a configuration object to extend. | + + + +### renderSystem.added(engine) +Initializes system when added. Requests renderable nodes and +attaches to event listeners to add / remove them to pixi stage + +**Kind**: instance method of [RenderSystem](#RenderSystem) + +| Param | Type | Description | +| --- | --- | --- | +| engine | external:Serpentity.Engine | the serpentity engine to which we are getting added | + + + +### renderSystem.removed() +Clears system resources when removed. + +**Kind**: instance method of [RenderSystem](#RenderSystem) + + +### renderSystem.update(currentFrameDuration) +Runs on every update of the loop. Does nothing. + +**Kind**: instance method of [RenderSystem](#RenderSystem) + +| Param | Type | Description | +| --- | --- | --- | +| currentFrameDuration | Number | the duration of the current frame | + + + +## PixiFactory : object +Factory object that contains many methods to create prefab pixi +objects + +**Kind**: global variable + +* [PixiFactory](#PixiFactory) : object + * [.createSumo()](#PixiFactory.createSumo) ⇒ external:CreateJs.Container + * [.createEmptyGraphic()](#PixiFactory.createEmptyGraphic) ⇒ external:CreateJs.Container + + + +### PixiFactory.createSumo() ⇒ external:CreateJs.Container +Creates a sumo container + +**Kind**: static method of [PixiFactory](#PixiFactory) +**Returns**: external:CreateJs.Container - the created container + + +### PixiFactory.createEmptyGraphic() ⇒ external:CreateJs.Container +Creates an empty graphic + +**Kind**: static method of [PixiFactory](#PixiFactory) +**Returns**: external:CreateJs.Container - the created container + + +## SumoFactory : object +Factory object that contains many methods to create prefab entities. + +**Kind**: global variable + +* [SumoFactory](#SumoFactory) : object + * [.createSumo([engine], [config])](#SumoFactory.createSumo) ⇒ external:Serpentity.Entity + * [.createRubberBand([engine], [config])](#SumoFactory.createRubberBand) ⇒ external:Serpentity.Entity + + + +### SumoFactory.createSumo([engine], [config]) ⇒ external:Serpentity.Entity +Creates a sumo entity and adds it to the engine. Can override +position in the config object + +**Kind**: static method of [SumoFactory](#SumoFactory) +**Returns**: external:Serpentity.Entity - the created entity + +| Param | Type | Description | +| --- | --- | --- | +| [engine] | external:Serpentity | the serpentity engine to attach to. If not sent, it will not be attached. | +| [config] | object | the config to override the entity, accepts the key `position` as an object with an x and y property. | + + + +### SumoFactory.createRubberBand([engine], [config]) ⇒ external:Serpentity.Entity +Creates a rubber band entity and adds it to the engine. + +**Kind**: static method of [SumoFactory](#SumoFactory) +**Returns**: external:Serpentity.Entity - the created entity + +| Param | Type | Description | +| --- | --- | --- | +| [engine] | external:Serpentity | the serpentity engine to attach to. If not sent, it will not be attached. | +| [config] | object | the config to override the entity, it must include entityA and entityB which will be tied by it. If they are not sent or don't have a physics body, this will throw. | +