Advertisement
keybode

Renderer.h

May 21st, 2014
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.16 KB | None | 0 0
  1. #ifndef RENDERER_H
  2. #define RENDERER_H
  3.  
  4. #include "Include.h"
  5.  
  6. class Color
  7. {
  8. public:
  9.     Color ( int red, int green, int blue, int alpha )
  10.     {
  11.         m_red = red; m_green = green; m_blue = blue; m_alpha = alpha;
  12.         m_colorCode = D3DCOLOR_RGBA(red, green, blue, alpha);
  13.     }
  14.  
  15.     Color ( DWORD colorCode )
  16.     {
  17.         m_colorCode = colorCode;
  18.     }
  19.  
  20.     DWORD GetCode ( void ) { return m_colorCode; }
  21.     int A ( void ) { return m_alpha; }
  22.     int R ( void ) { return m_red; }
  23.     int G ( void ) { return m_green; }
  24.     int B ( void ) { return m_blue; }
  25.  
  26. private:
  27.     DWORD   m_colorCode;
  28.     int     m_red, m_green, m_blue, m_alpha;
  29. };
  30.  
  31. #define COLORCODE(r, g, b, a)   Color ( r, g, b, a )
  32. #define COLOR_WHITE             Color ( 255, 255, 255, 255 )
  33. #define COLOR_BLACK             Color ( 0, 0, 0, 255 )
  34. #define COLOR_RED               Color ( 255, 0, 0, 255 )
  35. #define COLOR_GREEN             Color ( 0, 255, 0, 255 )
  36. #define COLOR_BLUE              Color ( 0, 0, 255, 255 )
  37. #define COLOR_CYAN              Color ( 0, 150, 255, 255 )
  38. #define COLOR_YELLOW            Color ( 255, 255, 0, 255 )
  39.  
  40. class CRenderer
  41. {
  42. public:
  43.     CRenderer ( void );
  44.     ~CRenderer ( void );
  45.  
  46.     void                    Update ( IDirect3DDevice9* pDevice );
  47.     void                    PreFrame ( void );
  48.     void                    PostFrame ( void );
  49.     void                    Release ( void );
  50.  
  51.     void                    SetDevice ( IDirect3DDevice9* pDevice );
  52.  
  53.     IDirect3DDevice9*       GetDevice ( void );
  54.  
  55.     void                    Rect ( int x, int y, int w, int h, Color color );
  56.     void                    RectOutlined ( int x, int y, int w, int h, Color color, Color outlined, int t );
  57.     void                    BorderBox ( int x, int y, int w, int h, Color color, int t );
  58.     void                    BorderBoxOutlined ( int x, int y, int w, int h, Color color, Color outlined, int t );
  59.     void                    Line ( int x0, int y0, int x1, int y1, int w, Color color );
  60.     void                    String ( const char* fontName, int x, int y, Color color, const char* text, ... );
  61.     void                    StringOutlined ( const char* fontName, int x, int y, Color color, const char* text, ... );
  62.     void                    Circle ( int x, int y, int radius, Color color );
  63.  
  64. private:
  65.     bool                    IsReady ( void );
  66.  
  67. private:
  68.     ID3DXSprite*            m_pSprite;
  69.     IDirect3DStateBlock9*   m_pStateBlock;
  70.     IDirect3DDevice9*       m_pDevice;
  71.     DWORD_PTR               m_dwFVF;
  72. };
  73.  
  74. extern CRenderer gRenderer;
  75.  
  76. #endif // RENDERER_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement