Renamed SDLK_a-z to SDLK_A-Z

Made the symbols uppercase for consistency with the other SDLK_* constants, but the values are still lowercase.
This commit is contained in:
Sam Lantinga 2024-06-30 20:05:22 -07:00
parent d9dc4b320a
commit e8dbbf8380
16 changed files with 275 additions and 93 deletions

View File

@ -3384,3 +3384,107 @@ typedef SDL_Colour, SDL_Color;
@@ @@
- SDLK_MEDIASELECT - SDLK_MEDIASELECT
+ SDLK_MEDIA_SELECT + SDLK_MEDIA_SELECT
@@
@@
- SDLK_a
+ SDLK_A
@@
@@
- SDLK_b
+ SDLK_B
@@
@@
- SDLK_c
+ SDLK_C
@@
@@
- SDLK_d
+ SDLK_D
@@
@@
- SDLK_e
+ SDLK_E
@@
@@
- SDLK_f
+ SDLK_F
@@
@@
- SDLK_g
+ SDLK_G
@@
@@
- SDLK_h
+ SDLK_H
@@
@@
- SDLK_i
+ SDLK_I
@@
@@
- SDLK_j
+ SDLK_J
@@
@@
- SDLK_k
+ SDLK_K
@@
@@
- SDLK_l
+ SDLK_L
@@
@@
- SDLK_m
+ SDLK_M
@@
@@
- SDLK_n
+ SDLK_N
@@
@@
- SDLK_o
+ SDLK_O
@@
@@
- SDLK_p
+ SDLK_P
@@
@@
- SDLK_q
+ SDLK_Q
@@
@@
- SDLK_r
+ SDLK_R
@@
@@
- SDLK_s
+ SDLK_S
@@
@@
- SDLK_t
+ SDLK_T
@@
@@
- SDLK_u
+ SDLK_U
@@
@@
- SDLK_v
+ SDLK_V
@@
@@
- SDLK_w
+ SDLK_W
@@
@@
- SDLK_x
+ SDLK_X
@@
@@
- SDLK_y
+ SDLK_Y
@@
@@
- SDLK_z
+ SDLK_Z

View File

@ -362,7 +362,7 @@ now looks like this:
SDL_Keymod mod = event.key.mod; SDL_Keymod mod = event.key.mod;
``` ```
The keycode in key events is affected by modifiers by default. e.g. pressing the A key would generate the keycode `SDLK_a`, or 'a', and pressing it while holding the shift key would generate the keycode `SDLK_A`, or 'A'. This behavior can be customized with `SDL_HINT_KEYCODE_OPTIONS`. The keycode in key events is affected by modifiers by default. e.g. pressing the A key would generate the keycode `SDLK_A`, or 'a', and pressing it while holding the shift key would generate the keycode `SDLK_A`, or 'A'. This behavior can be customized with `SDL_HINT_KEYCODE_OPTIONS`.
The gamepad event structures caxis, cbutton, cdevice, ctouchpad, and csensor have been renamed gaxis, gbutton, gdevice, gtouchpad, and gsensor. The gamepad event structures caxis, cbutton, cdevice, ctouchpad, and csensor have been renamed gaxis, gbutton, gdevice, gtouchpad, and gsensor.
@ -975,6 +975,32 @@ The following symbols have been renamed:
* SDLK_MEDIASELECT => SDLK_MEDIA_SELECT * SDLK_MEDIASELECT => SDLK_MEDIA_SELECT
* SDLK_QUOTE => SDLK_APOSTROPHE * SDLK_QUOTE => SDLK_APOSTROPHE
* SDLK_QUOTEDBL => SDLK_DBLAPOSTROPHE * SDLK_QUOTEDBL => SDLK_DBLAPOSTROPHE
* SDLK_a => SDLK_A
* SDLK_b => SDLK_B
* SDLK_c => SDLK_C
* SDLK_d => SDLK_D
* SDLK_e => SDLK_E
* SDLK_f => SDLK_F
* SDLK_g => SDLK_G
* SDLK_h => SDLK_H
* SDLK_i => SDLK_I
* SDLK_j => SDLK_J
* SDLK_k => SDLK_K
* SDLK_l => SDLK_L
* SDLK_m => SDLK_M
* SDLK_n => SDLK_N
* SDLK_o => SDLK_O
* SDLK_p => SDLK_P
* SDLK_q => SDLK_Q
* SDLK_r => SDLK_R
* SDLK_s => SDLK_S
* SDLK_t => SDLK_T
* SDLK_u => SDLK_U
* SDLK_v => SDLK_V
* SDLK_w => SDLK_W
* SDLK_x => SDLK_X
* SDLK_y => SDLK_Y
* SDLK_z => SDLK_Z
## SDL_loadso.h ## SDL_loadso.h

