rename scancode to mappedcode so it does not get confused with the conflicting definitions of scancode in GFLW and SDL.
This commit is contained in:
parent
dccef93604
commit
a066d647a8
|
|
@ -1236,7 +1236,7 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
||||||
CORE.Input.Keyboard.currentKeyState[key] = 1; // Key down
|
CORE.Input.Keyboard.currentKeyState[key] = 1; // Key down
|
||||||
|
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = key;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = key;
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].scancode = -1;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].mappedcode = -1;
|
||||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||||
}
|
}
|
||||||
else if (AKeyEvent_getAction(event) == AKEY_EVENT_ACTION_MULTIPLE) CORE.Input.Keyboard.keyRepeatInFrame[key] = 1;
|
else if (AKeyEvent_getAction(event) == AKEY_EVENT_ACTION_MULTIPLE) CORE.Input.Keyboard.keyRepeatInFrame[key] = 1;
|
||||||
|
|
|
||||||
|
|
@ -1804,7 +1804,8 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
|
||||||
{
|
{
|
||||||
// Add character to the queue
|
// Add character to the queue
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = key;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = key;
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].scancode = scancode;
|
// glfw calls the key value that is mapped to the layout a scancode.
|
||||||
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].mappedcode = scancode;
|
||||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -999,7 +999,7 @@ void PollInputEvents(void)
|
||||||
if ((CORE.Input.Keyboard.currentKeyState[key] == 0) && (CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE))
|
if ((CORE.Input.Keyboard.currentKeyState[key] == 0) && (CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE))
|
||||||
{
|
{
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = key;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = key;
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].scancode = event->keyCode;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].mappedcode = event->keyCode;
|
||||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1477,9 +1477,9 @@ void PollInputEvents(void)
|
||||||
{
|
{
|
||||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||||
// SDL3 Migration: The following structures have been removed: * SDL_Keysym
|
// SDL3 Migration: The following structures have been removed: * SDL_Keysym
|
||||||
KeyboardKey key = ConvertScancodeToKey(event.key.scancode);
|
KeyboardKey key = ConvertScancodeToKey(event.key.mappedcode);
|
||||||
#else
|
#else
|
||||||
KeyboardKey key = ConvertScancodeToKey(event.key.keysym.scancode);
|
KeyboardKey key = ConvertScancodeToKey(event.key.keysym.mappedcode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (key != KEY_NULL)
|
if (key != KEY_NULL)
|
||||||
|
|
@ -1487,8 +1487,11 @@ void PollInputEvents(void)
|
||||||
// If key was up, add it to the key pressed queue
|
// If key was up, add it to the key pressed queue
|
||||||
if ((CORE.Input.Keyboard.currentKeyState[key] == 0) && (CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE))
|
if ((CORE.Input.Keyboard.currentKeyState[key] == 0) && (CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE))
|
||||||
{
|
{
|
||||||
|
// SDL calls the physical key value from the hardware a scancode.
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = key;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = key;
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].scancode = event.key.keysym.sym;
|
|
||||||
|
// SDL calls the key value that is mapped to the layout a virtual keysym.
|
||||||
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].mappedcode = event.key.keysym.sym;
|
||||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1508,9 +1511,9 @@ void PollInputEvents(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||||
KeyboardKey key = ConvertScancodeToKey(event.key.scancode);
|
KeyboardKey key = ConvertScancodeToKey(event.key.mappedcode);
|
||||||
#else
|
#else
|
||||||
KeyboardKey key = ConvertScancodeToKey(event.key.keysym.scancode);
|
KeyboardKey key = ConvertScancodeToKey(event.key.keysym.mappedcode);
|
||||||
#endif
|
#endif
|
||||||
if (key != KEY_NULL) CORE.Input.Keyboard.currentKeyState[key] = 0;
|
if (key != KEY_NULL) CORE.Input.Keyboard.currentKeyState[key] = 0;
|
||||||
} break;
|
} break;
|
||||||
|
|
|
||||||
|
|
@ -1310,7 +1310,7 @@ static void ProcessKeyboard(void)
|
||||||
CORE.Input.Keyboard.currentKeyState[257] = 1;
|
CORE.Input.Keyboard.currentKeyState[257] = 1;
|
||||||
|
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = 257; // Add keys pressed into queue
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = 257; // Add keys pressed into queue
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].scancode = -1;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].mappedcode = -1;
|
||||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||||
}
|
}
|
||||||
else if (keysBuffer[i] == 0x7f) // raylib KEY_BACKSPACE
|
else if (keysBuffer[i] == 0x7f) // raylib KEY_BACKSPACE
|
||||||
|
|
@ -1318,7 +1318,7 @@ static void ProcessKeyboard(void)
|
||||||
CORE.Input.Keyboard.currentKeyState[259] = 1;
|
CORE.Input.Keyboard.currentKeyState[259] = 1;
|
||||||
|
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = 257; // Add keys pressed into queue
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = 257; // Add keys pressed into queue
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].scancode = -1;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].mappedcode = -1;
|
||||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1331,7 +1331,7 @@ static void ProcessKeyboard(void)
|
||||||
else CORE.Input.Keyboard.currentKeyState[(int)keysBuffer[i]] = 1;
|
else CORE.Input.Keyboard.currentKeyState[(int)keysBuffer[i]] = 1;
|
||||||
|
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = keysBuffer[i]; // Add keys pressed into queue
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = keysBuffer[i]; // Add keys pressed into queue
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].scancode = -1;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].mappedcode = -1;
|
||||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1624,7 +1624,7 @@ static void PollKeyboardEvents(void)
|
||||||
if (CORE.Input.Keyboard.keyPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
if (CORE.Input.Keyboard.keyPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
|
||||||
{
|
{
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = keycode;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = keycode;
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].scancode = (int)event.code;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].mappedcode = (int)event.code;
|
||||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1500,7 +1500,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
|
||||||
{
|
{
|
||||||
// Add character to the queue
|
// Add character to the queue
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = key;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = key;
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].scancode = scancode;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].mappedcode = scancode;
|
||||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ __declspec(dllimport) unsigned int __stdcall timeEndPeriod(unsigned int uPeriod)
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
typedef struct { int x; int y; } Point;
|
typedef struct { int x; int y; } Point;
|
||||||
typedef struct { unsigned int width; unsigned int height; } Size;
|
typedef struct { unsigned int width; unsigned int height; } Size;
|
||||||
typedef struct { int keycode; int scancode; } KeyInfo;
|
typedef struct { int keycode; int mappedcode; } KeyInfo;
|
||||||
|
|
||||||
// Core global state context data
|
// Core global state context data
|
||||||
typedef struct CoreData {
|
typedef struct CoreData {
|
||||||
|
|
@ -3062,7 +3062,7 @@ void PlayAutomationEvent(AutomationEvent event)
|
||||||
{
|
{
|
||||||
// Add character to the queue
|
// Add character to the queue
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = event.params[0];
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].keycode = event.params[0];
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].scancode = -1;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount].mappedcode = -1;
|
||||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3200,7 +3200,7 @@ int GetKeyPressedPro(int* scanCode)
|
||||||
// Get character from the queue head
|
// Get character from the queue head
|
||||||
value = CORE.Input.Keyboard.keyPressedQueue[0].keycode;
|
value = CORE.Input.Keyboard.keyPressedQueue[0].keycode;
|
||||||
if (scanCode != NULL)
|
if (scanCode != NULL)
|
||||||
*scanCode = CORE.Input.Keyboard.keyPressedQueue[0].scancode;
|
*scanCode = CORE.Input.Keyboard.keyPressedQueue[0].mappedcode;
|
||||||
|
|
||||||
// Shift elements 1 step toward the head
|
// Shift elements 1 step toward the head
|
||||||
for (int i = 0; i < (CORE.Input.Keyboard.keyPressedQueueCount - 1); i++)
|
for (int i = 0; i < (CORE.Input.Keyboard.keyPressedQueueCount - 1); i++)
|
||||||
|
|
@ -3208,7 +3208,7 @@ int GetKeyPressedPro(int* scanCode)
|
||||||
|
|
||||||
// Reset last character in the queue
|
// Reset last character in the queue
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount - 1].keycode = 0;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount - 1].keycode = 0;
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount - 1].scancode = -1;
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount - 1].mappedcode = -1;
|
||||||
CORE.Input.Keyboard.keyPressedQueueCount--;
|
CORE.Input.Keyboard.keyPressedQueueCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user