![]() |
AppEasy Core SDK
1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
|
CzGeometry - A renderable geometry shape or collection of shapes. More...
#include <CzGeometry.h>
Public Member Functions | |
CzGeometry () | |
~CzGeometry () | |
int | LoadFromXoml (IzXomlResource *parent, bool load_children, CzXmlNode *node) |
void | CalculateDimensions (float &min_x, float &max_x, float &min_y, float &max_y) |
Public Attributes | |
eCzPrimType | Type |
Type of primitive. | |
CzVec2 * | Verts |
Screen vertices. | |
CzVec2 * | UVs |
Texture UV coordinmaes. | |
CzColour * | Colours |
Colour vertices. | |
uint16 * | Indices |
Face indices. | |
uint16 | VertCount |
Vertex count. | |
uint16 | FaceCount |
Face count. | |
uint16 | IndicesCount |
indices count | |
bool | PercBased |
If true then the vertices are pecentage based. |
CzGeometry - A renderable geometry shape or collection of shapes.
Geometries are resources that contain collections of vertices, UV texture coordinates, RGBA colours and face vertex index lists that can be used to create 2D geometry that can be attached to Actors to modify their visual shape. Currently 3 types of geometry are supported by XOML:
Note that concave polygons are not supported however you can create the same concave shape using a triangle list. A geometry resource is declared using the Geometry XOML tag, e.g:
<!--Create a single triangle--> <Geometry Name="Geoms1" Vertices="-200,-200,200,200,-200,200" UV="0,0,1,1,0,1" Type="TriList" /> <!--Create two triangles--> <Geometry Name="Geoms2" Vertices="-200,-200,200,200,-200,200,-400,-400,-200,-400,-200,0" Type="TriList" /> <!--Create a house shape --> <Geometry Name="Geoms3" Vertices="-200,-200,0,-300,200,-200,200,200,-200,200" Indices="0,1,2,3,4" Colours="255,0,0,255,0,255,0,255,0,0,255,255,255,255,255,255,255,255,255,255" Type="Poly"/>
The above XOML shows 3 different examples of creating geometries.
The Geometry XOML tag has the following properties:
Assigning a geometry to an Actor will force the actor to render the geometry in place of its default rectangular shape, e.g:
<Icon Name="Sprite1" Position="200,0" Background="bg1" Geometry="Geoms1" />
Note that hit detection and overlap detection is supported for all types of geometry, including disconnected geometry.
CzGeometry::CzGeometry | ( | ) | [inline] |
void CzGeometry::CalculateDimensions | ( | float & | min_x, |
float & | max_x, | ||
float & | min_y, | ||
float & | max_y | ||
) |
int CzGeometry::LoadFromXoml | ( | IzXomlResource * | parent, |
bool | load_children, | ||
CzXmlNode * | node | ||
) | [virtual] |
Implements IzXomlResource.
Colour vertices.
uint16 CzGeometry::FaceCount |
Face count.
uint16* CzGeometry::Indices |
Face indices.
uint16 CzGeometry::IndicesCount |
indices count
If true then the vertices are pecentage based.
Type of primitive.
Texture UV coordinmaes.
uint16 CzGeometry::VertCount |
Vertex count.
Screen vertices.