File IController.hpp¶
File List > Engine > include > Inputs > IController.hpp
Go to the documentation of this file
/*
** EPITECH PROJECT, 2026
** G-ING-500-BAR-5-1-rtype-1
** File description:
** IController.hpp
*/
#ifndef G_ING_500_BAR_5_1_RTYPE_1_ICONTROLLER_HPP
#define G_ING_500_BAR_5_1_RTYPE_1_ICONTROLLER_HPP
#include "raylib-cpp.hpp"
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
namespace Engine {
using Action = std::string;
enum DeviceType { KEYBOARD, MOUSE, GAMEPAD, TOUCH };
struct Keybind {
int key = 0;
int composeKey = 0;
DeviceType type = KEYBOARD;
};
struct ActionBinding {
std::vector<Keybind> keybinds;
bool networked = false;
};
class IController {
public:
using Kmap = std::unordered_map<Action, ActionBinding>;
virtual ~IController() = default;
virtual void Update() = 0;
virtual void addKeybind(const Action& action, const Keybind& kb, bool networked = false) = 0;
virtual bool isActionActive(const std::string& action) const = 0;
virtual bool isActionPressed(const std::string& action) const = 0;
virtual const std::set<Action>& getNetworkedActiveActions() const = 0;
virtual const std::set<Action>& getActiveActions() const = 0;
std::set<Action> _activeActions;
std::set<Action> _pressedActions;
std::set<Action> _networkedActions;
Kmap m_keymap;
};
} // namespace Engine
#endif // G_ING_500_BAR_5_1_RTYPE_1_ICONTROLLER_HPP