GUI for my game

Started by
14 comments, last by Sandman 19 years, 6 months ago
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 ???
Advertisement
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 :)
---PS3dev
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
Whoops, Dave's post wasn't there when I posted...

Doolwind
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 .....
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 :-)
enum Bool { True, False, FileNotFound };
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.

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...
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
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.

This topic is closed to new replies.

Advertisement