GUI and SDL
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 :)
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
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
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?
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement