Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
VideoGame.h
Go to the documentation of this file.
1/* VideoGame.h
2 High-level videogame class that composes World, GameRules, QuestManager and GameMenu.
3*/
4#pragma once
5
6#include "World.h"
7#include "GameRules.h"
8#include "QuestManager.h"
9#include "system/GameMenu.h"
12#include "system/message.h"
13#include "GameState.h"
14#include <memory>
15#include <iostream>
16#include <vector>
17#include <unordered_map>
18#include "system/system_utils.h"
19#include "GameEngine.h"
20
22{
23public:
24 VideoGame();
25
26 virtual ~VideoGame();
27
28 // Per-class singleton accessors
30 {
31 static VideoGame instance;
32 return instance;
33 }
34 static VideoGame& Get() { return GetInstance(); }
35
36
37 // Game state helpers (front-end to GameStateManager)
44 bool IsPaused() const { return GameStateManager::IsPaused(); }
45
49
50 // Player management
51 void SetViewportLayout(short playerID);
54
55 // Register a player entity that was loaded from a level
56 // (reuses setup logic from AddPlayerEntity without entity creation)
58
59 // Check if an input device slot is available for a new player
60 bool IsInputDeviceAvailable() const;
61
62 // Save / Load game state (slot optional)
63 bool SaveGame(int slot = 0) { return false; }
64 bool LoadGame(int slot = 0) { return false; }
65
66 virtual void RegisterPrefabItems();
67
68 // Initialize test scene with AI guard NPC
70 //{
71 // Example prefab registration
72 /*
73 PrefabFactory::Get().RegisterPrefab("MiliceGuard", [](EntityID id) {
74 World& world = World::Get();
75 world.AddComponent<TransformComponent>(id, Vector(0, 0, 0), 100.0f, 150.0f);
76 world.AddComponent<SpriteComponent>(id, "milice_guard_sprite.png");
77 world.AddComponent<AIComponent>(id, AIType::Guard);
78 // Add other components as needed
79 });
80 /**/
81 //}
82
83public:
89
90 // Players & Entities
91 std::vector<EntityID> m_playersEntity;
92 static short m_playerIdCounter;
93
94private:
95 string name;
96 // cached state for quick local reads (authoritative value lives in GameStateManager)
98};
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
std::uint64_t EntityID
Definition ECS_Entity.h:21
Core game engine class.
GameState
Definition GameState.h:7
@ GameState_Running
@ GameState_Paused
World and ECS Manager for Olympe Engine.
static GameMenu & GetInstance()
Definition GameMenu.h:33
static GameRules & GetInstance()
Definition GameRules.h:17
static QuestManager & GetInstance()
std::vector< EntityID > m_playersEntity
Definition VideoGame.h:91
GameMenu & gamemenu
Definition VideoGame.h:86
static VideoGame & Get()
Definition VideoGame.h:34
static short m_playerIdCounter
Definition VideoGame.h:92
bool SaveGame(int slot=0)
Definition VideoGame.h:63
World & world
Definition VideoGame.h:84
ViewportManager & viewport
Definition VideoGame.h:88
bool LoadGame(int slot=0)
Definition VideoGame.h:64
static VideoGame & GetInstance()
Definition VideoGame.h:29
EntityID AddPlayerEntity(string _playerPrefabName="Player")
Definition VideoGame.cpp:49
bool IsInputDeviceAvailable() const
void RegisterLoadedPlayerEntity(EntityID entity)
string name
Definition VideoGame.h:95
QuestManager & questmanager
Definition VideoGame.h:87
GameRules & gamerules
Definition VideoGame.h:85
void InitializeAITestScene()
void SetViewportLayout(short playerID)
GameState m_state
Definition VideoGame.h:97
virtual void RegisterPrefabItems()
bool IsPaused() const
Definition VideoGame.h:44
void Pause()
Definition VideoGame.h:46
virtual ~VideoGame()
Definition VideoGame.cpp:41
void SetState(GameState s)
Definition VideoGame.h:38
GameState GetState() const
Definition VideoGame.h:43
void RequestQuit()
Definition VideoGame.h:48
void Resume()
Definition VideoGame.h:47
bool RemovePlayerEntity(const EntityID eid)
static ViewportManager & GetInstance()
Core ECS manager and world coordinator.
Definition World.h:210
static World & GetInstance()
Get singleton instance.
Definition World.h:222
GameState GetState()
Definition GameState.cpp:15
void SetState(GameState s)
Definition GameState.cpp:10