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
CzShapes.h
Go to the documentation of this file.
00001 // 
00002 //
00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine
00004 //
00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk
00006 //
00007 // For updates, tutorials and more details check out www.appeasymobile.com
00008 //
00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin.
00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support
00011 //
00012 //
00013 
00014 #if !defined(_CZ_SHAPES_H_)
00015 #define _CZ_SHAPES_H_
00016 
00017 
00018 #include "CzUtil.h"
00019 #include "CzXoml.h"
00020 
00021 // 
00022 // 
00023 //
00024 //
00025 // CzShape - A basic shape class
00026 // 
00027 // 
00028 // 
00029 //
00030 
00031 struct CzGeomShape
00032 {
00033     enum eGeomShapeType
00034     {
00035         ST_None, 
00036         ST_Box, 
00037         ST_Circle, 
00038         ST_Polygon, 
00039     };
00040 
00041     eGeomShapeType      ShapeType;              // Type of shape
00042     virtual ~CzGeomShape() {}
00043 };
00044 
00045 struct CzGeomShapeBox : public CzGeomShape
00046 {
00047     float       Width, Height;                      // Dimensions
00048     CzGeomShapeBox()                                { ShapeType = ST_Box; }
00049 };
00050 
00051 struct CzGeomShapeCircle : public CzGeomShape
00052 {
00053     float       Radius;                             // Radius of circle
00054     CzGeomShapeCircle()                             { ShapeType = ST_Circle; }
00055 };
00056 
00057 struct CzGeomShapePolygon : public CzGeomShape
00058 {
00059     CzVec2*     Vertices;                           // Radius of circle
00060     int         NumVertices;                        // Number of vertices in the polygon
00061     CzGeomShapePolygon() : Vertices(NULL)           { ShapeType = ST_Polygon; }
00062     virtual ~CzGeomShapePolygon()                   { SAFE_DELETE_ARRAY(Vertices) }
00063 };
00064 
00065 class CzShape : public IzXomlResource
00066 {
00067 public:
00068     // Properties
00069 protected:
00070     CzGeomShape*            Shape;                  // Shape data
00071 public:
00072     void                    setShape(CzGeomShape* shape)    { Shape = shape; }
00073     CzGeomShape*            getShape()                      { return Shape; }
00074     // Properties end
00075 
00076 public:
00077     CzShape() : IzXomlResource(), Shape(NULL)       { setClassType("shape"); }
00078     virtual ~CzShape()                              { SAFE_DELETE(Shape); }
00079 
00080     // Implementation of IzXomlClass interface
00081     int                     LoadFromXoml(IzXomlResource* parebt, bool load_children, CzXmlNode* node);
00082 };
00083 
00084 //
00085 //
00086 //
00087 //
00088 //  CzShapeCreator - Creates an instance of a shape
00089 //
00090 //
00091 //
00092 //
00093 class CzShapeCreator : public IzXomlClassCreator
00094 {
00095 public:
00096     CzShapeCreator()
00097     {
00098         setClassName("shape");
00099     }
00100     IzXomlResource* CreateInstance(IzXomlResource* parent)  { return new CzShape(); }
00101 };
00102 
00103 
00104 
00105 
00106 #endif  // _CZ_SHAPES_H_