-
Notifications
You must be signed in to change notification settings - Fork 1
/
InputManager.h
41 lines (31 loc) · 870 Bytes
/
InputManager.h
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
34
35
36
37
38
39
40
41
//
// Created by lasagnaphil on 7/10/18.
//
#ifndef THESYSTEM_INPUTMANAGER_H
#define THESYSTEM_INPUTMANAGER_H
#include <SDL_events.h>
#include "Vec.h"
#include "Map.h"
#include "vec2.h"
struct InputManager {
Uint8 currKeys[SDL_NUM_SCANCODES] = {};
Uint8 prevKeys[SDL_NUM_SCANCODES] = {};
Uint32 currMouse = {};
Uint32 prevMouse = {};
vec2i currMousePos = {};
vec2i prevMousePos = {};
static InputManager inst;
static InputManager* get() {
return &InputManager::inst;
}
void update();
bool isKeyPressed(SDL_Scancode key);
bool isKeyEntered(SDL_Scancode key);
bool isKeyExited(SDL_Scancode key);
bool isMousePressed(Uint8 button);
bool isMouseEntered(Uint8 button);
bool isMouseExited(Uint8 button);
vec2i getMousePos();
vec2i getRelMousePos();
};
#endif //THESYSTEM_INPUTMANAGER_H