-
Notifications
You must be signed in to change notification settings - Fork 0
/
agent.cpp
56 lines (50 loc) · 1.42 KB
/
agent.cpp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "agent.h"
#include "glstuff.h"
#include "globals.h"
#include "compute_queue.h"
void mouseButtonFunction(GLFWwindow* window, int button, int action, int mods)
{
//printf("mouseButtonFunction(button=%d, action=%d, mods=%d)\n", button, action, mods);
}
void mousePosFunction(int x, int y)
{
//printf("mousePosFunction(x=%d, y=%d)\n", x, y);
}
void mouseWheelFunction(GLFWwindow* window, double xoffset, double yoffset)
{
//printf("mouseWheelFunction(xoffset=%lf, yoffset=%lf)\n", xoffset, yoffset);
}
void keyFunction(GLFWwindow* window, int key, int scancode, int action, int mods)
{
//printf("keyFunction(key=%d, action=%d)\n", key, action);
if (action == GLFW_PRESS)
{
switch (key)
{
case 'm':
case 'M':
GLOBALS.setInputToOverlay(true);
break;
case 'x':
case 'X':
ComputeQueue::get().runAll();
break;
default:
break;
}
}
}
void charFunction(GLFWwindow* window, unsigned int codepoint)
{
//printf("charFunction(codepoint=%d)\n", codepoint);
}
void sendInputToAgent()
{
glfwSetInputMode(appWindow, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
// Set GLFW event callbacks. I removed glfwSetWindowSizeCallback for conciseness
glfwSetMouseButtonCallback(appWindow, mouseButtonFunction);
glfwSetCursorPosCallback(appWindow, (GLFWcursorposfun)0);
glfwSetScrollCallback(appWindow, mouseWheelFunction);
glfwSetKeyCallback(appWindow, keyFunction);
glfwSetCharCallback(appWindow, charFunction);
}