ebitenui

package module
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 7 Imported by: 100

README

ebitenui-logo

Ebiten UI

Release License Github Docs Docs Discord Subreddit


A user interface engine and widget library for Ebitengine

>> Note: This library is separate from Ebitengine. Please reach out to the linked Discord server for questions or suggestions

Ebiten UI is an extension to Ebitengine that provides the ability to render a complete user interface, with widgets such as buttons, lists, combo boxes, and so on. It uses the [retained mode] model. All graphics used by Ebiten UI can be fully customized, so you can really make your UI your own.

Documentation on how to use and extend Ebiten UI is available at ebitenui.github.io.

Screenshots

Quick Start

Ebiten UI is written in Go 1.19 which is available at https://go.dev/.

There are Ebiten UI examples that can be found in the _examples/ folder.

They can be run from the root directory of the project with the following commands:

  • Ebiten UI complete demo: go run github.com/ebitenui/ebitenui/_examples/demo
  • Ebiten UI widget: go run github.com/ebitenui/ebitenui/_examples/widget_demos/<folder_name>

The examples can also be tested as WASM by running the following commands and opening your browser to http://localhost:6262:

  • Ebiten UI complete demo: go run github.com/hajimehoshi/wasmserve@latest -http=:6262 ./_examples/demo
  • Ebiten UI widget: go run github.com/hajimehoshi/wasmserve@latest -http=:6262 ./_examples/widget_demos/<folder_name>

Used By

Social Media

License

Ebiten UI is licensed under the MIT license.

Maintainers

Contributing

Want to help develop Ebiten UI? Check out our current issues. Want to know the steps on how to start contributing, take a look at the open source guide.

Documentation

Overview

Package ebitenui contains the main UI type that renders a complete user interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UI

type UI struct {
	// Container is the root container of the UI hierarchy.
	Container widget.Containerer
	// If true the default tab/shift-tab to focus will be disabled
	DisableDefaultFocus bool

	// If true the default relayering of Windows will be disabled
	DisableWindowRelayering bool

	// This exposes a Render call before the Container is drawn,
	// but after the Windows with DrawLayer < 0 are drawn.
	PreRenderHook widget.RenderFunc

	// This exposes a Render call after the Container is drawn,
	// but before the Windows with DrawLayer >= 0 (all by default) are drawn.
	PostRenderHook widget.RenderFunc

	// Theme settings
	PrimaryTheme *widget.Theme
	// contains filtered or unexported fields
}

UI encapsulates a complete user interface that can be rendered onto the screen. There should only be exactly one UI per application.

func (*UI) AddWindow

func (u *UI) AddWindow(w *widget.Window) widget.RemoveWindowFunc

AddWindow adds window w to ui for rendering. It returns a function to remove w from ui.

func (*UI) AddWindowQuietly added in v0.7.0

func (u *UI) AddWindowQuietly(w *widget.Window, closeEphemeralWindows bool) widget.RemoveWindowFunc

AddWindowQuietly adds window w to ui for rendering. It returns a function to remove w from ui. This function allows you to specify if you would like it to close any open ephemeralWindows (tooltip/dnd/etc)

func (*UI) ChangeFocus added in v0.3.3

func (u *UI) ChangeFocus(direction widget.FocusDirection)

func (*UI) ClearFocus added in v0.3.0

func (u *UI) ClearFocus()

This function will unfocus the currently focused widget

func (*UI) Draw

func (u *UI) Draw(screen *ebiten.Image)

Draw renders u onto screen. This function should be called in the Ebiten Draw function.

func (*UI) GetFocusedWidget added in v0.4.3

func (u *UI) GetFocusedWidget() widget.Focuser

This function will return the currently focused widget if available otherwise it returns nil

func (*UI) HasFocus

func (u *UI) HasFocus() bool

This function will return true if any widget is currently focused or a Modal window is open.

func (*UI) IsWindowOpen added in v0.3.3

func (u *UI) IsWindowOpen(w *widget.Window) bool

This function returns true if the provided window object is currently active in this UI.

func (*UI) SetFocusedWidget added in v0.7.0

func (u *UI) SetFocusedWidget(focused widget.Focuser)

This function will set a specific focusable widget as the currently focused widget.

func (*UI) SortWindows added in v0.6.1

func (u *UI) SortWindows()

This function will re-sort the current windows attached to this UI based on its DrawLayer value.

func (*UI) Update

func (u *UI) Update()

Update updates u. This method should be called in the Ebiten Update function.

Directories

Path Synopsis
_examples
demo command
game command
hello_world command
toolbar command
widget_demos/cut_copy_paste_js command
TO RUN: go run github.com/hajimehoshi/wasmserve@latest -http :9090 ./_examples/widget_demos/cut_copy_paste_js
TO RUN: go run github.com/hajimehoshi/wasmserve@latest -http :9090 ./_examples/widget_demos/cut_copy_paste_js
Package event contains types to deal with firing and handling events.
Package event contains types to deal with firing and handling events.
Package image contains types to deal with nine-slice images, buffered (cached) images, as well as drawing using masks.
Package image contains types to deal with nine-slice images, buffered (cached) images, as well as drawing using masks.
Package input deals with user input such as mouse button clicks, scroll wheel movement etc.
Package input deals with user input such as mouse button clicks, scroll wheel movement etc.
utilities
Package widget contains various widget implementations such as buttons, checkboxes, combo boxes, lists etc.
Package widget contains various widget implementations such as buttons, checkboxes, combo boxes, lists etc.

Jump to

Keyboard shortcuts

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