78 inline static bool IsKeyPressed(
int keycode)
80 return s_Instance->IsKeyPressedImpl(keycode);
83 inline static bool IsMouseButtonPressed(
int button)
85 return s_Instance->IsMouseButtonPressedImpl(button);
88 inline static bool IsMouseButtonReleased(
int button)
90 return s_Instance->IsMouseButtonReleasedImpl(button);
93 inline static bool IsControllerButtonPressed(
int button,
int cID)
95 return s_Instance->IsControllerButtonPressedImpl(button, cID);
98 inline static float ControllerAxisPivotVal(
int axis,
int cID)
100 return s_Instance->ControllerAxisPivotValImpl(axis, cID);
103 inline static std::pair<float, float>GetMousePosition()
105 return s_Instance->GetMousePositionImpl();
108 inline static float GetMouseX()
110 return s_Instance->GetMouseXImpl();
113 inline static float GetMouseY()
115 return s_Instance->GetMouseYImpl();
118 inline static InputRegisteringAPI GetAPI() {
return s_InputAPI; }
120 inline static void DeInit()
122 KR_CORE_INFO(
"Shutting down input system");
127 static std::shared_ptr<Input> GetInputInstance() {
return s_Instance; }
129 using EventCallbackFn = std::function<void(
Event&)>;
130 virtual void SetEventCallback(
const EventCallbackFn& callback,
Window* window) = 0;
132 void SetGamepadMapping();
135 static void DisplayControllerDevices();
138 virtual bool IsKeyPressedImpl(
int keycode) = 0;
139 virtual bool IsMouseButtonPressedImpl(
int button) = 0;
140 virtual bool IsMouseButtonReleasedImpl(
int button) = 0;
141 virtual bool IsControllerButtonPressedImpl(
int button,
int cID) = 0;
142 virtual float ControllerAxisPivotValImpl(
int axis,
int cID) = 0;
144 virtual std::pair<float, float> GetMousePositionImpl() = 0;
145 virtual float GetMouseXImpl() = 0;
146 virtual float GetMouseYImpl() = 0;
149 static void SetConnectedJoySticks();
152 const std::list<std::shared_ptr<ControllerDevice>>& GetControllerDevices()
const {
return m_ControllerDevices; }
154 void AddControllerDevice(std::shared_ptr<ControllerDevice> device);
157 static InputRegisteringAPI s_InputAPI;
158 static std::shared_ptr<Input> s_Instance;
161 static std::list<std::shared_ptr<ControllerDevice>> m_ControllerDevices;