speartip
2017-03-15 21:32:47 UTC
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!
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!