Fixed key press callback
This commit is contained in:
parent
45db8cdd22
commit
01e7a46753
4 changed files with 7 additions and 7 deletions
|
|
@ -271,7 +271,7 @@ cdef extern from "GLFW/glfw3.h":
|
|||
ctypedef void (* GLFWcursorposfun)(GLFWwindow *,double,double)
|
||||
ctypedef void (* GLFWcursorenterfun)(GLFWwindow *,int)
|
||||
ctypedef void (* GLFWscrollfun)(GLFWwindow *,double,double)
|
||||
ctypedef void (* GLFWkeyfun)(GLFWwindow *,int,int)
|
||||
ctypedef void (* GLFWkeyfun)(GLFWwindow *,int,int,int,int)
|
||||
ctypedef void (* GLFWcharfun)(GLFWwindow *,int)
|
||||
ctypedef void (* GLFWmonitorfun)(c_GLFWmonitor,int)
|
||||
|
||||
|
|
|
|||
|
|
@ -280,8 +280,8 @@ cdef class Window:
|
|||
Callback on mouse button press or release
|
||||
'''
|
||||
pass
|
||||
|
||||
cpdef onKey(self, int key, int action):
|
||||
|
||||
cpdef onKey(self, int key, int scancode, int action, int mods):
|
||||
'''
|
||||
Callback on key press or relase.
|
||||
'''
|
||||
|
|
@ -355,11 +355,11 @@ cdef void cb_onMouseButton(GLFWwindow *window, int button, int action):
|
|||
except Exception as err:
|
||||
self.error = err
|
||||
|
||||
cdef void cb_onKey(GLFWwindow *window, int key, int action):
|
||||
cdef void cb_onKey(GLFWwindow *window, int key, int scancode, int action, int mods):
|
||||
cdef Window self = <Window>glfwGetWindowUserPointer(window)
|
||||
|
||||
try:
|
||||
self.onKey(key, action)
|
||||
self.onKey(key, scancode, action, mods)
|
||||
except Exception as err:
|
||||
self.error = err
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ cdef class Window:
|
|||
cpdef onRefresh(self)
|
||||
cpdef onCursorPos(self, double x, double y)
|
||||
cpdef onMouseButton(self, int button, int action)
|
||||
cpdef onKey(self, int key, int action)
|
||||
cpdef onKey(self, int key, int scancode, int action, int mods)
|
||||
cpdef onChar(self, ch)
|
||||
cpdef onFocus(self, int status)
|
||||
cpdef onEnter(self, int status)
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ class MainWindow(gl.Window):
|
|||
|
||||
self.onRefresh()
|
||||
|
||||
def onKey(self, key, action):
|
||||
def onKey(self, key, scancode, action, mods):
|
||||
#print('onKey ', key, action)
|
||||
if key == gl.KEY.ESCAPE:
|
||||
self.running = False
|
||||
|
|
|
|||
Loading…
Reference in a new issue