Advertisement Jump to content
Sign in to follow this  

How do you do (SDL)...

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

Hi, I was just wondering how you deal with screens in sdl (not surfaces), but like main screen, credits screen and so on. Do you have booleans and from them decide what to show in your main loop, like:
main loop
    if showMain = true
    else if showGame = true
end loop
I was also wondering if I can decide where my window will appear on the screen after I have set a video mode?

Share this post

Link to post
Share on other sites
The method you suggested is one way of getting it done. It shouldw work fine, but you will probabally want to wrap it all in a class so you can easily have multiple screens. You will need to add a timer so it can advance though the various screens. I don't have any specific examples for this, but I'm sure you can figure out something that works [smile].

As for getting the SDL window to go where you want, you can do this:

// ... Globals ...
#include <SDL/SDL_syswm.h>
SDL_SysWMinfo pInfo; // MUST be global or static inside a function

// ... Init Function ...
SDL_SetVideoMode ( ... );
// Get the info of the window Win32 style
// Move the window using Win32 API
// HWND, X, Y, W, H, Repaint( true )
MoveWindow( pInfo.window, 0, 0, 640, 480, true );

That's it for that, just make sure you resize the window to what the screen is [wink]. If you have any other questions or comments, feel free to ask.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!