ebiten: make some MouseButton definitions explicit

This change redefines named mouse button consts like MouseButtonLeft
to use MouseButton0, so that users can know which enums are the same
and different.

Updates #2445
This commit is contained in:
Hajime Hoshi 2022-11-23 04:40:31 +09:00
parent 6e12fd13e4
commit 9e9cec249a
4 changed files with 21 additions and 24 deletions

View File

@ -149,9 +149,9 @@ func (i *Input) Wheel() (xoff, yoff float64) {
}
var glfwMouseButtonToMouseButton = map[glfw.MouseButton]MouseButton{
glfw.MouseButtonLeft: MouseButtonLeft,
glfw.MouseButtonRight: MouseButtonRight,
glfw.MouseButtonMiddle: MouseButtonMiddle,
glfw.MouseButtonLeft: MouseButton0,
glfw.MouseButtonRight: MouseButton1,
glfw.MouseButtonMiddle: MouseButton2,
glfw.MouseButton3: MouseButton3,
glfw.MouseButton4: MouseButton4,
}

View File

@ -126,9 +126,9 @@ func (i *Input) IsKeyPressed(key Key) bool {
}
var codeToMouseButton = map[int]MouseButton{
0: MouseButtonLeft,
1: MouseButtonMiddle,
2: MouseButtonRight,
0: MouseButton0, // Left
1: MouseButton2, // Middle
2: MouseButton1, // Right
3: MouseButton3,
4: MouseButton4,
}

View File

@ -24,15 +24,11 @@ import (
type MouseButton int
const (
MouseButton0 MouseButton = iota
MouseButton1
MouseButton2
MouseButton3
MouseButton4
MouseButtonLeft = MouseButton0
MouseButtonRight = MouseButton1
MouseButtonMiddle = MouseButton2
MouseButton0 MouseButton = iota // The 'left' button
MouseButton1 // The 'right' button
MouseButton2 // The 'middle' button
MouseButton3 // The additional button (usually browser-back)
MouseButton4 // The additional button (usually browser-forward)
)
type TouchID int

View File

@ -23,9 +23,10 @@ type MouseButton = ui.MouseButton
// MouseButtons
const (
MouseButtonLeft MouseButton = ui.MouseButtonLeft
MouseButtonRight MouseButton = ui.MouseButtonRight
MouseButtonMiddle MouseButton = ui.MouseButtonMiddle
MouseButtonLeft MouseButton = MouseButton0
MouseButtonRight MouseButton = MouseButton1
MouseButtonMiddle MouseButton = MouseButton2
MouseButton0 MouseButton = ui.MouseButton0
MouseButton1 MouseButton = ui.MouseButton1
MouseButton2 MouseButton = ui.MouseButton2