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
LuaEntity.cpp
Go to the documentation of this file.
1
7
8#include <entt/locator/locator.hpp>
9#include <sol/sol.hpp>
10
13
14#include "../Lua.hpp"
15
16namespace galaxy
17{
18 void Lua::inject_entity() noexcept
19 {
20 auto& lua = entt::locator<sol::state>::value();
21
22 auto registry_type = lua.new_usertype<Registry>("Registry", sol::constructors<Registry()>());
23 registry_type["entt"] = &Registry::m_entt;
24
25 auto em_type = lua.new_usertype<EntityManager>("EntityManager", sol::no_constructor);
26 em_type["registry"] = &EntityManager::registry;
27
28 /*auto prefab_type = lua.new_usertype<Prefab>("Prefab", sol::constructors<Prefab(entt::entity, entt::registry&), Prefab(const nlohmann::json&)>());
29 prefab_type["from_entity"] = &Prefab::from_entity;
30 prefab_type["from_json"] = &Prefab::from_json;
31 prefab_type["to_entity"] = &Prefab::to_entity;
32 prefab_type["to_json"] = &Prefab::to_json;
33 prefab_type["load"] = &Prefab::load;
34 lua.set_function("galaxy_load_user_config", &load_config_wrapper);
35 lua.set_function("galaxy_load_window_config", &load_window_wrapper);
36 */
37 }
38} // namespace galaxy
Class for making creating and managing entities easier.
Registry & registry() noexcept
Get entity registry.
static void inject_entity() noexcept
Inject galaxy entity management into Lua.
Definition LuaEntity.cpp:18
Wrapper around entt::registry to expand functionality.
Definition Registry.hpp:19
entt::registry m_entt
Function that integrates a box2d construction with entt.
Definition Registry.hpp:167
Application.hpp galaxy.