space-game001/src/Game.h
Vladislav Khorev 41f370f2ee Minor fixing
2026-03-06 22:34:03 +03:00

79 lines
1.7 KiB
C++

#pragma once
#include "render/Renderer.h"
#include "Environment.h"
#include "render/TextureManager.h"
#include "SparkEmitter.h"
#include "planet/PlanetObject.h"
#include "UiManager.h"
#include "Projectile.h"
#include "utils/TaskManager.h"
#include "network/NetworkInterface.h"
#include <queue>
#include <vector>
#include <string>
#include <memory>
#include <render/TextRenderer.h>
#include "MenuManager.h"
#include "Space.h"
#include <unordered_set>
namespace ZL {
class Game {
public:
Game();
~Game();
void setup();
void setupPart2();
void update();
void render();
bool shouldExit() const { return Environment::exitGameLoop; }
Renderer renderer;
TaskManager taskManager;
MainThreadHandler mainThreadHandler;
std::unique_ptr<INetworkClient> networkClient;
std::shared_ptr<Texture> loadingTexture;
VertexRenderStruct loadingMesh;
bool loadingCompleted = false;
private:
int64_t getSyncTimeMs();
void processTickCount();
void drawScene();
void drawUI();
void drawUnderMainMenu();
void drawLoading();
void handleDown(int mx, int my);
void handleUp(int mx, int my);
void handleMotion(int mx, int my);
#ifdef EMSCRIPTEN
static Game* s_instance;
static void onResourcesZipLoaded(const char* filename);
static void onResourcesZipError(const char* filename);
#endif
//SDL_Window* window;
//SDL_GLContext glContext;
int64_t newTickCount;
int64_t lastTickCount;
uint32_t connectingStartTicks = 0;
static constexpr uint32_t CONNECTING_TIMEOUT_MS = 10000;
static const size_t CONST_TIMER_INTERVAL = 10;
static const size_t CONST_MAX_TIME_INTERVAL = 1000;
MenuManager menuManager;
Space space;
};
} // namespace ZL