bootleg-game-engine/include/input.h

39 lines
643 B
C++

#include <SDL.h>
#include <map>
#include <string>
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;
};
class Input
{
private:
SDL_Event event;
public:
bool exit;
std::map<int, Controller> controllers;
std::map<SDL_Keycode, bool> activeKeys;
Mouse mouse;
Input();
void update();
};