ui

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ui contains the components for displaying ui elements

Index

Constants

View Source
const (
	LeftHAlignment   = HAlignment(iota) // LeftHAlignment indicates left Text HAlignment
	RightHAlignment                     // RightHAlignment indicates right Text HAlignment
	CenterHAlignment                    // RightHAlignment indicates center Text HAlignment
)

Horizontal Text alignments

View Source
const (
	BottomVAlignment = VAlignment(iota) // BottomVAlignment indicates bottom text.VAlignment
	TopVAlignment                       // TopVAlignment indicates top text.VAlignment
	MiddleVAlignment                    // MiddleVAlignment indicates middle text.VAlignment
)

Vertical Text alignments

Variables

View Source
var Get = gets{

	FlatButton: func(e *entity.Entity) FlatButton {
		return e.Get(TYPE.FlatButton).(FlatButton)
	},

	ButtonHoverColors: func(e *entity.Entity) ButtonHoverColors {
		return e.Get(TYPE.ButtonHoverColors).(ButtonHoverColors)
	},

	SpriteButton: func(e *entity.Entity) SpriteButton {
		return e.Get(TYPE.SpriteButton).(SpriteButton)
	},

	Text: func(e *entity.Entity) Text {
		return e.Get(TYPE.Text).(Text)
	},
}

Get a ui component

View Source
var TYPE = types{
	FlatButton:        reflect.TypeOf(FlatButton{}),
	ButtonHoverColors: reflect.TypeOf(ButtonHoverColors{}),
	SpriteButton:      reflect.TypeOf(SpriteButton{}),
	Text:              reflect.TypeOf(Text{}),
}

TYPE hold the reflect.Type for our ui components

Functions

This section is empty.

Types

type ButtonColor added in v0.1.1

type ButtonColor struct {
	Solid    color.Solid    // Solid is a color.Solid
	Gradient color.Gradient // Gradient is a color.Gradient
}

ButtonColor represent the colors of the button

type ButtonHoverColors added in v0.1.1

type ButtonHoverColors struct {
	Normal ButtonColor // Normal is the ui.ButtonColor on normal state
	Hover  ButtonColor // Hover is the  ui.ButtonColor on hover state
}

ButtonHoverColors is the hover colors for a FlatButton

type FlatButton

type FlatButton struct {
	Shadow geometry.Size // Shadow is the offset of the shadow on the ui.FlatButton
	Event  interface{}   // Event is the event that will be trigger when this button is click
}

FlatButton is a UI element for displaying a button

type HAlignment

type HAlignment int

HAlignment horizontal alignment for a Text

type SpriteButton added in v0.1.1

type SpriteButton struct {
	Sheet  string      // Sheet is the Sprite sheet
	Normal string      // Normal is the sprite on normal state
	Hover  string      // Hover is the  sprite on hover state
	Scale  float32     // Scale is the Sprite scale
	Sound  string      // Sound is the click sound for this SpriteButton
	Event  interface{} // Event is the event that will be trigger when this button is click
}

SpriteButton is a UI element for displaying a image base button

type Text

type Text struct {
	String     string     // String is the Text string
	Size       float32    // Size is the Text size
	Font       string     // Font is the font to use
	VAlignment VAlignment // VAlignment is the text.VAlignment
	HAlignment HAlignment // HAlignment is the text.HAlignment
}

Text is a graphical text to drawn on the screen

type VAlignment

type VAlignment int

VAlignment vertical alignment for a Text

Jump to

Keyboard shortcuts

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