MCPcopy Create free account
hub / github.com/SolarLune/masterplan / ThickLine

Function ThickLine

utils.go:784–835  ·  view source on GitHub ↗
(start, end Vector, thickness float32, color Color)

Source from the content-addressed store, hash-verified

782var indices []int32
783
784func ThickLine(start, end Vector, thickness float32, color Color) {
785
786 th := thickness
787
788 diagStart1 := start.Sub(end).Unit().Rotate(math.Pi / 4).Scale(th)
789 diagStart2 := start.Sub(end).Unit().Rotate(-math.Pi / 4).Scale(th)
790
791 diagEnd1 := end.Sub(start).Unit().Rotate(math.Pi / 4).Scale(th)
792 diagEnd2 := end.Sub(start).Unit().Rotate(-math.Pi / 4).Scale(th)
793
794 vertices = append(vertices[:0],
795 sdl.Vertex{
796 Position: sdl.FPoint{
797 start.X + diagStart1.X,
798 start.Y + diagStart1.Y,
799 },
800 Color: color.SDLFColor(),
801 },
802
803 sdl.Vertex{
804 Position: sdl.FPoint{
805 start.X + diagStart2.X,
806 start.Y + diagStart2.Y,
807 },
808 Color: color.SDLFColor(),
809 },
810
811 sdl.Vertex{
812 Position: sdl.FPoint{
813 end.X + diagEnd1.X,
814 end.Y + diagEnd1.Y,
815 },
816 Color: color.SDLFColor(),
817 },
818
819 sdl.Vertex{
820 Position: sdl.FPoint{
821 end.X + diagEnd2.X,
822 end.Y + diagEnd2.Y,
823 },
824 Color: color.SDLFColor(),
825 },
826 )
827
828 indices = append(indices[:0],
829 0, 1, 3,
830 1, 2, 3,
831 )
832
833 globals.Renderer.RenderGeometry(globals.PlainWhiteTexture, vertices, indices)
834
835}
836
837func FilledCircleColor(x, y, radius int32, color Color) {
838

Callers 10

DrawMethod · 0.85
PostDrawMethod · 0.85
DrawMethod · 0.85
DrawGridMethod · 0.85
ThickRectFunction · 0.85
DrawMethod · 0.85
DrawMethod · 0.85
DrawMethod · 0.85
DrawMethod · 0.85
DrawMethod · 0.85

Calls 5

ScaleMethod · 0.80
UnitMethod · 0.80
SDLFColorMethod · 0.80
RotateMethod · 0.45
SubMethod · 0.45

Tested by

no test coverage detected