Documentation ¶
Index ¶
- func New(ctx *scene.Context, opts ...Option) *entities.Entity
- type Generator
- type Option
- func AddChildren(cg ...Generator) Option
- func And(opts ...Option) Option
- func AndMod(m mod.Transform) Option
- func Binding[Payload any](ev event.EventID[Payload], bnd event.Bindable[*entities.Entity, Payload]) Option
- func CID(c event.CallerID) Option
- func Clear() Option
- func Click(bnd event.Bindable[*entities.Entity, *mouse.Event]) Option
- func Color(c color.Color) Option
- func FitText(buffer int) Option
- func Font(f *render.Font) Option
- func Height(h float64) Option
- func Label(l collision.Label) 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 TextPtr(s *string) Option
- func TextStringer(s fmt.Stringer) Option
- func TxtOff(x, y float64) Option
- func VGradient(c1, c2 color.Color) Option
- func Width(w float64) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
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.CallerID
Font *render.Font
Layers []int
Text string
TextPtr *string
TextStringer fmt.Stringer
Children []Generator
Bindings []func(ctx *scene.Context, caller *entities.Entity) event.Binding
Trigger string
Shape shape.Shape
Label collision.Label
}
A Generator defines the variables used to create buttons from optional arguments
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 Binding ¶
func Binding[Payload any](ev event.EventID[Payload], bnd event.Bindable[*entities.Entity, Payload]) Option
Binding appends a function to be called when a specific event is triggered.
func FitText ¶
FitText adjusts a btn's width, given it has text and font defined, to be large enough for the given text plus the provided buffer
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 TextStringer ¶
TextStringer sets the text of the generated button to use a fmt.Stringer String call