Skip to content

Commit 01fdf84

Browse files
Try rendering system bodies as solids
1 parent 283fde4 commit 01fdf84

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

Pulsar4X/Pulsar4X.Client/Rendering/Icons/SysBodyIcon.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,42 @@ public override void OnFrameUpdate(Matrix matrix, Camera camera)
108108
Scale = _viewRadius * 0.01f;
109109
base.OnFrameUpdate(matrix, camera);
110110
}
111+
112+
public override void Draw(IntPtr rendererPtr, Camera camera)
113+
{
114+
if (DrawShapes == null || DrawShapes.Length == 0)
115+
return;
116+
117+
// Draw filled circle for non-asteroid body types
118+
if (_bodyType != BodyType.Asteroid)
119+
{
120+
var shape = DrawShapes[0];
121+
if (shape.Points != null && shape.Points.Length > 2)
122+
{
123+
int cx = ViewScreenPos.X;
124+
int cy = ViewScreenPos.Y;
125+
int radius = (int)(Scale * 100);
126+
127+
if (radius > 0)
128+
{
129+
// Brighter fill color derived from the body's base color
130+
byte fillR = (byte)Math.Min(255, shape.Color.R + 80);
131+
byte fillG = (byte)Math.Min(255, shape.Color.G + 80);
132+
byte fillB = (byte)Math.Min(255, shape.Color.B + 80);
133+
SDL.SetRenderDrawColor(rendererPtr, fillR, fillG, fillB, shape.Color.A);
134+
for (int y = -radius; y <= radius; y++)
135+
{
136+
int xSpan = (int)Math.Sqrt(radius * radius - y * y);
137+
SDL.RenderLine(rendererPtr, cx - xSpan, cy + y, cx + xSpan, cy + y);
138+
}
139+
}
140+
}
141+
return; // skip outline for filled bodies
142+
}
143+
144+
// Draw outline for asteroids
145+
base.Draw(rendererPtr, camera);
146+
}
111147
}
112148
}
113149

0 commit comments

Comments
 (0)