Shape.h

00001 // Shape.h: interface for the Shape class.
00002 //
00004 
00005 #ifndef _Shape_H_
00006 #define _Shape_H_
00007 
00008 #include "Renderer.h"
00009 #include "VertexBufferManager.h"
00010 #include "Entity2D.h"
00011 #include "Defines.h"
00012 
00013 #define CIRCLE_MAX_SEGMENTS 102
00014 
00015 #if _MSC_VER > 1000     
00016 #pragma once
00017 #endif // _MSC_VER > 1000
00018 
00019 namespace zak {
00020 
00021 enum ShapeType
00022 {
00023         ZAK_SHAPE_TRIANGLE=0,
00024         ZAK_SHAPE_QUAD=1,
00025         ZAK_SHAPE_CIRCLE=2
00026 };
00031 class ZAKENGINE_API Shape : public Entity2D
00032 {
00033         private:
00034                 unsigned int   _Color;
00035                 unsigned int   _Color1;
00036                 unsigned int   _Color2;
00037                 unsigned int   _Color3;
00038                 unsigned int   _Color4;
00039                 float                   _radius;
00040                 int                             _segments;
00041 
00042                 ShapeType   _eShapeType;
00043                 ColorVertex _vertex[CIRCLE_MAX_SEGMENTS];
00044 
00045                 static void Constructor(Shape *shp){
00046                         new(shp) Shape();
00047                 }
00048                 static void Destructor(Shape *shp){
00049                         shp->~Shape();
00050                 }
00051                 static void ConstructArray(vector<Shape> *self) {
00052                         new(self) vector<Shape>();
00053                 }
00054 
00055                 static void ConstructArray(int length, vector<Shape> *self) {
00056                         new(self) vector<Shape>(length);
00057                 }
00058 
00059                 static void DestructArray(vector<Shape> *self) {
00060                         self->~vector();
00061                 }
00062                 void SetShape(int Type) { SetShape((ShapeType)Type); }
00063 
00064 
00065         public:
00066                 void SetSegmentsCount(int segments) { if (segments < CIRCLE_MAX_SEGMENTS-2 && segments >= 3) _segments = segments; }
00074                 void SetColorPerVertex(DWORD dwColor1,DWORD dwColor2,DWORD dwColor3,DWORD dwColor4);
00075 
00082                 void SetColorPerVertex(DWORD dwColor1,DWORD dwColor2,DWORD dwColor3);
00083 
00088                 void SetColor(DWORD color);
00089 
00094                 void SetShape(ShapeType Type);
00095 
00096                 void SetRadius(float radius) { _radius = radius; }
00097 
00101                 virtual void Draw();
00102 
00103                 static bool RegisterShape(char *className=NULL);
00104                 
00105                 //bool IsColliding(Shape *shape) { return Entity2D::IsColliding((Entity2D*)shape); }
00106 
00110                 Shape ();
00111 
00115                 virtual ~Shape ();
00116 };
00117 
00118 }
00119 
00120 #endif // _Shape_H_

Generado el Tue May 29 14:46:15 2007 para Zak Engine v1.1.0 por  doxygen 1.5.1-p1