last_light/game/ui/ui.go

31 lines
443 B
Go
Raw Normal View History

2024-04-21 03:48:58 +03:00
package ui
import (
2024-05-06 20:43:35 +03:00
"mvvasilev/last_light/engine"
2024-04-21 03:48:58 +03:00
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-05-06 21:47:20 +03:00
Position() engine.Position
Size() engine.Size
2024-04-24 17:11:33 +03:00
Input(e *tcell.EventKey)
2024-05-06 20:43:35 +03:00
engine.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())
2024-05-12 23:22:39 +03:00
UIElement
2024-04-21 03:48:58 +03:00
}