[SDL] esc detector wont run -- 'out of scope'

speartip clangray at fastmail.com
Wed Mar 15 14:32:47 PDT 2017


For what ever reason I get an out of scope error with the following key presser

Code:

 while (gameRunning)
   {
      if (SDL_PollEvent(&event))
      {
         if (event.type == SDL_QUIT)
         {
            gameRunning = false;
         }

         if (event.type == SDL_KEYDOWN)
         {
            SDL_Key keyPressed = event.key.keysym.sym;

            switch (keyPressed)
            {
               case SDLK_ESCAPE:
                  gameRunning = false;
                  break;
            }
         }
      }
   }





Code:

..\src\drawLine.cpp:39:13: error: 'SDLKey' was not declared in this scope
             SDLKey keyPressed = event.key.keysym.sym;
             ^
..\src\drawLine.cpp:41:21: error: 'keyPressed' was not declared in this scope
             switch (keyPressed)




Got to be something simple!




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20170315/4b200228/attachment.htm>


More information about the SDL mailing list