|
| PolygonNode () |
|
virtual | ~PolygonNode () |
|
virtual void | setPolygon (const std::vector< Vec2 > &vertices) override |
|
virtual void | setPolygon (const Poly2 &poly) override |
|
virtual void | setPolygon (const Rect &rect) override |
|
virtual void | draw (const std::shared_ptr< SpriteBatch > &batch, const Mat4 &transform, Color4 tint) override |
|
| TexturedNode () |
|
virtual | ~TexturedNode () |
|
virtual void | dispose () override |
|
virtual bool | init () override |
|
bool | init (const std::vector< Vec2 > &vertices) |
|
bool | init (const Poly2 &poly) |
|
bool | init (const Rect &rect) |
|
bool | initWithFile (const std::string &filename) |
|
bool | initWithFile (const std::string &filename, const std::vector< Vec2 > &vertices) |
|
bool | initWithFile (const std::string &filename, const Poly2 &poly) |
|
bool | initWithFile (const std::string &filename, const Rect &rect) |
|
bool | initWithTexture (const std::shared_ptr< Texture > &texture) |
|
bool | initWithTexture (const std::shared_ptr< Texture > &texture, const std::vector< Vec2 > &vertices) |
|
bool | initWithTexture (const std::shared_ptr< Texture > &texture, const Poly2 &poly) |
|
bool | initWithTexture (const std::shared_ptr< Texture > &texture, const Rect &rect) |
|
void | setTexture (const std::string &filename) |
|
void | setTexture (const std::shared_ptr< Texture > &texture) |
|
std::shared_ptr< Texture > & | getTexture () |
|
const std::shared_ptr< Texture > & | getTexture () const |
|
const Poly2 & | getPolygon () const |
|
virtual void | shiftPolygon (float dx, float dy) |
|
const Rect & | getBoundingRect () const |
|
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 |
|
void | refresh () |
|
| Node () |
|
virtual | ~Node () |
|
virtual bool | initWithPosition (const Vec2 &pos) |
|
bool | initWithPosition (float x, float y) |
|
virtual bool | initWithBounds (const Size &size) |
|
bool | initWithBounds (float width, float height) |
|
virtual bool | initWithBounds (const Rect &rect) |
|
bool | initWithBounds (float x, float y, float width, float height) |
|
virtual Node * | copy (Node *dst) |
|
unsigned int | getTag () const |
|
void | setTag (unsigned int tag) |
|
const std::string & | getName () const |
|
void | setName (const std::string &name) |
|
| operator std::string () 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) |
|
Size | getSize () const |
|
float | getWidth () const |
|
float | getHeight () const |
|
Rect | getBoundingBox () const |
|
void | setAnchor (float x, float y) |
|
const Vec2 & | getAnchor () const |
|
Vec2 | getAnchorInPixels () |
|
Color4 | getColor () const |
|
void | setColor (Color4 color) |
|
Color4 | getAbsoluteColor () |
|
bool | isVisible () const |
|
void | setVisible (bool visible) |
|
bool | hasRelativeColor () |
|
void | setRelativeColor (bool flag) |
|
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 Mat4 & | getAlternateTransform () |
|
void | setAlternateTransform (const Mat4 &transform) |
|
bool | withAlternateTransform () |
|
void | chooseAlternateTransform (bool active) |
|
const Mat4 & | getNodeToParentTransform () const |
|
Mat4 | getParentToNodeTransform () const |
|
Mat4 | getNodeToWorldTransform () const |
|
Mat4 | 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 |
|
void | setZOrder (int z) |
|
int | getZOrder () const |
|
bool | isZDirty () const |
|
void | sortZOrder () |
|
size_t | getChildCount () const |
|
std::shared_ptr< Node > | getChild (unsigned int pos) |
|
const std::shared_ptr< Node > & | getChild (unsigned int pos) const |
|
template<typename T > |
std::shared_ptr< T > | getChild (unsigned int pos) const |
|
std::shared_ptr< Node > | getChildByTag (unsigned int tag) const |
|
template<typename T > |
std::shared_ptr< T > | getChildByTag (unsigned int tag) const |
|
std::shared_ptr< Node > | getChildByName (const std::string &name) const |
|
template<typename T > |
std::shared_ptr< T > | getChildByName (const std::string &name) const |
|
std::vector< std::shared_ptr< Node > > | getChildren () |
|
const std::vector< std::shared_ptr< Node > > & | getChildren () const |
|
void | addChild (std::shared_ptr< Node > child) |
|
virtual void | addChild (const std::shared_ptr< Node > &child, int zval) |
|
void | addChildWithTag (const std::shared_ptr< Node > &child, unsigned int tag) |
|
void | addChildWithTag (const std::shared_ptr< Node > &child, unsigned int tag, int zval) |
|
void | addChildWithName (const std::shared_ptr< Node > &child, const std::string &name) |
|
void | addChildWithName (const std::shared_ptr< Node > &child, const std::string &name, int zval) |
|
void | swapChild (const std::shared_ptr< Node > &child1, const std::shared_ptr< Node > &child2, bool inherit=false) |
|
Node * | getParent () |
|
const Node * | getParent () const |
|
Scene * | getScene () |
|
const Scene * | getScene () const |
|
void | removeFromParent () |
|
virtual void | removeChild (unsigned int pos) |
|
void | removeChild (const std::shared_ptr< Node > &child) |
|
void | removeChildByTag (unsigned int tag) |
|
void | removeChildByName (const std::string &name) |
|
virtual void | removeAllChildren () |
|
void | render (const std::shared_ptr< SpriteBatch > &batch, const Mat4 &transform, Color4 tint) |
|
void | render (const std::shared_ptr< SpriteBatch > &batch) |
|
|
static std::shared_ptr< PolygonNode > | alloc () |
|
static std::shared_ptr< PolygonNode > | alloc (const std::vector< Vec2 > &vertices) |
|
static std::shared_ptr< PolygonNode > | alloc (const Poly2 &poly) |
|
static std::shared_ptr< PolygonNode > | alloc (const Rect &rect) |
|
static std::shared_ptr< PolygonNode > | allocWithFile (const std::string &filename) |
|
static std::shared_ptr< PolygonNode > | allocWithFile (const std::string &filename, const std::vector< Vec2 > &vertices) |
|
static std::shared_ptr< PolygonNode > | allocWithFile (const std::string &filename, const Poly2 &poly) |
|
static std::shared_ptr< PolygonNode > | allocWithFile (const std::string &filename, const Rect &rect) |
|
static std::shared_ptr< PolygonNode > | allocWithTexture (const std::shared_ptr< Texture > &texture) |
|
static std::shared_ptr< PolygonNode > | allocWithTexture (const std::shared_ptr< Texture > &texture, const std::vector< Vec2 > &vertices) |
|
static std::shared_ptr< PolygonNode > | allocWithTexture (const std::shared_ptr< Texture > &texture, const Poly2 &poly) |
|
static std::shared_ptr< PolygonNode > | allocWithTexture (const std::shared_ptr< Texture > &texture, const Rect &rect) |
|
static std::shared_ptr< Node > | alloc () |
|
static std::shared_ptr< Node > | allocWithPosition (const Vec2 &pos) |
|
static std::shared_ptr< Node > | allocWithPosition (float x, float y) |
|
static std::shared_ptr< Node > | allocWithBounds (const Size &size) |
|
static std::shared_ptr< Node > | allocWithBounds (float width, float height) |
|
static std::shared_ptr< Node > | allocWithBounds (const Rect &rect) |
|
static std::shared_ptr< Node > | allocWithBounds (float x, float y, float width, float height) |
|
This is a scene graph node representing a solid 2D polygon textured by a sprite.
The polygon is specified in image coordinates. Image coordinates are different from texture coordinates. Their origin is at the bottom-left corner of the file, and each pixel is one unit. This makes specifying a polygon more natural for irregular shapes.
This means that a polygon with vertices (0,0), (width,0), (width,height), and (0,height) would be identical to a sprite node. However, a polygon with vertices (0,0), (2*width,0), (2*width,2*height), and (0,2*height) would tile the sprite (given the wrap settings) twice both horizontally and vertically.
The content size of this node is defined by the size (but not the offset) of the bounding box. The anchor point is relative to this content size. The default anchor point in TexturedNode is (0.5, 0.5). This means that a uniform translation of the polygon (in contrast to the node itself) will not move the shape on the the screen. Instead, it will just change the part of the texture it uses.
For example, suppose the texture has given width and height. We have one polygon with vertices (0,0), (width/2,0), (width/2,height/2), and (0,height/2). We have another polygon with vertices (width/2,height/2), (width,height/2), (width,height), and (width/2,height). Both polygons would create a rectangle of size (width/2,height/2). centered at the node position. However, the first would use the bottom left part of the texture, while the second would use the top right.