Compare commits

...

1 Commits

3 changed files with 20 additions and 0 deletions

View File

@ -287,6 +287,15 @@ func (r *Renderer) Line(p, q geom.PointF32, color color.Color, thickness float32
allg5.DrawLine(p.X, p.Y, q.X, q.Y, newColor(color), thickness) allg5.DrawLine(p.X, p.Y, q.X, q.Y, newColor(color), thickness)
} }
func (r *Renderer) Location() geom.Point {
x, y := r.disp.Position()
return geom.Pt(x, y)
}
func (r *Renderer) Move(to geom.Point) {
r.disp.SetPosition(to.X, to.Y)
}
func (r *Renderer) mustGetBitmap(t ui.Texture) *allg5.Bitmap { func (r *Renderer) mustGetBitmap(t ui.Texture) *allg5.Bitmap {
texture, ok := t.(*texture) texture, ok := t.(*texture)
if !ok { if !ok {

View File

@ -374,6 +374,15 @@ func (r *Renderer) Line(p, q geom.PointF32, color color.Color, thickness float32
r.renderer.DrawLineF(p.X, p.Y, q.X, q.Y) r.renderer.DrawLineF(p.X, p.Y, q.X, q.Y)
} }
func (r *Renderer) Location() geom.Point {
x, y := r.renderer.GetPosition()
return geom.Pt(int(x), int(y))
}
func (r *Renderer) Move(to geom.Point) {
r.renderer.SetPosition(int32(to.X), int32(to.Y))
}
func (r *Renderer) Rectangle(rect geom.RectangleF32, c color.Color, thickness float32) { func (r *Renderer) Rectangle(rect geom.RectangleF32, c color.Color, thickness float32) {
r.SetDrawColorGo(c) r.SetDrawColorGo(c)
if rect.Dx() == 0 { // SDL doesn't draw a 1 px wide line when Dx() == 0 && thickness == 1 if rect.Dx() == 0 { // SDL doesn't draw a 1 px wide line when Dx() == 0 && thickness == 1

View File

@ -31,6 +31,8 @@ type Renderer interface {
DrawTexturePointOptions(t Texture, p geom.PointF32, opts DrawOptions) DrawTexturePointOptions(t Texture, p geom.PointF32, opts DrawOptions)
FillRectangle(r geom.RectangleF32, c color.Color) FillRectangle(r geom.RectangleF32, c color.Color)
Line(p, q geom.PointF32, color color.Color, thickness float32) Line(p, q geom.PointF32, color color.Color, thickness float32)
Location() geom.Point
Move(geom.Point)
Rectangle(r geom.RectangleF32, c color.Color, thickness float32) Rectangle(r geom.RectangleF32, c color.Color, thickness float32)
RenderTo(Texture) RenderTo(Texture)
RenderToDisplay() RenderToDisplay()