#include "MyDrawSprite.h"
Functions | |
void | my_DrawSprite (D3DXMATRIX *mat, D3DXVECTOR2 *scaling, D3DXVECTOR2 *spriteCentre, float rotation, D3DXVECTOR2 *trans, LPDIRECT3DTEXTURE9 tex, LPD3DXSPRITE sprite, bool enabled, LPRECT rect, WCHAR *strText, LPD3DXFONT pFont, D3DCOLOR color) |
my_DrawSprite draws sprite with the given billion parameters. | |
void | my_DrawOutlineText (D3DXMATRIX *mat, D3DXVECTOR2 *scaling, D3DXVECTOR2 *spriteCentre, float rotation, D3DXVECTOR2 *trans, LPD3DXSPRITE sprite, LPD3DXFONT pFont, WCHAR *strText, LPRECT rect, D3DCOLOR color, D3DCOLOR outlineColor) |
Ahh, my_DrawOutlineText, this is how I draw fancy outlined text used for intro movie. | |
void | my_DrawText (D3DXMATRIX *mat, D3DXVECTOR2 *scaling, D3DXVECTOR2 *spriteCentre, float rotation, D3DXVECTOR2 *trans, LPD3DXSPRITE sprite, LPD3DXFONT pFont, WCHAR *strText, LPRECT rect, D3DCOLOR color) |
Draws text on sprite. |
Why did I make my own sprite drawing functions in separate file? 2D Sprites are drawn everywhere in the game. And newer DirectX version have diferent API for drawing sprites. If you want to move your game to another DirectX SDK there is no need to search the entire game code looking for all places sprites are drawn - you just change them in here. I happened to work on two close DirectX SDK - august and october 2006, and there was this difference in sprite API. Basicly - if I made all graphic calls in one separate layer I would have completely portable game. If I wanted to move my game to OpenGL then only one layer would be changed. But you don't do that for such small game like this unless youre bitten to.
void my_DrawOutlineText | ( | D3DXMATRIX * | mat, | |
D3DXVECTOR2 * | scaling, | |||
D3DXVECTOR2 * | spriteCentre, | |||
float | rotation, | |||
D3DXVECTOR2 * | trans, | |||
LPD3DXSPRITE | sprite, | |||
LPD3DXFONT | pFont, | |||
WCHAR * | strText, | |||
LPRECT | rect, | |||
D3DCOLOR | color, | |||
D3DCOLOR | outlineColor | |||
) |
Ahh, my_DrawOutlineText, this is how I draw fancy outlined text used for intro movie.
void my_DrawSprite | ( | D3DXMATRIX * | mat, | |
D3DXVECTOR2 * | scaling, | |||
D3DXVECTOR2 * | spriteCentre, | |||
float | rotation, | |||
D3DXVECTOR2 * | trans, | |||
LPDIRECT3DTEXTURE9 | tex, | |||
LPD3DXSPRITE | sprite, | |||
bool | enabled, | |||
LPRECT | rect, | |||
WCHAR * | strText, | |||
LPD3DXFONT | pFont, | |||
D3DCOLOR | color | |||
) |
my_DrawSprite draws sprite with the given billion parameters.
void my_DrawText | ( | D3DXMATRIX * | mat, | |
D3DXVECTOR2 * | scaling, | |||
D3DXVECTOR2 * | spriteCentre, | |||
float | rotation, | |||
D3DXVECTOR2 * | trans, | |||
LPD3DXSPRITE | sprite, | |||
LPD3DXFONT | pFont, | |||
WCHAR * | strText, | |||
LPRECT | rect, | |||
D3DCOLOR | color | |||
) |
Draws text on sprite.