|
@@ -4,10 +4,12 @@ local C = ffi.os == 'Windows' and ffi.load('glfw3') or ffi.C
|
|
ffi.cdef [[
|
|
ffi.cdef [[
|
|
typedef struct GLFWwindow GLFWwindow;
|
|
typedef struct GLFWwindow GLFWwindow;
|
|
typedef void(*GLFWkeyfun)(GLFWwindow*, int, int, int, int);
|
|
typedef void(*GLFWkeyfun)(GLFWwindow*, int, int, int, int);
|
|
|
|
+ typedef void (*GLFWcharfun)(GLFWwindow*, unsigned int);
|
|
|
|
|
|
GLFWwindow* glfwGetCurrentContext(void);
|
|
GLFWwindow* glfwGetCurrentContext(void);
|
|
int glfwGetKey(GLFWwindow* window, int key);
|
|
int glfwGetKey(GLFWwindow* window, int key);
|
|
GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback);
|
|
GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback);
|
|
|
|
+ GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun callback);
|
|
]]
|
|
]]
|
|
|
|
|
|
local window = C.glfwGetCurrentContext()
|
|
local window = C.glfwGetCurrentContext()
|
|
@@ -148,4 +150,8 @@ C.glfwSetKeyCallback(window, function(window, key, scancode, action, mods)
|
|
end
|
|
end
|
|
end)
|
|
end)
|
|
|
|
|
|
|
|
+C.glfwSetCharCallback(window, function(window, char)
|
|
|
|
+ lovr.event.push('textinput', string.char(char))
|
|
|
|
+ end)
|
|
|
|
+
|
|
return keyboard
|
|
return keyboard
|