AppEasy Core SDK  1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
CzGeometry Struct Reference

CzGeometry - A renderable geometry shape or collection of shapes. More...

#include <CzGeometry.h>

Inheritance diagram for CzGeometry:
IzXomlResource

List of all members.

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.
CzVec2Verts
 Screen vertices.
CzVec2UVs
 Texture UV coordinmaes.
CzColourColours
 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.

Detailed Description

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:

  • Poly – A convex polygon with any number of vertices
  • TriList – A list of triangles
  • QuadList – A list of quadrangles

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:

XOML Example:
<!--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:

  • Name (string) – The name of the geometry
    • Tag (string) – Resource tag name
    • Vertices (vec2 list) – A list of pairs of x,y coordinates that describe the shape of the geometry in 2D
    • UV (vec2 list) – A list of pairs of x,y texture coordinates that describe how the assigned image is mapped to the polygon(s) vertices. If this not supplied then it is automatically calculated
    • Colours (vec4 list) – A list of RGBA colours that are assigned to each vertex. If this is not supplied then all vertices will be assigned RGBA of 255,255,255,255
    • Indices (list of numbers)– The face index list which determines the order in which vertices form face. If this is not supplied then this will be automatically be generated
    • Type (geometry-type) – The type of geometry:
      • Poly – A polygon
      • TriList – A list of triangles
      • QuadList – A list of quadrangles
    • PercVerts (boolean) – If set to true then the geometries vertices will be treated as proportional percentage based. The geometry when attached to an actor will be resized to fit the width and height of the host actor.

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.


Constructor & Destructor Documentation

CzGeometry::CzGeometry ( ) [inline]

Member Function Documentation

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.


Member Data Documentation

Colour vertices.

Face count.

Face indices.

indices count

If true then the vertices are pecentage based.

Type of primitive.

Texture UV coordinmaes.

Vertex count.

Screen vertices.


The documentation for this struct was generated from the following files: