Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef SPRITE_BATCHER
- #define SPRITE_BATCHER
- #include <d3d9.h>
- #include <d3dx9.h>
- #include <iostream>
- #define CUSTOMFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1)
- class SpriteBatcher
- {
- //Vertex struct
- struct vertex
- {
- float x;
- float y;
- float z;
- float rhw;
- D3DCOLOR color;
- float u;
- float v;
- };
- private:
- LPDIRECT3DDEVICE9 batDevice;
- LPDIRECT3DVERTEXBUFFER9 vBuffer;
- LPDIRECT3DINDEXBUFFER9 iBuffer;
- LPDIRECT3DTEXTURE9 currentTexture;
- D3DCOLOR CLEAR_COLOR;
- vertex vertices[12];
- short indices[18];
- int numShapes;
- int vertCount;
- int idxBuffCount;
- int renderCount;
- bool setTexture;
- VOID* pVoid;
- void render();
- void resetCounts();
- public:
- SpriteBatcher();
- ~SpriteBatcher();
- void setBatcherDevice(LPDIRECT3DDEVICE9 &device);
- void beginBatch();
- void endBatch();
- void draw(float x, float y, float width, float height, D3DCOLOR color, LPDIRECT3DTEXTURE9 texture);
- void draw(float x, float y, float width, float height, D3DCOLOR color, float rotation, LPDIRECT3DTEXTURE9 texture);
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement