mirror of
https://github.com/ScrelliCopter/Lesson10-SDL3.git
synced 2025-02-21 07:19:26 +11:00
use logical keycodes
This commit is contained in:
15
Lesson10.c
15
Lesson10.c
@@ -408,15 +408,15 @@ int SDL_AppEvent(const SDL_Event *event)
|
|||||||
return 1; // Exit with success status
|
return 1; // Exit with success status
|
||||||
|
|
||||||
case SDL_EVENT_KEY_DOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
if (event->key.keysym.scancode == SDL_SCANCODE_ESCAPE) // Quit on Escape
|
if (event->key.keysym.sym == SDLK_ESCAPE) // Quit on Escape
|
||||||
{
|
{
|
||||||
return 1; // Exit with success status
|
return 1; // Exit with success status
|
||||||
}
|
}
|
||||||
if (!event->key.repeat) // Was a key just pressed?
|
if (!event->key.repeat) // Was a key just pressed?
|
||||||
{
|
{
|
||||||
switch (event->key.keysym.scancode)
|
switch (event->key.keysym.sym)
|
||||||
{
|
{
|
||||||
case SDL_SCANCODE_B: // B = Toggle blending
|
case SDLK_b: // B = Toggle blending
|
||||||
blend = !blend;
|
blend = !blend;
|
||||||
if (!blend)
|
if (!blend)
|
||||||
{
|
{
|
||||||
@@ -430,7 +430,7 @@ int SDL_AppEvent(const SDL_Event *event)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case SDL_SCANCODE_F: // F = Cycle texture filtering
|
case SDLK_f: // F = Cycle texture filtering
|
||||||
filter += 1;
|
filter += 1;
|
||||||
if (filter > 2)
|
if (filter > 2)
|
||||||
{
|
{
|
||||||
@@ -438,8 +438,7 @@ int SDL_AppEvent(const SDL_Event *event)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case SDL_SCANCODE_F1:
|
case SDLK_F1: // F1 = Toggle Fullscreen / Windowed Mode
|
||||||
// Toggle Fullscreen / Windowed Mode
|
|
||||||
fullscreen = !fullscreen;
|
fullscreen = !fullscreen;
|
||||||
SDL_SetWindowFullscreen(win, fullscreen);
|
SDL_SetWindowFullscreen(win, fullscreen);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -449,8 +448,8 @@ int SDL_AppEvent(const SDL_Event *event)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED: // Resize The OpenGL Window
|
case SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED: // Deal with window resizes
|
||||||
ReSizeGLScene(event->window.data1, event->window.data2); // data1=Width, data2=Height
|
ReSizeGLScene(event->window.data1, event->window.data2); // data1=Backbuffer Width, data2=Backbuffer Height
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
default: return 0;
|
default: return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user