示例#1
0
func (this *Listener) ButtonPressed(key int) bool { //just once
	if glfw.MouseButton(key) == glfw.KeyRelease {
		return false
	}
	_, found := this.mButtons[key]
	if !found {
		this.mButtons[key] = keyDown
		return true
	}
	if this.mButtons[key] == keyPressed {
		this.mButtons[key] = keyDown
		return true
	}
	return false
}
示例#2
0
// MouseButton returns true if the given mouse button btn is held down, or false otherwise.
func (w *window) MouseButton(btn MouseButton) bool {
	if glfw.MouseButton(int(btn)) == glfw.KeyPress {
		return true
	}
	return false
}
示例#3
0
func (this *Listener) ButtonUp(key int) bool {
	return glfw.MouseButton(key) == glfw.KeyRelease
}
示例#4
0
func (this *Listener) ButtonDown(key int) bool {
	return glfw.MouseButton(key) == glfw.KeyPress
}