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
|
||||
for _, b := range []ebiten.MouseButton{
|
||||
ebiten.MouseButtonLeft,
|
||||
ebiten.MouseButtonRight,
|
||||
ebiten.MouseButtonMiddle,
|
||||
} {
|
||||
for b := ebiten.MouseButton(0); b <= ebiten.MouseButtonMax; b++ {
|
||||
i.prevMouseButtonDurations[b] = i.mouseButtonDurations[b]
|
||||
if ebiten.IsMouseButtonPressed(b) {
|
||||
i.mouseButtonDurations[b]++
|
||||
|
@ -54,6 +54,8 @@ const (
|
||||
MouseButtonLeft = MouseButton(0)
|
||||
MouseButtonRight = MouseButton(1)
|
||||
MouseButtonMiddle = MouseButton(2)
|
||||
MouseButton3 = MouseButton(3)
|
||||
MouseButton4 = MouseButton(4)
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -152,6 +152,8 @@ var glfwMouseButtonToMouseButton = map[glfw.MouseButton]MouseButton{
|
||||
glfw.MouseButtonLeft: MouseButtonLeft,
|
||||
glfw.MouseButtonRight: MouseButtonRight,
|
||||
glfw.MouseButtonMiddle: MouseButtonMiddle,
|
||||
glfw.MouseButton3: MouseButton3,
|
||||
glfw.MouseButton4: MouseButton4,
|
||||
}
|
||||
|
||||
// update must be called from the main thread.
|
||||
|
@ -129,6 +129,8 @@ var codeToMouseButton = map[int]MouseButton{
|
||||
0: MouseButtonLeft,
|
||||
1: MouseButtonMiddle,
|
||||
2: MouseButtonRight,
|
||||
3: MouseButton3,
|
||||
4: MouseButton4,
|
||||
}
|
||||
|
||||
func (i *Input) IsMouseButtonPressed(button MouseButton) bool {
|
||||
|
@ -24,9 +24,15 @@ import (
|
||||
type MouseButton int
|
||||
|
||||
const (
|
||||
MouseButtonLeft MouseButton = iota
|
||||
MouseButtonRight
|
||||
MouseButtonMiddle
|
||||
MouseButton0 MouseButton = iota
|
||||
MouseButton1
|
||||
MouseButton2
|
||||
MouseButton3
|
||||
MouseButton4
|
||||
|
||||
MouseButtonLeft = MouseButton0
|
||||
MouseButtonRight = MouseButton1
|
||||
MouseButtonMiddle = MouseButton2
|
||||
)
|
||||
|
||||
type TouchID int
|
||||
|
@ -26,4 +26,10 @@ const (
|
||||
MouseButtonLeft MouseButton = ui.MouseButtonLeft
|
||||
MouseButtonRight MouseButton = ui.MouseButtonRight
|
||||
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