The parent of actor object. Manages render/update ticks as wells as provides methods fo actors to get references to other actors(collision detections/radius searches)
Functions
constructor(elem) -> bind itself to a canvas element
start() -> starts render and update loops
stop() -> stops render and update loops
callUpdateCycles() -> check if deltaTime is bigger than desired FPS if so call updateCycles
updateCycles(deltaTime) -> call self update as well as update methods on children
update(deltaTime) -> all stage update functionality goes here
callRenderCycles() -> check if deltaTime is bigger than desired FPS if so call renderCycles
renderCycles(deltaTime) -> call self render as well as render methods on children(preserve painting order)
render(deltaTime) -> all stage render functionality goes here
destroy() -> called when object is destroyed
addActor(actor, zIndex) -> adds an actor to the stage, setting it's painting order
Painting Order
Actors should be stored in a map of lists corresponding to paint order:
E.G. {-10: [actorA, actorB], 0: [actorC, actorD], 100: [actorE]}
When calling renderCycles, the order of paint should be followed(where smaller order gets painted first)
Render/Update Loops
Use window.requestAnimationFrame to start loops on callbacks
Use window.cancelAnimationFrame to stop loops on callbacks
Collision/Search Methods
TODO: Complete after quadtree implementation is complete
Define the class structure for Stage objects
Stage
The parent of actor object. Manages render/update ticks as wells as provides methods fo actors to get references to other actors(collision detections/radius searches)
Functions
Painting Order
Actors should be stored in a map of lists corresponding to paint order: E.G. {-10: [actorA, actorB], 0: [actorC, actorD], 100: [actorE]} When calling renderCycles, the order of paint should be followed(where smaller order gets painted first)
Render/Update Loops
Use window.requestAnimationFrame to start loops on callbacks Use window.cancelAnimationFrame to stop loops on callbacks
Collision/Search Methods
TODO: Complete after quadtree implementation is complete