package tins2020 import "github.com/veandco/go-sdl2/sdl" type Point struct { sdl.Point } func (p Point) Add(q Point) Point { return Pt(p.X+q.X, p.Y+q.Y) } func (p Point) In(r Rectangle) bool { return r.IsPointInsidePt(p) } func (p Point) ToPtF() PointF { return PtF(float32(p.X), float32(p.Y)) } type PointF struct { sdl.FPoint } func (p PointF) Add(q PointF) PointF { return PtF(p.X+q.X, p.Y+q.Y) } func (p PointF) Mul(f float32) PointF { return PtF(f*p.X, f*p.Y) } func (p PointF) Sub(q PointF) PointF { return PtF(p.X-q.X, p.Y-q.Y) } func Pt(x, y int32) Point { return Point{sdl.Point{X: x, Y: y}} } func PtF(x, y float32) PointF { return PointF{sdl.FPoint{X: x, Y: y}} } func PtPtr(x, y int32) *Point { p := Pt(x, y) return &p } func PtFPtr(x, y float32) *PointF { p := PtF(x, y) return &p }