#include "Components.hpp" #include "Draw.hpp" #include "Entities.hpp" #include "Entity.hpp" #include "GameContext.hpp" #include "Systems.hpp" #include "raylib-cpp.hpp" int main() { raylib::Window window(700, 460, "Gravity Surfing"); window.SetState(FLAG_WINDOW_RESIZABLE); window.SetTargetFPS(60); std::vector> entities; entities.reserve(20); GameContext context; entities.push_back(CreateWorld()); entities.push_back(CreateGravityWell()); entities.push_back(CreateProbe()); entities.push_back(CreateStar(900.0f, 120.0f)); entities.push_back(CreateAsteroid(1100.0f, 330.0f)); entities.push_back(CreateNullZone(1280.0f, 70.0f)); entities.push_back(CreateHUD()); while (!window.ShouldClose()) { float dt = window.GetFrameTime(); UpdateAllSystems(entities, context, dt); auto worldScroll = entities[0]->GetComponent(); auto probeTransform = entities[2]->GetComponent(); auto hudMeter = entities.back()->GetComponent(); window.BeginDrawing(); window.ClearBackground(raylib::Color(11, 15, 26, 255)); DrawSceneOutline(); raylib::DrawText("Gravity Surfing", 14, 12, 20, raylib::Color::RayWhite()); if (worldScroll) { // debug readout for early loop validation raylib::DrawText(TextFormat("scrollX: %.2f", worldScroll->get().scrollX), 14, 40, 16, raylib::Color(125, 225, 205, 255)); } if (probeTransform) { const auto &probe = probeTransform->get(); raylib::DrawText(TextFormat("probe: (%.1f, %.1f)", probe.x, probe.y), 14, 60, 16, raylib::Color(235, 215, 125, 255)); } if (hudMeter) { raylib::DrawText(TextFormat("meter: %.1f", hudMeter->get().value), 14, 80, 16, raylib::Color(120, 210, 190, 255)); } for (auto &entity : entities) { if (!entity) { continue; } auto collectible = entity->GetComponent(); if (collectible && collectible->get().collected) { continue; } auto render = entity->GetComponent(); if (render) { render->get().Draw(); } } window.EndDrawing(); } return 0; }