Esempio n. 1
0
func key(w *glfw.Window, key glfw.Key, scancode int, action glfw.Action, mods glfw.ModifierKey) {
	if key == glfw.KeyEscape && action == glfw.Press {
		w.SetShouldClose(true)
	} else if key == glfw.KeySpace && action == glfw.Press {
		blowup = !blowup
	} else if key == glfw.KeyP && action == glfw.Press {
		premult = !premult
	}
}
Esempio n. 2
0
func getMouseState(w *glfw.Window) gxui.MouseState {
	var s gxui.MouseState
	for _, button := range []glfw.MouseButton{glfw.MouseButtonLeft, glfw.MouseButtonMiddle, glfw.MouseButtonRight} {
		if w.GetMouseButton(button) == glfw.Press {
			s |= 1 << uint(translateMouseButton(button))
		}
	}
	return s
}