home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 July & August / PCWorld_2006-07-08_cd.bin / temacd / planearcade / planearcade.exe / Tank3.bmp / 2Dpanel.h < prev    next >
C/C++ Source or Header  |  2004-09-07  |  2KB  |  77 lines

  1.  
  2. #ifndef _2DPANEL_H_
  3. #define _2DPANEL_H_
  4.  
  5. //----------------------------
  6. //Custom Vertex
  7. //----------------------------
  8. struct CUSTOMVERTEX2DPANEL
  9. {
  10.     float x,y,z,rhw;
  11.     D3DCOLOR    color;    // The color
  12.     FLOAT       tu, tv;   // The texture coordinates
  13. };
  14.  
  15. #define D3DFVF_CUSTOMVERTEX2DPANEL (D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1)
  16.  
  17. //------------------------------------------------------------------
  18. // Name: 2DPANEL CLASS
  19. // Desc: *************
  20. //------------------------------------------------------------------
  21. class PANEL2D
  22. {
  23. private:
  24.  
  25.  
  26.     //textura
  27.     LPDIRECT3DTEXTURE9   *g_pTexture;  
  28.  
  29.     //vertex do ktoreho sa ukladaju hodnoty
  30.     CUSTOMVERTEX2DPANEL   *pVertices;  
  31.  
  32.     //
  33.     //Funckie
  34.     //
  35.     void UpDateVertices();
  36.     void ResetPoints();
  37.     VECTOR3D GetNewPos(VECTOR3D Centre,VECTOR3D Point);
  38.  
  39. public:
  40.  
  41.     //
  42.     //VLASTNOSTI
  43.     //
  44.     
  45.     VECTOR3D P1,P2,P3,P4; //body - vertexi
  46.     float Rot;            //rotacia - natocenie
  47.     float Width,Height;   //sirka vyska
  48.     int NumFrames;        //pocet framov
  49.     float Frame;          //Frame - snimok
  50.     bool RelativeMode;    //relativna velkost
  51.     float Scale;          //scale
  52.     VECTOR3D Pos;         //pozicia
  53.     COLOR Color;          //farba
  54.  
  55.     //
  56.     //FUNKCIE
  57.     //
  58.  
  59.     //konstruktor
  60.     PANEL2D();
  61.  
  62.     //destruktor
  63.     ~PANEL2D();
  64.  
  65.     void Create(float PanelWidth, float PanelHeight,int NumAnimFrames);
  66.     void AddFrame(char *FileName,COLOR ColorKey);
  67.     void ClearAllFrames();
  68.     void Center(VECTOR3D CPos);
  69.     void Render();
  70.     bool MousePick(VECTOR3D Point);
  71.  
  72.     void SetTexture(int ToFrame,LPDIRECT3DTEXTURE9 Tex);
  73. };
  74.  
  75.  
  76.  
  77. #endif  //_2DPANEL_H_