Jump to content
  • Advertisement

Archived

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

flame_warrior

sdl window static , how ?

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

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
Advertisement
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

  • 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!