mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-14 16:09:06 +07:00
init dummy high level table
This commit is contained in:
@@ -6,10 +6,70 @@
|
|||||||
|
|
||||||
#include "bindings.hpp"
|
#include "bindings.hpp"
|
||||||
|
|
||||||
|
#include <enduro2d/high/library.hpp>
|
||||||
|
#include <enduro2d/high/luasol.hpp>
|
||||||
|
#include <enduro2d/high/world.hpp>
|
||||||
|
|
||||||
|
#include <enduro2d/high/node.hpp>
|
||||||
|
#include <enduro2d/high/gobject.hpp>
|
||||||
|
|
||||||
|
#include <enduro2d/high/components/actor.hpp>
|
||||||
|
#include <enduro2d/high/components/behaviour.hpp>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
using namespace e2d;
|
||||||
|
|
||||||
|
void bind_library(sol::state& l) {
|
||||||
|
l.new_usertype<library>("library");
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind_luasol(sol::state& l) {
|
||||||
|
l.new_usertype<luasol>("luasol");
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind_world(sol::state& l) {
|
||||||
|
l.new_usertype<world>("world");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
using namespace e2d;
|
||||||
|
|
||||||
|
void bind_node(sol::state& l) {
|
||||||
|
l.new_usertype<node>("node");
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind_gobject(sol::state& l) {
|
||||||
|
l.new_usertype<gobject>("gobject");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
using namespace e2d;
|
||||||
|
|
||||||
|
void bind_actor(sol::state& l) {
|
||||||
|
l.new_usertype<actor>("actor");
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind_behaviour(sol::state& l) {
|
||||||
|
l.new_usertype<behaviour>("behaviour");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace e2d::bindings
|
namespace e2d::bindings
|
||||||
{
|
{
|
||||||
void bind_high(sol::state& l) {
|
void bind_high(sol::state& l) {
|
||||||
//TODO(BlackMat): implme
|
bind_library(l);
|
||||||
E2D_UNUSED(l);
|
bind_luasol(l);
|
||||||
|
bind_world(l);
|
||||||
|
|
||||||
|
bind_node(l);
|
||||||
|
bind_gobject(l);
|
||||||
|
|
||||||
|
bind_actor(l);
|
||||||
|
bind_behaviour(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,11 +192,11 @@ namespace e2d
|
|||||||
.register_component<spine_player_evt>("spine_player_evt")
|
.register_component<spine_player_evt>("spine_player_evt")
|
||||||
.register_component<sprite_renderer>("sprite_renderer");
|
.register_component<sprite_renderer>("sprite_renderer");
|
||||||
|
|
||||||
|
safe_module_initialize<luasol>();
|
||||||
|
|
||||||
safe_module_initialize<library>(
|
safe_module_initialize<library>(
|
||||||
params.library_params().root());
|
params.library_params().root());
|
||||||
|
|
||||||
safe_module_initialize<luasol>();
|
|
||||||
|
|
||||||
safe_module_initialize<world>();
|
safe_module_initialize<world>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,8 +204,8 @@ namespace e2d
|
|||||||
the<luasol>().collect_garbage();
|
the<luasol>().collect_garbage();
|
||||||
|
|
||||||
modules::shutdown<world>();
|
modules::shutdown<world>();
|
||||||
modules::shutdown<luasol>();
|
|
||||||
modules::shutdown<library>();
|
modules::shutdown<library>();
|
||||||
|
modules::shutdown<luasol>();
|
||||||
modules::shutdown<factory>();
|
modules::shutdown<factory>();
|
||||||
modules::shutdown<engine>();
|
modules::shutdown<engine>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,32 @@
|
|||||||
|
|
||||||
#include <enduro2d/high/systems/script_system.hpp>
|
#include <enduro2d/high/systems/script_system.hpp>
|
||||||
|
|
||||||
|
#include <enduro2d/high/library.hpp>
|
||||||
|
#include <enduro2d/high/luasol.hpp>
|
||||||
|
#include <enduro2d/high/world.hpp>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
using namespace e2d;
|
||||||
|
|
||||||
|
void init_core_table(sol::state& s) {
|
||||||
|
auto e2d_table = s["e2d"].get_or_create<sol::table>();
|
||||||
|
e2d_table["core"] = s.create_table_with(
|
||||||
|
"debug", &the<debug>(),
|
||||||
|
"engine", &the<engine>(),
|
||||||
|
"input", &the<input>(),
|
||||||
|
"window", &the<window>());
|
||||||
|
}
|
||||||
|
|
||||||
|
void init_high_table(sol::state& s) {
|
||||||
|
auto e2d_table = s["e2d"].get_or_create<sol::table>();
|
||||||
|
e2d_table["high"] = s.create_table_with(
|
||||||
|
"library", &the<library>(),
|
||||||
|
"luasol", &the<luasol>(),
|
||||||
|
"world", &the<world>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace e2d
|
namespace e2d
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -14,7 +40,12 @@ namespace e2d
|
|||||||
|
|
||||||
class script_system::internal_state final : private noncopyable {
|
class script_system::internal_state final : private noncopyable {
|
||||||
public:
|
public:
|
||||||
internal_state() = default;
|
internal_state() {
|
||||||
|
the<luasol>().with_state([](sol::state& s){
|
||||||
|
init_core_table(s);
|
||||||
|
init_high_table(s);
|
||||||
|
});
|
||||||
|
}
|
||||||
~internal_state() noexcept = default;
|
~internal_state() noexcept = default;
|
||||||
|
|
||||||
void update_process(ecs::registry& owner) {
|
void update_process(ecs::registry& owner) {
|
||||||
|
|||||||
Reference in New Issue
Block a user