View File

@ -94,32 +94,32 @@ typedef Uint32 SDL_Keycode;
#define SDLK_CARET 0x0000005eu /* '^' */ #define SDLK_CARET 0x0000005eu /* '^' */
#define SDLK_UNDERSCORE 0x0000005fu /* '_' */ #define SDLK_UNDERSCORE 0x0000005fu /* '_' */
#define SDLK_GRAVE 0x00000060u /* '`' */ #define SDLK_GRAVE 0x00000060u /* '`' */
#define SDLK_a 0x00000061u /* 'a' */ #define SDLK_A 0x00000061u /* 'a' */
#define SDLK_b 0x00000062u /* 'b' */ #define SDLK_B 0x00000062u /* 'b' */
#define SDLK_c 0x00000063u /* 'c' */ #define SDLK_C 0x00000063u /* 'c' */
#define SDLK_d 0x00000064u /* 'd' */ #define SDLK_D 0x00000064u /* 'd' */
#define SDLK_e 0x00000065u /* 'e' */ #define SDLK_E 0x00000065u /* 'e' */
#define SDLK_f 0x00000066u /* 'f' */ #define SDLK_F 0x00000066u /* 'f' */
#define SDLK_g 0x00000067u /* 'g' */ #define SDLK_G 0x00000067u /* 'g' */
#define SDLK_h 0x00000068u /* 'h' */ #define SDLK_H 0x00000068u /* 'h' */
#define SDLK_i 0x00000069u /* 'i' */ #define SDLK_I 0x00000069u /* 'i' */
#define SDLK_j 0x0000006au /* 'j' */ #define SDLK_J 0x0000006au /* 'j' */
#define SDLK_k 0x0000006bu /* 'k' */ #define SDLK_K 0x0000006bu /* 'k' */
#define SDLK_l 0x0000006cu /* 'l' */ #define SDLK_L 0x0000006cu /* 'l' */
#define SDLK_m 0x0000006du /* 'm' */ #define SDLK_M 0x0000006du /* 'm' */
#define SDLK_n 0x0000006eu /* 'n' */ #define SDLK_N 0x0000006eu /* 'n' */
#define SDLK_o 0x0000006fu /* 'o' */ #define SDLK_O 0x0000006fu /* 'o' */
#define SDLK_p 0x00000070u /* 'p' */ #define SDLK_P 0x00000070u /* 'p' */
#define SDLK_q 0x00000071u /* 'q' */ #define SDLK_Q 0x00000071u /* 'q' */
#define SDLK_r 0x00000072u /* 'r' */ #define SDLK_R 0x00000072u /* 'r' */
#define SDLK_s 0x00000073u /* 's' */ #define SDLK_S 0x00000073u /* 's' */
#define SDLK_t 0x00000074u /* 't' */ #define SDLK_T 0x00000074u /* 't' */
#define SDLK_u 0x00000075u /* 'u' */ #define SDLK_U 0x00000075u /* 'u' */
#define SDLK_v 0x00000076u /* 'v' */ #define SDLK_V 0x00000076u /* 'v' */
#define SDLK_w 0x00000077u /* 'w' */ #define SDLK_W 0x00000077u /* 'w' */
#define SDLK_x 0x00000078u /* 'x' */ #define SDLK_X 0x00000078u /* 'x' */
#define SDLK_y 0x00000079u /* 'y' */ #define SDLK_Y 0x00000079u /* 'y' */
#define SDLK_z 0x0000007au /* 'z' */ #define SDLK_Z 0x0000007au /* 'z' */
#define SDLK_LEFTBRACE 0x0000007bu /* '{' */ #define SDLK_LEFTBRACE 0x0000007bu /* '{' */
#define SDLK_PIPE 0x0000007cu /* '|' */ #define SDLK_PIPE 0x0000007cu /* '|' */
#define SDLK_RIGHTBRACE 0x0000007du /* '}' */ #define SDLK_RIGHTBRACE 0x0000007du /* '}' */

