X-Git-Url: https://git.r.bdr.sh/rbdr/sumo/blobdiff_plain/11be5ebabcdab8272d938f7b90ef0ea9be29a421..refs/heads/rbdr-bouncy-walls:/doc/README.md?ds=sidebyside 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 + +
external:Serpentity.Component
external:Serpentity.Component
external:Serpentity.Component
external:Serpentity.Component
external:Serpentity.Node
external:Serpentity.Node
external:Serpentity.Node
external:Serpentity.Node
external:Serpentity.Node
external:Serpentity.System
external:Serpentity.System
external:Serpentity.System
external:Serpentity.System
external:Serpentity.System
object
Factory object that contains many methods to create prefab pixi +objects
+object
Factory object that contains many methods to create prefab entities.
+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. |
+