-
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.
rename project to cruft, eliminate dependencies in core/ classes, beg…
…in documentation on core classes
- Loading branch information
1 parent
ca1072d
commit ea8f54c
Showing
51 changed files
with
189 additions
and
158 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"parser": "babel-eslint", | ||
"env": { | ||
"browser": true, | ||
"node": true | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
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 @@ | ||
export default class MemoryManager { | ||
|
||
constructor() { | ||
this.references = {}; | ||
} | ||
|
||
add(actor) { | ||
this.references[actor.guid] = actor; | ||
} | ||
|
||
destroy(actor, recursive = false) { | ||
if(!actor) return; | ||
delete this.references[actor.guid] | ||
actor.destroy(); | ||
for(var id in actor.children) { | ||
destroy(actor.children[id], recursive); | ||
} | ||
} | ||
|
||
get(guid) { | ||
return this.references[guid] || null; | ||
} | ||
|
||
ptr(actor) { | ||
return new Ptr(actor.guid, this); | ||
} | ||
|
||
} | ||
|
||
class Ptr { | ||
|
||
constructor(guid, manager) { | ||
this.guid = guid; | ||
this.manager = manager; | ||
} | ||
|
||
reset(actor) { | ||
this.guid = actor.guid; | ||
} | ||
|
||
get() { | ||
return this.manager.get(this.guid); | ||
} | ||
|
||
destroy(recursive = false) { | ||
this.manager.destroy(this.get(), recursive); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,86 @@ | ||
#Actor extends [Referenceable](Referenceable.js) | ||
[engine/core/Actor.js](https://github.com/mjneil/CruftEngine/blob/master/engine/core/Actor.js) | ||
This class defines an Actor. | ||
|
||
## Constructors | ||
|
||
### Actor( [ [guid](/primitives.md#number) ] ) | ||
[guid](/primitives.md#number) - guid of super class [Referenceable](Referenceable.js) | ||
|
||
```javascript | ||
let actor = new Actor(); | ||
//or | ||
let actor2 = new Actor(12); | ||
``` | ||
|
||
|
||
|
||
## Properties | ||
.[parent](Actor.md) - Strong reference to parent actor. | ||
.[components](/primitives.md#object) - Object containing strong references to the actor's components. | ||
.[children](/primitives.md#object) - Object containing strong references to the actor's children. | ||
|
||
|
||
##Methods | ||
|
||
|
||
### addComponent( ) | ||
DESC | ||
|
||
```javascript | ||
//example | ||
``` | ||
|
||
|
||
### removeComponent( ) | ||
DESC | ||
|
||
```javascript | ||
//example | ||
``` | ||
|
||
|
||
### getComponent( ) | ||
DESC | ||
|
||
```javascript | ||
//example | ||
``` | ||
|
||
### addChild( ) | ||
DESC | ||
|
||
```javascript | ||
//example | ||
``` | ||
|
||
### removeChild( ) | ||
DESC | ||
|
||
```javascript | ||
//example | ||
``` | ||
|
||
|
||
### setParent( ) | ||
DESC | ||
|
||
```javascript | ||
//example | ||
``` | ||
|
||
|
||
### update( ) | ||
DESC | ||
|
||
```javascript | ||
//example | ||
``` | ||
|
||
|
||
### destroy( ) | ||
DESC | ||
|
||
```javascript | ||
//example | ||
``` |
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.