View File

@ -378,6 +378,32 @@
#define SDLK_MEDIASELECT SDLK_MEDIA_SELECT #define SDLK_MEDIASELECT SDLK_MEDIA_SELECT
#define SDLK_QUOTE SDLK_APOSTROPHE #define SDLK_QUOTE SDLK_APOSTROPHE
#define SDLK_QUOTEDBL SDLK_DBLAPOSTROPHE #define SDLK_QUOTEDBL SDLK_DBLAPOSTROPHE
#define SDLK_a SDLK_A
#define SDLK_b SDLK_B
#define SDLK_c SDLK_C
#define SDLK_d SDLK_D
#define SDLK_e SDLK_E
#define SDLK_f SDLK_F
#define SDLK_g SDLK_G
#define SDLK_h SDLK_H
#define SDLK_i SDLK_I
#define SDLK_j SDLK_J
#define SDLK_k SDLK_K
#define SDLK_l SDLK_L
#define SDLK_m SDLK_M
#define SDLK_n SDLK_N
#define SDLK_o SDLK_O
#define SDLK_p SDLK_P
#define SDLK_q SDLK_Q
#define SDLK_r SDLK_R
#define SDLK_s SDLK_S
#define SDLK_t SDLK_T
#define SDLK_u SDLK_U
#define SDLK_v SDLK_V
#define SDLK_w SDLK_W
#define SDLK_x SDLK_X
#define SDLK_y SDLK_Y
#define SDLK_z SDLK_Z
/* ##SDL_log.h */ /* ##SDL_log.h */
#define SDL_LogGetOutputFunction SDL_GetLogOutputFunction #define SDL_LogGetOutputFunction SDL_GetLogOutputFunction
@ -947,6 +973,32 @@
#define SDLK_MEDIASELECT SDLK_MEDIASELECT_renamed_SDLK_MEDIA_SELECT #define SDLK_MEDIASELECT SDLK_MEDIASELECT_renamed_SDLK_MEDIA_SELECT
#define SDLK_QUOTE SDLK_QUOTE_renamed_SDLK_APOSTROPHE #define SDLK_QUOTE SDLK_QUOTE_renamed_SDLK_APOSTROPHE
#define SDLK_QUOTEDBL SDLK_QUOTEDBL_renamed_SDLK_DBLAPOSTROPHE #define SDLK_QUOTEDBL SDLK_QUOTEDBL_renamed_SDLK_DBLAPOSTROPHE
#define SDLK_a SDLK_a_renamed_SDLK_A
#define SDLK_b SDLK_b_renamed_SDLK_B
#define SDLK_c SDLK_c_renamed_SDLK_C
#define SDLK_d SDLK_d_renamed_SDLK_D
#define SDLK_e SDLK_e_renamed_SDLK_E
#define SDLK_f SDLK_f_renamed_SDLK_F
#define SDLK_g SDLK_g_renamed_SDLK_G
#define SDLK_h SDLK_h_renamed_SDLK_H
#define SDLK_i SDLK_i_renamed_SDLK_I
#define SDLK_j SDLK_j_renamed_SDLK_J
#define SDLK_k SDLK_k_renamed_SDLK_K
#define SDLK_l SDLK_l_renamed_SDLK_L
#define SDLK_m SDLK_m_renamed_SDLK_M
#define SDLK_n SDLK_n_renamed_SDLK_N
#define SDLK_o SDLK_o_renamed_SDLK_O
#define SDLK_p SDLK_p_renamed_SDLK_P
#define SDLK_q SDLK_q_renamed_SDLK_Q
#define SDLK_r SDLK_r_renamed_SDLK_R
#define SDLK_s SDLK_s_renamed_SDLK_S
#define SDLK_t SDLK_t_renamed_SDLK_T
#define SDLK_u SDLK_u_renamed_SDLK_U
#define SDLK_v SDLK_v_renamed_SDLK_V
#define SDLK_w SDLK_w_renamed_SDLK_W
#define SDLK_x SDLK_x_renamed_SDLK_X
#define SDLK_y SDLK_y_renamed_SDLK_Y
#define SDLK_z SDLK_z_renamed_SDLK_Z
/* ##SDL_log.h */ /* ##SDL_log.h */
#define SDL_LogGetOutputFunction SDL_LogGetOutputFunction_renamed_SDL_GetLogOutputFunction #define SDL_LogGetOutputFunction SDL_LogGetOutputFunction_renamed_SDL_GetLogOutputFunction

