feat: add basic ah game (Kinda shitty, i should use components)

This commit is contained in:
2026-08-12 01:37:36 +02:00
parent 405ef0baeb
commit 08a6df4e68
4 changed files with 231 additions and 521 deletions
+24 -8
View File
@@ -1,10 +1,10 @@
#ifndef LIGHTKEEPER_H
#define LIGHTKEEPER_H
#include <string>
#include <random>
#include <vector>
#include <destrum/App.h>
#include <destrum/Scene/SceneManager.h>
#include <destrum/Graphics/RenderResources.h>
#include "destrum/Graphics/Resources/Cubemap.h"
@@ -21,19 +21,35 @@ public:
void customFixedUpdate(float dt) override;
void onWindowResize(int newWidth, int newHeight) override;
private:
struct FallingStar {
GameObject* object{};
float speed{};
};
void resetGame();
void respawnStar(FallingStar& star, float minimumHeight);
void drawHud();
Camera camera{glm::vec3(0.f, 0.f, -5.f), glm::vec3(0, 1, 0)};
MeshID sphereMesh;
MaterialID sphereMaterial;
MeshID sphereMesh{NULL_MESH_ID};
MaterialID playerMaterial{NULL_MATERIAL_ID};
MaterialID starMaterial{NULL_MATERIAL_ID};
std::unique_ptr<CubeMap> skyboxCubemap;
GameObject* capybara = nullptr;
GameObject* player{nullptr};
std::vector<FallingStar> stars;
std::mt19937 randomEngine{0xD35A1234u};
std::uniform_real_distribution<float> spawnX{-5.5f, 5.5f};
std::uniform_real_distribution<float> spawnHeight{0.0f, 2.0f};
std::uniform_real_distribution<float> spawnSpeed{2.8f, 4.2f};
char scenePath[512]{"scenes/debug_scene.json"};
char newSceneName[128]{"EmptyScene"};
std::string sceneStatus;
int score{0};
int misses{0};
bool gameOver{false};
};
#endif //LIGHTKEEPER_H