|
| SpriteNode () |
|
| ~SpriteNode () |
|
bool | initWithSheet (const std::shared_ptr< graphics::Texture > &texture, int rows, int cols) |
|
bool | initWithSheet (const std::shared_ptr< graphics::Texture > &texture, int rows, int cols, int size) |
|
bool | initWithSprite (const std::shared_ptr< SpriteNode > &sprite) |
|
virtual bool | initWithData (const AssetManager *manager, const std::shared_ptr< JsonValue > &data) override |
|
virtual std::shared_ptr< SceneNode > | copy (const std::shared_ptr< SceneNode > &dst) const override |
|
int | getCount () const |
|
unsigned int | getFrame () const |
|
void | setFrame (int frame) |
|
| PolygonNode () |
|
| ~PolygonNode () |
|
bool | initWithPoly (const std::vector< Vec2 > &vertices) |
|
bool | initWithPoly (const Poly2 &poly) |
|
bool | initWithPoly (const Rect rect) |
|
virtual bool | initWithFile (const std::string filename) override |
|
bool | initWithFilePoly (const std::string filename, const std::vector< Vec2 > &vertices) |
|
bool | initWithFilePoly (const std::string filename, const Poly2 &poly) |
|
bool | initWithFilePoly (const std::string filename, const Rect rect) |
|
virtual bool | initWithTexture (const std::shared_ptr< graphics::Texture > &texture) override |
|
bool | initWithTexturePoly (const std::shared_ptr< graphics::Texture > &texture, const std::vector< Vec2 > &vertices) |
|
bool | initWithTexturePoly (const std::shared_ptr< graphics::Texture > &texture, const Poly2 &poly) |
|
bool | initWithTexturePoly (const std::shared_ptr< graphics::Texture > &texture, const Rect rect) |
|
virtual bool | initWithData (const AssetManager *manager, const std::shared_ptr< JsonValue > &data) override |
|
virtual std::shared_ptr< SceneNode > | copy (const std::shared_ptr< SceneNode > &dst) const override |
|
float | getFringe () const |
|
void | setFringe (float fringe) |
|
virtual void | setPolygon (const std::vector< Vec2 > &vertices) |
|
virtual void | setPolygon (const Poly2 &poly) |
|
virtual void | setPolygon (const Rect rect) |
|
const Poly2 & | getPolygon () const |
|
const Rect | getBoundingRect () const |
|
virtual void | draw (const std::shared_ptr< graphics::SpriteBatch > &batch, const Affine2 &transform, Color4 tint) override |
|
| TexturedNode () |
|
| ~TexturedNode () |
|
virtual void | dispose () override |
|
virtual bool | init () override |
|
virtual bool | initWithFile (const std::string filename) |
|
virtual bool | initWithTexture (const std::shared_ptr< graphics::Texture > &texture) |
|
virtual bool | initWithData (const AssetManager *manager, const std::shared_ptr< JsonValue > &data) override |
|
virtual std::shared_ptr< SceneNode > | copy (const std::shared_ptr< SceneNode > &dst) const override |
|
void | setTexture (const std::string &filename) |
|
void | setTexture (const std::shared_ptr< graphics::Texture > &texture) |
|
std::shared_ptr< graphics::Texture > | getTexture () |
|
const std::shared_ptr< graphics::Texture > | getTexture () const |
|
const std::shared_ptr< graphics::Gradient > | getGradient () const |
|
void | setGradient (const std::shared_ptr< graphics::Gradient > &gradient) |
|
void | shiftTexture (float dx, float dy) |
|
void | setBlendFunc (GLenum srcFactor, GLenum dstFactor) |
|
GLenum | getSourceBlendFactor () const |
|
GLenum | getDestinationBlendFactor () const |
|
void | setBlendEquation (GLenum equation) |
|
GLenum | getBlendEquation () const |
|
void | flipHorizontal (bool flag) |
|
bool | isFlipHorizontal () const |
|
void | flipVertical (bool flag) |
|
bool | isFlipVertical () const |
|
virtual std::string | toString (bool verbose=false) const override |
|
bool | isAbsolute () const |
|
void | setAbsolute (bool flag) |
|
virtual void | setAnchor (const Vec2 anchor) override |
|
virtual void | setAnchor (float x, float y) override |
|
virtual void | setContentSize (const Size size) override |
|
virtual void | setContentSize (float width, float height) override |
|
virtual void | draw (const std::shared_ptr< graphics::SpriteBatch > &batch, const Affine2 &transform, Color4 tint) override=0 |
|
void | refresh () |
|
| SceneNode () |
|
| ~SceneNode () |
|
virtual void | dispose () |
|
virtual bool | init () |
|
virtual bool | initWithPosition (const Vec2 pos) |
|
bool | initWithPosition (float x, float y) |
|
virtual bool | initWithBounds (const Size size) |
|
virtual bool | initWithBounds (float width, float height) |
|
virtual bool | initWithBounds (const Rect rect) |
|
virtual bool | initWithBounds (float x, float y, float width, float height) |
|
virtual bool | initWithData (const AssetManager *manager, const std::shared_ptr< JsonValue > &data) |
|
virtual std::shared_ptr< SceneNode > | copy (const std::shared_ptr< SceneNode > &dst) const |
|
unsigned int | getTag () const |
|
void | setTag (unsigned int tag) |
|
const std::string | getName () const |
|
void | setName (const std::string name) |
|
const std::string | getClassName () const |
|
virtual std::string | toString (bool verbose=false) const |
|
| operator std::string () const |
|
const std::shared_ptr< cugl::JsonValue > & | getJSON () const |
|
const Vec2 | getPosition () const |
|
void | setPosition (const Vec2 &position) |
|
void | setPosition (float x, float y) |
|
float | getPositionX (void) const |
|
void | setPositionX (float x) |
|
float | getPositionY (void) const |
|
void | setPositionY (float y) |
|
Vec2 | getWorldPosition () const |
|
const Size | getContentSize () const |
|
virtual void | setContentSize (const Size size) |
|
virtual void | setContentSize (float width, float height) |
|
float | getContentWidth () const |
|
void | setContentWidth (float width) |
|
float | getContentHeight () const |
|
void | setContentHeight (float height) |
|
virtual Rect | getLayoutBounds () const |
|
Size | getSize () const |
|
float | getWidth () const |
|
float | getHeight () const |
|
Rect | getBoundingBox () const |
|
virtual bool | inContentBounds (const Vec2 point) |
|
bool | inContentBounds (float x, float y) |
|
virtual void | setAnchor (const Vec2 anchor) |
|
virtual void | setAnchor (float x, float y) |
|
const Vec2 | getAnchor () const |
|
Vec2 | getAnchorInPixels () |
|
Color4 | getColor () const |
|
virtual void | setColor (Color4 color) |
|
Color4 | getAbsoluteColor () |
|
bool | isVisible () const |
|
void | setVisible (bool visible) |
|
bool | hasRelativeColor () const |
|
void | setRelativeColor (bool flag) |
|
std::shared_ptr< graphics::Scissor > | getScissor () const |
|
void | setScissor (const std::shared_ptr< graphics::Scissor > &scissor) |
|
void | setScissor () |
|
const Vec2 | getScale () const |
|
float | getScaleX () const |
|
float | getScaleY () const |
|
void | setScale (float scale) |
|
void | setScale (const Vec2 vec) |
|
void | setScale (float sx, float sy) |
|
float | getAngle () |
|
void | setAngle (float angle) |
|
const Affine2 & | getTransform () const |
|
const Affine2 & | getAlternateTransform () const |
|
void | setAlternateTransform (const Affine2 &transform) |
|
bool | withAlternateTransform () |
|
void | chooseAlternateTransform (bool active) |
|
const Affine2 & | getNodeToParentTransform () const |
|
Affine2 | getParentToNodeTransform () const |
|
virtual Affine2 | getNodeToWorldTransform () const |
|
Affine2 | getWorldToNodeTransform () const |
|
Vec2 | screenToNodeCoords (const Vec2 screenPoint) const |
|
Vec2 | worldToNodeCoords (const Vec2 worldPoint) const |
|
Vec2 | nodeToScreenCoords (const Vec2 nodePoint) const |
|
Vec2 | nodeToWorldCoords (const Vec2 nodePoint) const |
|
Vec2 | parentToNodeCoords (const Vec2 parentPoint) const |
|
Vec2 | nodeToParentCoords (const Vec2 nodePoint) const |
|
size_t | getChildCount () const |
|
std::shared_ptr< SceneNode > | getChild (unsigned int pos) |
|
const std::shared_ptr< SceneNode > & | getChild (unsigned int pos) const |
|
template<typename T > |
std::shared_ptr< T > | getChild (unsigned int pos) const |
|
std::shared_ptr< SceneNode > | getChildByTag (unsigned int tag) const |
|
template<typename T > |
std::shared_ptr< T > | getChildByTag (unsigned int tag) const |
|
std::shared_ptr< SceneNode > | getChildByName (const std::string name) const |
|
template<typename T > |
std::shared_ptr< T > | getChildByName (const std::string name) const |
|
std::vector< std::shared_ptr< SceneNode > > | getChildren () |
|
const std::vector< std::shared_ptr< SceneNode > > & | getChildren () const |
|
void | addChild (const std::shared_ptr< SceneNode > &child) |
|
void | addChildWithTag (const std::shared_ptr< SceneNode > &child, unsigned int tag) |
|
void | addChildWithName (const std::shared_ptr< SceneNode > &child, const std::string name) |
|
void | swapChild (const std::shared_ptr< SceneNode > &child1, const std::shared_ptr< SceneNode > &child2, bool inherit=false) |
|
SceneNode * | getParent () |
|
const SceneNode * | getParent () const |
|
Scene2 * | getScene () |
|
const Scene2 * | getScene () const |
|
void | removeFromParent () |
|
virtual void | removeChild (unsigned int pos) |
|
void | removeChild (const std::shared_ptr< SceneNode > &child) |
|
void | removeChildByTag (unsigned int tag) |
|
void | removeChildByName (const std::string name) |
|
virtual void | removeAllChildren () |
|
void | setPriority (float priority) |
|
float | getPriority () |
|
virtual void | render (const std::shared_ptr< graphics::SpriteBatch > &batch, const Affine2 &transform, Color4 tint) |
|
virtual void | render (const std::shared_ptr< graphics::SpriteBatch > &batch) |
|
virtual void | draw (const std::shared_ptr< graphics::SpriteBatch > &batch, const Affine2 &transform, Color4 tint) |
|
const std::shared_ptr< Layout > & | getLayout () const |
|
void | setLayout (const std::shared_ptr< Layout > &layout) |
|
virtual void | doLayout () |
|
|
static std::shared_ptr< SpriteNode > | allocWithSheet (const std::shared_ptr< graphics::Texture > &texture, int rows, int cols) |
|
static std::shared_ptr< SpriteNode > | allocWithSheet (const std::shared_ptr< graphics::Texture > &texture, int rows, int cols, int size) |
|
static std::shared_ptr< SpriteNode > | allocWithSprite (const std::shared_ptr< SpriteNode > &sprite) |
|
static std::shared_ptr< SceneNode > | allocWithData (const AssetManager *manager, const std::shared_ptr< JsonValue > &data) |
|
static std::shared_ptr< PolygonNode > | alloc () |
|
static std::shared_ptr< PolygonNode > | allocWithPoly (const std::vector< Vec2 > &vertices) |
|
static std::shared_ptr< PolygonNode > | allocWithPoly (const Poly2 &poly) |
|
static std::shared_ptr< PolygonNode > | allocWithPoly (const Rect rect) |
|
static std::shared_ptr< PolygonNode > | allocWithFile (const std::string filename) |
|
static std::shared_ptr< PolygonNode > | allocWithFilePoly (const std::string filename, const std::vector< Vec2 > &vertices) |
|
static std::shared_ptr< PolygonNode > | allocWithFilePoly (const std::string filename, const Poly2 &poly) |
|
static std::shared_ptr< PolygonNode > | allocWithFilePoly (const std::string filename, const Rect rect) |
|
static std::shared_ptr< PolygonNode > | allocWithTexture (const std::shared_ptr< graphics::Texture > &texture) |
|
static std::shared_ptr< PolygonNode > | allocWithTexture (const std::shared_ptr< graphics::Texture > &texture, const std::vector< Vec2 > &vertices) |
|
static std::shared_ptr< PolygonNode > | allocWithTexture (const std::shared_ptr< graphics::Texture > &texture, const Poly2 &poly) |
|
static std::shared_ptr< PolygonNode > | allocWithTexture (const std::shared_ptr< graphics::Texture > &texture, const Rect rect) |
|
static std::shared_ptr< SceneNode > | allocWithData (const AssetManager *manager, const std::shared_ptr< JsonValue > &data) |
|
static std::shared_ptr< SceneNode > | alloc () |
|
static std::shared_ptr< SceneNode > | allocWithPosition (const Vec2 pos) |
|
static std::shared_ptr< SceneNode > | allocWithPosition (float x, float y) |
|
static std::shared_ptr< SceneNode > | allocWithBounds (const Size size) |
|
static std::shared_ptr< SceneNode > | allocWithBounds (float width, float height) |
|
static std::shared_ptr< SceneNode > | allocWithBounds (const Rect rect) |
|
static std::shared_ptr< SceneNode > | allocWithBounds (float x, float y, float width, float height) |
|
static std::shared_ptr< SceneNode > | allocWithData (const AssetManager *manager, const std::shared_ptr< JsonValue > &data) |
|
This is a scene graph node to support simple sprite sheet animation
The API for this class is very similar to PolygonNode
, except that it treats the texture as a sprite sheet. This means that you must specify the rows and columns in the sprite sheet so that it can break up the images for you.
The basic constructors always set this object equal to a rectangle the same size as a single frame in the sprite sheet. However, you could conceivably animate the sprite sheet over polygons, simpy by changing the shape via setPolygon
. This can have undesirable effects if the polygon coordinate extend beyond a single animation frame. The basic renderer does not allow us to wrap a single frame of a texture atlas.
For example, suppose you have a sprite sheet where each frame has a given width and height. Setting the polygon to a triangle with vertices (0,0), (width/2, height), and (width,height) is okay. However, the vertices (0,0), (width, 2*height), and (2*width, height) are not okay.