View File

@ -257,8 +257,8 @@ SDL_Scancode SDL_GetDefaultScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate
return (SDL_Scancode)(key & ~SDLK_SCANCODE_MASK); return (SDL_Scancode)(key & ~SDLK_SCANCODE_MASK);
} }
if (key >= SDLK_a && key <= SDLK_z) { if (key >= SDLK_A && key <= SDLK_Z) {
return (SDL_Scancode)(SDL_SCANCODE_A + key - SDLK_a); return (SDL_Scancode)(SDL_SCANCODE_A + key - SDLK_A);
} }
if (key >= 'A' && key <= 'Z') { if (key >= 'A' && key <= 'Z') {

View File

@ -2206,7 +2206,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
} }
} }
break; break;
case SDLK_o: case SDLK_O:
if (withControl) { if (withControl) {
/* Ctrl-O (or Ctrl-Shift-O) changes window opacity. */ /* Ctrl-O (or Ctrl-Shift-O) changes window opacity. */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
@ -2223,7 +2223,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
} }
} }
break; break;
case SDLK_h: case SDLK_H:
if (withControl) { if (withControl) {
/* Ctrl-H changes cursor visibility. */ /* Ctrl-H changes cursor visibility. */
if (SDL_CursorVisible()) { if (SDL_CursorVisible()) {
@ -2233,7 +2233,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
} }
} }
break; break;
case SDLK_c: case SDLK_C:
if (withAlt) { if (withAlt) {
/* Alt-C copy awesome text to the primary selection! */ /* Alt-C copy awesome text to the primary selection! */
SDL_SetPrimarySelectionText("SDL rocks!\nYou know it!"); SDL_SetPrimarySelectionText("SDL rocks!\nYou know it!");
@ -2258,7 +2258,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
break; break;
} }
break; break;
case SDLK_v: case SDLK_V:
if (withAlt) { if (withAlt) {
/* Alt-V paste awesome text from the primary selection! */ /* Alt-V paste awesome text from the primary selection! */
char *text = SDL_GetPrimarySelectionText(); char *text = SDL_GetPrimarySelectionText();
@ -2285,7 +2285,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
} }
} }
break; break;
case SDLK_f: case SDLK_F:
if (withControl) { if (withControl) {
/* Ctrl-F flash the window */ /* Ctrl-F flash the window */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
@ -2294,7 +2294,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
} }
} }
break; break;
case SDLK_g: case SDLK_G:
if (withControl) { if (withControl) {
/* Ctrl-G toggle mouse grab */ /* Ctrl-G toggle mouse grab */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
@ -2303,7 +2303,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
} }
} }
break; break;
case SDLK_k: case SDLK_K:
if (withControl) { if (withControl) {
/* Ctrl-K toggle keyboard grab */ /* Ctrl-K toggle keyboard grab */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
@ -2312,7 +2312,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
} }
} }
break; break;
case SDLK_m: case SDLK_M:
if (withControl) { if (withControl) {
/* Ctrl-M maximize */ /* Ctrl-M maximize */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
@ -2334,13 +2334,13 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
} }
} }
break; break;
case SDLK_r: case SDLK_R:
if (withControl) { if (withControl) {
/* Ctrl-R toggle mouse relative mode */ /* Ctrl-R toggle mouse relative mode */
SDL_SetRelativeMouseMode(!SDL_GetRelativeMouseMode()); SDL_SetRelativeMouseMode(!SDL_GetRelativeMouseMode());
} }
break; break;
case SDLK_t: case SDLK_T:
if (withControl) { if (withControl) {
/* Ctrl-T toggle topmost mode */ /* Ctrl-T toggle topmost mode */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
@ -2354,7 +2354,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
} }
} }
break; break;
case SDLK_z: case SDLK_Z:
if (withControl) { if (withControl) {
/* Ctrl-Z minimize */ /* Ctrl-Z minimize */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
@ -2393,7 +2393,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
} }
break; break;
case SDLK_b: case SDLK_B:
if (withControl) { if (withControl) {
/* Ctrl-B toggle window border */ /* Ctrl-B toggle window border */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
@ -2404,7 +2404,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
} }
} }
break; break;
case SDLK_a: case SDLK_A:
if (withControl) { if (withControl) {
/* Ctrl-A toggle aspect ratio */ /* Ctrl-A toggle aspect ratio */
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);

View File

@ -104,32 +104,32 @@ static const SDL_Keycode emscripten_keycode_table[] = {
/* 62 */ SDLK_UNKNOWN, /* 62 */ SDLK_UNKNOWN,
/* 63 */ SDLK_MINUS, /* 63 */ SDLK_MINUS,
/* 64 */ SDLK_UNKNOWN, /* 64 */ SDLK_UNKNOWN,
/* 65 */ SDLK_a, /* 65 */ SDLK_A,
/* 66 */ SDLK_b, /* 66 */ SDLK_B,
/* 67 */ SDLK_c, /* 67 */ SDLK_C,
/* 68 */ SDLK_d, /* 68 */ SDLK_D,
/* 69 */ SDLK_e, /* 69 */ SDLK_E,
/* 70 */ SDLK_f, /* 70 */ SDLK_F,
/* 71 */ SDLK_g, /* 71 */ SDLK_G,
/* 72 */ SDLK_h, /* 72 */ SDLK_H,
/* 73 */ SDLK_i, /* 73 */ SDLK_I,
/* 74 */ SDLK_j, /* 74 */ SDLK_J,
/* 75 */ SDLK_k, /* 75 */ SDLK_K,
/* 76 */ SDLK_l, /* 76 */ SDLK_L,
/* 77 */ SDLK_m, /* 77 */ SDLK_M,
/* 78 */ SDLK_n, /* 78 */ SDLK_N,
/* 79 */ SDLK_o, /* 79 */ SDLK_O,
/* 80 */ SDLK_p, /* 80 */ SDLK_P,
/* 81 */ SDLK_q, /* 81 */ SDLK_Q,
/* 82 */ SDLK_r, /* 82 */ SDLK_R,
/* 83 */ SDLK_s, /* 83 */ SDLK_S,
/* 84 */ SDLK_t, /* 84 */ SDLK_T,
/* 85 */ SDLK_u, /* 85 */ SDLK_U,
/* 86 */ SDLK_v, /* 86 */ SDLK_V,
/* 87 */ SDLK_w, /* 87 */ SDLK_W,
/* 88 */ SDLK_x, /* 88 */ SDLK_X,
/* 89 */ SDLK_y, /* 89 */ SDLK_Y,
/* 90 */ SDLK_z, /* 90 */ SDLK_Z,
/* 91 */ SDLK_LGUI, /* 91 */ SDLK_LGUI,
/* 92 */ SDLK_UNKNOWN, /* 92 */ SDLK_UNKNOWN,
/* 93 */ SDLK_APPLICATION, /* 93 */ SDLK_APPLICATION,

View File

@ -219,22 +219,22 @@ static void loop(void)
#endif #endif
if (e.type == SDL_EVENT_KEY_DOWN) { if (e.type == SDL_EVENT_KEY_DOWN) {
SDL_Keycode key = e.key.key; SDL_Keycode key = e.key.key;
if (key == SDLK_q) { if (key == SDLK_Q) {
if (SDL_AudioDevicePaused(state->audio_id)) { if (SDL_AudioDevicePaused(state->audio_id)) {
SDL_ResumeAudioDevice(state->audio_id); SDL_ResumeAudioDevice(state->audio_id);
} else { } else {
SDL_PauseAudioDevice(state->audio_id); SDL_PauseAudioDevice(state->audio_id);
} }
} else if (key == SDLK_w) { } else if (key == SDLK_W) {
auto_loop = !auto_loop; auto_loop = !auto_loop;
} else if (key == SDLK_e) { } else if (key == SDLK_E) {
auto_flush = !auto_flush; auto_flush = !auto_flush;
} else if (key == SDLK_a) { } else if (key == SDLK_A) {
SDL_ClearAudioStream(stream); SDL_ClearAudioStream(stream);
SDL_Log("Cleared audio stream"); SDL_Log("Cleared audio stream");
} else if (key == SDLK_s) { } else if (key == SDLK_S) {
queue_audio(); queue_audio();
} else if (key == SDLK_d) { } else if (key == SDLK_D) {
float amount = 1.0f; float amount = 1.0f;
amount *= (e.key.mod & SDL_KMOD_CTRL) ? 10.0f : 1.0f; amount *= (e.key.mod & SDL_KMOD_CTRL) ? 10.0f : 1.0f;
amount *= (e.key.mod & SDL_KMOD_SHIFT) ? 10.0f : 1.0f; amount *= (e.key.mod & SDL_KMOD_SHIFT) ? 10.0f : 1.0f;

View File

@ -61,7 +61,7 @@ static int keyboard_getKeyFromName(void *arg)
/* Case where Key is known, 1 character input */ /* Case where Key is known, 1 character input */
result = SDL_GetKeyFromName("A"); result = SDL_GetKeyFromName("A");
SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/single)"); SDLTest_AssertPass("Call to SDL_GetKeyFromName(known/single)");
SDLTest_AssertCheck(result == SDLK_a, "Verify result from call, expected: %d, got: %" SDL_PRIs32, SDLK_a, result); SDLTest_AssertCheck(result == SDLK_A, "Verify result from call, expected: %d, got: %" SDL_PRIs32, SDLK_A, result);
/* Case where Key is known, 2 character input */ /* Case where Key is known, 2 character input */
result = SDL_GetKeyFromName("F1"); result = SDL_GetKeyFromName("F1");
@ -126,7 +126,7 @@ static int keyboard_getKeyFromScancode(void *arg)
/* Case where input is valid */ /* Case where input is valid */
result = SDL_GetKeyFromScancode(SDL_SCANCODE_A, SDL_KMOD_NONE); result = SDL_GetKeyFromScancode(SDL_SCANCODE_A, SDL_KMOD_NONE);
SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(valid)"); SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(valid)");
SDLTest_AssertCheck(result == SDLK_a, "Verify result from call, expected: %d, got: %" SDL_PRIs32, SDLK_a, result); SDLTest_AssertCheck(result == SDLK_A, "Verify result from call, expected: %d, got: %" SDL_PRIs32, SDLK_A, result);
/* Case where input is zero */ /* Case where input is zero */
result = SDL_GetKeyFromScancode(SDL_SCANCODE_UNKNOWN, SDL_KMOD_NONE); result = SDL_GetKeyFromScancode(SDL_SCANCODE_UNKNOWN, SDL_KMOD_NONE);

View File

@ -1853,30 +1853,30 @@ static void loop(void *arg)
SDL_SetGamepadPlayerIndex(controller->gamepad, player_index); SDL_SetGamepadPlayerIndex(controller->gamepad, player_index);
} }
break; break;
} else if (event.key.key == SDLK_a) { } else if (event.key.key == SDLK_A) {
OpenVirtualGamepad(); OpenVirtualGamepad();
} else if (event.key.key == SDLK_d) { } else if (event.key.key == SDLK_D) {
CloseVirtualGamepad(); CloseVirtualGamepad();
} else if (event.key.key == SDLK_r && (event.key.mod & SDL_KMOD_CTRL)) { } else if (event.key.key == SDLK_R && (event.key.mod & SDL_KMOD_CTRL)) {
SDL_ReloadGamepadMappings(); SDL_ReloadGamepadMappings();
} else if (event.key.key == SDLK_ESCAPE) { } else if (event.key.key == SDLK_ESCAPE) {
done = SDL_TRUE; done = SDL_TRUE;
} }
} else if (display_mode == CONTROLLER_MODE_BINDING) { } else if (display_mode == CONTROLLER_MODE_BINDING) {
if (event.key.key == SDLK_c && (event.key.mod & SDL_KMOD_CTRL)) { if (event.key.key == SDLK_C && (event.key.mod & SDL_KMOD_CTRL)) {
if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) { if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) {
CopyControllerName(); CopyControllerName();
} else { } else {
CopyMapping(); CopyMapping();
} }
} else if (event.key.key == SDLK_v && (event.key.mod & SDL_KMOD_CTRL)) { } else if (event.key.key == SDLK_V && (event.key.mod & SDL_KMOD_CTRL)) {
if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) { if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) {
ClearControllerName(); ClearControllerName();
PasteControllerName(); PasteControllerName();
} else { } else {
PasteMapping(); PasteMapping();
} }
} else if (event.key.key == SDLK_x && (event.key.mod & SDL_KMOD_CTRL)) { } else if (event.key.key == SDLK_X && (event.key.mod & SDL_KMOD_CTRL)) {
if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) { if (binding_element == SDL_GAMEPAD_ELEMENT_NAME) {
CopyControllerName(); CopyControllerName();
ClearControllerName(); ClearControllerName();

View File

@ -391,10 +391,10 @@ int main(int argc, char *argv[])
while (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done); SDLTest_CommonEvent(state, &event, &done);
if (event.type == SDL_EVENT_KEY_DOWN) { if (event.type == SDL_EVENT_KEY_DOWN) {
if (event.key.key == SDLK_o) { if (event.key.key == SDLK_O) {
swap_interval--; swap_interval--;
update_swap_interval = SDL_TRUE; update_swap_interval = SDL_TRUE;
} else if (event.key.key == SDLK_p) { } else if (event.key.key == SDLK_P) {
swap_interval++; swap_interval++;
update_swap_interval = SDL_TRUE; update_swap_interval = SDL_TRUE;
} }

View File

@ -139,7 +139,7 @@ int main(int argc, char **argv)
case SDL_EVENT_KEY_DOWN: case SDL_EVENT_KEY_DOWN:
if (e.key.key == SDLK_ESCAPE) { if (e.key.key == SDLK_ESCAPE) {
done = 1; done = 1;
} else if (e.key.key == SDLK_x) { } else if (e.key.key == SDLK_X) {
if (!areas) { if (!areas) {
areas = drag_areas; areas = drag_areas;
numareas = SDL_arraysize(drag_areas); numareas = SDL_arraysize(drag_areas);

View File

@ -226,7 +226,7 @@ static void loop(void *arg)
break; break;
case SDL_EVENT_KEY_DOWN: case SDL_EVENT_KEY_DOWN:
switch (event.key.key) { switch (event.key.key) {
case SDLK_l: case SDLK_L:
if (event.key.mod & SDL_KMOD_SHIFT) { if (event.key.mod & SDL_KMOD_SHIFT) {
num_lines = 0; num_lines = 0;
} else { } else {
@ -237,7 +237,7 @@ static void loop(void *arg)
(float)SDL_rand(480)); (float)SDL_rand(480));
} }
break; break;
case SDLK_r: case SDLK_R:
if (event.key.mod & SDL_KMOD_SHIFT) { if (event.key.mod & SDL_KMOD_SHIFT) {
num_rects = 0; num_rects = 0;
} else { } else {

View File

@ -91,14 +91,14 @@ int main(int argc, char *argv[])
w1 = NULL; w1 = NULL;
} }
} else if (e.type == SDL_EVENT_KEY_DOWN) { } else if (e.type == SDL_EVENT_KEY_DOWN) {
if ((e.key.key == SDLK_m || e.key.key == SDLK_n) && !w2) { if ((e.key.key == SDLK_M || e.key.key == SDLK_N) && !w2) {
if (SDL_CreateWindowAndRenderer("Non-Modal Window", 320, 200, SDL_WINDOW_HIDDEN, &w2, &r2) < 0) { if (SDL_CreateWindowAndRenderer("Non-Modal Window", 320, 200, SDL_WINDOW_HIDDEN, &w2, &r2) < 0) {
SDL_Log("Failed to create modal window and/or renderer: %s\n", SDL_GetError()); SDL_Log("Failed to create modal window and/or renderer: %s\n", SDL_GetError());
exit_code = 1; exit_code = 1;
goto sdl_quit; goto sdl_quit;
} }
if (e.key.key == SDLK_m) { if (e.key.key == SDLK_M) {
if (!SDL_SetWindowModalFor(w2, w1)) { if (!SDL_SetWindowModalFor(w2, w1)) {
SDL_SetWindowTitle(w2, "Modal Window"); SDL_SetWindowTitle(w2, "Modal Window");
} }
@ -108,7 +108,7 @@ int main(int argc, char *argv[])
SDL_DestroyWindow(w2); SDL_DestroyWindow(w2);
r2 = NULL; r2 = NULL;
w2 = NULL; w2 = NULL;
} else if (e.key.key == SDLK_h) { } else if (e.key.key == SDLK_H) {
if (e.key.mod & SDL_KMOD_CTRL) { if (e.key.mod & SDL_KMOD_CTRL) {
/* Hide the parent, which should hide the modal too. */ /* Hide the parent, which should hide the modal too. */
show_deadline = SDL_GetTicksNS() + SDL_SECONDS_TO_NS(3); show_deadline = SDL_GetTicksNS() + SDL_SECONDS_TO_NS(3);
@ -121,7 +121,7 @@ int main(int argc, char *argv[])
SDL_HideWindow(w2); SDL_HideWindow(w2);
} }
} }
} else if (e.key.key == SDLK_p && w2) { } else if (e.key.key == SDLK_P && w2) {
if (SDL_GetWindowFlags(w2) & SDL_WINDOW_MODAL) { if (SDL_GetWindowFlags(w2) & SDL_WINDOW_MODAL) {
/* Unparent the window */ /* Unparent the window */
if (!SDL_SetWindowModalFor(w2, NULL)) { if (!SDL_SetWindowModalFor(w2, NULL)) {

View File

@ -211,7 +211,7 @@ static void loop(void *arg)
break; break;
case SDL_EVENT_KEY_DOWN: case SDL_EVENT_KEY_DOWN:
if (event.key.key == SDLK_c) { if (event.key.key == SDLK_C) {
int x, y, w, h; int x, y, w, h;
SDL_GetWindowPosition(window, &x, &y); SDL_GetWindowPosition(window, &x, &y);
SDL_GetWindowSize(window, &w, &h); SDL_GetWindowSize(window, &w, &h);

View File

@ -189,7 +189,7 @@ static void loop(void)
if (event.type == SDL_EVENT_KEY_UP) { if (event.type == SDL_EVENT_KEY_UP) {
SDL_bool updateCursor = SDL_FALSE; SDL_bool updateCursor = SDL_FALSE;
if (event.key.key == SDLK_a) { if (event.key.key == SDLK_A) {
SDL_assert(!"Keyboard generated assert"); SDL_assert(!"Keyboard generated assert");
} else if (event.key.key == SDLK_LEFT) { } else if (event.key.key == SDLK_LEFT) {
--system_cursor; --system_cursor;