mirror of
https://github.com/mvvasilev/last_light.git
synced 2025-04-19 12:49:52 +03:00
28 lines
531 B
Go
28 lines
531 B
Go
package engine
|
|
|
|
import (
|
|
"github.com/gdamore/tcell/v2/views"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type ArbitraryDrawable struct {
|
|
id uuid.UUID
|
|
drawingInstructions func(v views.View)
|
|
}
|
|
|
|
func CreateDrawingInstructions(instructions func(v views.View)) *ArbitraryDrawable {
|
|
a := new(ArbitraryDrawable)
|
|
|
|
a.id = uuid.New()
|
|
a.drawingInstructions = instructions
|
|
|
|
return a
|
|
}
|
|
|
|
func (ab *ArbitraryDrawable) UniqueId() uuid.UUID {
|
|
return ab.id
|
|
}
|
|
|
|
func (ab *ArbitraryDrawable) Draw(v views.View) {
|
|
ab.drawingInstructions(v)
|
|
}
|