ui

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: BSD-3-Clause Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BOARD_ALPHA = iota
	BOARD_DEC
	BOARD_HEX
	BOARD_KEYBIND
)
View Source
const (
	MENU_GENERAL = iota
	MENU_UI
	MENU_GB
	MENU_GBA
	MENU_NDS
	MENU_ABOUT
	MENU_RETURN
)
View Source
const (
	MIN_HEIGHT   = 32
	BUTTON_WIDTH = 256
)
View Source
const MAX_DIALOG_LEN = 24
View Source
const TICKS_PER_TOAST = 60

Variables

View Source
var (
	DEC_KEYS = []string{
		"0", "1", "2", "3", "4",
		"5", "6", "7", "8", "9",
	}

	HEX_KEYS = []string{
		"0", "1", "2", "3", "4", "5", "6", "7",
		"8", "9", "A", "B", "C", "D", "E", "F",
	}

	KEYS_KEY_CONTROLLER = []string{
		"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
		"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
		"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
		"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
		"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ",", " ",
	}
)

Functions

func ColorNdsValidation

func ColorNdsValidation() func(string) (bool, *string)

func HexValidation

func HexValidation(maxValue int) func(string) (bool, *string)

func MaskedColorTint

func MaskedColorTint(src img.Image, clrWhite, clrBlack color.Color) *img.RGBA

func NewAboutMenu

func NewAboutMenu(g *Game) *widget.Container

func NewApplyPalettesMenu

func NewApplyPalettesMenu(focusGroups *[][]widget.Focuser, pals map[string][4]string, clrInputs [4]widget.PreferredSizeLocateableWidget, res *Resources) widget.PreferredSizeLocateableWidget

func NewCenteredButton

func NewCenteredButton(text string, f func(*widget.ButtonClickedEventArgs)) *widget.Button

func NewCenteredPage

func NewCenteredPage(bg *image.NineSlice, buttons ...*widget.Button) *widget.Container

func NewCheckbox

func NewCheckbox(value *bool) widget.PreferredSizeLocateableWidget

func NewColorInput

func NewColorInput(ui *Ui, label string, v *color.Color, validation func(s string) (bool, *string)) widget.PreferredSizeLocateableWidget

func NewDecimalInput

func NewDecimalInput(ui *Ui, label string, value any, maxValue int) *widget.TextInput

func NewDirectoryInput

func NewDirectoryInput(v *string, defaultPath string) widget.PreferredSizeLocateableWidget

func NewGbMenu

func NewGbMenu(g *Game) *widget.Container

func NewGbaMenu

func NewGbaMenu(g *Game) *widget.Container

func NewGeneralMenu

func NewGeneralMenu(g *Game) *widget.Container

func NewHeader

func NewHeader(text string, res *Resources) *widget.Text

func NewHexInput

func NewHexInput(ui *Ui, label string, value any, maxValue int) *widget.TextInput

func NewHome

func NewHome(g *Game)

func NewKeybindInput

func NewKeybindInput(ui *Ui, v *[]ebiten.Key) widget.PreferredSizeLocateableWidget

func NewLabel

func NewLabel(text string) *widget.Text

func NewLinkText

func NewLinkText(text string) *widget.Text

func NewNdsMenu

func NewNdsMenu(g *Game) *widget.Container

func NewPause

func NewPause(g *Game)

func NewRadioButton

func NewRadioButton(label string, ptr *int, value int, res *Resources) *widget.Button

func NewRadioInput

func NewRadioInput(focusRadios *[][]widget.Focuser, ptr *int, values []string, res *Resources) widget.PreferredSizeLocateableWidget

func NewScrollableContainer

func NewScrollableContainer(ui *Ui) *widget.Container

func NewSeparator

func NewSeparator() *widget.Container

func NewSettings

func NewSettings(g *Game, oldId PageId, initMenu int)

func NewSidebarButton

func NewSidebarButton(g *Game, label string, f func(g *Game)) *widget.Button

func NewTextBoxInput

func NewTextBoxInput(ui *Ui, board int, label string, value any, validation func(s string) (bool, *string)) *widget.TextInput

func NewTheme

func NewTheme(r *Resources) *widget.Theme

func NewUiMenu

func NewUiMenu(g *Game) *widget.Container

func NumberValidation

func NumberValidation(maxValue int) func(string) (bool, *string)

func StartEngine

func StartEngine()

func StringValidation

func StringValidation(maxLength int) func(string) (bool, *string)

func TintImage

func TintImage(src *ebiten.Image, c color.Color) *ebiten.Image

Types

type AboutLocalization

type AboutLocalization struct {
	About string `toml:"about"`

	Version   string `toml:"version"`
	Copyright string `toml:"copyright"`
	ThankYous string `toml:"thank_yous"`
}

type BindingInput

type BindingInput struct {
	ChangedEvent *event.Event
	// contains filtered or unexported fields
}

func NewBindingInput

func NewBindingInput(opts ...BindingInputOpt) *BindingInput

func (*BindingInput) GetText

func (t *BindingInput) GetText() string

func (*BindingInput) GetWidget

func (t *BindingInput) GetWidget() *widget.Widget

func (*BindingInput) PreferredSize

func (t *BindingInput) PreferredSize() (int, int)

func (*BindingInput) Render

func (t *BindingInput) Render(screen *ebiten.Image)

func (*BindingInput) SetFocus

func (t *BindingInput) SetFocus(focused bool)

func (*BindingInput) SetGamepadBinding

func (t *BindingInput) SetGamepadBinding(gamepadIds *map[ebiten.GamepadID]struct{})

func (*BindingInput) SetLocation

func (t *BindingInput) SetLocation(rect img.Rectangle)

func (*BindingInput) SetText

func (t *BindingInput) SetText(text string)

func (*BindingInput) Update

func (t *BindingInput) Update(updObj *widget.UpdateObject)

func (*BindingInput) Validate

func (t *BindingInput) Validate()

type BindingInputChangedEventArgs

type BindingInputChangedEventArgs struct {
	BindingInput *BindingInput
	InputText    string
	Keys         []ebiten.Key
	Buttons      []ebiten.StandardGamepadButton
	OffsetX      int
	OffsetY      int
}

type BindingInputChangedHandlerFunc

type BindingInputChangedHandlerFunc func(args *BindingInputChangedEventArgs)

type BindingInputColor

type BindingInputColor struct {
	Idle  color.Color
	Focus color.Color
}

type BindingInputImage

type BindingInputImage struct {
	Idle  *image.NineSlice
	Focus *image.NineSlice
}

type BindingInputOpt

type BindingInputOpt func(t *BindingInput)

type BindingInputOptions

type BindingInputOptions struct{}
var BindingInputOpts BindingInputOptions

func (BindingInputOptions) ChangedHandler

func (BindingInputOptions) Color

func (BindingInputOptions) Face

func (BindingInputOptions) Image

func (BindingInputOptions) Padding

func (BindingInputOptions) Placeholder

func (o BindingInputOptions) Placeholder(s string) BindingInputOpt

func (BindingInputOptions) WidgetOpts

func (o BindingInputOptions) WidgetOpts(opts ...widget.WidgetOpt) BindingInputOpt

type BindingInputParams

type BindingInputParams struct {
	Image   *BindingInputImage
	Color   *BindingInputColor
	Padding *widget.Insets
	Face    *text.Face
}

type Focus

type Focus struct {
	// contains filtered or unexported fields
}

func (*Focus) BuildMenuFocus

func (f *Focus) BuildMenuFocus(menu *widget.Container, bindings ...*widget.Container)

func (*Focus) ClearFocus

func (f *Focus) ClearFocus()

func (*Focus) DeFocus

func (f *Focus) DeFocus()

