minecraft-pi-reborn/mods/src/input/keys.cpp
2024-09-20 21:30:47 -04:00

24 lines
641 B
C++

#include <mods/input/input.h>
#include <symbols/minecraft.h>
#include <libreborn/libreborn.h>
#include <SDL/SDL.h>
#include "input-internal.h"
// Translator
static int32_t sdl_key_to_minecraft_key_injection(Common_sdl_key_to_minecraft_key_t original, const int32_t sdl_key) {
switch (sdl_key) {
#define KEY(name, value) case SDLK_##name: return MC_KEY_##name;
#include <mods/input/key-list.h>
#undef KEY
default: {
// Call Original Method
return original(sdl_key);
}
}
}
// Init
void _init_keys() {
overwrite_calls(Common_sdl_key_to_minecraft_key, sdl_key_to_minecraft_key_injection);
}