Jump to content
  • Advertisement
Sign in to follow this  
Scanmaster_k

How do you do (SDL)...

This topic is 4922 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
        showMain
    else if showGame = true
        showGame
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
Advertisement
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
SDL_VERSION(&pInfo.version);
SDL_GetWMInfo(&pInfo);
// 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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!