26 lines
462 B
C
26 lines
462 B
C
#ifndef INPUT_H
|
|
#define INPUT_H
|
|
|
|
#include <stdint.h>
|
|
#include <SDL2/SDL.h>
|
|
|
|
#define KEY_COUNT 16
|
|
|
|
struct s_chip8;
|
|
typedef struct s_chip8 t_chip8;
|
|
|
|
typedef struct s_keyboard
|
|
{
|
|
uint8_t keyboard[KEY_COUNT];
|
|
uint8_t waiting_for_key;
|
|
uint8_t key_pressed;
|
|
uint8_t key_register;
|
|
} t_keyboard;
|
|
|
|
|
|
void input_update(SDL_Event *event, uint8_t *keyboard);
|
|
uint8_t map_sdl_to_chip8(SDL_Keycode key);
|
|
uint8_t get_pressed_key(t_chip8 *emu);
|
|
|
|
|
|
#endif // INPUT_H
|