Sign in to follow this  
Adamb

GUI and SDL

Recommended Posts

Adamb    124
Hello, I've just gotten into programming with graphics, and I've been using SDL. I want to include a gui in the program I'm working on. Is there any way to do this with SDL? I want to use the built in Windows gui that almost every program uses, not some custom one. (It doesn't need to be portable or anything.) Is this possible? I don't need the more complicated features, all I really want is a menu bar, and maybe message boxes. Thanks :)

Share this post


Link to post
Share on other sites
FrankCashio    168
I'm confused as to what your question is. Do you want to use the windows GUI in your game or SDL?

Well to answer your first question if you can use the Windows GUI. It depends if you’re going to do full screen game then no. Well you could pop up Message Boxes but, you’d have to be careful that they actually get rendered, and if you switch the resolution that could be an issues. In general it not a good idea. Windows doesn’t play nice with games. It still amazes me that it's a viable gaming platform to begin with.

As to if you can use SDL for a GUI the answer is yes, You can make a GUI out of anything that can draw pixels.


Happy Coding,
Frank

Share this post


Link to post
Share on other sites
Adamb    124
Let me clarify. I have created a game using sdl. All of the loading of the graphics, blitting, input, etc. are handled by sdl. What I want to do now is add a menu bar to it. File -> New Game, Quit, and so on. Instead of coding my own menu bar, I'd like to use Windows' standard menu bar. The game runs in a window btw, not fullscreen. Can I do this?

Share this post


Link to post
Share on other sites
jeroenb    282
It is possible but slightly hard to do. First you have to create the resources (your menu etc), which isn't very hard. I assume here that you made a console project. In that case you must create a message loop for handling the windows messages. When you have the message loop running, it isn't very hard anymore to receive the menu messages. Try to google 'SDL dialog' and you'll probably find more information about setting such a message loop up.

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