couch/core/Input.h

28 lines
739 B
C
Raw Normal View History

#ifndef COUCH_H
#define COUCH_H
2021-01-13 18:51:58 -06:00
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <vector>
2021-01-13 18:51:58 -06:00
#include "types.h"
typedef void (*KeyHandler)(Window *window, int key, int code, int action, int mods);
typedef void (*MousePositionHandler)(Window *window, double xpos, double ypos, double xrel, double yrel);
2021-01-13 18:51:58 -06:00
class Input {
public:
static Input *GetInstance();
void Use(Window *window);
std::vector<KeyHandler> keyHandlers;
std::vector<MousePositionHandler> mousePositionHandlers;
2021-01-13 18:51:58 -06:00
private:
2021-01-13 22:50:01 -06:00
double lastx, lasty;
2021-01-13 18:51:58 -06:00
Input();
static void HandleKeys(Window *window, int key, int code, int action, int mods);
2021-01-13 22:50:01 -06:00
static void HandleMousePosition(Window *window, double xpos, double ypos);
2021-01-13 18:51:58 -06:00
static Input *instance;
};
#endif // COUCH_H