func (*Focus) FocusLastSidebar

func (f *Focus) FocusLastSidebar()

func (*Focus) FocusLastSubMenu

func (f *Focus) FocusLastSubMenu()

func (*Focus) FocusSidebar

func (f *Focus) FocusSidebar(idx int)

func (*Focus) FocusSubmenu

func (f *Focus) FocusSubmenu()

func (*Focus) KeepFocusedInView

func (f *Focus) KeepFocusedInView(slider *widget.Slider, ui *ebitenui.UI)

type Game

type Game struct {
	Bus         *bus.EventBus
	DrawOptions ebiten.DrawImageOptions
	// contains filtered or unexported fields
}

func NewGame

func NewGame(res *Resources) *Game

func (*Game) ButtonInput

func (g *Game) ButtonInput(justButtons, buttons []ebiten.StandardGamepadButton)

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

func (*Game) GetGamepadButtons

func (g *Game) GetGamepadButtons() (justButtons, buttons []ebiten.StandardGamepadButton)

func (*Game) HandleGlobalInputs

func (g *Game) HandleGlobalInputs(justKeys []ebiten.Key, justButtons, buttons []ebiten.StandardGamepadButton)

func (*Game) InitConsole

func (g *Game) InitConsole(file string) bool

func (*Game) Layout

func (g *Game) Layout(outsideWidth int, outsideHeight int) (int, int)

func (*Game) ToggleMute

func (g *Game) ToggleMute()

func (*Game) TogglePause

func (g *Game) TogglePause()

func (*Game) Update

func (g *Game) Update() error

type GbLocalization

type GbLocalization struct {
	General      string   `toml:"general"`
	System       string   `toml:"system"`
	Systems      []string `toml:"systems"`
	DmgPalette   string   `toml:"dmg_palette"`
	Lightest     string   `toml:"lightest"`
	Light        string   `toml:"light"`
	Dark         string   `toml:"dark"`
	Darkest      string   `toml:"darkest"`
	DmgLightest  string   `toml:"dmg_lightest"`
	DmgLight     string   `toml:"dmg_light"`
	DmgDark      string   `toml:"dmg_dark"`
	DmgDarkest   string   `toml:"dmg_darkest"`
	ApplyPalette string   `toml:"apply_palette"`
	Bios         string   `toml:"bios"`
	DmgPath      string   `toml:"dmg_bios_path"`
	GbcPath      string   `toml:"gbc_bios_path"`
	DirectBoot   string   `toml:"direct_boot"`
	Keyboard     string   `toml:"keyboard"`
	Controller   string   `toml:"controller"`
	A            string   `toml:"a"`
	B            string   `toml:"b"`
	Select       string   `toml:"select"`
	Start        string   `toml:"start"`
	Left         string   `toml:"left"`
	Right        string   `toml:"right"`
	Up           string   `toml:"up"`
	Down         string   `toml:"down"`
	Save         string   `toml:"save"`
}

type GbaLocalization

type GbaLocalization struct {
	General          string   `toml:"general"`
	OptmizeIdleLoops string   `toml:"optimize_idle_loops"`
	Rotation         string   `toml:"rotation"`
	Rotations        []string `toml:"rotations"`

	Hardware         string   `toml:"hardware"`
	BackupType       string   `toml:"backup_type"`
	BackupTypes      []string `toml:"backup_types"`
	ForceRtc         string   `toml:"force_rtc"`
	ForceSolarSensor string   `toml:"force_solar_sensor"`
	SolarSensorLevel string   `toml:"solar_sensor_level"`

	Bios       string `toml:"bios"`
	BiosPath   string `toml:"bios_path"`
	DirectBoot string `toml:"direct_boot"`
	Keyboard   string `toml:"keyboard"`
	Controller string `toml:"controller"`

	A              string `toml:"a"`
	B              string `toml:"b"`
	Select         string `toml:"select"`
	Start          string `toml:"start"`
	Left           string `toml:"left"`
	Right          string `toml:"right"`
	Up             string `toml:"up"`
	Down           string `toml:"down"`
	L              string `toml:"l"`
	R              string `toml:"r"`
	SolarMin       string `toml:"solar_minimum"`
	Solar1         string `toml:"solar_1"`
	Solar2         string `toml:"solar_2"`
	Solar3         string `toml:"solar_3"`
	SolarMax       string `toml:"solar_maximum"`
	RotationToggle string `toml:"rotation_toggle"`

	Save string `toml:"save"`
}

