ui

package
v0.0.0-...-4ee5d08 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const VScrollBarWidth = 16

VScrollBarWidth is width for VScrollBar.

Variables

View Source
var BackgroundType = goecs.NewComponentType()

BackgroundType is the ComponentType of Background

View Source
var ButtonType = goecs.NewComponentType()

ButtonType is the ComponentType of Button

TextType is the ComponentType of Text

Functions

func CopyPixel

func CopyPixel(image *ebiten.Image, pXsrc int, pYsrc int, pXdst int, pYdst int)

CopyPixel copy

func DrawRectangle

func DrawRectangle(screen *ebiten.Image, x1 int, y1 int, x2 int, y2 int, c color.Color)

DrawRectangle draw

func Floodfill

func Floodfill(image *ebiten.Image, x int, y int, c color.Color)

Floodfill fill

func GetTextYOffset

func GetTextYOffset() int

GetTextYOffset ...

func GetUIFont

func GetUIFont() font.Face

GetUIFont ...

func LoadImage

func LoadImage(path string) *ebiten.Image

LoadImage ...

Types

type Background

type Background struct {
	X int
	Y int
	// contains filtered or unexported fields
}

Background represents background.

func NewBackground

func NewBackground(x int, y int, image *ebiten.Image) *Background

NewBackground ...

func (*Background) Draw

func (b *Background) Draw(dst *ebiten.Image, op *ebiten.DrawImageOptions)

Draw renders content

func (*Background) GetImage

func (b *Background) GetImage() *ebiten.Image

GetImage ...

func (Background) Type

func (b Background) Type() goecs.ComponentType

Type will return Button goecs.ComponentType

func (*Background) Update

func (b *Background) Update()

Update ...

type Button

type Button struct {
	Rect image.Rectangle
	Text string
	// contains filtered or unexported fields
}

Button represents button ui.

func NewButton

func NewButton(rect image.Rectangle, text string, onPressed func(b *Button)) *Button

NewButton ...

func (*Button) Draw

func (b *Button) Draw(dst *ebiten.Image)

Draw render texture and text.

func (*Button) SetEnabled

func (b *Button) SetEnabled(enabled bool)

SetEnabled set enabled.

func (*Button) SetOnPressed

func (b *Button) SetOnPressed(f func(b *Button))

SetOnPressed register callback.

func (Button) Type

func (b Button) Type() goecs.ComponentType

Type will return Button goecs.ComponentType

func (*Button) Update

func (b *Button) Update()

Update handles input.

type CheckBox

type CheckBox struct {
	X    int
	Y    int
	Text string
	// contains filtered or unexported fields
}

CheckBox represents check box ui.

func NewCheckBox

func NewCheckBox(x int, y int, text string) *CheckBox

NewCheckBox ...

func (*CheckBox) Checked

func (c *CheckBox) Checked() bool

Checked returns whether checked or not.

func (*CheckBox) Draw

func (c *CheckBox) Draw(dst *ebiten.Image)

Draw renders texture and text.

func (*CheckBox) SetOnCheckChanged

func (c *CheckBox) SetOnCheckChanged(f func(c *CheckBox))

SetOnCheckChanged set onCheckChanged handlers.

func (*CheckBox) Update

func (c *CheckBox) Update()

Update handle mouse click and onCheckChanged handler.

type Input

type Input struct {
}

Input indicates mouseButtonState for now.

type Keyboard

type Keyboard struct {
	TopLeft image.Point
	// contains filtered or unexported fields
}

Keyboard ...

func NewKeyboard

func NewKeyboard(topLeft image.Point) *Keyboard

NewKeyboard is a constructor.

func (*Keyboard) Clear

func (k *Keyboard) Clear()

Clear clears composed string.

func (*Keyboard) DisableFeedback

func (k *Keyboard) DisableFeedback()

DisableFeedback disables

func (*Keyboard) Draw

func (k *Keyboard) Draw(dst *ebiten.Image)

Draw render textures

func (*Keyboard) EnableFeedback

func (k *Keyboard) EnableFeedback(pos image.Point, widthB int)

EnableFeedback enables

func (*Keyboard) GetBuffer

func (k *Keyboard) GetBuffer() string

GetBuffer gets temporal string.

func (*Keyboard) GetString

func (k *Keyboard) GetString() string

GetString gets composed string.

func (*Keyboard) SetOnPressed

func (k *Keyboard) SetOnPressed(f func(k *Keyboard))

SetOnPressed register callback.

func (*Keyboard) Update

func (k *Keyboard) Update()

Update handles input. simple automata

type NumPad

type NumPad struct {
	TopLeft image.Point
	// contains filtered or unexported fields
}

NumPad ...

func NewNumPad

func NewNumPad(topLeft image.Point) *NumPad

NewNumPad is a constructor.

func (*NumPad) Clear

func (k *NumPad) Clear()

Clear clears composed string.

func (*NumPad) DisableFeedback

func (k *NumPad) DisableFeedback()

DisableFeedback disables

func (*NumPad) Draw

func (k *NumPad) Draw(dst *ebiten.Image)

Draw render textures

func (*NumPad) EnableFeedback

func (k *NumPad) EnableFeedback(pos image.Point, widthB int)

EnableFeedback enables

func (*NumPad) GetBuffer

func (k *NumPad) GetBuffer() string

GetBuffer gets temporal string.

func (*NumPad) GetString

func (k *NumPad) GetString() string

GetString gets composed string.

func (*NumPad) SetFeedbackColor

func (k *NumPad) SetFeedbackColor(color color.Color)

SetFeedbackColor ...

func (*NumPad) SetMax

func (k *NumPad) SetMax(max int)

SetMax sets upper bounds(minus means no check)

func (*NumPad) SetMin

func (k *NumPad) SetMin(min int)

SetMin sets lower bounds(minus means no check)

func (*NumPad) SetOnPressed

func (k *NumPad) SetOnPressed(f func(k *NumPad))

SetOnPressed register callback.

func (*NumPad) Update

func (k *NumPad) Update()

Update handles input. simple automata

type Text

type Text struct {
	X        int
	Y        int
	Text     string
	Color    color.Color
	IsCenter bool
}

Text represents text ui.

func NewText

func NewText(x int, y int, text string, c color.Color, isCenter bool) *Text

NewText ...

func (*Text) Draw

func (t *Text) Draw(dst *ebiten.Image)

Draw renders content

func (Text) Type

func (t Text) Type() goecs.ComponentType

Type will return Button goecs.ComponentType

func (*Text) Update

func (t *Text) Update()

Update ...

type TextBox

type TextBox struct {
	Rect image.Rectangle
	Text string
	// contains filtered or unexported fields
}

TextBox represents text box ui.

func NewTextBox

func NewTextBox(rect image.Rectangle) *TextBox

NewTextBox ...

func (*TextBox) AppendLine

func (t *TextBox) AppendLine(line string)

AppendLine append one line.

func (*TextBox) Draw

func (t *TextBox) Draw(dst *ebiten.Image)

Draw renders content and scroll bar.

func (*TextBox) Update

func (t *TextBox) Update()

Update handle scroll bar and itself.

type VScrollBar

type VScrollBar struct {
	X      int
	Y      int
	Height int
	// contains filtered or unexported fields
}

VScrollBar represents vertical scroll bar.

func (*VScrollBar) ContentOffset

func (v *VScrollBar) ContentOffset() int

ContentOffset ?

func (*VScrollBar) Draw

func (v *VScrollBar) Draw(dst *ebiten.Image)

Draw render textures.

func (*VScrollBar) Update

func (v *VScrollBar) Update(contentHeight int)

Update handles input and scroll.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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