/**
 * @file game.hpp
 * @brief Main game state and context
 */

#pragma once

#include <SDL3/SDL.h>
#include <flecs.h>

struct WindowConfig {
  const char *title = "RIDGE RACER 37";
  int width = 1280;
  int height = 720;
  SDL_WindowFlags flags = 0;
};

struct PipelineState;

/**
 * @brief Game context containing all core resources
 */
struct GameContext {
  // SDL Resources
  SDL_Window *window = nullptr;
  SDL_Renderer *renderer = nullptr;

  // FLECS World (C++ wrapper)
  flecs::world ecs;

  // Timing
  uint64_t last_time = 0;
  float delta_time = 0.0f;

  // State
  bool running = true;
  bool paused = false;

  // Window info
  int window_width = 0;
  int window_height = 0;

  // Pipeline visualization
  PipelineState *pipeline = nullptr;
};

bool game_init(GameContext &ctx, const WindowConfig &config);
void game_shutdown(GameContext &ctx);
void game_process_events(GameContext &ctx);
void game_update(GameContext &ctx);
void game_render(GameContext &ctx);
bool game_loop(GameContext &ctx);
