How do you do (SDL)...

This topic is 4681 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

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 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 styleSDL_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.