package tins2020 import "github.com/veandco/go-sdl2/sdl" type Control interface { Init(*Context) error Handle(*Context, sdl.Event) Render(*Context) } type ControlBase struct { Bounds Rectangle IsMouseOver bool } func (b *ControlBase) Init(*Context) error { return nil } func (b *ControlBase) Handle(ctx *Context, event sdl.Event) { switch e := event.(type) { case *sdl.MouseMotionEvent: b.IsMouseOver = b.Bounds.IsPointInside(e.X, e.Y) } } func (b *ControlBase) Render(*Context) {}