Sign in to follow this  
NathanPockrus

Basic Elements to GUI's

Recommended Posts

NathanPockrus    100
Hello all,
I am new to developing games and I am currently working on the basics of game GUI's (menus/scrolling text boxes/ect.) and I am wondering about a few specific implementation issues that would allow me to grasp how certain elements of the GUI is designed. I am trying to make it so that a box pop up on the screen (when the option is selected) with all of the music files in a certain directory listed within the box and the box has scroll bars the are sized according to the number of files in the directory. How would you go about designing the text box so that when you scroll it shows different files, how would you design the slider so that the size of the slider bar changes according the number of files (for this one I know how to do proportions to get the size, but i do not know how to resize an image so that the size is smaller) and one last thing, how would you make it so that a click highlights a single song in the list? I know these are easy questions in comparison to overall game programming, but I would love to understand these basics so I can apply them in various ways. Thanks much!

Nathan

Share this post


Link to post
Share on other sites
SuperVGA    1132
You can apply some knowledge of 2D tile maps here. It's important that you render only the visible list entries, even through a stencil buffer or a smaller viewport.
There are a lot of ways to make GUIs, though.
I'd like to know, after you're done implementing that music srlection dialog, and you need an options dialog, would you create that from scratch?
How about making an abstract class, a generalization of a GUI element. It would be drawable, so it should have an offset and dimensions for both axes.
Then start inheriting windows, panels, lists and buttons from that class. All as generic as possible (so you can use them for different things later on).

Finally, create a simple scripting language for your application to compose the gui from, or hardcode it. This is where you use the generic elements.

Or you could use CEgui and not have to program the gui yourself. - i forget you haven't written what language you use, or target platform.

Share this post


Link to post
Share on other sites
NathanPockrus    100
Thanks for the reply,
I mainly want to do this as a learning experience so I can understand the most basic elements of graphic movement. This will help me apply these concepts to different parts of a game that might not be inherently obvious to some one who hasn't broken down elements to their basics like this. I planned on creating a base window class, then inheriting that class to create different styles of windows (btw I'm going to be using C++ with the SDL library). I do plan to create everything from scratch (even if its just once to understand how it works)

Share this post


Link to post
Share on other sites
SuperVGA    1132
Try messing around with panels and other GUI elements, scaling and parent-children relationships (e.g. panels containing other elements)
Also, It's advisable that you research the concepts of Model-view view-model, model-view-control and observer patterns. The design of messages between a GUI and the business layer is nontrivial.

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