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

Function FilledCircleColor

utils.go:837–872  ·  view source on GitHub ↗
(x, y, radius int32, color Color)

Source from the content-addressed store, hash-verified

835}
836
837func FilledCircleColor(x, y, radius int32, color Color) {
838
839 vertexCount := 32
840
841 vertices = append(vertices[:0], sdl.Vertex{
842 Position: sdl.FPoint{
843 float32(x),
844 float32(y),
845 },
846 Color: color.SDLFColor(),
847 })
848
849 indices = indices[:0]
850
851 for i := range vertexCount - 1 {
852 vertices = append(vertices, sdl.Vertex{
853 Position: sdl.FPoint{
854 float32(x) + float32(math.Sin(float64(i)/float64(vertexCount-1)*math.Pi*2)*float64(radius)),
855 float32(y) + float32(math.Cos(float64(i)/float64(vertexCount-1)*math.Pi*2)*float64(radius)),
856 },
857 Color: color.SDLFColor(),
858 })
859 if i < vertexCount-2 {
860 indices = append(indices, 0, int32(i+1), int32(i+2))
861 } else if i == vertexCount-2 {
862 indices = append(indices, 0, int32(i+1), 1)
863 }
864 }
865
866 err := globals.Renderer.RenderGeometry(globals.PlainWhiteTexture, vertices, indices)
867
868 if err != nil {
869 panic(err)
870 }
871
872}
873
874func RoundedBoxColor(renderer *sdl.Renderer, x1 int32, y1 int32, x2 int32, y2 int32, rad int32, color Color) {
875 // gfx.RoundedBoxColor(globals.Renderer, int32(rect.X), int32(rect.Y), int32(rect.X+rect.W), int32(rect.Y+rect.H), 4, highlightColor)

Callers 1

DrawMethod · 0.85

Calls 1

SDLFColorMethod · 0.80

Tested by

no test coverage detected