Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3601024
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:34:10+00:00 2026-05-18T20:34:10+00:00

Take a look at this piece of code here: void game::startLoop() { while(QUIT ==

  • 0

Take a look at this piece of code here:

void game::startLoop()
{
 while(QUIT == false)
 {
  getRoomUpdate();
  applySurface(-15, 280, zombie_lefthand, buffer);
  applySurface(455, 280, zombie_righthand, buffer);

  SDL_Flip(buffer);

  while(SDL_PollEvent(&gameEvent))
  {
   if(gameEvent.type == SDL_QUIT)
   {
    QUIT = true;
   }
  }

  while(SDL_WaitEvent(&keyEvent))
  {
   switch(keyEvent.type)
   {
    case SDL_KEYDOWN:
    switch(keyEvent.key.keysym.sym)
    {
     //blahkeypress
    }
   }
  }
 }
}

I’m trying to figure out how to allow SDL_QUIT to work while we’re waiting for a keypress. Is there a way to do this or do you guys have a better idea?

I’m a bit of a newbie so please be specific. 😀

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:34:11+00:00Added an answer on May 18, 2026 at 8:34 pm

    The name keyEvent is misleading. SDL_WaitEvent will wait for any sort of event, including QUIT.

    SDL_Event event;
    SDL_WaitEvent(&event);
    switch (event.type) {
        case SDL_QUIT:
            quit = true;
            break;
        /* cases for keyboard events, etc. */
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

take a look at this example code: public class Comment { private Comment() {
Take a look at this VB.NET code: list = GeoController.RegionByCountry(country, language) Region.allByLanguage(key) = list
Take a look at this code please : fighter = [:str => 2, :dex
Please take a look on this code: <!DOCTYPE html> <html lang=es> <head runat=server> <title>Main
This is a follow-up question to this one . Take a look at these
I recently had to take a quick look at Adobe InDesign server. In this
Hi, Pleas take look at this example : http://jsfiddle.net/snowman/Hne3h/1/ If you hover over the
Take a look at this site . I am trying to make the main
Please take a look at this: https://i.stack.imgur.com/9UOhU.jpg The problem: The grid is drawn perfectly
Take a look at the ssl_requirement plugin. Shouldn't it check to see if you're

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.