What is the best way of doing this
Hi all,
Well I have a bit of experiance programming 3D Games using DirectX. But now I decided to create a full game (and its comming along nicely). I wanted to add a menu because I need the player to select a player profile (so I can load the players info).
But now I have a bit of a problem because how should I draw my menu items. I want to create (sort of) a gui system. It only needs to contain a list box (custom made with images and stuff), buttons and labels. I have them all set up and added them to my render list. But now I have to tell my program how to render. Should I render them a sprites (so I can add nice transparency and rounded items) or should I create vertex buffer planes to draw them on. Or is there a better way.
I already tried it with vertex buffers but didn't like the fact that (when creating a mouse pointer) I have to matrix move my vertex buffer and didn't have a pointer (it was more like a box moving on the screen). Also when I create sprites it works nicely only problem is that when i move my mouse and after clearing the scene redraw it it leaves a blue square behind (on top of my background (blue is my clearing color)).
So how to create menus (and later on in-game huds)? I tried searching but couldn't really figure out what keywords to search on (tried main menu, sprites vs vertexbuffers, etc). So if anyone could give me some advice I would really apriciate it. (also tried irrlighh or something like that (the 3d engine) to see how its done but didn't find out.
With Kind Regards,
EyeSize
Hi,
Thanks for your reply I was thinking of using sprites but the only problem with my sprites is that when I clear my buffer it leaves a blue spot on my background (background is still a vertex buffer) but still what would I use for my GUI in my 3D Game because its not working correctly. So how would I fix that ?
With kind regards,
EyeSize
Thanks for your reply I was thinking of using sprites but the only problem with my sprites is that when I clear my buffer it leaves a blue spot on my background (background is still a vertex buffer) but still what would I use for my GUI in my 3D Game because its not working correctly. So how would I fix that ?
With kind regards,
EyeSize
Quote:Original post by EyeSize
Hi,
Thanks for your reply I was thinking of using sprites but the only problem with my sprites is that when I clear my buffer it leaves a blue spot on my background (background is still a vertex buffer) but still what would I use for my GUI in my 3D Game because its not working correctly. So how would I fix that ?
With kind regards,
EyeSize
If you've implemented everything correctly there shouldn't be a blue spot leftover. Try and figure out a solution to this blue spot and stick to using sprites.
Another idea is to use a GUI package, like CEGUI.
To clarify,
When you say "clear the buffer" your removing the data from the buffer itself?
At the same time, your not bypassing the draw process for the sprite buffer itself?
IE you dont have something like:
if (menuState == MENU_ON)
{
DrawMenuSprite();
}
Effectively, if you dont have a capture to say you want to draw it as apposed to just clearing the buffer you are potentially drawing a sprite of NULL content to the screen, which may be filling in with any background colour. Incidently, i would have expected it to crash your program in all honesty.
When you say "clear the buffer" your removing the data from the buffer itself?
At the same time, your not bypassing the draw process for the sprite buffer itself?
IE you dont have something like:
if (menuState == MENU_ON)
{
DrawMenuSprite();
}
Effectively, if you dont have a capture to say you want to draw it as apposed to just clearing the buffer you are potentially drawing a sprite of NULL content to the screen, which may be filling in with any background colour. Incidently, i would have expected it to crash your program in all honesty.
Hi all,
Thanks for all of your replies.
@Shakedown: thanks for your advice about the gui package. I will definitly look into this. I hope it helps me create my own gui (in game) or if all else fails i could implement there gui.
@Kalten: When I say clear the buffer I use the (direct3ddevice)->clear(Some Stuff here) function. As for the bypassing I do have a function to see if I am in the main menu or in game. When I am in game the render object is passed a few sprites and stuff when its in game it is passed some 3D objects.
With kind regards,
EyeSize
Thanks for all of your replies.
@Shakedown: thanks for your advice about the gui package. I will definitly look into this. I hope it helps me create my own gui (in game) or if all else fails i could implement there gui.
@Kalten: When I say clear the buffer I use the (direct3ddevice)->clear(Some Stuff here) function. As for the bypassing I do have a function to see if I am in the main menu or in game. When I am in game the render object is passed a few sprites and stuff when its in game it is passed some 3D objects.
With kind regards,
EyeSize
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement