Archived

This topic is now archived and is closed to further replies.

flame_warrior

sdl window static , how ?

Recommended Posts

flame_warrior    122
Ok, this seems like a very simple probelm, but then again I won''t learn if I don''t ask. Ok I made a code which just open and closes the window in sdl. #include int main() { SDL_Init(SDL_INIT_VIDEO); SDL_SetVideoMode(800,600,16,SDL_DOUBLEBUF|SDL_FULLESCREEN); SDL_Quit(); } I compiled it, now I wan''t to make the window static - meaning available till I kill it manually. What code or function will allow me to do this ? Thank you for your patience.

Share this post


Link to post
Share on other sites
Prefect    373
There is some example code in the test/ section of the SDL source, but the main idea is to make a main program (message) loop, as in all games/window apps.

This main loop should look like this:


done = 0;
while ( !done ) {
/* Check for events */
while ( SDL_PollEvent(&event) ) {
switch (event.type) {
case SDL_MOUSEBUTTONDOWN: {
// Do mouse stuff here
} break;

case SDL_KEYDOWN:
case SDL_KEYUP:
switch(event.key.keysym.sym) {
case SDLK_ESCAPE:
done = 1;
break;
// Handle other keys..
default: ;
}
break;
case SDL_QUIT:
done = 1;
break;
default:
break;
}
}

// Do game logic here...

// Render the scene here
R_RenderScene();
SDL_Flip(screen);
}


cu,
Prefect

---
Sanity is the trademark of a weak mind.

Share this post


Link to post
Share on other sites