inital commit

This commit is contained in:
2026-07-21 17:00:54 +01:00
commit c98d556af8
29 changed files with 1493 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
#pragma once
+30
View File
@@ -0,0 +1,30 @@
#include "engine/core/application.hpp"
#include "engine/core/service-locator.hpp"
#include "engine/scene/scene.hpp"
#include "game/scenes/game-over-scene/game-over.hpp"
#include "game/scenes/main-scene/main-scene.hpp"
#include "game/scenes/menu-scene/menu.hpp"
#include <raylib.h>
class Game : public varicle::Application {
public:
void on_init() override {
auto &scene_manager =
varicle::ServiceLocator::get<varicle::SceneManager>();
scene_manager.register_scene(
"menu", []() { return std::make_unique<MenuScene>(); });
change_scene("menu");
}
void on_shutdown() override {}
};
int main() {
Game game;
game.run();
return 0;
}
+49
View File
@@ -0,0 +1,49 @@
#include "menu.hpp"
#include "engine/core/service-locator.hpp"
#include "raylib.h"
#include <imgui.h>
void MenuScene::init() {}
void MenuScene::update(float dt) {}
void MenuScene::render() {}
void MenuScene::ui() {
// Get the current screen/viewport size
ImVec2 screen_size = ImGui::GetIO().DisplaySize;
// size of button container
ImVec2 vbox_size = ImVec2(200.0f, 250.0f);
// set next container to be center of the screen
ImVec2 screen_center = ImVec2(screen_size.x * 0.5f, screen_size.y * 0.5f);
ImGui::SetNextWindowPos(screen_center, ImGuiCond_Always,
ImVec2(0.5f, 0.5f));
ImGui::SetNextWindowSize(vbox_size);
// remove sub window decoration
ImGuiWindowFlags flags =
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoBackground;
ImGui::Begin("VBoxContainer", nullptr, flags);
// set button width to be size fill container
ImVec2 button_size = ImVec2(ImGui::GetContentRegionAvail().x, 50.0f);
// ImGui::SetCursorPos(centeredPos);
if (ImGui::Button("Play", button_size)) {
v::ServiceLocator::get<v::SceneManager>().switch_to_scene("main");
}
ImGui::Dummy(ImVec2(0, 10)); // Gap
if (ImGui::Button("Quit", button_size)) {
v::ServiceLocator::get<v::SceneManager>().quit();
}
ImGui::End();
}
+13
View File
@@ -0,0 +1,13 @@
#pragma once
#include "engine/scene/scene.hpp"
namespace v = varicle;
class MenuScene : public v::Scene {
public:
void init() override;
void update(float dt) override;
void render() override;
void ui() override;
};