#pragma once #include #include #include "WorldCoordinates.h" class QPainter; // The handful of world-space shapes the game view and the balancing tool's arena // view draw identically: a ship, its health bar, a piece of debris, a sensor range. // // Shared because the arena exists to eyeball combat, which only works while a ship // there looks like a ship in the game — if these drift, the balancing tool quietly // stops representing what it is measuring. Deliberately kept to shapes that are // genuinely the same in both: the two views differ on selection highlights, beams // and target lines, and those stay with each view. // // Free functions taking explicit values, with no state and no simulation: each // view keeps its own iteration and layer order. Sizes derive from the tile size so // everything scales with the view (REQ-GW-TILE-SIZE). // Distance from a ship's centre to its nose, in pixels. The selection ring and the // health bar are positioned from this, so callers need it whether or not they are // the ones drawing the body. float getShipForwardExtentPx(const WorldCoordinates& coordinates); // Radius of a piece of debris, in pixels. Shared so the selection ring around // debris cannot drift from the debris it is meant to circle. float getDebrisRadiusPx(const WorldCoordinates& coordinates); // Draws a ship as a triangle at `center` (widget space), pointing along // `facing_radians`. void drawShipBody(QPainter& painter, const WorldCoordinates& coordinates, QPointF center, float facing_radians, const QColor& fill, const QColor& outline); // Draws a health bar: a dark track with `fraction` of it filled, red for an enemy // and green for the player. A negative fraction is clamped to empty. void drawHealthBar(QPainter& painter, const WorldCoordinates& coordinates, qreal left, qreal top, qreal width, float fraction, bool isEnemy); // Draws a piece of debris as a small brown circle at `center` (widget space). void drawDebrisMarker(QPainter& painter, const WorldCoordinates& coordinates, QPointF center); // Draws a ship's sensor range as a faint circle in the ship's own outline colour, // so overlapping ranges stay distinguishable. void drawSensorRange(QPainter& painter, const WorldCoordinates& coordinates, QPointF center, float range_tiles, const QColor& shipOutline);