galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
LuaScenes.cpp
Go to the documentation of this file.
1
7
8#include <entt/locator/locator.hpp>
9#include <sol/sol.hpp>
10
12
13namespace galaxy
14{
15 namespace lua
16 {
18 {
19 auto& lua = entt::locator<sol::state>::value();
20
21 auto scene_type = lua.new_usertype<scene::Scene>("Scene", sol::no_constructor);
22 scene_type["add_system"] = &scene::Scene::add_system;
23 scene_type["load"] = &scene::Scene::load;
24 scene_type["name"] = &scene::Scene::name;
25 scene_type["render"] = &scene::Scene::render;
26 scene_type["unload"] = &scene::Scene::unload;
27 scene_type["update"] = &scene::Scene::update;
28
29 auto scenemanager_type = lua.new_usertype<scene::SceneManager>("SceneManager", sol::no_constructor);
30 scenemanager_type["clear"] = &scene::SceneManager::clear;
31 scenemanager_type["empty"] = &scene::SceneManager::empty;
32 scenemanager_type["load_app"] = &scene::SceneManager::load_app;
33 scenemanager_type["save_app"] = &scene::SceneManager::save_app;
34 scenemanager_type["create"] = &scene::SceneManager::create;
35 scenemanager_type["pop"] = &scene::SceneManager::pop;
36 scenemanager_type["pop_all"] = &scene::SceneManager::pop_all;
37 scenemanager_type["push"] = &scene::SceneManager::push;
38 scenemanager_type["render"] = &scene::SceneManager::render;
39 scenemanager_type["set"] = &scene::SceneManager::set;
40 scenemanager_type["top"] = &scene::SceneManager::top;
41 scenemanager_type["update"] = &scene::SceneManager::update;
42 }
43 } // namespace lua
44} // namespace galaxy
Scene saving/loading, pushing, popping, creating. Also manages entities.
void save_app(const std::string &file)
Save all active scenes and sub data within those scenes.
bool empty() const noexcept
Are there any scenes.
std::shared_ptr< Scene > top() noexcept
Get top scene.
void pop()
Remove scene on top of stack.
void set(const std::string &scene)
Clears all from stack and sets as active.
std::shared_ptr< Scene > create(const std::string &scene)
Create scene in engine.
void clear()
Deletes all scene data.
void update()
Process events and updates.
void render()
Render scenes.
void pop_all()
Pop all scenes.
void load_app(const std::string &appdata_file)
Load app data file into scene manager.
void push(const std::string &scene)
Push a scene onto the top of stack.
Represents a scene in a game. Like the menu, game, etc.
Definition Scene.hpp:29
void add_system(const std::string &system)
Add a system to operate on entities in this scene.
Definition Scene.cpp:40
void load()
When scene is loaded and made active.
Definition Scene.cpp:46
const std::string & name() const noexcept
Get scene name.
Definition Scene.cpp:103
void render()
Update ui.
Definition Scene.cpp:78
void update(core::Registry &registry)
Process events and updates.
Definition Scene.cpp:55
void unload()
When scene is deactivated / unloaded.
Definition Scene.cpp:50
void inject_scene_control()
Injects galaxy scene management into lua.
Definition LuaScenes.cpp:17
Timer.hpp galaxy.
Definition Async.hpp:17