bootleg-game-engine/include/input.h

39 lines
643 B
C
Raw Permalink Normal View History

2024-09-06 09:34:29 +00:00
#include <SDL.h>
#include <map>
#include <string>
2024-09-13 11:12:31 +00:00
struct Controller
{
SDL_GameController* controller;
std::string name;
std::map<Uint8, bool> buttons;
Sint16 leftStickX = 0;
Sint16 leftStickY = 0;
Sint16 rightStickX = 0;
Sint16 rightStickY = 0;
Sint16 leftTrigger = 0;
Sint16 rightTrigger = 0;
};
struct Mouse
{
int x;
int y;
int wheel;
std::map<int, bool> buttons;
};
2024-09-06 09:34:29 +00:00
class Input
{
private:
SDL_Event event;
public:
bool exit;
2024-09-13 11:12:31 +00:00
std::map<int, Controller> controllers;
2024-09-06 09:34:29 +00:00
std::map<SDL_Keycode, bool> activeKeys;
2024-09-13 11:12:31 +00:00
Mouse mouse;
Input();
2024-09-06 09:34:29 +00:00
void update();
};