aboutsummaryrefslogtreecommitdiffstats
path: root/src/window/Events.hpp
blob: 6914dca92235242e7538f931ed7d47b37e1aafe4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef ENGINE_EVENTS_H
#define ENGINE_EVENTS_H

#define MAX_KEYS GLFW_KEY_LAST + 1 + GLFW_MOUSE_BUTTON_LAST + 1
#define MOUSE_BUTTONS GLFW_KEY_LAST + 1 /* when start mouse buttons */

class Events {
	bool *keys;
	unsigned int *frames;
	unsigned int cur_frame;
	bool update_frame;
	float delta_x;
	float delta_y;
	float x;
	float y;
	bool cursor_locked;
	
public:
	Events();
	~Events();

	bool Pressed(int keycode);
	bool Jpressed(int keycode);
	bool Clicked(int button);
	bool Jclicked(int button);

	void NextFrame();
	void KeyHandle(int key, int scancode, int action, int mode);
	void CursorPosHandle(double xpos, double ypos);
	void MouseButtonHandle(int button, int action, int mode);
};

#endif /* ENGINE_EVENTS_H */