Example #1
0
func NewControllerManager(window *glfw.Window) *ControllerManager {
	var controllerList []Controller
	c := &ControllerManager{controllerList}
	window.SetKeyCallback(c.KeyCallback)
	window.SetMouseButtonCallback(c.MouseButtonCallback)
	window.SetCursorPosCallback(c.CursorPosCallback)
	window.SetScrollCallback(c.ScrollCallback)
	return c
}
Example #2
0
func NewEventHandler(w *glfw.Window) (e *EventHandler) {
	e = &EventHandler{
		Events: make(chan Event, 100),
		window: w,
	}
	// See http://www.glfw.org/docs/latest/input.html#input_keyboard
	w.SetInputMode(glfw.StickyKeysMode, 1)
	w.SetCursorPosCallback(e.onMouseMove)
	w.SetKeyCallback(e.onKey)
	w.SetMouseButtonCallback(e.onMouseButton)
	return
}
Example #3
0
// setupCallbacks sets the callback handlers for the window.
func setupCallbacks(w *glfw.Window) {
	w.SetKeyCallback(gameKeyCallback)
}