Skip to content

Commit 8752fef

Browse files
Add comment: Clarify handling of macro SDL_SCANCODE_TO_KEYCODE
1 parent 829206d commit 8752fef

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

units/sdlkeycode.inc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ type
1717

1818
const
1919
SDLK_SCANCODE_MASK = 1 shl 30;
20+
//#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
21+
//SDL2-for-Pascal: Not translated, see comment about this macro below.
2022

2123
SDLK_UNKNOWN = TSDL_KeyCode(0);
2224

@@ -93,6 +95,12 @@ const
9395
SDLK_y = TSDL_KeyCode('y');
9496
SDLK_z = TSDL_KeyCode('z');
9597
98+
{SDL2-for-Pascal: In C the following scancodes are or'd by a macro:
99+
SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
100+
101+
We convert the scancodes directly by:
102+
TSDL_KeyCode(X or SDLK_SCANCODE_MASK); }
103+
96104
SDLK_CAPSLOCK = TSDL_KeyCode(SDL_SCANCODE_CAPSLOCK or SDLK_SCANCODE_MASK);
97105

98106
SDLK_F1 = TSDL_KeyCode(SDL_SCANCODE_F1 or SDLK_SCANCODE_MASK);

0 commit comments

Comments
 (0)