holesome/src/game/input/input_mapper.h

35 lines
672 B
C
Raw Normal View History

#ifndef HOLESOME_INPUT_MAPPER_H
#define HOLESOME_INPUT_MAPPER_H
#include "../game.h"
#include <SFML/Window/Event.hpp>
#include "../../config.h"
2023-05-09 20:50:50 +02:00
#include "direction.h"
class Game;
/**
* Maps the inputs to actions.
*/
class InputMapper
{
public:
2023-05-08 18:20:55 +02:00
static void setGame(Game *game);
2023-05-08 18:20:55 +02:00
static void processEvents();
static Direction getInputDirection();
2023-05-09 20:50:50 +02:00
private:
2023-05-08 18:20:55 +02:00
static inline Game *game = nullptr;
static inline std::vector<HardDirection> inputDirectionBuffer = std::vector<HardDirection>();
2023-05-09 20:50:50 +02:00
2023-05-08 18:20:55 +02:00
static void handleKeyPress(sf::Event::KeyEvent event);
2023-05-09 20:50:50 +02:00
static void handleKeyRelease(sf::Event::KeyEvent event);
};
#endif //HOLESOME_INPUT_MAPPER_H