holesome/src/game/input/input_mapper.h
2023-05-09 20:50:50 +02:00

34 lines
679 B
C++

#ifndef HOLESOME_INPUT_MAPPER_H
#define HOLESOME_INPUT_MAPPER_H
#include "../game.h"
#include <SFML/Window/Event.hpp>
#include "../../config.h"
#include "direction.h"
class Game;
/**
* Maps the inputs to actions.
*/
class InputMapper
{
public:
static void setGame(Game *game);
static void processEvents();
static InputDirection getInputDirection();
private:
static inline Game *game = nullptr;
static inline std::vector<InputDirection> inputDirectionBuffer = std::vector<InputDirection>();
static void handleKeyPress(sf::Event::KeyEvent event);
static void handleKeyRelease(sf::Event::KeyEvent event);
};
#endif //HOLESOME_INPUT_MAPPER_H