- Jo que se, moltes coses
This commit is contained in:
36
jinput.cpp
Normal file
36
jinput.cpp
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user