-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathApplicationInputHandler.h
More file actions
24 lines (22 loc) · 885 Bytes
/
ApplicationInputHandler.h
File metadata and controls
24 lines (22 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once
#include "Engine/Input/IInputEventHandler.h"
#include "Engine/Input/InputEventTypes.h"
#include <functional>
#include <unordered_map>
#include <vector>
using namespace StudyEngine;
class ApplicationInputHandler : public IInputEventHandler
{
private:
std::unordered_map<int, std::function<void()>> m_keyBindings;
std::vector<std::function<void(float, float)>> m_mouseMoveBindings;
public:
void BindKey(InputEvents keyCode, std::function<void()> callback);
void BindMouseMove(std::function<void(float, float)> callback);
bool OnKeyPressed(int keyCode) override;
bool OnKeyReleased(int keyCode) override;
bool OnMousePressed(int button, float x, float y) override;
bool OnMouseReleased(int button, float x, float y) override;
bool OnMouseMoved(float x, float y) override;
bool OnMouseScrolled(float deltaX, float deltaY) override;
};