gui

package
v0.0.0-...-33ef502 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Joystick1 = &Joystick{}
View Source
var Joystick2 = &Joystick{}

Functions

func PoolEvents

func PoolEvents(stop chan struct{})

Types

type Button

type Button interface {
	GUIObject
	MouseTarget
	SetAction(f func())
}

func NewButton

func NewButton(txt string) Button

func NewTab

func NewTab(txt string) Button

type Display

type Display struct {
	Start        Point // image 0x0 position
	ViewPortRect Rect  // rect to display
	ViewSize     Size  // size to display
	// contains filtered or unexported fields
}

func NewDisplay

func NewDisplay(s Size) *Display

func (*Display) At

func (dis *Display) At(x, y int) color.Color

func (*Display) Bounds

func (dis *Display) Bounds() image.Rectangle

func (*Display) ColorModel

func (dis *Display) ColorModel() color.Model

func (*Display) Pix

func (dis *Display) Pix() []uint8

func (*Display) Set

func (dis *Display) Set(x, y int, c color.Color)

func (*Display) SetRGBA

func (dis *Display) SetRGBA(x, y int, c color.RGBA)

func (*Display) Swap

func (dis *Display) Swap()

type GUIObject

type GUIObject interface {
	Render()
	Resize(Rect)
}

type Grid

type Grid interface {
	GUIObject
	Add(...GUIObject)
}

func NewHGrid

func NewHGrid(cols, rowH uint32) Grid

type HCT

type HCT interface {
	GUIObject
	SetHead(ui GUIObject, size int32)
	SetCenter(ui GUIObject)
	SetTail(ui GUIObject, size int32)
}

func NewVerticalHCT

func NewVerticalHCT() HCT

type Image

type Image interface {
	GUIObject
}

func NewDisplayViewer

func NewDisplayViewer(display *Display) Image

type Joystick

type Joystick struct {
	ON                               bool
	U, D, R, L, F, F2, Select, Start bool
}

type Label

type Label interface {
	GUIObject
	SetText(txt string)
	GetText() string
	SetForeground(c color.RGBA)
}

func NewLabel

func NewLabel(txt string, aling LabelAlign) Label

type LabelAlign

type LabelAlign int
const (
	Left LabelAlign = iota
	Center
	Right
)

type MouseTarget

type MouseTarget interface {
	Rect() Rect
	OnMouseOver(bool)
	OnMouseClick(bool)
}

type Point

type Point struct{ X, Y int32 }

type Rect

type Rect struct{ X, Y, W, H int32 }

func (Rect) In

func (r Rect) In(p Point) bool

func (Rect) Relative

func (r Rect) Relative(new Rect) Rect

type Size

type Size struct{ W, H int32 }

type Tabs

type Tabs interface {
	GUIObject
	Tabs() []MouseTarget
	AddTabs(name string, panel GUIObject)
}

func NewTabs

func NewTabs() Tabs

type Text

type Text interface {
	GUIObject
	SetText(txt string)
	SetForeground(c color.Color)
}

func NewText

func NewText(t string) Text

type Window

type Window interface {
	SetMainUI(GUIObject)
	AddMouseListeners(...MouseTarget)
	SetOnKey(func(sdl.Scancode))
}

func NewWindow

func NewWindow(name string, size Size) Window

Jump to

Keyboard shortcuts

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