type GeneralLocalization

type GeneralLocalization struct {
	General             string `toml:"general"`
	Muted               string `toml:"muted"`
	ShowFps             string `toml:"show_fps"`
	InitFullscreen      string `toml:"init_fullscreen"`
	TargetFps           string `toml:"target_fps"`
	VsyncEnabled        string `toml:"vsync_enabled"`
	DisableSaves        string `toml:"disable_saves"`
	IntegerScalingDesc  string `toml:"integer_scaling_desc"`
	IntegerScaling      string `toml:"integer_scaling"`
	IntegerScalingRatio string `toml:"integer_scaling_ratio"`
	SampleRateDesc      string `toml:"sample_rate_desc"`
	SampleRate          string `toml:"sample_rate"`
	Keyboard            string `toml:"keyboard"`
	Controller          string `toml:"controller"`
	Select              string `toml:"select"`
	Return              string `toml:"return"`
	Mute                string `toml:"mute"`
	Pause               string `toml:"pause"`
	Left                string `toml:"left"`
	Right               string `toml:"right"`
	Up                  string `toml:"up"`
	Down                string `toml:"down"`
	Fullscreen          string `toml:"fullscreen"`
	Quit                string `toml:"quit"`
	Save                string `toml:"save"`
}

type Keyboard

type Keyboard struct {
	// contains filtered or unexported fields
}

func NewKeyboard

func NewKeyboard(res *Resources, alphaKeys []string) *Keyboard

func (*Keyboard) Close

func (k *Keyboard) Close(save bool)

func (*Keyboard) Open

func (k *Keyboard) Open(ui *Ui, caller *widget.TextInput, board int, label string, v any, validation func(string) (bool, *string))

type LangOptions

type LangOptions int
const (
	ENGLISH LangOptions = iota
	SPANISH
)

type Localization

type Localization struct {
	Main     MainLocalization     `toml:"main"`
	Pause    PauseLocalization    `toml:"pause"`
	Settings SettingsLocalization `toml:"settings"`
	Toast    ToastLocalization    `toml:"toast"`
}

func NewLocalization

func NewLocalization(lang LangOptions) *Localization

type MainLocalization

type MainLocalization struct {
	Open        string `toml:"open"`
	Settings    string `toml:"settings"`
	Quit        string `toml:"quit"`
	DialogTitle string `toml:"dialog_title"`
	DialogDesc  string `toml:"dialog_desc"`
}

type NdsLocalization

