Updated keyboard.c for SDL

This commit is contained in:
0xmac 2025-01-07 14:35:57 +01:00
parent 13603f61f8
commit 6f2c89964f

View File

@ -1,17 +1,30 @@
#include <SDL2/SDL.h>
#include <stdint.h>
#include <SFML/Window.h>
extern uint8_t systemRegister;
extern uint8_t keyboardResult;
extern sfKeyCode currentKey;
extern SDL_Scancode currentKey;
const static sfKeyCode scanMatrix[48] = {
sfKeyNum1, sfKeyNum2, sfKeyNum3, sfKeyNum4, sfKeyNum5, sfKeyNum6, sfKeyNum7, sfKeyNum8,
sfKeyQ, sfKeyW, sfKeyE, sfKeyR, sfKeyT, sfKeyY, sfKeyU, sfKeyI,
sfKeyA, sfKeyS, sfKeyD, sfKeyF, sfKeyG, sfKeyH, sfKeyJ, sfKeyK,
sfKeyZ, sfKeyX, sfKeyC, sfKeyV, sfKeyB, sfKeyN, sfKeyM, sfKeyComma,
sfKeyNum9, sfKeyNum0, sfKeyL, sfKeyO, sfKeyP, sfKeyPeriod,sfKeyEnter, sfKeyBackspace,
sfKeyLShift,sfKeyLControl, sfKeyLAlt, sfKeySpace, sfKeyUp, sfKeyRight, sfKeyDown, sfKeyLeft,
/* Virtual Keyrows */
const static SDL_Scancode scanMatrix[48] = {
SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_3, SDL_SCANCODE_4,
SDL_SCANCODE_5, SDL_SCANCODE_6, SDL_SCANCODE_7, SDL_SCANCODE_8,
SDL_SCANCODE_Q, SDL_SCANCODE_W, SDL_SCANCODE_E, SDL_SCANCODE_R,
SDL_SCANCODE_T, SDL_SCANCODE_Y, SDL_SCANCODE_U, SDL_SCANCODE_I,
SDL_SCANCODE_A, SDL_SCANCODE_S, SDL_SCANCODE_D, SDL_SCANCODE_F,
SDL_SCANCODE_G, SDL_SCANCODE_H, SDL_SCANCODE_J, SDL_SCANCODE_K,
SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_C, SDL_SCANCODE_V,
SDL_SCANCODE_B, SDL_SCANCODE_N, SDL_SCANCODE_M, SDL_SCANCODE_COMMA,
SDL_SCANCODE_9, SDL_SCANCODE_0, SDL_SCANCODE_L, SDL_SCANCODE_O,
SDL_SCANCODE_P, SDL_SCANCODE_PERIOD, SDL_SCANCODE_RETURN, SDL_SCANCODE_BACKSPACE,
SDL_SCANCODE_LSHIFT, SDL_SCANCODE_LCTRL, SDL_SCANCODE_LALT, SDL_SCANCODE_SPACE,
SDL_SCANCODE_UP, SDL_SCANCODE_RIGHT, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT,
};