egui

package module
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: Apache-2.0 Imports: 19 Imported by: 1

README

egui

Ebiten Graphical User Interface (and Framework)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scene

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

Scene represents a layout of ui

func (*Scene) AddElement

func (s *Scene) AddElement(e element.Interfacer) error

AddElement adds an element to the scene list

func (*Scene) Draw added in v0.0.11

func (s *Scene) Draw(screen *ebiten.Image)

Draw renders on a destination image

func (*Scene) Element

func (s *Scene) Element(name string) (element.Interfacer, error)

Element returns an element based on name

func (*Scene) RemoveElement

func (s *Scene) RemoveElement(name string) error

RemoveElement flags an element to be removed next update

func (*Scene) Update added in v0.0.11

func (s *Scene) Update(dt float64)

Update is called during a frame update

type UI

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

UI contains core game components

func NewUI

func NewUI(screenResolution image.Point, scale float64) (*UI, error)

NewUI instantiates a new User Interface

func (*UI) AddFont added in v0.0.4

func (u *UI) AddFont(font *common.Font) error

AddFont adds an font font to ui

func (*UI) AddImage added in v0.0.4

func (u *UI) AddImage(img *common.Image) error

AddImage adds an image image to ui

func (*UI) AddScene

func (u *UI) AddScene(name string, scene *Scene) error

AddScene appends a new scene to the UI

func (*UI) CurrentScene

func (u *UI) CurrentScene() *Scene

CurrentScene returns the current scene

func (*UI) DefaultFont added in v0.0.4

func (u *UI) DefaultFont(name string) error

DefaultFont returns the current default font

func (*UI) Draw added in v0.0.11

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

Draw renders all UI elements

func (*UI) Font added in v0.0.4

func (u *UI) Font(name string) (*common.Font, error)

Font returns named font

func (*UI) Image added in v0.0.4

func (u *UI) Image(name string) (*common.Image, error)

Image returns a named image

func (*UI) NewButton

func (u *UI) NewButton(name string, scene string, text string, x float64, y float64, width int, height int, textColor color.Color, pressedSliceName string, unpressedSliceName string) (*button.Element, error)

NewButton creates a new button instance

func (*UI) NewFontTTF added in v0.0.4

func (u *UI) NewFontTTF(name string, fontData []byte, opts *truetype.Options, r rune) (*common.Font, error)

NewFontTTF instantiates a truetype font. truetype.Parse() can be used to load a TTF to fontData

func (*UI) NewImage added in v0.0.4

func (u *UI) NewImage(name string, f io.Reader, filter ebiten.Filter) (*common.Image, error)

NewImage adds a new image to egui

func (*UI) NewLabel

func (u *UI) NewLabel(name string, scene string, text string, x float64, y float64, textColor color.Color) (*label.Element, error)

NewLabel creates a new label instance

func (*UI) NewProgress added in v0.0.11

func (u *UI) NewProgress(name string, scene string, text string, x float64, y float64, width int, height int, progressImageName string, fillImageName string) (*progress.Element, error)

NewProgress creates a new progress bar instance

func (*UI) NewScene added in v0.0.5

func (ui *UI) NewScene(name string) (*Scene, error)

NewScene initializes a new scene

func (*UI) NewSprite added in v0.0.6

func (u *UI) NewSprite(name string, scene string, x float64, y float64, imageName string) (*sprite.Element, error)

NewSprite creates a new button instance

func (*UI) RemoveFont added in v0.0.4

func (u *UI) RemoveFont(name string) error

RemoveFont is used to unload and remove a font

func (*UI) Resolution

func (u *UI) Resolution() image.Point

Resolution returns the resolution

func (*UI) Scene

func (u *UI) Scene(name string) (*Scene, error)

Scene gets a scene

func (*UI) SetCurrentScene

func (u *UI) SetCurrentScene(name string) error

SetCurrentScene sets current scene

func (*UI) SetDefaultFont added in v0.0.4

func (u *UI) SetDefaultFont(name string) error

SetDefaultFont updates all elements to use a new default font

func (*UI) SetResolution

func (u *UI) SetResolution(resolution image.Point)

SetResolution changes the resolution of the UI

func (*UI) Update

func (u *UI) Update(image *ebiten.Image) error

Update updates all UI elements

Directories

Path Synopsis
map
examples

Jump to

Keyboard shortcuts

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