More input

This commit is contained in:
MrLetsplay 2022-10-08 23:25:16 +02:00
parent 6bc5f4656e
commit 1676867489
2 changed files with 13 additions and 3 deletions

View File

@ -51,6 +51,16 @@ void onCursorPosCallback(GLFWwindow *window, double x, double y) {
kekData.activeCamera->rotateYaw(xoff);
kekData.activeCamera->rotatePitch(yoff);
for(std::pair<InputListener, MouseCallback> cb : kekData.mouseCallbacks) {
cb.second(window, x, y);
}
}
void onKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods) {
for(std::pair<InputListener, KeyCallback> cb : kekData.keyCallbacks) {
cb.second(window, key, scancode, action, mods);
}
}
int init() {

View File

@ -6,9 +6,9 @@
namespace kek {
typedef generic_callable_t<GLFWwindow *> PeriodicCallback;
typedef generic_callable_t<GLFWwindow *> KeyCallback;
typedef generic_callable_t<GLFWwindow *, double, double> MouseCallback;
typedef generic_callable_t<GLFWwindow *> PeriodicCallback; // periodicCallback(GLFWwindow *window)
typedef generic_callable_t<GLFWwindow *, int, int, int, int> KeyCallback; // keyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
typedef generic_callable_t<GLFWwindow *, double, double> MouseCallback; // mouseCallback(GLFWwindow *window, double x, double y)
typedef unsigned int InputListener;