Documentation ¶
Index ¶
- func NewIntText(f *render.Font, str *int, x, y float64, layers ...int) *entities.Doodad
- func NewRawText(f *render.Font, str fmt.Stringer, x, y float64, layers ...int) *entities.Doodad
- func NewText(f *render.Font, str string, x, y float64, layers ...int) *entities.Doodad
- func Revert(b Btn, n int) error
- type Box
- type Btn
- type Generator
- type Group
- type Option
- func AddChildren(cg ...Generator) Option
- func And(opts ...Option) Option
- func AndMod(m mod.Transform) Option
- func Binding(s string, bnd event.Bindable) Option
- func CID(c event.CID) Option
- func Clear() Option
- func Click(bnd event.Bindable) Option
- func Color(c color.Color) Option
- func DisallowRevert() Option
- func Font(f *render.Font) Option
- func Height(h float64) Option
- func Layers(ls ...int) Option
- func Mod(m mod.Transform) Option
- func Offset(x, y float64) Option
- func Pos(x, y float64) Option
- func Renderable(r render.Modifiable) Option
- func Text(s string) Option
- func Toggle(r1, r2 render.Modifiable, isChecked *bool) Option
- func ToggleGroup(gr *Group) Option
- func ToggleList(chosen *int, rs ...render.Modifiable) Option
- func TxtOff(x, y float64) Option
- func VGradient(c1, c2 color.Color) Option
- func Width(w float64) Option
- type TextBox
- func (b *TextBox) Init() event.CID
- func (b *TextBox) SetOffsets(txtX, txtY float64)
- func (b *TextBox) SetPos(x, y float64)
- func (b *TextBox) SetSpace(sp *collision.Space)
- func (b *TextBox) ShiftX(x float64)
- func (b *TextBox) ShiftY(y float64)
- func (b *TextBox) X() float64
- func (b *TextBox) Y() float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewIntText ¶
NewIntText creates some uitext from an integer
func NewRawText ¶
NewRawText creates some uitext from a stringer
Types ¶
type Box ¶
type Box struct { entities.Solid mouse.CollisionPhase // contains filtered or unexported fields }
Box is a basic implementation of btn
func (*Box) GetRenderable ¶
func (b *Box) GetRenderable() render.Renderable
GetRenderable returns the box's renderable
func (*Box) Metadata ¶
Metadata accesses the value, and whether it existed, for a given metadata key
func (*Box) SetMetadata ¶
SetMetadata sets the metadata for some key to some value. Empty value strings will not be stored.
type Btn ¶
type Btn interface { event.Caller render.Positional GetRenderable() render.Renderable GetSpace() *collision.Space SetMetadata(string, string) Metadata(string) (string, bool) }
Btn defines a button for use in the UI
type Generator ¶
type Generator struct {
X, Y float64
W, H float64
TxtX, TxtY float64
Color color.Color
Color2 color.Color
ProgressFunc func(x, y, w, h int) float64
Mod mod.Transform
R render.Modifiable
R1 render.Modifiable
R2 render.Modifiable
RS []render.Modifiable
Cid event.CID
Font *render.Font
Layers []int
Text string
Children []Generator
Bindings map[string][]event.Bindable
Trigger string
Toggle *bool
ListChoice *int
Group *Group
DisallowRevert bool
}
A Generator defines the variables used to create buttons from optional arguments
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group links several btns together
type Option ¶
An Option is used to populate generator fields prior to generation of a button
func AddChildren ¶
AddChildren adds a generator to create a child btn
func AndMod ¶
AndMod combines the input modification with whatever existing modifications exist for the generator, as opposed to Mod which resets previous modifications.
func DisallowRevert ¶
func DisallowRevert() Option
Todo: change this to AllowRevert, and reverse the default behavior
func Mod ¶
Mod sets the modifications to apply to the initial color box for the button to be generated
func Renderable ¶
func Renderable(r render.Modifiable) Option
Renderable sets a renderable to use as a base image for the button. Not compatible with Color / Toggle.
func Toggle ¶
func Toggle(r1, r2 render.Modifiable, isChecked *bool) Option
Toggle sets that the type of the button toggles between two modifiables when it is clicked. The boolean behind isChecked is updated according to the state of the button. Todo: the copies here should be optional
func ToggleGroup ¶
ToggleGroup sets the group that this button is linked with
func ToggleList ¶
func ToggleList(chosen *int, rs ...render.Modifiable) Option
ToggleList sets the togglable choices for a button
type TextBox ¶
TextBox is a Box with an associated text element
func NewTextBox ¶
func NewTextBox(cid event.CID, x, y, w, h, txtX, txtY float64, f *render.Font, r render.Renderable, layers ...int) *TextBox
NewTextBox creates a textbox
func (*TextBox) SetOffsets ¶
SetOffsets changes the text position within the box
func (*TextBox) SetSpace ¶
SetSpace overwrites entities.Solid, pointing this button to use the mouse collision Rtree instead of the entity collision space.
func (*TextBox) ShiftX ¶
ShiftX shifts the box by x. The associated text is attached and so will be moved along by default
func (*TextBox) ShiftY ¶
ShiftY shifts the box by y. The associated text is attached and so will be moved along by default