last_light/ui/ui.go

32 lines
481 B
Go
Raw Normal View History

2024-04-21 03:48:58 +03:00
package ui
import (
"mvvasilev/last_light/render"
2024-04-21 03:48:58 +03:00
"mvvasilev/last_light/util"
2024-04-24 17:11:33 +03:00
"github.com/gdamore/tcell/v2"
2024-04-21 03:48:58 +03:00
)
type UIElement interface {
MoveTo(x, y int)
2024-04-21 03:48:58 +03:00
Position() util.Position
2024-04-24 17:11:33 +03:00
Size() util.Size
Input(e *tcell.EventKey)
render.Drawable
2024-04-24 17:11:33 +03:00
}
type UIHighlightableElement interface {
IsHighlighted() bool
Highlight()
Unhighlight()
SetHighlighted(highlighted bool)
UIElement
}
type UISelectableElement interface {
Select()
OnSelect(func())
UIHighlightableElement
2024-04-21 03:48:58 +03:00
}