Add 'dotscape/' from commit 'f306501a68a51b634e895c5fdac70788ae899d75'
git-subtree-dir: dotscape git-subtree-mainline:6b91d64fc3git-subtree-split:f306501a68
This commit is contained in:
78
dotscape/ffi/glfw-input.c
Normal file
78
dotscape/ffi/glfw-input.c
Normal file
@@ -0,0 +1,78 @@
|
||||
#include "export.h"
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
int PRESS = GLFW_PRESS;
|
||||
int RELEASE = GLFW_RELEASE;
|
||||
int LEFT_MOUSE_BUTTON = GLFW_MOUSE_BUTTON_1;
|
||||
|
||||
int KEY_R = GLFW_KEY_R;
|
||||
int KEY_G = GLFW_KEY_G;
|
||||
int KEY_B = GLFW_KEY_B;
|
||||
|
||||
int KEY_T = GLFW_KEY_T;
|
||||
int KEY_Y = GLFW_KEY_Y;
|
||||
int KEY_Z = GLFW_KEY_Z;
|
||||
|
||||
int KEY_S = GLFW_KEY_S;
|
||||
int KEY_E = GLFW_KEY_E;
|
||||
int KEY_I = GLFW_KEY_I;
|
||||
int KEY_L = GLFW_KEY_L;
|
||||
int KEY_O = GLFW_KEY_O;
|
||||
int KEY_A = GLFW_KEY_A;
|
||||
int KEY_W = GLFW_KEY_W;
|
||||
int KEY_H = GLFW_KEY_H;
|
||||
int KEY_C = GLFW_KEY_C;
|
||||
int KEY_M = GLFW_KEY_M;
|
||||
int KEY_F = GLFW_KEY_F;
|
||||
|
||||
int KEY_ENTER = GLFW_KEY_ENTER;
|
||||
int KEY_SPACE = GLFW_KEY_SPACE;
|
||||
int KEY_UP = GLFW_KEY_UP;
|
||||
int KEY_LEFT = GLFW_KEY_LEFT;
|
||||
int KEY_RIGHT = GLFW_KEY_RIGHT;
|
||||
int KEY_DOWN = GLFW_KEY_DOWN;
|
||||
int KEY_BACKSPACE = GLFW_KEY_BACKSPACE;
|
||||
int KEY_ESC = GLFW_KEY_ESCAPE;
|
||||
|
||||
int KEY_0 = GLFW_KEY_0;
|
||||
int KEY_1 = GLFW_KEY_1;
|
||||
int KEY_2 = GLFW_KEY_2;
|
||||
int KEY_3 = GLFW_KEY_3;
|
||||
int KEY_4 = GLFW_KEY_4;
|
||||
int KEY_5 = GLFW_KEY_5;
|
||||
int KEY_6 = GLFW_KEY_6;
|
||||
int KEY_7 = GLFW_KEY_7;
|
||||
int KEY_8 = GLFW_KEY_8;
|
||||
int KEY_9 = GLFW_KEY_9;
|
||||
|
||||
// Calls function exported from SML
|
||||
void mouseMoveCallback(GLFWwindow *window, double xpos, double ypos) {
|
||||
mltonMouseMoveCallback((float)xpos, (float)ypos);
|
||||
}
|
||||
|
||||
// Call this from MLton to register callback with GLFW.
|
||||
void setMouseMoveCallback(GLFWwindow *window) {
|
||||
glfwSetCursorPosCallback(window, mouseMoveCallback);
|
||||
}
|
||||
|
||||
void mouseClickCallback(GLFWwindow *window, int button, int action, int mods) {
|
||||
mltonMouseClickCallback(button, action);
|
||||
}
|
||||
void setMouseClickCallback(GLFWwindow *window) {
|
||||
glfwSetMouseButtonCallback(window, mouseClickCallback);
|
||||
}
|
||||
|
||||
void framebufferSizeCallback(GLFWwindow *window, int width, int height) {
|
||||
mltonFramebufferSizeCallback(width, height);
|
||||
}
|
||||
void setFramebufferSizeCallback(GLFWwindow *window, int width, int height) {
|
||||
glfwSetFramebufferSizeCallback(window, framebufferSizeCallback);
|
||||
}
|
||||
|
||||
void keyCallback(GLFWwindow *window, int key, int scancode, int action, int mods) {
|
||||
mltonKeyCallback(key, scancode, action, mods);
|
||||
}
|
||||
void setKeyCallback(GLFWwindow *window) {
|
||||
glfwSetKeyCallback(window, keyCallback);
|
||||
}
|
||||
Reference in New Issue
Block a user