Core::Instance
GameInstance in Unified Engine
The GameInstance
class stands as a central manager within the Unified Engine
framework. It manages the game loop, interactions, rendering, and holds references to core game objects and components.
Initialization and Cleanup
Upon creation, the GameInstance
sets up essential resources and configurations for the game. At destruction, it ensures proper cleanup.
GameInstance();
~GameInstance();
Rendering and Interaction
The class defines essential rendering resources and interaction points for a consistent game experience.
private:
GLuint Framebuffer = 0;
GLuint Renderbuffer = 0;
GLuint Texture = 0;
public:
std::list<Window*> __windows = {};
bool gladInited = false;
Ticking Mechanism
The engine's main loop is governed by update and render ticks that ensure the game state is consistent and visuals are rendered smoothly.
int Update();
int Render();
Object Management
GameInstance
provides functionality to retrieve game objects and components based on their types, names, and tags.
ObjectComponent* GetObjectOfType(ObjectComponentType type);
std::list<ObjectComponent*> GetObjectsOfType(ObjectComponentType type);
GameObject* GetGameObjectWithName(std::string name);
GameObject* GetGameObjectWithTag(std::string tag);
std::list<GameObject*> GetGameObjectsWithName(std::string name);
std::list<GameObject*> GetGameObjectsWithTag(std::string tag);
Camera* GetMainCamera();
Global Access
The engine provides global access to the game instance and offers essential utility functions for managing game objects.
extern GameInstance* __GAME__GLOBAL__INSTANCE__;
int instantiate(ObjectComponent* Object);
int destroy(ObjectComponent* Object);
Last updated