# baanista/solarwars architecture

> Architecture diagram of the GitHub repository baanista/solarwars, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/baanista/solarwars
- Repository: https://github.com/baanista/solarwars

## Overview

SolarWars is an SFML/TGUI space-simulation application. Its visible entry point creates and runs a Launcher; the domain model represents a galaxy of solar systems and celestial objects, with generation helpers for random or Solar-like systems and orbital setup. The excerpts establish the entry call and generation behavior, while several runtime implementations are only indexed or unsampled, so their interactions are not drawn as confirmed calls.

Main entry points: [`src/solarsystem.hpp`](https://github.com/baanista/solarwars/blob/main/src/solarsystem.hpp) (Solar System), [`src/celestial.hpp`](https://github.com/baanista/solarwars/blob/main/src/celestial.hpp) (Celestial Body), [`src/spaceobject.cpp`](https://github.com/baanista/solarwars/blob/main/src/spaceobject.cpp) (Space Object), [`src/systemGenerators.cpp`](https://github.com/baanista/solarwars/blob/main/src/systemGenerators.cpp) (System Generators)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["Program Entry<br/>[Main.cpp]"]
  node_launcher["Launcher<br/>[launcher.cpp]"]
  node_global["Shared Font<br/>[global.hpp]"]
end

subgraph group_world["Galaxy Model"]
  node_galaxy["Galaxy<br/>[galaxy.hpp]"]
  node_system["Solar System<br/>[solarsystem.hpp]"]
end

subgraph group_bodies["Celestial Model"]
  node_spaceobject["Space Object<br/>[spaceobject.cpp]"]
  node_celestial["Celestial Body<br/>[celestial.hpp]"]
  node_planetoid["Planetoid<br/>[planetoid.hpp]"]
  node_sun["Sun<br/>[sun.hpp]"]
end

subgraph group_generation["System Generation"]
  node_generators["System Generators"]
  node_random["Random Generators"]
end

node_player(("Player"))

node_player -.->|"starts"| node_main
node_main -->|"runs"| node_launcher
node_galaxy -->|"tracks systems"| node_system
node_system -->|"tracks objects"| node_spaceobject
node_system -->|"tracks bodies"| node_celestial
node_system -->|"tracks planetoids"| node_planetoid
node_system -->|"tracks suns"| node_sun
node_celestial -->|"extends"| node_spaceobject
node_planetoid -->|"extends"| node_celestial
node_sun -->|"extends"| node_celestial
node_generators -->|"populates systems"| node_system
node_generators -->|"creates bodies"| node_planetoid
node_generators -->|"chooses parameters"| node_random
node_celestial -->|"updates motion"| node_spaceobject
node_spaceobject -.->|"uses font"| node_global

click node_main "https://github.com/baanista/solarwars/blob/main/src/Main.cpp"
click node_launcher "https://github.com/baanista/solarwars/blob/main/src/launcher.cpp"
click node_galaxy "https://github.com/baanista/solarwars/blob/main/src/galaxy.hpp"
click node_system "https://github.com/baanista/solarwars/blob/main/src/solarsystem.hpp"
click node_spaceobject "https://github.com/baanista/solarwars/blob/main/src/spaceobject.cpp"
click node_celestial "https://github.com/baanista/solarwars/blob/main/src/celestial.hpp"
click node_planetoid "https://github.com/baanista/solarwars/blob/main/src/planetoid.hpp"
click node_sun "https://github.com/baanista/solarwars/blob/main/src/sun.hpp"
click node_generators "https://github.com/baanista/solarwars/blob/main/src/systemGenerators.cpp"
click node_random "https://github.com/baanista/solarwars/blob/main/src/randomgenerators.hpp"
click node_global "https://github.com/baanista/solarwars/blob/main/src/global.hpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_launcher,node_global toneBlue
class node_galaxy,node_system toneAmber
class node_spaceobject,node_celestial,node_planetoid,node_sun toneMint
class node_generators,node_random toneRose
class node_player toneIndigo
```

## Components

### Application

- [Program Entry](https://github.com/baanista/solarwars/blob/main/src/Main.cpp): `src/Main.cpp`
- [Launcher](https://github.com/baanista/solarwars/blob/main/src/launcher.cpp): `src/launcher.cpp`
- [Shared Font](https://github.com/baanista/solarwars/blob/main/src/global.hpp): `src/global.hpp`

### Galaxy Model

- [Galaxy](https://github.com/baanista/solarwars/blob/main/src/galaxy.hpp): `src/galaxy.hpp`
- [Solar System](https://github.com/baanista/solarwars/blob/main/src/solarsystem.hpp): `src/solarsystem.hpp`

### Celestial Model

- [Space Object](https://github.com/baanista/solarwars/blob/main/src/spaceobject.cpp): `src/spaceobject.cpp`
- [Celestial Body](https://github.com/baanista/solarwars/blob/main/src/celestial.hpp): `src/celestial.hpp`
- [Planetoid](https://github.com/baanista/solarwars/blob/main/src/planetoid.hpp): `src/planetoid.hpp`
- [Sun](https://github.com/baanista/solarwars/blob/main/src/sun.hpp): `src/sun.hpp`

### System Generation

- [System Generators](https://github.com/baanista/solarwars/blob/main/src/systemGenerators.cpp): `src/systemGenerators.cpp`
- [Random Generators](https://github.com/baanista/solarwars/blob/main/src/randomgenerators.hpp): `src/randomgenerators.hpp`

### Other components

- **Player**

## Connections

- Player → Program Entry: starts
- Program Entry → Launcher: runs (evidence: `src/Main.cpp`)
- Galaxy → Solar System: tracks systems (evidence: `src/galaxy.hpp`)
- Solar System → Space Object: tracks objects (evidence: `src/solarsystem.hpp`)
- Solar System → Celestial Body: tracks bodies (evidence: `src/solarsystem.hpp`)
- Solar System → Planetoid: tracks planetoids (evidence: `src/solarsystem.hpp`)
- Solar System → Sun: tracks suns (evidence: `src/solarsystem.hpp`)
- Celestial Body → Space Object: extends (evidence: `src/celestial.hpp`)
- Planetoid → Celestial Body: extends (evidence: `src/planetoid.hpp`)
- Sun → Celestial Body: extends (evidence: `src/sun.hpp`)
- System Generators → Solar System: populates systems (evidence: `src/systemGenerators.cpp`)
- System Generators → Planetoid: creates bodies (evidence: `src/systemGenerators.cpp`)
- System Generators → Random Generators: chooses parameters (evidence: `src/systemGenerators.cpp`)
- Celestial Body → Space Object: updates motion (evidence: `src/celestial.hpp`)
- Space Object → Shared Font: uses font
