1
0
Fork 0

feat(ui): implement new ui system

This commit is contained in:
Henrik Hautakoski 2025-10-27 20:17:13 +01:00
parent d407eaad8b
commit 6cf0e4abb4
11 changed files with 430 additions and 113 deletions

26
game/ui/base/focus.go Normal file
View 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
}