feat(ui): implement new ui system
This commit is contained in:
parent
d407eaad8b
commit
6cf0e4abb4
11 changed files with 430 additions and 113 deletions
26
game/ui/base/focus.go
Normal file
26
game/ui/base/focus.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package base
|
||||
|
||||
// WithFocus is a base component that implements the Focusable interface
|
||||
type WithFocus struct {
|
||||
focus bool
|
||||
}
|
||||
|
||||
// SetFocus - Set the focus value on this component
|
||||
func (f *WithFocus) SetFocus(value bool) {
|
||||
f.focus = value
|
||||
}
|
||||
|
||||
// Focus - focus this component, syntactic sugar for f.SetFocus(true)
|
||||
func (f *WithFocus) Focus() {
|
||||
f.SetFocus(true)
|
||||
}
|
||||
|
||||
// Unfocus - unfocus this component, syntactic sugar for f.SetFocus(false)
|
||||
func (f *WithFocus) Unfocus() {
|
||||
f.SetFocus(false)
|
||||
}
|
||||
|
||||
// HasFocus - Returns true if this component has focus.
|
||||
func (f WithFocus) HasFocus() bool {
|
||||
return f.focus
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue