Sign in to follow this  

GUI for my game

This topic is 4812 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I started game programming a year ago, when i made a sports simulation game in vb. Since then i have moved forword to VC++ and directx 9.0. I am planning to make a sports management simulation (cricket) game. One thing i am stuck at is the GUI. how to go about it ? Since mine is a management simulation , its bound to have lots of windows and buttons and other controls . The kind of GUI i am looking for is along the lines of Championship Manager 4 (find the screenshots here http://www.gameinfowire.com/ss.asp?gid=375&pid=6 ) I read the article at gamedev named "Creating a GUI using c++ and directx", but it didnt help a lot. I need a tutorial or something with a source code, so i understand it better. Can anyone help me with this ???

Share this post


Link to post
Share on other sites
Hi,

DX 9.0 Update Summer 04: Sample Framework Overview

This may be of interest to you (it certainly is to me, when I can scrounge the bandwidth to d/l the latest update) :) I've seen the results on someone else's PC, and it looks pretty flexible and pretty enough to use in a game. Basically, MS have provided a textured GUI framework mirroring many of the standard Win32 GUI components in DX.

Although I haven't messed with it yet, I believe programming with it is similar to most GUI programming: lots of event handlers for the components - GUI's are by nature event-driven programming.

Anyway, it's worth a look. Let us know how you go :)

Share this post


Link to post
Share on other sites
hanifv-

You're in luck! The latest version of DirectX 9.0 (Summer 2004) has an entirely new GUI system. Check if you have the summer update and if not, download it.

9.0c just came out, here's a link:

DirectX 9.0c

I can't find any documenation to go with it, and I don't think there is any, however just look through the example code, it is quite clean now and should be a big help.

One final thought, if you decide to have no graphics, or just VERY simple ones perhaps a C# app would be better as making a GUI using windows forms would be a lot easier, and you could even step up to making web based game.

Doolwind

Share this post


Link to post
Share on other sites
Thanks for your help

Didnt knew Directx 9.0c was released. Well i will download it soon.

Basically i dont understand how the whole process of GUI works.

Lets say we drop the whole directx 9.0 c idea. How do i create all those cool and classy looking windows ( which should not look like they have been borrowed from windows ) ? how to make my custom controls like buttons and textboxes (which also look good and go along with the theme ) ?


Lets say i manage to build all that. Now say, the user presses "Player Stats" button, a window showing the player stats and some other functional buttons show up in a window, so where do i design such a window. like in MFC we design the window using a resource editor.

Also to inform you, that the game i am planning should run in
fullscreen mode (with the GUI ).

i have seen many games/apps that have a good interface, use XML in some kind. what purpose do the XML file serve for the GUI ?

I know i might sound stupid .....

Share this post


Link to post
Share on other sites
I can second the recommendation for the DX9 GUI (in the DXUT library). It's pretty spiffy, as is the new simple demo/application framework.

Note that a new version of the DSK was JUST released (October 2004 update) so you probably want to get that, rather than the Summer 2004 SDK, to avoid re-downloading a 250 MB thing :-)

Share this post


Link to post
Share on other sites
Thanks for your suggestions

i saw the screenshot of the example program showing the new GUI in directx and it looks great. But what about making a unique GUI. I mean all the advance games will still create their own GUI instead of using the directx 9.0c one, wont they ? after all a good looking and unique GUI is very important for a game.

Any more suggestions are welcome.

Share this post


Link to post
Share on other sites
Hi there,
I haven't downloaded the new DX9 SDK yet but what i've heard it seems to be pretty easy to implement it's gui system.

Of course you could go ahead and create your own gui. I have done it myself and it was way harder than I thought.

Here is a pic:


*******EDIT*******
My d**n provider doesn't
allow external links... :(
Visit the link below and
click on screenies
********EDIT********

from my website

You will most probably need:
-Some base class like CGUIObject
-Derived classed like CGUIWindow CGUIButton CGUIListbox
-bitmaps with your theme(s)

That sounds easy at first, but it gets tricky when you want to have real windows-like functionality. (overlapping windows, focus, moving windows around, resizing windows, ...)

The XML File would be most likely used to store the window. Adding tags for every object and its children.

If you choose to build your own gui framework, go ahead it's a great lerning experience plus your application will be more cross platform than with the DX9c aproach.

Hope that helps...

Share this post


Link to post
Share on other sites
thanks a lot madhed, that really helps

You really have done some good work on your engine .

So if i wanna make a GUI , what preparations will i have to make , what all stuff will i need to learn ? is there some article/tutorial/book which makes the job easier ?

When you started making it, what all stuff did u refer ?

i know vc++ , mfc , directx but i havent mastered them . i dont think that will be enough, will it ? may be i should master all that first ? what do you think

Share this post


Link to post
Share on other sites
Ah You registered yesterday... welcome to the comunity hanifv ;)

I didn't refer anything execpt all the stuff I've collected in my brain the last few years. :)

Basically What you need is here:

class CGUIObject:
-Position x,y
-width, height
-list<CGUIObject*> children
-CGUIObject* parent
-CGUIObjectPainter* painter

class CGUIWindow : public CGUIObject
-string title
-texture* windowTexture

....

then you start from the top-object (it's really the bottom object)
You call object->painter->Draw(object);
And then you do the same for all the children of this object.

You derive different painter classes for your different objects.
Like CGUIWindowPainter CGUIButtonPainter.

That way you have a neat seperation of gui functionality vs. graphics subsystem.

Keep in mind, this is how I would do it. You can come up with a better idea if you like. ;)

I have uploaded a new picture of the skin I'm using for my windows. There are many tiles for the different objects which are taken from the texture and stretched to fit the size of the window.

Share this post


Link to post
Share on other sites
thanks once again.

I think i will need to get a lot of experience before, i could pull of something like that.

P.S : could you guys suggest me a really nice book for C++ . I have decided to strengthen my roots first :)

Share this post


Link to post
Share on other sites
One more question :)

If i make my own GUI and all the controls once, and then say if i just wanted to change the theme and the look and feel, i would just have to change the graphics files (just the art part) , right ?

i searched a lot over the net but i couldnt find a tutorial/article (with source) which helps us accomplish our own GUI. :(



Share this post


Link to post
Share on other sites
Here's a set of tutorials on creating your own GUI using XML to store the layouts. It's in OpenGL and not DX, but it shouldn't be that hard to follow and change.

Tutorials

And about changing the look of your GUI, yes you usually would just have to change the texture images you use, but you may have to tweak some things to make it look right.

-Auron

Share this post


Link to post
Share on other sites
Thanks a lot for that link. That will surely help. too bad its not in directx but i think i will manage.

btw, i may sound stupid, but can we use directx and opengl together in the game ? say we make the GUI using opengl and use directx for other stuff ?

Share this post


Link to post
Share on other sites
I remember reading somewhere that we can use both directx and openGL in the same game. Like opengl for 3d stuff and directx
for input.

is it true ??

If yes , then is it advisable ???

Share this post


Link to post
Share on other sites
Quote:
Original post by hanifv
If yes , then is it advisable ???


Yes you can. You can't use Direct3D and OpenGL together, but using OpenGL with the other elements of the DirectX API is fine.

Both API's do essentially the same thing, so it shouldn't be too hard to convert from OpenGL to Direct3D, or vice versa.

EDIT: duh, didn't read your post properly.

Share this post


Link to post
Share on other sites

This topic is 4812 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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