Files
aego/platform/ext.go
T
sanspie 5eb1832907
ci-platforms / darwin amd64 smoke (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Failing after 15m28s
ci / release (push) Skipped
ci-platforms / windows amd64 smoke (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
ci / checks (push) Successful in 7m47s
Complete Stage 12 for v0.12.0
2026-11-05 11:46:53 +03:00

114 lines
2.1 KiB
Go

package platform
import "aego/core/mathx"
type CursorShape uint8
const (
CursorDefault CursorShape = iota
CursorText
CursorPointer
CursorMove
CursorResizeEW
CursorResizeNS
CursorResizeNWSE
CursorResizeNESW
CursorNotAllowed
CursorCrosshair
)
type TextInputer interface {
StartTextInput()
StopTextInput()
SetTextInputArea(r mathx.Rect, cursor int)
}
type Clipboard interface {
ClipboardText() string
SetClipboardText(s string)
SetClipboardData(mime string, data []byte, text string) bool
ClipboardData(mime string) ([]byte, bool)
}
type Cursorer interface {
SetCursor(CursorShape)
}
type MouseCapturer interface {
CaptureMouse(on bool)
}
type WindowMode uint8
const (
Windowed WindowMode = iota
Borderless
Fullscreen
)
type DisplayMode struct {
W, H int
Hz float32
}
type Display struct {
ID uint32
Name string
Current DisplayMode
Modes []DisplayMode
}
func (d *Display) Has(m DisplayMode) bool {
for _, x := range d.Modes {
if x.W == m.W && x.H == m.H {
return true
}
}
return false
}
type Displayer interface {
Displays() []Display
WindowDisplay() int
WindowMode() WindowMode
SetWindowMode(mode WindowMode, display int, size DisplayMode) error
}
// FrameClockResetter requests a new wall-clock origin for the first frame
// after a platform suspension. Explicit fixed clocks keep their own cadence.
type FrameClockResetter interface {
ConsumeFrameClockReset() bool
}
type Driver interface {
Drive(step func() bool)
}
// PixelRatioLimiter is a window that can render below the screen's pixel density.
type PixelRatioLimiter interface {
SetMaxPixelRatio(r float64)
}
// FrameLimiter is a Driver that limits how often it steps the engine, for platforms whose swap is always synced.
type FrameLimiter interface {
SetFrameLimit(fps float64)
}
type SystemTheme uint8
const (
ThemeUnknown SystemTheme = iota
ThemeLight
ThemeDark
)
// SystemThemer reports whether the OS asks for a light or a dark look (D345).
type SystemThemer interface {
SystemTheme() SystemTheme
}
// Localer reports the languages the user prefers, most wanted first, as "ru-RU" or "en" (D348).
type Localer interface {
PreferredLocales() []string
}