Skip to content

Core: Feather Class

Attict edited this page Jul 10, 2018 · 5 revisions

The feather class is the equivalent of a node. It is the basis for every object in our application. Feathers are recursive and nest inside themselves to "feather" our application. Feathers also use an instance of the Quill class. Quill's contain and manage all components attached to the feather.

Sample Code

Feather gameScene = createFeather('game_scene'); gameScene.addComponent<SizeComponent>(new SizeComponent(50.0, 25.0));

Constructors

Feather([Quill quill]);

Creates an object with the optional quill parameter.

Properties

enabled -> boolean

This determines whether or not the feather will be displayed, updated or checked for events.

true by default

quill -> Quill

All components attached to this feather. By default this is empty, but you can instantiate the class with a preset quill.

new Quill() by default

feathers -> Map<String, Feather>

All nested feathers inside of this feather by name.

Methods

init() -> void

Initializes all components, followed by nested feathers.

destroy() -> void

Destroys all components, followed by nested feathers.

load() -> void

Loads all components, followed by nested feathers.

unload() -> void

Unloads all components, followed by nested feathers.

input(Event event) -> void

Handles input for all components, followed by nested feathers.

update(Time time) -> void

Updates all components, followed by nested feathers.

render(Context context) -> void

Renders all components, followed by nested feathers.

addComponent(T component) -> T extends Component

Adds a component by class name using . This method will also return the newly added Component.

removeComponent() -> void

Remove a component by .

getComponent() -> T extends Component

Returns if it exists.

setQuill(Quill quill) -> void

Sets the quill to a preset of components, called a quill.

createFeather(String name, {Quill quill}) -> Feather

Creates a feather by name. Optionally specify a preset quill.

addFeather(String name, Feather feather) -> Feather

Adds a feather by name, if the named feather does not already exist.

removeFeather(String name) -> void

Removes a feather by name if it exists.

getFeather(String name) -> Feather

Returns a feather by name if it exists.

setFeather(String name, Feather feather) -> void

Changes a feather to a new feather by name.

Operators

N/A