|
|
#1 | ||||||||
|
Member
Location: N. America |
I want to learn to implement the game menu-system and how does changing various options in the game menu affect the game-play.
I want to learn to program the same.. Can anyone please guide me in the right direction or give me some link which deals with this ? I think, this also follows in the league of menu systems, but I also want to learn to make a HUD. The way I do it now is pretty cheesy since what I do is; for example, if I have to make a button at x,y. I make a texture, draw it at x,y and whenever u click in that area of the screen, i check to see if the mouse coordinates are within that area and then i just perform the necessary action. This really sucks when I have to change the resolution of the screen. The right way would be to setup an event-delegation model or something like that..but i dont have much leads on this subject. So, please let me know something for HUD as well. Thanks |
||||||||
|
|
|
|
|
#2 | ||||||||
|
Administrator
Location: UK |
Why can't you make the HUD resolution independent?
__________________
Steven Yau [Alix Games Blog] [Portfolio] [How I broke into the Games Industry] [Why I left my Games Job] [How to be a Games Tester] [Getting back into the Game] |
||||||||
|
|
|
|
|
#3 | ||||||||
|
Member
Location: N. America |
It just stretches the textures that is rendered and it looks all messed up..
|
||||||||
|
|
|
|
|
#4 | ||||||||
|
Senior Member
Location: Montreal, Canada |
The simplest way to do this would be to use the on_click event of the object. However, I do not know the programming language you are using, nor if it has events.
If not, try creating a class for each object, put all of your objects in a collection, and on each click iterate through that collection to see if the area clicked corresponds to an object. This can also apply to non-HUD objects, such as enemies, for example.
__________________
Aspiring game designer and software engineering student at École de technologie supérieure (ETS) ◄ CONJURE ♣ IGDA Profile ♦ LinkedIn Profile ♥ Facebook Page ♠ My Website ► |
||||||||
|
|
|
|
|
#5 | ||||||||
|
Member
Location: N. America |
Yea. I feel my post was more abstract. But, I am currently in C#-XNA. And I'm making a transition to C++ =>openGL. Thus, I am all ears for either of the languages since its the concept that I am looking forward to.
I understand the event delegation model, but whatever I had used till date had such a structure already built-in with events registered onto it.(am referring to java and the button-event system therein). Here, I dont have that kind of a structure..so do I need to make something similar to that ? |
||||||||
|
|
|
|
|
#6 | ||||||||
|
Administrator
Location: UK |
To be honest, I think you are making it more complicated then it needs to be. As long as you have a list of 'clickable' objects that you iterate through when the player clicks, you are fine.
As for the resolution issue, have the texture at a decent resolution to start with then in the worst case scenario, it gets scaled down.
__________________
Steven Yau [Alix Games Blog] [Portfolio] [How I broke into the Games Industry] [Why I left my Games Job] [How to be a Games Tester] [Getting back into the Game] |
||||||||
|
|
|
|
|
#7 | |||||||||
|
Member
|
Quote:
Your graphics wont scale, but be properally positioned, so changing to a larger position just gives the player more screen room, if this is what you want. |
|||||||||
|
|
|
|
|
#8 | ||||||||
|
Member
|
As far as actual HUD design goes, you have millions of options.
People specialize in GUI design, it's not something you can get right, right off the bat. I'm also led to believe it's not something you can do perfectly. I'd agree w/ yaustar here. Don't over complicate what your trying to do. A simple list of gui objects you check for mouse clicks and evoke their OnHit method, or whatever you want is probably just fine. The most basic HUD i would go w/ would be something like this: GUIObject (Base class any gui object derives from, buttons, text boxes, scroll bars ect) The GUIObject would have these functions: RegisterClickAction() OnClick() So when you create a new GUIObject, you can call it's RegisterClickAction and pass in a function pointer. The OnClick may do some specific things (show the down graphic for a button for example) but it also calls the registered function, if one exists. Then you can create custom functions outside of your system for each button and assign your buttons those functions. You can get slick and even script out those functions to have a scripted GUI system. Give GUIObject a Z priority variable and keep your list sorted by Z priority, check starting from the top most and stop checking for clicks the first one you get. Now you cant click multiple buttons at once, and the buttons on the topmost are clicked instead of the one below them, that solves a couple problems for ya too. GUI systems can be extremely complicated beasts. I reccomdend going w/ a simple implementation that works for what you want. You can get into observer patterns and all sorts of quirky shit to make a truly badass GUI, but just remember to ask yourself, "Is this really necessary or important?" have fun ![]() Last edited by nef : 01-01-2009 at 08:55 PM. |
||||||||
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Powered by vBulletin® Version 3.6.9
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
All times are GMT -8. The time now is 08:12 AM.

























Linear Mode

