func bindEvents(window *glfw.Window, delegate WindowDelegate) { window.SetFramebufferSizeCallback(delegate.Reshape) window.SetMouseButtonCallback(delegate.MouseClick) window.SetCursorPositionCallback(delegate.MouseMove) window.SetKeyCallback(delegate.KeyPress) window.SetScrollCallback(delegate.Scroll) window.SetCloseCallback(delegate.OnClose) }
// Init initializes a glfw.Window to be used in a xorg Gorgasm // application. It has to be called after the GLFW initialization // boilerplate. See // https://github.com/remogatto/gorgasm-examples/triangle/src/triangle/main.go // for an example. func Init(window *glfw.Window) { glfw.SetErrorCallback(errorCallback) // Set callbacks associated with window events window.SetCloseCallback(exitCallback) window.SetMouseButtonCallback(mouseButtonCallback) window.SetCursorPositionCallback(cursorPositionCallback) // Begin sending events related to the creation process event <- CreateEvent{} event <- StartEvent{} event <- ResumeEvent{} event <- NativeWindowCreatedEvent{Window: window} }