コード例 #1
0
ファイル: web.go プロジェクト: shibukawa/nanovgo
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
	}
}
コード例 #2
0
ファイル: mouse_translate.go プロジェクト: langxj/gxui
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
}