ui

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2020 License: Apache-2.0 Imports: 4 Imported by: 5

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 *goecs.Entity) FlatButton {
		return e.Get(TYPE.FlatButton).(FlatButton)
	},

	ButtonColor: func(e *goecs.Entity) ButtonColor {
		return e.Get(TYPE.ButtonColor).(ButtonColor)
	},

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

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

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

	ProgressBar: func(e *goecs.Entity) ProgressBar {
		return e.Get(TYPE.ProgressBar).(ProgressBar)
	},

	ProgressBarColor: func(e *goecs.Entity) ProgressBarColor {
		return e.Get(TYPE.ProgressBarColor).(ProgressBarColor)
	},

	ProgressBarHoverColor: func(e *goecs.Entity) ProgressBarHoverColor {
		return e.Get(TYPE.ProgressBarHoverColor).(ProgressBarHoverColor)
	},

	ControlState: func(e *goecs.Entity) ControlState {
		return e.Get(TYPE.ControlState).(ControlState)
	},
}

Get a ui component

View Source
var TYPE = types{
	FlatButton:            reflect.TypeOf(FlatButton{}),
	ButtonColor:           reflect.TypeOf(ButtonColor{}),
	ButtonHoverColors:     reflect.TypeOf(ButtonHoverColors{}),
	SpriteButton:          reflect.TypeOf(SpriteButton{}),
	Text:                  reflect.TypeOf(Text{}),
	ProgressBar:           reflect.TypeOf(ProgressBar{}),
	ProgressBarColor:      reflect.TypeOf(ProgressBarColor{}),
	ProgressBarHoverColor: reflect.TypeOf(ProgressBarHoverColor{}),
	ControlState:          reflect.TypeOf(ControlState{}),
}

TYPE hold the reflect.Type for our ui components

Functions

This section is empty.

Types

type ButtonColor

type ButtonColor struct {
	Solid    color.Solid    // Solid is a color.Solid
	Gradient color.Gradient // Gradient is a color.Gradient
	Border   color.Solid    // Border is the border color.Solid
	Text     color.Solid    // Text is the text color.Solid
}

ButtonColor represent the colors of the button

type ButtonHoverColors

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

ButtonHoverColors is the hover colors for a FlatButton

type ControlState added in v0.1.12

type ControlState struct {
	Hover    bool
	Clicked  bool
	Disabled bool
	Checked  bool
	Focused  bool
}

ControlState is the state of UI element

type FlatButton

type FlatButton struct {
	Shadow   geometry.Size // Shadow is the offset of the shadow on the ui.FlatButton
	CheckBox bool          // CheckBox indicates if this is a checkbox
	Group    string        // Group indicates if this has a option group
	Sound    string        // Sound is the click sound
	Volume   float32       // Volume is the volume for click Sound
	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 ProgressBar added in v0.1.9

type ProgressBar struct {
	Min     float32       // Min is the minimum value for the ui.ProgressBar
	Max     float32       // Max is the maximum value for the ui.ProgressBar
	Current float32       // Current is the current value for the ui.ProgressBar
	Shadow  geometry.Size // Shadow is the offset of the shadow on the ui.ProgressBar
	Sound   string        // Sound is the click sound
	Volume  float32       // Volume is the volume for click Sound
	Event   interface{}   // Event is the event that will be trigger when this bar is click
}

ProgressBar is a component representing a progress bar

type ProgressBarColor added in v0.1.9

type ProgressBarColor struct {
	Solid    color.Solid    // Solid is a color.Solid
	Gradient color.Gradient // Gradient is a color.Gradient
	Empty    color.Solid    // Empty is the empty bar color
	Border   color.Solid    // Border is a color.Solid
}

ProgressBarColor represent the colors of the ui.ProgressBar

type ProgressBarHoverColor added in v0.1.9

type ProgressBarHoverColor struct {
	Normal   ProgressBarColor // Normal is the ui.ProgressBarColor on normal state
	Hover    ProgressBarColor // Hover is the  ui.ProgressBarColor on hover state
	Clicked  ProgressBarColor // Clicked is the  ui.ProgressBarColor on clicked state
	Disabled ProgressBarColor // Disabled is the  ui.ProgressBarColor on disabled state
}

ProgressBarHoverColor is the hover colors for a ui.ProgressBar

type SpriteButton

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
	Clicked  string      // Clicked is the sprite on clicked state
	Focused  string      // Focused is the sprite on focused state
	Disabled string      // Disable is teh sprite on disabled state
	Scale    float32     // Scale is the Sprite scale
	Sound    string      // Sound is the click sound
	Volume   float32     // Volume is the volume for click Sound
	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