#include "Components.hpp" #include "Draw.hpp" #include "Entities.hpp" #include "Entity.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); 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, dt); auto worldScroll = entities[0]->GetComponent(); auto wellTransform = entities[1]->GetComponent(); auto probeTransform = entities[2]->GetComponent(); auto starTransform = entities[3]->GetComponent(); auto asteroidTransform = entities[4]->GetComponent(); auto nullTransform = entities[5]->GetComponent(); auto nullZone = entities[5]->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(); ::DrawCircleV({probe.x, probe.y}, 7.0f, raylib::Color(250, 244, 227, 255)); raylib::DrawText(TextFormat("probe: (%.1f, %.1f)", probe.x, probe.y), 14, 60, 16, raylib::Color(235, 215, 125, 255)); } if (wellTransform) { const auto &well = wellTransform->get(); ::DrawCircleLines(static_cast(well.x), static_cast(well.y), 18.0f, raylib::Color(86, 197, 255, 255)); } if (starTransform) { const auto &star = starTransform->get(); ::DrawCircleV({star.x, star.y}, 6.0f, raylib::Color(255, 223, 86, 255)); } if (asteroidTransform) { const auto &asteroid = asteroidTransform->get(); ::DrawCircleV({asteroid.x, asteroid.y}, 13.0f, raylib::Color(116, 126, 142, 255)); } if (nullTransform && nullZone) { const auto &zone = nullTransform->get(); const int width = static_cast(nullZone->get().width); ::DrawRectangle(static_cast(zone.x), 0, width, GetScreenHeight(), raylib::Color(96, 64, 146, 80)); } window.EndDrawing(); } return 0; }