Engine
The Game Engine for Ian Parberry's "Introduction to Game Physics with Box2D"
 All Classes Files Functions Variables Pages
renderer.h
Go to the documentation of this file.
1 
2 
3 
4 #pragma once
5 
6 #include "text.h"
7 #include "spriteman.h"
8 
13 
14 class CRenderer{
15 
16  friend void InitGame();
17 
18  protected:
19  D3DPRESENT_PARAMETERS m_d3dpp;
20  IDirect3D9* m_d3d;
21  IDirect3DSurface9* m_d3dbackbuffer;
23  LPDIRECT3DVERTEXBUFFER9 m_pBackgroundVB;
24  LPDIRECT3DTEXTURE9 m_pBackgroundTexture;
25  IDirect3DDevice9* m_d3ddevice;
29 
30  HRESULT CreateD3DDevice(HWND hwnd);
31  void SetWorldMatrix(float dx=0.0f);
32  void SetViewMatrix(float x, float y, float z);
33  void SetProjectionMatrix();
34  void SetAmbientLighting();
35  void SetTextureStates();
36  void SetD3dStates();
37  BOOL RestoreDevice();
38  BOOL DeviceLost();
39  void ReleaseD3D();
40  void LoadTexture(LPDIRECT3DTEXTURE9& texture, char* filename);
41  BOOL PageFlip();
42  void GetTextDC(COLORREF color);
43  void ReleaseTextDC();
44  void TextWrite(char *string, COLORREF color=RGB(255, 255, 255));
46  void LoadBackground();
47 
48  public:
49  CRenderer();
50  void Initialize();
51  BOOL BeginScene();
52  void DrawBackground();
53  void EndScene();
54  void End();
55  void Load(int sprite, char* name);
56  void draw(int sprite, float x, float y, float angle=0.0f, float xsize=1.0f, float ysize=1.0f);
57  void drawtop(int sprite, float x, float y, float angle=0.0f, float size=1.0f);
58  void GetWorldSize(int &x, int &y);
59 }; //CRenderer