Axmol Engine 2.4.0-258ceca
Loading...
Searching...
No Matches
2D Nodes

Classes

class  AnchoredSprite
 Anchored Sprite. More...
 
class  AnimationFrame
 A frame of the animation. More...
 
class  Animation
 A Animation object is used to perform animations on the Sprite objects. More...
 
class  AnimationCache
 Singleton that manages the Animations. More...
 
class  AtlasNode
 AtlasNode is a subclass of Node that implements the RGBAProtocol and TextureProtocol protocol. More...
 
class  PolygonInfo
 PolygonInfo is an object holding the required data to display Sprites. More...
 
class  AutoPolygon
 AutoPolygon is a helper Object AutoPolygon's purpose is to process an image into 2d polygon mesh in runtime It has functions for each step in the process, from tracing all the points, to triangulation the result can be then passed to Sprite::create() to create a Polygon Sprite. More...
 
class  ClippingNode
 ClippingNode is a subclass of Node. More...
 
class  ClippingRectangleNode
 Clipping Rectangle Node. More...
 
class  DrawNode
 Node that draws dots, segments and polygons. More...
 
class  FastTMXLayer
 FastTMXLayer represents the TMX layer. More...
 
class  TMXTileAnimTask
 TMXTileAnimTask represents the frame-tick task of an animated tile. More...
 
class  TMXTileAnimManager
 TMXTileAnimManager controls all tile animation of a layer. More...
 
class  FastTMXTiledMap
 FastTMXTiledMap knows how to parse and render a TMX map. More...
 
class  FontFreeType
 FontFreeType is a class of rendering ttf/ttc characters. More...
 
class  GridBase
 Base class for Other grid. More...
 
class  Grid3D
 Grid3D is a 3D grid implementation. More...
 
class  TiledGrid3D
 TiledGrid3D is a 3D grid implementation. More...
 
struct  TTFConfig
 
class  Label
 Label is a subclass of Node that knows how to render text labels. More...
 
class  LabelAtlas
 LabelAtlas is a subclass of AtlasNode. More...
 
class  LayerColor
 LayerColor is a subclass of Layer that implements the RGBAProtocol protocol. More...
 
class  LayerGradient
 LayerGradient is a subclass of LayerColor that draws gradients across the background. More...
 
class  LayerRadialGradient
 LayerRadialGradient is a subclass of Layer that draws radial gradients across the background. More...
 
class  LayerMultiplex
 MultipleLayer is a Layer with the ability to multiplex it's children. More...
 
class  Menu
 A Menu for touch handling. More...
 
class  MenuItem
 MenuItem base class. More...
 
class  MenuItemLabel
 An abstract class for "label" MenuItemLabel items. More...
 
class  MenuItemAtlasFont
 A MenuItemAtlasFont. More...
 
class  MenuItemFont
 A MenuItemFont. More...
 
class  MenuItemSprite
 MenuItemSprite accepts Node<RGBAProtocol> objects as items. More...
 
class  MenuItemImage
 MenuItemImage accepts images as items. More...
 
class  MenuItemToggle
 A MenuItemToggle. More...
 
class  MotionStreak
 Creates a trailing path. More...
 
class  Node
 Node is the base element of the Scene Graph. More...
 
class  NodeGrid
 Base class for Grid Node. More...
 
class  ParallaxNode
 ParallaxNode: A node that simulates a parallax scroller. More...
 
class  ParticleBatchNode
 ParticleBatchNode is like a batch node: if it contains children, it will draw them in 1 single OpenGL call (often known as "batch draw"). More...
 
class  ParticleFire
 A fire particle system. More...
 
class  ParticleFireworks
 A fireworks particle system. More...
 
class  ParticleSun
 A sun particle system. More...
 
class  ParticleGalaxy
 A galaxy particle system. More...
 
class  ParticleFlower
 A flower particle system. More...
 
class  ParticleMeteor
 A meteor particle system. More...
 
class  ParticleSpiral
 An spiral particle system. More...
 
class  ParticleExplosion
 An explosion particle system. More...
 
class  ParticleSmoke
 An smoke particle system. More...
 
class  ParticleSnow
 An snow particle system. More...
 
class  ParticleRain
 A rain particle system. More...
 
