Added support for getting & setting location of Renderer.
This commit is contained in:
parent
ddf9476920
commit
f56c5dd389
@ -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)
|
||||
}
|
||||
|
||||
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 {
|
||||
texture, ok := t.(*texture)
|
||||
if !ok {
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
func (r *Renderer) Location() geom.Point {
|
||||
x, y := r.window.GetPosition()
|
||||
return geom.Pt(int(x), int(y))
|
||||
}
|
||||
|
||||
func (r *Renderer) Move(to geom.Point) {
|
||||
r.window.SetPosition(int32(to.X), int32(to.Y))
|
||||
}
|
||||
|
||||
func (r *Renderer) Rectangle(rect geom.RectangleF32, c color.Color, thickness float32) {
|
||||
r.SetDrawColorGo(c)
|
||||
if rect.Dx() == 0 { // SDL doesn't draw a 1 px wide line when Dx() == 0 && thickness == 1
|
||||
|
@ -31,6 +31,8 @@ type Renderer interface {
|
||||
DrawTexturePointOptions(t Texture, p geom.PointF32, opts DrawOptions)
|
||||
FillRectangle(r geom.RectangleF32, c color.Color)
|
||||
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)
|
||||
RenderTo(Texture)
|
||||
RenderToDisplay()
|
||||
|
Loading…
Reference in New Issue
Block a user