mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
parent
5356b44286
commit
6e12fd13e4
@ -101,11 +101,7 @@ func (i *inputState) update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mouse
|
// Mouse
|
||||||
for _, b := range []ebiten.MouseButton{
|
for b := ebiten.MouseButton(0); b <= ebiten.MouseButtonMax; b++ {
|
||||||
ebiten.MouseButtonLeft,
|
|
||||||
ebiten.MouseButtonRight,
|
|
||||||
ebiten.MouseButtonMiddle,
|
|
||||||
} {
|
|
||||||
i.prevMouseButtonDurations[b] = i.mouseButtonDurations[b]
|
i.prevMouseButtonDurations[b] = i.mouseButtonDurations[b]
|
||||||
if ebiten.IsMouseButtonPressed(b) {
|
if ebiten.IsMouseButtonPressed(b) {
|
||||||
i.mouseButtonDurations[b]++
|
i.mouseButtonDurations[b]++
|
||||||
|
@ -54,6 +54,8 @@ const (
|
|||||||
MouseButtonLeft = MouseButton(0)
|
MouseButtonLeft = MouseButton(0)
|
||||||
MouseButtonRight = MouseButton(1)
|
MouseButtonRight = MouseButton(1)
|
||||||
MouseButtonMiddle = MouseButton(2)
|
MouseButtonMiddle = MouseButton(2)
|
||||||
|
MouseButton3 = MouseButton(3)
|
||||||
|
MouseButton4 = MouseButton(4)
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -152,6 +152,8 @@ var glfwMouseButtonToMouseButton = map[glfw.MouseButton]MouseButton{
|
|||||||
glfw.MouseButtonLeft: MouseButtonLeft,
|
glfw.MouseButtonLeft: MouseButtonLeft,
|
||||||
glfw.MouseButtonRight: MouseButtonRight,
|
glfw.MouseButtonRight: MouseButtonRight,
|
||||||
glfw.MouseButtonMiddle: MouseButtonMiddle,
|
glfw.MouseButtonMiddle: MouseButtonMiddle,
|
||||||
|
glfw.MouseButton3: MouseButton3,
|
||||||
|
glfw.MouseButton4: MouseButton4,
|
||||||
}
|
}
|
||||||
|
|
||||||
// update must be called from the main thread.
|
// update must be called from the main thread.
|
||||||
|
@ -129,6 +129,8 @@ var codeToMouseButton = map[int]MouseButton{
|
|||||||
0: MouseButtonLeft,
|
0: MouseButtonLeft,
|
||||||
1: MouseButtonMiddle,
|
1: MouseButtonMiddle,
|
||||||
2: MouseButtonRight,
|
2: MouseButtonRight,
|
||||||
|
3: MouseButton3,
|
||||||
|
4: MouseButton4,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Input) IsMouseButtonPressed(button MouseButton) bool {
|
func (i *Input) IsMouseButtonPressed(button MouseButton) bool {
|
||||||
|
@ -24,9 +24,15 @@ import (
|
|||||||
type MouseButton int
|
type MouseButton int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MouseButtonLeft MouseButton = iota
|
MouseButton0 MouseButton = iota
|
||||||
MouseButtonRight
|
MouseButton1
|
||||||
MouseButtonMiddle
|
MouseButton2
|
||||||
|
MouseButton3
|
||||||
|
MouseButton4
|
||||||
|
|
||||||
|
MouseButtonLeft = MouseButton0
|
||||||
|
MouseButtonRight = MouseButton1
|
||||||
|
MouseButtonMiddle = MouseButton2
|
||||||
)
|
)
|
||||||
|
|
||||||
type TouchID int
|
type TouchID int
|
||||||
|
@ -26,4 +26,10 @@ const (
|
|||||||
MouseButtonLeft MouseButton = ui.MouseButtonLeft
|
MouseButtonLeft MouseButton = ui.MouseButtonLeft
|
||||||
MouseButtonRight MouseButton = ui.MouseButtonRight
|
MouseButtonRight MouseButton = ui.MouseButtonRight
|
||||||
MouseButtonMiddle MouseButton = ui.MouseButtonMiddle
|
MouseButtonMiddle MouseButton = ui.MouseButtonMiddle
|
||||||
|
MouseButton0 MouseButton = ui.MouseButton0
|
||||||
|
MouseButton1 MouseButton = ui.MouseButton1
|
||||||
|
MouseButton2 MouseButton = ui.MouseButton2
|
||||||
|
MouseButton3 MouseButton = ui.MouseButton3
|
||||||
|
MouseButton4 MouseButton = ui.MouseButton4
|
||||||
|
MouseButtonMax MouseButton = MouseButton4
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user