class  ParticleSystemQuad
 ParticleSystemQuad is a subclass of ParticleSystem. More...
 
class  ProgressTimer
 ProgressTimer is a subclass of Node. More...
 
class  ProtectedNode
 A inner node type mainly used for UI module. More...
 
class  RenderTexture
 RenderTexture is a generic rendering target. More...
 
class  Scene
 Scene is a subclass of Node that is used only as an abstract concept. More...
 
class  Sprite
 Sprite is a 2d image ( http://en.wikipedia.org/wiki/Sprite_(computer_graphics) ). More...
 
class  SpriteBatchNode
 SpriteBatchNode is like a batch node: if it contains children, it will draw them in 1 single OpenGL call (often known as "batch draw"). More...
 
class  SpriteFrame
 A SpriteFrame has: More...
 
class  SpriteFrameCache
 Singleton that handles the loading of the sprite frames. More...
 
class  TMXObjectGroup
 TMXObjectGroup represents the TMX object group. More...
 
class  TransitionEaseScene
 TransitionEaseScene can ease the actions of the scene protocol. More...
 
class  TransitionScene
 Base class for Transition scenes. More...
 
class  TransitionSceneOriented
 A Transition that supports orientation like. More...
 
class  TransitionRotoZoom
 TransitionRotoZoom: Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming. More...
 
class  TransitionJumpZoom
 TransitionJumpZoom: Zoom out and jump the outgoing scene, and then jump and zoom in the incoming. More...
 
class  TransitionMoveInL
 TransitionMoveInL: Move in from to the left the incoming scene. More...
 
class  TransitionMoveInR
 TransitionMoveInR: Move in from to the right the incoming scene. More...
 
class  TransitionMoveInT
 TransitionMoveInT: Move in from to the top the incoming scene. More...
 
class  TransitionMoveInB
 TransitionMoveInB: Move in from to the bottom the incoming scene. More...
 
class  TransitionSlideInL
 TransitionSlideInL: Slide in the incoming scene from the left border. More...
 
class  TransitionSlideInR
 TransitionSlideInR: Slide in the incoming scene from the right border. More...
 
class  TransitionSlideInB
 TransitionSlideInB: Slide in the incoming scene from the bottom border. More...
 
class  TransitionSlideInT
 TransitionSlideInT: Slide in the incoming scene from the top border. More...
 
class  TransitionShrinkGrow
 Shrink the outgoing scene while grow the incoming scene. More...
 
class  TransitionFlipX
 TransitionFlipX: Flips the screen horizontally. More...
 
class  TransitionFlipY
 TransitionFlipY: Flips the screen vertically. More...
 
class  TransitionFlipAngular
 TransitionFlipAngular: Flips the screen half horizontally and half vertically. More...
 
class  TransitionZoomFlipX
 TransitionZoomFlipX: Flips the screen horizontally doing a zoom out/in The front face is the outgoing scene and the back face is the incoming scene. More...
 
class  TransitionZoomFlipY
 TransitionZoomFlipY: Flips the screen vertically doing a little zooming out/in The front face is the outgoing scene and the back face is the incoming scene. More...
 
class  TransitionZoomFlipAngular
 TransitionZoomFlipAngular: Flips the screen half horizontally and half vertically doing a little zooming out/in. More...
 
class  TransitionFade
 TransitionFade: Fade out the outgoing scene and then fade in the incoming scene. More...
 
class  TransitionCrossFade
 TransitionCrossFade: Cross fades two scenes using the RenderTexture object. More...
 
class  TransitionTurnOffTiles
 TransitionTurnOffTiles: Turn off the tiles of the outgoing scene in random order. More...
 
class  TransitionSplitCols
 TransitionSplitCols: The odd columns goes upwards while the even columns goes downwards. More...
 
class  TransitionSplitRows
 TransitionSplitRows: The odd rows goes to the left while the even rows goes to the right. More...
 
class  TransitionFadeTR
 TransitionFadeTR: Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner. More...
 
class  TransitionFadeBL
 TransitionFadeBL: Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner. More...
 
class  TransitionFadeUp
 TransitionFadeUp: Fade the tiles of the outgoing scene from the bottom to the top. More...
 
class  TransitionFadeDown
 TransitionFadeDown: Fade the tiles of the outgoing scene from the top to the bottom. More...
 
class  TransitionPageTurn
 A transition which peels back the bottom right hand corner of a scene to transition to the scene beneath it simulating a page turn. More...
 
class  TransitionProgress
 A base class of progress transition. More...
 
class  TransitionProgressRadialCCW
 TransitionRadialCCW transition. More...
 
class  TransitionProgressRadialCW
 TransitionRadialCW transition. More...
 
class  TransitionProgressHorizontal
 TransitionProgressHorizontal transition. More...
 
class  TransitionProgressVertical
 TransitionProgressVertical transition. More...
 
class  TransitionProgressInOut
 TransitionProgressInOut transition. More...
 
class  TransitionProgressOutIn
 TransitionProgressOutIn transition. More...
 
class  Texture2D
 Texture2D class. More...
 
class  TextureAtlas
 A class that implements a Texture Atlas. More...
 
class  TextureCache
 Singleton that handles the loading of textures. More...
 

Macros

#define AX_FAST_TILEMAP_32_BIT_INDICES   1
 !
 

Functions

PolygonInfooperator= (const PolygonInfo &other)
 Copy the member of the other PolygonInfo.
 
void setQuad (V3F_C4B_T2F_Quad *quad)
 set the data to be a pointer to a quad the member verts will not be released when this PolygonInfo destructs as the verts memory are managed by other objects
 
void setQuads (V3F_C4B_T2F_Quad *quads, int numberOfQuads)
 set the data to be a pointer to a number of Quads the member verts will not be released when this PolygonInfo destructs as the verts memory are managed by other objects
 
void setTriangles (const TrianglesCommand::Triangles &triangles)
 set the data to be a pointer to a triangles the member verts will not be released when this PolygonInfo destructs as the verts memory are managed by other objects
 
unsigned int getVertCount () const
 get vertex count
 
unsigned int getTrianglesCount () const
 get triangles count
 
float getArea () const
 get sum of all triangle area size
 
 AutoPolygon (std::string_view filename)
 create an AutoPolygon and initialize it with an image file the image must be a 32bit PNG for current version 3.7
 
 ~AutoPolygon ()
 Destructor of AutoPolygon.
 
std::vector< Vec2trace (const ax::Rect &rect, float threshold=0.0f)
 trace all the points along the outline of the image,
 
std::vector< Vec2reduce (const std::vector< Vec2 > &points, const Rect &rect, float epsilon=2.0f)
 reduce the amount of points so its faster for GPU to process and draw based on Ramer-Douglas-Peucker algorithm
 
std::vector< Vec2expand (const std::vector< Vec2 > &points, const Rect &rect, float epsilon)
 expand the points along their edge, useful after you reduce the points that cuts into the sprite using ClipperLib
 
TrianglesCommand::Triangles triangulate (const std::vector< Vec2 > &points)
 Triangulate the input points into triangles for rendering using poly2tri.
 
void calculateUV (const Rect &rect, V3F_C4B_T2F *verts, ssize_t count)
 calculate the UV coordinates for each points based on a texture rect
 
PolygonInfo generateTriangles (const Rect &rect=Rect::ZERO, float epsilon=2.0f, float threshold=0.05f)
 a helper function, packing trace, reduce, expand, triangulate and calculate uv in one function
 
static PolygonInfo generatePolygon (std::string_view filename, const Rect &rect=Rect::ZERO, float epsilon=2.0f, float threshold=0.05f)
 a helper function, packing autoPolygon creation, trace, reduce, expand, triangulate and calculate uv in one function
 
bool isScreenPointInRect (const Vec2 &pt, const Camera *camera, const Mat4 &w2l, const Rect &rect, Vec3 *p)
 This is a helper function, checks a GL screen point is in content rectangle space.
 

Creators

 PolygonInfo ()
 Creates an empty Polygon info.
 
 PolygonInfo (const PolygonInfo &other)
 Create an polygoninfo from the data of another Polygoninfo.
 

Detailed Description

Macro Definition Documentation

◆ AX_FAST_TILEMAP_32_BIT_INDICES

#define AX_FAST_TILEMAP_32_BIT_INDICES   1

!

!! uncomment if you want reduce bandwidth of GPU, then the tiled layer size will be limited to 128x128

Function Documentation

◆ PolygonInfo() [1/2]

Creates an empty Polygon info.

Returns
PolygonInfo object

◆ PolygonInfo() [2/2]

PolygonInfo ( const PolygonInfo & other)

Create an polygoninfo from the data of another Polygoninfo.

Parameters
otheranother PolygonInfo to be copied
Returns
duplicate of the other PolygonInfo

◆ operator=()

PolygonInfo & operator= ( const PolygonInfo & other)

Copy the member of the other PolygonInfo.

Parameters
otheranother PolygonInfo to be copied

◆ setQuad()

void setQuad ( V3F_C4B_T2F_Quad * quad)

set the data to be a pointer to a quad the member verts will not be released when this PolygonInfo destructs as the verts memory are managed by other objects

Parameters
quada pointer to the V3F_C4B_T2F_Quad object

◆ setQuads()

void setQuads ( V3F_C4B_T2F_Quad * quads,
int numberOfQuads )

set the data to be a pointer to a number of Quads the member verts will not be released when this PolygonInfo destructs as the verts memory are managed by other objects

Parameters
quada pointer to the V3F_C4B_T2F_Quad quads

◆ setTriangles()

void setTriangles ( const TrianglesCommand::Triangles & triangles)

set the data to be a pointer to a triangles the member verts will not be released when this PolygonInfo destructs as the verts memory are managed by other objects

Parameters
trianglesa pointer to the TrianglesCommand::Triangles object

◆ getVertCount()

unsigned int getVertCount ( ) const

get vertex count

Returns
number of vertices

◆ getTrianglesCount()

unsigned int getTrianglesCount ( ) const

get triangles count

Returns
number of triangles

◆ getArea()

float getArea ( ) const

get sum of all triangle area size

Returns
sum of all triangle area size

◆ AutoPolygon()

AutoPolygon ( std::string_view filename)

create an AutoPolygon and initialize it with an image file the image must be a 32bit PNG for current version 3.7

Parameters
filenamea path to image file, e.g., "scene1/monster.png".
Returns
an AutoPolygon object;

◆ trace()

std::vector< Vec2 > trace ( const ax::Rect & rect,
float threshold = 0.0f )

trace all the points along the outline of the image,

Warning
must create AutoPolygon with filename to use this function
Parameters
recta texture rect for specify an area of the image
thresholdthe value when alpha is greater than this value will be counted as opaque, default to 0.0
Returns
a vector of vec2 of all the points found in clockwise order
auto ap = AutoPolygon("grossini.png");
auto rect = Rect(100, 100, 200, 200);
std::vector<Vec2> points = ap.trace(rect);//default threshold is 0.0
Rectangle area.
Definition Rect.h:43
AutoPolygon(std::string_view filename)
create an AutoPolygon and initialize it with an image file the image must be a 32bit PNG for current ...

◆ reduce()

std::vector< Vec2 > reduce ( const std::vector< Vec2 > & points,
const Rect & rect,
float epsilon = 2.0f )

reduce the amount of points so its faster for GPU to process and draw based on Ramer-Douglas-Peucker algorithm

Parameters
pointsa vector of Vec2 points as input
recta texture rect for specify an area of the image to avoid over reduction
epsilonthe perpendicular distance where points smaller than this value will be discarded
Returns
a vector of Vec2 of the remaining points in clockwise order
auto ap = AutoPolygon();
std::vector<Vec2> reduced = ap.reduce(inputPoints, rect);//default epsilon is 2

◆ expand()

std::vector< Vec2 > expand ( const std::vector< Vec2 > & points,
const Rect & rect,
float epsilon )

expand the points along their edge, useful after you reduce the points that cuts into the sprite using ClipperLib

Parameters
pointsa vector of Vec2 points as input
recta texture rect for specify an area of the image, the expanded points will be clamped in this rect, ultimately resulting in a quad if the expansion is too great
epsilonthe distance which the edges will expand
Returns
a vector of Vec2 as the result of the expansion
auto ap = AutoPolygon();
std::vector<Vec2> expanded = ap.expand(inputPoints, rect, 2.0);

◆ triangulate()

TrianglesCommand::Triangles triangulate ( const std::vector< Vec2 > & points)

Triangulate the input points into triangles for rendering using poly2tri.

Warning
points must be closed loop, cannot have 2 points sharing the same position and cannot intersect itself
Parameters
pointsa vector of vec2 points as input
Returns
a Triangles object with points and indices
auto ap = AutoPolygon();
TrianglesCommand::Triangles myPolygons = ap.triangulate(myPoints);
The structure of Triangles.
Definition TrianglesCommand.h:56

◆ calculateUV()

void calculateUV ( const Rect & rect,
V3F_C4B_T2F * verts,
ssize_t count )

calculate the UV coordinates for each points based on a texture rect

Warning
This method requires the AutoPolygon object to know the texture file dimension
Parameters
recta texture rect to specify where to map the UV
vertsa pointer to the verts array, served both as input and output verts
countthe count for the verts array
auto ap = AutoPolygon("grossini.png");
TrianglesCommand::Triangles myPolygons = ap.triangulate(myPoints);
ap.calculateUV(rect, myPolygons.verts, 20);
V3F_C4B_T2F * verts
Vertex data pointer.
Definition TrianglesCommand.h:64

◆ generateTriangles()

PolygonInfo generateTriangles ( const Rect & rect = Rect::ZERO,
float epsilon = 2.0f,
float threshold = 0.05f )

a helper function, packing trace, reduce, expand, triangulate and calculate uv in one function

Parameters
recttexture rect, use Rect::ZERO for the size of the texture, default is Rect::ZERO
epsilonthe value used to reduce and expand, default to 2.0
thresholdthe value where bigger than the threshold will be counted as opaque, used in trace
Returns
a PolygonInfo, to use with sprite
auto ap = AutoPolygon("grossini.png");
PolygonInfo myInfo = ap.generateTriangles();//use all default values
auto sp1 = Sprite::create(myInfo);
polygonInfo myInfo2 = ap.generateTriangles(Rect::ZERO, 5.0, 0.1);//ap can be reused to generate another set of
PolygonInfo with different settings auto sp2 = Sprite::create(myInfo2);
PolygonInfo is an object holding the required data to display Sprites.
Definition AutoPolygon.h:52
static const Rect ZERO
An empty Rect.
Definition Rect.h:185
static Sprite * create()
Creates an empty sprite without texture.

◆ generatePolygon()

static PolygonInfo generatePolygon ( std::string_view filename,
const Rect & rect = Rect::ZERO,
float epsilon = 2.0f,
float threshold = 0.05f )
static

a helper function, packing autoPolygon creation, trace, reduce, expand, triangulate and calculate uv in one function

Warning
if you want to repetitively generate polygons, consider create an AutoPolygon object, and use generateTriangles function, as it only reads the file once
Parameters
filenameA path to image file, e.g., "scene1/monster.png".
recttexture rect, use Rect::ZERO for the size of the texture, default is Rect::ZERO
epsilonthe value used to reduce and expand, default to 2.0
thresholdthe value where bigger than the threshold will be counted as opaque, used in trace
Returns
a PolygonInfo, to use with sprite
auto sp = Sprite::create(AutoPolygon::generatePolygon("grossini.png"));
static PolygonInfo generatePolygon(std::string_view filename, const Rect &rect=Rect::ZERO, float epsilon=2.0f, float threshold=0.05f)
a helper function, packing autoPolygon creation, trace, reduce, expand, triangulate and calculate uv ...

◆ isScreenPointInRect()

bool isScreenPointInRect ( const Vec2 & pt,
const Camera * camera,
const Mat4 & w2l,
const Rect & rect,
Vec3 * p )

This is a helper function, checks a GL screen point is in content rectangle space.

The content rectangle defined by origin(0,0) and content size. This function convert GL screen point to near and far planes as points Pn and Pf, then calculate the intersect point P which the line PnPf intersect with content rectangle. If P in content rectangle means this node be hit.

Parameters
ptThe point in GL screen space.
cameraWhich camera used to unproject pt to near/far planes.
w2lWorld to local transform matrix, used to convert Pn and Pf to rectangle space.
rectThe test rectangle in local space. @parma p Point to a Vec3 for store the intersect point, if don't need them set to nullptr.
Returns
true if the point is in content rectangle, false otherwise.