Archived

This topic is now archived and is closed to further replies.

Link

Option Screen help need

Recommended Posts

I would make an option screen or a start game screen in Direct3D (9.0). It is a simple bitmap of background and 2 buttons START GAME and EXIT. How can i make these two buttons so i can handle them by the mouse? P.s. The game is FullScreen

Share this post


Link to post
Share on other sites
a quick and easy way to do it is just to draw the buttons onto the bitmap, and check if mouse clicks are within a box that surrounds the two options.

or you could work out a real GUI, or use a 3rd party one from somewhere...

Share this post


Link to post
Share on other sites
Just take the time and implement your own version of menu system so that you can change it easily later.

The principle behind drawing 2D menu over 3d engine in the background is to create rectangles (2 triangles) with the texture of the menu with RHW component (RHW=1)


// Custom FVF, which describes our Menu rectangle vertex structure

struct MENURECTANGLECUSTOMVERTEX
{
FLOAT x, y, z, rhw; // The position for the vertex

D3DCOLOR color; // The vertex color

FLOAT tu,tv; // Tex.coordinate

};
#define D3DFVF_MENURECTANGLECUSTOMVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1)


The coordinates for triangles are normal screen coordinates (0,0 ->1024x768), for every vertex, RHW=1.0f and z=0.0f and that`s it. You render it normally through VB as any other 3d object and you have a nice 2D menu over the 3d engine in the background.

Then just take the current mouse position and compare it if it is in the range of the menu and check pressing of mouse buttons and you`re done.

VladR
Avenger 3D game

Share this post


Link to post
Share on other sites