Nox Engine
 
Loading...
Searching...
No Matches
Scene.h
Go to the documentation of this file.
1
6#pragma once
7
8#include "Collider.h"
9#include "ECS.h"
10#include <vector>
11
16struct Scene {
17public:
18 std::string name;
20 int layer;
21 bool mouseButtonPressed;
22
31 Scene(std::string name, int buildIndex, bool isPanel, bool isLocking, int layer);
32
33 virtual ~Scene() {}
34
38 virtual void init() = 0;
42 virtual void update() = 0;
46 virtual void reload() = 0;
51 virtual void reloadWithState() = 0;
56 virtual void handleEvents(SDL_Event& event) = 0;
60 virtual void draw() = 0;
61
66 void addEntityToScene(Entity& entity);
71 void removeEntityFromScene(Entity* entity);
77 bool existsInScene(Entity* entity);
81 void clearScene();
85 void enableScene();
89 void disableScene();
90
95 const bool& getIsPanel() const;
100 const bool& getIsLocking() const;
101
102private:
103 std::vector<Entity*> entities;
104 bool isPanel;
105 bool isLocking;
106};
Defines a component for collision detection.
Defines the core classes for the Entity-Component-System (ECS) architecture.
ComponentID getComponentTypeID() noexcept
Gets the unique ID for a given component type.
Definition ECS.h:39
A general-purpose object in the game world.
Definition ECS.h:84
An abstract class representing a distinct part of the game, like a main menu or a level.
Definition Scene.h:16
virtual void handleEvents(SDL_Event &event)=0
Pure virtual function to handle scene-specific SDL events.
virtual void reload()=0
Pure virtual function to reset the scene to its initial state.
void disableScene()
Deactivates all entities within the scene.
Definition Scene.cpp:43
std::string name
The unique name of the scene.
Definition Scene.h:18
const bool & getIsLocking() const
Gets whether the scene locks updates on lower layers.
Definition Scene.cpp:53
void removeEntityFromScene(Entity *entity)
Removes an entity from this scene's management.
Definition Scene.cpp:16
int buildIndex
The index of the scene for sequential loading.
Definition Scene.h:19
virtual void draw()=0
Pure virtual function for scene-specific drawing logic.
virtual void init()=0
Pure virtual function for scene-specific initialization logic.
virtual void update()=0
Pure virtual function for scene-specific update logic.
bool existsInScene(Entity *entity)
Checks if a specific entity is part of this scene.
Definition Scene.cpp:23
virtual void reloadWithState()=0
Pure virtual function to reload the scene while preserving some state (e.g., UI state).
void clearScene()
Removes all entities from the scene.
Definition Scene.cpp:32
void enableScene()
Activates all entities within the scene.
Definition Scene.cpp:37
void addEntityToScene(Entity &entity)
Registers an entity as belonging to this scene.
Definition Scene.cpp:12
int layer
The rendering layer, for handling multiple active scenes (e.g., UI panels).
Definition Scene.h:20
const bool & getIsPanel() const
Gets whether the scene is a UI panel.
Definition Scene.cpp:49