#include "jinput.h" #include #include "jdraw.h" #include "jfile.h" namespace input { static const uint8_t *keys = nullptr; static uint8_t keypressed = 0; static uint8_t keydown = 0; static uint8_t btnClicked = 0; static int wheel = 0; static SDL_GameController *gamepad = NULL; static int8_t pad_btn_pressed = SDL_CONTROLLER_BUTTON_INVALID; static int8_t pad_btn_down = SDL_CONTROLLER_BUTTON_INVALID; void initGamePad() { int size; char *buffer = file::getFileBuffer("gamecontrollerdb.txt", size); if (SDL_GameControllerAddMappingsFromRW(SDL_RWFromMem(buffer, size), 1) < 0) printf("No s'ha pogut carregar el gamecontrollersdb.txt\n"); free(buffer); const int num_joysticks = SDL_NumJoysticks(); if (num_joysticks>=1) { for (int i=0; i