Added Line to Renderer.
This commit is contained in:
parent
7aa88e2dc6
commit
72138bb8e3
@ -279,6 +279,10 @@ func (r *Renderer) FillRectangle(rect geom.RectangleF32, c color.Color) {
|
||||
allg5.DrawFilledRectangle(rect.Min.X, rect.Min.Y, rect.Max.X, rect.Max.Y, newColor(c))
|
||||
}
|
||||
|
||||
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) mustGetBitmap(t ui.Texture) *allg5.Bitmap {
|
||||
texture, ok := t.(*texture)
|
||||
if !ok {
|
||||
|
@ -361,6 +361,11 @@ func (r *Renderer) FillRectangle(rect geom.RectangleF32, c color.Color) {
|
||||
r.renderer.FillRect(SDLRectanglePtr(rect))
|
||||
}
|
||||
|
||||
func (r *Renderer) Line(p, q geom.PointF32, color color.Color, thickness float32) {
|
||||
r.SetDrawColorGo(color)
|
||||
r.renderer.DrawLineF(p.X, p.Y, p.X, p.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
|
||||
|
@ -29,6 +29,7 @@ type Renderer interface {
|
||||
DrawTexturePoint(t Texture, p geom.PointF32)
|
||||
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)
|
||||
Rectangle(r geom.RectangleF32, c color.Color, thickness float32)
|
||||
RenderTo(Texture)
|
||||
RenderToDisplay()
|
||||
|
Loading…
Reference in New Issue
Block a user