• Advertisement
Sign in to follow this  

Making GUIs for C++, where to start?

This topic is 2162 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

I am experimenting with C++, and trying to learn how to make some basic games and applications. I know swing is used a lot for the GUIs in Java, and qt is pretty popular for C++ development. However, would qt also provide the graphics representation for the games themselves?

My wording may have been a bit poor, my project I'd like to work towards (by creating other small applications and games to learn the necessary skills) is something like the OpenSteer project(http://opensteer.sourceforge.net/). I want to have triangle characters that I will program to navigate and steer themselves towards certain goals. I know that qt can make the window for the game, but would it also handle drawing the triangles and simple graphics?

What tools (like qt or swing) are available for making game graphics? Could they be carried over to 3d graphic projects (not necessary by any means, just curious)?

Share this post


Link to post
Share on other sites
Advertisement
You typically use a GUI on top of an existing graphics API such as DirectX or OpenGL. For example you would write a game using the SFML library which is based off OpenGL and they have supported the use of qt and many others to be used. I think I understood your question so I hope this answered a little bit for you, but maybe someone else could give a more detailed explanation.

Share this post


Link to post
Share on other sites
Thanks wicked357,
That does help. I guess I should look into graphic APIs and libraries that use them.

Share this post


Link to post
Share on other sites
I just program my own GUI's while using the graphics API to display graphics, ect... Much easier when you've done some programs with your own GUI due to the re-usable code. Just add in your class "Button" or "Text Box" when needed, and modify the code as needed. :)

Share this post


Link to post
Share on other sites
I too program my own GUI in a very crude way. I have a Class which handles "windows", each window is a struct which holds information such as position, width, height, sprites and texts. Each "text" has its own RECT, and each sprite has position and so fourth. I have a "parent position" in the struct and the sprites and texts positions are relative to the parent window, so if the window moves I recalculate the sprite and texts positions, ex: txt1pos = ParentPos + Txt1RelPos.

The harder part is getting input from the user, for example entering text to a field and hitting enter and submitting that string to a function which handles it. Or clicking a button or changing the color of the button if you hover over it. Which windows are currently visible, and which is "active" for input etc... all these things I just manually hammer out with spaghetti code :D

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement