Cornell Cocos
Cornell Extensions to Cocos2d
|
#include <CURootLayer.h>
Public Member Functions | |
virtual void | setContentSize (const Size &size) override |
void | setBlendFunc (const BlendFunc &blendFunc) override |
const BlendFunc & | getBlendFunc () const override |
virtual void | draw (Renderer *renderer, const Mat4 &transform, uint32_t flags) override |
virtual void | cleanup () override |
bool | isActive () const |
virtual void | start () |
virtual void | stop () |
virtual void | update (float dt) override |
void | shutdown () |
virtual | ~RootLayer (void) |
virtual bool | init () override |
virtual bool | initWithSize (const Size &size) |
virtual bool | initWithColor (const Color4B &color, const Size &size) |
Public Attributes | |
CC_CONSTRUCTOR_ACCESS | __pad0__: RootLayer(void) |
Protected Member Functions | |
void | clearRenderData () |
void | updateColor (void) override |
void | updateBlendFunc (void) |
Protected Attributes | |
Texture2D * | _texture |
BlendFunc | _blendFunc |
TrianglesCommand | _command |
TrianglesCommand::Triangles | _triangles |
bool | _active |
Friends | |
template<class T > | |
Scene * | GameRoot::createScene () |
template<class T > | |
Scene * | GameRoot::createScene (const Size &size) |
The top layer for the game scene graph.
|
virtual |
Releases all resources allocated with this layer.
|
overridevirtual |
Stops all running actions and schedulers
|
protected |
Clears the render data, releasing all vertices and indices.
|
overridevirtual |
Sends drawing commands to the renderer
This method is overridden from Node, to draw the background node. It draws using the same commands as PolygonNode, making it more efficient than the built-in LayerColor.
renderer | Reference to the render thread |
transform | The accumulated transform from the parent |
flags | Specialized Cocos2d drawing flags |
|
inlineoverride |
Returns the current blend function for this node
This is part of BlendProtocol.
|
overridevirtual |
Intializes an root layer to fit the screen dimensions.
The layer will use the XNA background color for nostalgic reasons.
|
virtual |
Intializes an root layer to fit the given color and dimensions.
color | the background color |
size | the size for the layer |
|
virtual |
Intializes an root layer to fit the given dimensions.
The layer will use the XNA background color for nostalgic reasons.
size | the size for the layer |
|
inline |
Returns true if this layer is active
An active layer is regularly receiving calls to update.
|
inlineoverride |
Sets the blend function to the one specified
This is part of BlendProtocol.
blendFunc | the new blend function. |
|
overridevirtual |
Sets the untransformed size of the layer.
The contentSize remains the same no matter how the layer is scaled or rotated. Typically this size is the same size as the screen.
contentSize | The untransformed size of the layer. |
void RootLayer::shutdown | ( | ) |
Shutsdown the layer, forcing an exit from the application.
This is the method to call to cleanly quit the game.
|
inlinevirtual |
Starts the layer, allocating initial resources
This method is used to bootstrap the game. It should start up an asset manager and load initial assets.
|
inlinevirtual |
Stops the layer, releasing all resources
This method is used to clean-up any allocation that occurred in either start or update. While Cocos2d does have rudimentary garbage collection, you still have to release any objects that you have retained.
|
inlineoverridevirtual |
Primary update method called every animation frame
This method is called every animation frame. There is no draw() or render() counterpoint to this method; drawing is done automatically in the scene graph. However, this method is responsible for updating any transforms in the scene graph.
dt | the time in seconds since last update |
|
protected |
Update the blend options for this node to use in a render pass
|
overrideprotected |
Updates the color for each vertices to match the node settings.
|
friend |
Creates a new Scene object with class T as its root layer.
The scene object needs to be attached to a root layer. However, the designer needs to subclass RootLayer in order to define gameplay features. As the createScene() method associated with Layer is typically static, this means we need to define a new method for each subclass. This function uses templates to emulate a static method that works for any subclass.
|
friend |
Creates a new Scene object with class T as its root layer.
The scene object needs to be attached to a root layer. However, the designer needs to subclass RootLayer in order to define gameplay features. As the createScene() method associated with Layer is typically static, this means we need to define a new method for each subclass. This function uses templates to emulate a static method that works for any subclass.
size | the size of the layer |
|
protected |
Whether or not this layer is currently active (e.g. handling updates)
|
protected |
Blending function is required to implement BlendProtocol
|
protected |
The command for the Cocos2D rendering pipeline
|
protected |
Texture to be applied to the polygon
|
protected |
Rendering data representing a solid shape