Sign in to follow this  
kelicant

Making GUIs for C++, where to start?

Recommended Posts

kelicant    101
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([url="http://opensteer.sourceforge.net/"]http://opensteer.sourceforge.net/[/url]). 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
wicked357    2424
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
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
Tispe    1468
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

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