Sign in to follow this  
emforce

In game menus

Recommended Posts

hi guys i was wondering how you create in game menus? like for instance in wow when you open up the equipement menu to see your gear. How do they do that? do they render a box and a texture with some gui buttons? Im just wondering cause im looking into putting small inventory boxes and menus for random things in my games/ apps

Share this post


Link to post
Share on other sites
Quote:
Original post by emforce
hi guys i was wondering how you create in game menus? like for instance in wow when you open up the equipement menu to see your gear. How do they do that? do they render a box and a texture with some gui buttons? Im just wondering cause im looking into putting small inventory boxes and menus for random things in my games/ apps
It's usually a quad with a texture, or multiple quads depending on how you want to structure things.

You can also use third party libraries that handle all of the drudgery for you. In my game I use CEGUI for example.

Share this post


Link to post
Share on other sites
ok so i got the textured quad running but how would i make it so it was like in orthogonal projection? aka so it was predominant in the screen

Share this post


Link to post
Share on other sites
Render it with 2D coordinates, possibly relative if you want it to cover the same percentage of the screen at different resolutions.
How you do that depends on which API. Direct3D supports pre-transformed vertices (D3DFVF_XYZRHW for 9 or an empty vertex shader for 10), and OpenGL can do it for example with an identity projection matrix and glVertex2d.

Share this post


Link to post
Share on other sites
That would be with D3DXMatrixOrthoLH. That'll create an orthographic projection matrix which you can use to display your GUI with (You'll need to set that matrix on the device though, presumably by setting a shader param).

Share this post


Link to post
Share on other sites
i tried using the D3DXMatrixOrthoLH but to no avail. I set the zn and zf to 1.0f and 1000.0f respectively but if i try to render the square it will just disappear. How do i set the matrix on the device? and how would i set a shader parameter?

Share this post


Link to post
Share on other sites
ID3D9Device::SetTransform with D3DTS_PROJECTION for D3D9 fixed-function, or using for example ID3D10Effect::GetVariableByName as described in the Set Effect State (Direct3D 10) guide for D3D10 with effects. If you're not using the effect interface you need to create a constant buffer manually.

This is all covered in the D3D10 tutorials and samples, starting at Tutorial 0: Win32 Basics, which should be completed in order. Specifically tutorial 7 seems to be covering constant buffers.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this