-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding Actor, Component, and ActorFactory docs
- Loading branch information
1 parent
26ee533
commit e5b0847
Showing
7 changed files
with
143 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
[cruft/core/ActorFactory.js](https://github.com/mjneil/CruftEngine/blob/master/cruft/core/ActorFactory.js) | ||
This class defines an ActorFactory. | ||
|
||
## Importing | ||
```javascript | ||
import ActorFactory from "cruft/core/ActorFactory"; | ||
``` | ||
|
||
## Constructors | ||
|
||
### ActorFactory( ) | ||
|
||
```javascript | ||
let factory = new ActorFactory(); | ||
``` | ||
|
||
|
||
##Methods | ||
|
||
### register( [name](/primitives.md#string), [creator](/primitives.md#function) ) | ||
[name](/primitives.md#string) - name to associate with the given creator function. | ||
[creator](/primitives.md#function) - a function that returns an actor. | ||
|
||
```javascript | ||
let EmptyCreator = () => { | ||
return new Actor(); | ||
} | ||
factory.register("Empty", EmptyCreator) | ||
``` | ||
|
||
### create( [name](/primitives.md#string), [config](/primitives.md#object) ) | ||
creates an actor of the given type. | ||
```javascript | ||
|
||
let MyCreator = (config) => { | ||
return new Actor(config.guid); | ||
} | ||
|
||
factory.register("MyCreator", MyCreator) | ||
let actor = factory.create("MyCreator", {guid : 12}); | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#Component extends [Emitter](Emitter.md) | ||
[cruft/core/Component.js](https://github.com/mjneil/CruftEngine/blob/master/cruft/core/Component.js) | ||
This class defines a Component. | ||
|
||
## Importing | ||
```javascript | ||
import Component from "cruft/core/Component"; | ||
``` | ||
|
||
## Constructors | ||
|
||
### Component( [ [guid](/primitives.md#number) ] ) | ||
[guid](/primitives.md#number) - guid of the component. | ||
|
||
```javascript | ||
let component = new Component(); | ||
``` | ||
|
||
|
||
|
||
## Properties | ||
.[guid](/primitives.md#number) - guid of the component. | ||
.[actor](Actor.md) - Strong reference to the parent Actor. | ||
|
||
|
||
##Methods | ||
|
||
|
||
### initialize( ) | ||
Initializes the component. | ||
**initialize is already called once the component has been added to an active actor in the scene. ** | ||
```javascript | ||
component.initialize(); | ||
``` | ||
|
||
### update( [now](/primitives.md#number), [deltaMs](/primitives.md#number) ) | ||
Update the component every game loop. | ||
```javascript | ||
component.update(now, deltaMs); | ||
``` | ||
|
||
|
||
### destroy( ) | ||
//DESC | ||
|
||
```javascript | ||
//EXAMPLE | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
[cruft/core/Scheduler.js](https://github.com/mjneil/CruftEngine/blob/master/cruft/core/Scheduler.js) | ||
This class defines a Scheduler. | ||
|
||
## Importing | ||
```javascript | ||
import Scheduler from "cruft/core/Scheduler"; | ||
``` | ||
|
||
## Constructors | ||
|
||
### Scheduler( ) | ||
|
||
```javascript | ||
let scheduler = new Scheduler(); | ||
``` | ||
|
||
|
||
##Methods | ||
|
||
### start( [deltaMs](/primitives.md#number) ) | ||
Starts the scheduler with the given delay. | ||
```javascript | ||
scheduler.start(17); | ||
``` | ||
|
||
### kill( ) | ||
Stops the scheduler from updating. | ||
```javascript | ||
scheduler.kill() | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters