Basic Elements to GUI's

Started by
2 comments, last by SuperVGA 12 years, 9 months ago
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
Advertisement
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.
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)

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.

This topic is closed to new replies.

Advertisement