- Jo que se, moltes coses

This commit is contained in:
2024-01-29 06:59:46 +01:00
parent a690619865
commit 3832fdf5e4
13 changed files with 1068 additions and 399 deletions

36
jinput.cpp Normal file
View File

@@ -0,0 +1,36 @@
#include "jinput.h"
#include <SDL2/SDL.h>
#include "crt.h"
namespace input
{
static const uint8_t *keys = nullptr;
static uint8_t keypressed = 0;
void init()
{
keys = SDL_GetKeyboardState(NULL);
}
bool anyKey()
{
update();
return keypressed != 0;
}
bool keyPressed(uint8_t tecla)
{
update();
return keys[tecla];
}
uint8_t getKey()
{
return keypressed;
}
void updateKey(uint8_t key)
{
keypressed = key;
}
}