Skip to content

Commit

Permalink
Sync SDL3 header -> wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
SDLWikiBot committed Jun 22, 2024
1 parent 75bdd78 commit 97bbe21
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions SDL3/README/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ now looks like this:
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 gamepad event structures caxis, cbutton, cdevice, ctouchpad, and csensor have been renamed gaxis, gbutton, gdevice, gtouchpad, and gsensor.

The mouseX and mouseY fields of SDL_MouseWheelEvent have been renamed mouse_x and mouse_y.
Expand Down
54 changes: 54 additions & 0 deletions SDL3/SDL_HINT_KEYCODE_OPTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
###### (This is the documentation for SDL3, which is under heavy development and the API is changing! [SDL2](https://wiki.libsdl.org/SDL2/) is the current stable version!)
# SDL_HINT_KEYCODE_OPTIONS

A variable that controls keycode representation in keyboard events.

## Header File

Defined in [<SDL3/SDL_hints.h>](https://github.com/libsdl-org/SDL/blob/main/include/SDL3/SDL_hints.h)

## Syntax

```c
#define SDL_HINT_KEYCODE_OPTIONS "SDL_KEYCODE_OPTIONS"
```
## Remarks
This variable is a comma separated set of options for translating keycodes
in events:
- "unmodified": The keycode is the symbol generated by pressing the key
without any modifiers applied. e.g. Shift+A would yield the keycode
[SDLK_a](SDLK_a), or 'a'.
- "modified": The keycode is the symbol generated by pressing the key with
modifiers applied. e.g. Shift+A would yield the keycode [SDLK_A](SDLK_A),
or 'A'.
- "french_numbers": The number row on French keyboards is inverted, so
pressing the 1 key would yield the keycode [SDLK_1](SDLK_1), or '1',
instead of [SDLK_AMPERSAND](SDLK_AMPERSAND), or '&'
- "latin_letters": For keyboards using non-Latin letters, such as Russian
or Thai, the letter keys generate keycodes as though it had an en_US
layout. e.g. pressing the key associated with
[SDL_SCANCODE_A](SDL_SCANCODE_A) on a Russian keyboard would yield 'a'
instead of 'ф'.
The default value for this hint is equivalent to "modified,french_numbers"
Some platforms like Emscripten only provide modified keycodes and the
options are not used.
These options do not affect the return value of
[SDL_GetKeyFromScancode](SDL_GetKeyFromScancode)() or
[SDL_GetScancodeFromKey](SDL_GetScancodeFromKey)(), they just apply to the
keycode included in key events.
This hint can be set anytime.
## Version
This hint is available since SDL 3.0.0.
----
[CategoryAPI](CategoryAPI), [CategoryAPIMacro](CategoryAPIMacro), [CategoryHints](CategoryHints)

0 comments on commit 97bbe21

Please sign in to comment.