mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
ebiten: replace alias types with ints for better documentation
This commit is contained in:
parent
e90f99bd4a
commit
ab414558e8
10
cursor.go
10
cursor.go
@ -19,17 +19,17 @@ import (
|
||||
)
|
||||
|
||||
// CursorModeType represents a render and coordinate mode of a mouse cursor.
|
||||
type CursorModeType = ui.CursorMode
|
||||
type CursorModeType int
|
||||
|
||||
// CursorModeTypes
|
||||
const (
|
||||
CursorModeVisible CursorModeType = ui.CursorModeVisible
|
||||
CursorModeHidden CursorModeType = ui.CursorModeHidden
|
||||
CursorModeCaptured CursorModeType = ui.CursorModeCaptured
|
||||
CursorModeVisible CursorModeType = CursorModeType(ui.CursorModeVisible)
|
||||
CursorModeHidden CursorModeType = CursorModeType(ui.CursorModeHidden)
|
||||
CursorModeCaptured CursorModeType = CursorModeType(ui.CursorModeCaptured)
|
||||
)
|
||||
|
||||
// CursorShapeType represents a shape of a mouse cursor.
|
||||
type CursorShapeType = ui.CursorShape
|
||||
type CursorShapeType int
|
||||
|
||||
// CursorShapeTypes
|
||||
const (
|
||||
|
6
input.go
6
input.go
@ -350,7 +350,7 @@ func UpdateStandardGamepadLayoutMappings(mappings string) (bool, error) {
|
||||
}
|
||||
|
||||
// TouchID represents a touch's identifier.
|
||||
type TouchID = ui.TouchID
|
||||
type TouchID int
|
||||
|
||||
// AppendTouchIDs appends the current touch states to touches, and returns the extended buffer.
|
||||
// Giving a slice that already has enough capacity works efficiently.
|
||||
@ -446,7 +446,7 @@ func (i *inputState) appendTouchIDs(touches []TouchID) []TouchID {
|
||||
defer i.m.Unlock()
|
||||
|
||||
for _, t := range i.state.Touches {
|
||||
touches = append(touches, t.ID)
|
||||
touches = append(touches, TouchID(t.ID))
|
||||
}
|
||||
return touches
|
||||
}
|
||||
@ -456,7 +456,7 @@ func (i *inputState) touchPosition(id TouchID) (int, int) {
|
||||
defer i.m.Unlock()
|
||||
|
||||
for _, t := range i.state.Touches {
|
||||
if id != t.ID {
|
||||
if id != TouchID(t.ID) {
|
||||
continue
|
||||
}
|
||||
return t.X, t.Y
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
// A MouseButton represents a mouse button.
|
||||
type MouseButton = ui.MouseButton
|
||||
type MouseButton int
|
||||
|
||||
// MouseButtons
|
||||
const (
|
||||
@ -27,10 +27,10 @@ const (
|
||||
MouseButtonMiddle MouseButton = MouseButton1
|
||||
MouseButtonRight MouseButton = MouseButton2
|
||||
|
||||
MouseButton0 MouseButton = ui.MouseButton0
|
||||
MouseButton1 MouseButton = ui.MouseButton1
|
||||
MouseButton2 MouseButton = ui.MouseButton2
|
||||
MouseButton3 MouseButton = ui.MouseButton3
|
||||
MouseButton4 MouseButton = ui.MouseButton4
|
||||
MouseButton0 MouseButton = MouseButton(ui.MouseButton0)
|
||||
MouseButton1 MouseButton = MouseButton(ui.MouseButton1)
|
||||
MouseButton2 MouseButton = MouseButton(ui.MouseButton2)
|
||||
MouseButton3 MouseButton = MouseButton(ui.MouseButton3)
|
||||
MouseButton4 MouseButton = MouseButton(ui.MouseButton4)
|
||||
MouseButtonMax MouseButton = MouseButton4
|
||||
)
|
||||
|
20
run.go
20
run.go
@ -384,7 +384,7 @@ func ScreenSizeInFullscreen() (int, int) {
|
||||
//
|
||||
// CursorMode is concurrent-safe.
|
||||
func CursorMode() CursorModeType {
|
||||
return ui.Get().CursorMode()
|
||||
return CursorModeType(ui.Get().CursorMode())
|
||||
}
|
||||
|
||||
// SetCursorMode sets the render and capture mode of the mouse cursor.
|
||||
@ -406,7 +406,7 @@ func CursorMode() CursorModeType {
|
||||
//
|
||||
// SetCursorMode is concurrent-safe.
|
||||
func SetCursorMode(mode CursorModeType) {
|
||||
ui.Get().SetCursorMode(mode)
|
||||
ui.Get().SetCursorMode(ui.CursorMode(mode))
|
||||
}
|
||||
|
||||
// CursorShape returns the current cursor shape.
|
||||
@ -415,7 +415,7 @@ func SetCursorMode(mode CursorModeType) {
|
||||
//
|
||||
// CursorShape is concurrent-safe.
|
||||
func CursorShape() CursorShapeType {
|
||||
return ui.Get().CursorShape()
|
||||
return CursorShapeType(ui.Get().CursorShape())
|
||||
}
|
||||
|
||||
// SetCursorShape sets the cursor shape.
|
||||
@ -424,7 +424,7 @@ func CursorShape() CursorShapeType {
|
||||
//
|
||||
// SetCursorShape is concurrent-safe.
|
||||
func SetCursorShape(shape CursorShapeType) {
|
||||
ui.Get().SetCursorShape(shape)
|
||||
ui.Get().SetCursorShape(ui.CursorShape(shape))
|
||||
}
|
||||
|
||||
// IsFullscreen reports whether the current mode is fullscreen or not.
|
||||
@ -528,14 +528,14 @@ func SetVsyncEnabled(enabled bool) {
|
||||
// FPSModeType is a type of FPS modes.
|
||||
//
|
||||
// Deprecated: as of v2.5. Use SetVsyncEnabled instead.
|
||||
type FPSModeType = ui.FPSModeType
|
||||
type FPSModeType int
|
||||
|
||||
const (
|
||||
// FPSModeVsyncOn indicates that the game tries to sync the display's refresh rate.
|
||||
// FPSModeVsyncOn is the default mode.
|
||||
//
|
||||
// Deprecated: as of v2.5. Use SetVsyncEnabled(true) instead.
|
||||
FPSModeVsyncOn FPSModeType = ui.FPSModeVsyncOn
|
||||
FPSModeVsyncOn FPSModeType = FPSModeType(ui.FPSModeVsyncOn)
|
||||
|
||||
// FPSModeVsyncOffMaximum indicates that the game doesn't sync with vsync, and
|
||||
// the game is updated whenever possible.
|
||||
@ -546,7 +546,7 @@ const (
|
||||
// The game's Update is called based on the specified TPS.
|
||||
//
|
||||
// Deprecated: as of v2.5. Use SetVsyncEnabled(false) instead.
|
||||
FPSModeVsyncOffMaximum FPSModeType = ui.FPSModeVsyncOffMaximum
|
||||
FPSModeVsyncOffMaximum FPSModeType = FPSModeType(ui.FPSModeVsyncOffMaximum)
|
||||
|
||||
// FPSModeVsyncOffMinimum indicates that the game doesn't sync with vsync, and
|
||||
// the game is updated only when necessary.
|
||||
@ -559,7 +559,7 @@ const (
|
||||
//
|
||||
// Deprecated: as of v2.5. Use SetScreenClearedEveryFrame(false) instead.
|
||||
// See examples/skipdraw for GPU optimization with SetScreenClearedEveryFrame(false).
|
||||
FPSModeVsyncOffMinimum FPSModeType = ui.FPSModeVsyncOffMinimum
|
||||
FPSModeVsyncOffMinimum FPSModeType = FPSModeType(ui.FPSModeVsyncOffMinimum)
|
||||
)
|
||||
|
||||
// FPSMode returns the current FPS mode.
|
||||
@ -568,7 +568,7 @@ const (
|
||||
//
|
||||
// Deprecated: as of v2.5. Use SetVsyncEnabled instead.
|
||||
func FPSMode() FPSModeType {
|
||||
return ui.Get().FPSMode()
|
||||
return FPSModeType(ui.Get().FPSMode())
|
||||
}
|
||||
|
||||
// SetFPSMode sets the FPS mode.
|
||||
@ -578,7 +578,7 @@ func FPSMode() FPSModeType {
|
||||
//
|
||||
// Deprecated: as of v2.5. Use SetVsyncEnabled instead.
|
||||
func SetFPSMode(mode FPSModeType) {
|
||||
ui.Get().SetFPSMode(mode)
|
||||
ui.Get().SetFPSMode(ui.FPSModeType(mode))
|
||||
}
|
||||
|
||||
// ScheduleFrame schedules a next frame when the current FPS mode is FPSModeVsyncOffMinimum.
|
||||
|
12
window.go
12
window.go
@ -25,21 +25,21 @@ import (
|
||||
//
|
||||
// Regardless of the resizing mode, an Ebitengine application can still change the window size or make
|
||||
// the window fullscreen by calling Ebitengine functions.
|
||||
type WindowResizingModeType = ui.WindowResizingMode
|
||||
type WindowResizingModeType int
|
||||
|
||||
// WindowResizingModeTypes
|
||||
const (
|
||||
// WindowResizingModeDisabled indicates the mode to disallow resizing the window by a user.
|
||||
WindowResizingModeDisabled WindowResizingModeType = ui.WindowResizingModeDisabled
|
||||
WindowResizingModeDisabled WindowResizingModeType = WindowResizingModeType(ui.WindowResizingModeDisabled)
|
||||
|
||||
// WindowResizingModeOnlyFullscreenEnabled indicates the mode to disallow resizing the window,
|
||||
// but allow to make the window fullscreen by a user.
|
||||
// This works only on macOS so far.
|
||||
// On the other platforms, this is the same as WindowResizingModeDisabled.
|
||||
WindowResizingModeOnlyFullscreenEnabled WindowResizingModeType = ui.WindowResizingModeOnlyFullscreenEnabled
|
||||
WindowResizingModeOnlyFullscreenEnabled WindowResizingModeType = WindowResizingModeType(ui.WindowResizingModeOnlyFullscreenEnabled)
|
||||
|
||||
// WindowResizingModeEnabled indicates the mode to allow resizing the window by a user.
|
||||
WindowResizingModeEnabled WindowResizingModeType = ui.WindowResizingModeEnabled
|
||||
WindowResizingModeEnabled WindowResizingModeType = WindowResizingModeType(ui.WindowResizingModeEnabled)
|
||||
)
|
||||
|
||||
// IsWindowDecorated reports whether the window is decorated.
|
||||
@ -67,14 +67,14 @@ func SetWindowDecorated(decorated bool) {
|
||||
//
|
||||
// WindowResizingMode is concurrent-safe.
|
||||
func WindowResizingMode() WindowResizingModeType {
|
||||
return ui.Get().Window().ResizingMode()
|
||||
return WindowResizingModeType(ui.Get().Window().ResizingMode())
|
||||
}
|
||||
|
||||
// SetWindowResizingMode sets the mode in which a user resizes the window.
|
||||
//
|
||||
// SetWindowResizingMode is concurrent-safe.
|
||||
func SetWindowResizingMode(mode WindowResizingModeType) {
|
||||
ui.Get().Window().SetResizingMode(mode)
|
||||
ui.Get().Window().SetResizingMode(ui.WindowResizingMode(mode))
|
||||
}
|
||||
|
||||
// IsWindowResizable reports whether the window is resizable by the user's dragging on desktops.
|
||||
|
Loading…
Reference in New Issue
Block a user