Original Post
Hey all, Ive been creating a simple user interface for my game, previously when i have developed a UI for an application in directX i simply created a plane and textured it with the button, and placed the plane close to the camera so it obstructs whatevers behind it like you would expect. I know this is a terrible way of doing this and thats why in the game im developing (where the camera is moving and not static like in the previous example) i dont want to/cant do this. Ive created a simple class structure for the buttons and what i ideally want is some way of passing the x and y values of the top left and bottom right co-ordinates and overlaying it on the screen much in the same way that you can by creating a RECT structure and applying text to it like so:
void Button::RenderText(IDirect3DDevice9* Device, LPCSTR buttonText, int x, int y)
{
D3DXCreateFont( Device, 40, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, OUT_TT_ONLY_PRECIS,
DEFAULT_PITCH | FF_DONTCARE, TEXT("Times New Roman"), &g_pd3dxFont );
RECT rButtonTextBox;
SetRect( &rButtonTextBox, x, y, 0, 0 );
g_pd3dxFont->DrawText( NULL,buttonText, -1, &rButtonTextBox, DT_NOCLIP,
D3DXCOLOR(255, 255, 255, 1.0f) );
}
Im basically looking for a way of doing the above but with a rectangle(?) containing an image not text. Hopefully ive explained what im after well enough hehe, im still very much learning the ropes with DirectX so go easy !! - Chett