type NdsLocalization struct {
	Screen          string   `toml:"screen"`
	Layout          string   `toml:"layout"`
	Sizing          string   `toml:"sizing"`
	Rotation        string   `toml:"rotation"`
	Layouts         []string `toml:"layouts"`
	Sizings         []string `toml:"sizings"`
	Rotations       []string `toml:"rotations"`
	Rtc             string   `toml:"rtc"`
	AdditionalHours string   `toml:"additional_hours"`
	Bios            string   `toml:"bios"`
	Arm7Path        string   `toml:"arm7_path"`
	Arm9Path        string   `toml:"arm9_path"`
	Firmware        string   `toml:"firmware"`
	FilePath        string   `toml:"file_path"`
	Nickname        string   `toml:"nickname"`
	Message         string   `toml:"message"`
	FavoriteColor   string   `toml:"favorite_color"`
	SceneExport     string   `toml:"scene_export"`
	OutputDirectory string   `toml:"output_directory"`
	ShadowPolygons  string   `toml:"shadow_polygons"`

	Keyboard       string `toml:"keyboard"`
	Controller     string `toml:"controller"`
	A              string `toml:"a"`
	B              string `toml:"b"`
	Select         string `toml:"select"`
	Start          string `toml:"start"`
	Left           string `toml:"left"`
	Right          string `toml:"right"`
	Up             string `toml:"up"`
	Down           string `toml:"down"`
	L              string `toml:"l"`
	R              string `toml:"r"`
	X              string `toml:"x"`
	Y              string `toml:"y"`
	Hinge          string `toml:"hinge"`
	Debug          string `toml:"debug"`
	LayoutToggle   string `toml:"layout_toggle"`
	SizingToggle   string `toml:"sizing_toggle"`
	RotationToggle string `toml:"rotation_toggle"`
	ExportToggle   string `toml:"export_toggle"`

	Save string `toml:"save"`
}

type PageId

type PageId int
const (
	PAGE_HOME PageId = iota
	PAGE_PAUSE
	PAGE_SETTINGS
	PAGE_KEYBOARD
)

type PauseLocalization

type PauseLocalization struct {
	Resume   string `toml:"resume"`
	Settings string `toml:"settings"`
	Main     string `toml:"main"`
}

type Resources

type Resources struct {
	// contains filtered or unexported fields
}

func NewUIResources

func NewUIResources() (*Resources, error)

func (*Resources) Update

func (u *Resources) Update()

type SettingsLocalization

type SettingsLocalization struct {
	Sidebar SidebarLocalization `toml:"sidebar"`
	General GeneralLocalization `toml:"general"`
	Ui      UiLocalization      `toml:"ui"`
	Gb      GbLocalization      `toml:"gb"`
	Gba     GbaLocalization     `toml:"gba"`
	Nds     NdsLocalization     `toml:"nds"`
	About   AboutLocalization   `toml:"about"`
}

type SidebarField

type SidebarField struct {
	// contains filtered or unexported fields
}

type SidebarLocalization

type SidebarLocalization struct {
	General string `toml:"general"`
	Ui      string `toml:"ui"`
	Gb      string `toml:"gb"`
	Gba     string `toml:"gba"`
	Nds     string `toml:"nds"`
	About   string `toml:"about"`
	Return  string `toml:"return"`
}

type Toast

type Toast struct {
	// contains filtered or unexported fields
}

func NewToast

func NewToast(res *Resources) *Toast

func (*Toast) AddMessage

func (t *Toast) AddMessage(message string)

func (*Toast) Update

func (t *Toast) Update()

type ToastLocalization

type ToastLocalization struct {
	Saved                  string `toml:"saved"`
	Muted                  string `toml:"muted"`
	Unmuted                string `toml:"unmuted"`
	ControllerConnected    string `toml:"controller_connected"`
	ControllerDisconnected string `toml:"controller_disconnected"`
}

type Ui

type Ui struct {
	ActiveInputs int
	PageId       PageId
	PrevPageId   PageId
	// contains filtered or unexported fields
}

type UiLocalization

type UiLocalization struct {
	Ui        string   `toml:"ui"`
	Language  string   `toml:"language"`
	Languages []string `toml:"languages"`

	Backdrop    string `toml:"backdrop"`
	BgColor     string `toml:"bg_color"`
	FgColor     string `toml:"fg_color"`
	AccentColor string `toml:"accent_color"`
	ApplyTheme  string `toml:"apply_theme"`

	UiBackdrop    string `toml:"ui_backdrop"`
	UiBgColor     string `toml:"ui_bg_color"`
	UiFgColor     string `toml:"ui_fg_color"`
	UiAccentColor string `toml:"ui_accent_color"`
	Save          string `toml:"save"`

	Alphabet []string `toml:"alphabet"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL