core binds without e2d namespace

This commit is contained in:
2019-11-14 03:47:31 +07:00
parent 316de29c2c
commit 92b50030b7
6 changed files with 35 additions and 49 deletions

View File

@@ -1,8 +1,8 @@
/******************************************************************************* /*******************************************************************************
* This file is part of the "Enduro2D" * This file is part of the "Enduro2D"
* For conditions of distribution and use, see copyright notice in LICENSE.md * For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/ ******************************************************************************/
#pragma once #pragma once

View File

@@ -1,17 +1,15 @@
/******************************************************************************* /*******************************************************************************
* This file is part of the "Enduro2D" * This file is part of the "Enduro2D"
* For conditions of distribution and use, see copyright notice in LICENSE.md * For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/ ******************************************************************************/
#include "_core_binds.hpp" #include "_core_binds.hpp"
namespace e2d::bindings::core namespace e2d::bindings::core
{ {
void bind_dbgui(sol::state& l) { void bind_dbgui(sol::state& l) {
l["e2d"].get_or_create<sol::table>() l.new_usertype<dbgui>("dbgui",
["core"].get_or_create<sol::table>()
.new_usertype<dbgui>("dbgui",
sol::no_constructor, sol::no_constructor,
"visible", sol::property( "visible", sol::property(

View File

@@ -1,32 +1,30 @@
/******************************************************************************* /*******************************************************************************
* This file is part of the "Enduro2D" * This file is part of the "Enduro2D"
* For conditions of distribution and use, see copyright notice in LICENSE.md * For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/ ******************************************************************************/
#include "_core_binds.hpp" #include "_core_binds.hpp"
namespace e2d::bindings::core namespace e2d::bindings::core
{ {
void bind_debug(sol::state& l) { void bind_debug(sol::state& l) {
l["e2d"].get_or_create<sol::table>() l.new_usertype<debug>("debug",
["core"].get_or_create<sol::table>()
.new_usertype<debug>("debug",
sol::no_constructor, sol::no_constructor,
"trace", [](debug& d, const char* s){ "trace", [](debug& d, str_view s){
d.trace(s); d.trace(s);
}, },
"warning", [](debug& d, const char* s){ "warning", [](debug& d, str_view s){
d.warning(s); d.warning(s);
}, },
"error", [](debug& d, const char* s){ "error", [](debug& d, str_view s){
d.error(s); d.error(s);
}, },
"fatal", [](debug& d, const char* s){ "fatal", [](debug& d, str_view s){
d.fatal(s); d.fatal(s);
} }
); );

View File

@@ -1,17 +1,15 @@
/******************************************************************************* /*******************************************************************************
* This file is part of the "Enduro2D" * This file is part of the "Enduro2D"
* For conditions of distribution and use, see copyright notice in LICENSE.md * For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/ ******************************************************************************/
#include "_core_binds.hpp" #include "_core_binds.hpp"
namespace e2d::bindings::core namespace e2d::bindings::core
{ {
void bind_engine(sol::state& l) { void bind_engine(sol::state& l) {
l["e2d"].get_or_create<sol::table>() l.new_usertype<engine>("engine",
["core"].get_or_create<sol::table>()
.new_usertype<engine>("engine",
sol::no_constructor, sol::no_constructor,
"time", sol::property(&engine::time), "time", sol::property(&engine::time),

View File

@@ -1,8 +1,8 @@
/******************************************************************************* /*******************************************************************************
* This file is part of the "Enduro2D" * This file is part of the "Enduro2D"
* For conditions of distribution and use, see copyright notice in LICENSE.md * For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/ ******************************************************************************/
#include "_core_binds.hpp" #include "_core_binds.hpp"
@@ -36,18 +36,14 @@ namespace
namespace e2d::bindings::core namespace e2d::bindings::core
{ {
void bind_input(sol::state& l) { void bind_input(sol::state& l) {
l["e2d"].get_or_create<sol::table>() l.new_usertype<input>("input",
["core"].get_or_create<sol::table>()
.new_usertype<input>("input",
sol::no_constructor, sol::no_constructor,
"mouse", sol::property(&input::mouse), "mouse", sol::property(&input::mouse),
"keyboard", sol::property(&input::keyboard) "keyboard", sol::property(&input::keyboard)
); );
l["e2d"].get_or_create<sol::table>() l.new_usertype<mouse>("mouse",
["core"].get_or_create<sol::table>()
.new_usertype<mouse>("mouse",
sol::no_constructor, sol::no_constructor,
"cursor_pos", sol::property([](const mouse& m){ "cursor_pos", sol::property([](const mouse& m){
@@ -111,9 +107,7 @@ namespace e2d::bindings::core
}) })
); );
l["e2d"].get_or_create<sol::table>() l.new_usertype<keyboard>("keyboard",
["core"].get_or_create<sol::table>()
.new_usertype<keyboard>("keyboard",
sol::no_constructor, sol::no_constructor,
"input_text", sol::property([](const keyboard& k){ "input_text", sol::property([](const keyboard& k){

View File

@@ -1,17 +1,15 @@
/******************************************************************************* /*******************************************************************************
* This file is part of the "Enduro2D" * This file is part of the "Enduro2D"
* For conditions of distribution and use, see copyright notice in LICENSE.md * For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/ ******************************************************************************/
#include "_core_binds.hpp" #include "_core_binds.hpp"
namespace e2d::bindings::core namespace e2d::bindings::core
{ {
void bind_window(sol::state& l) { void bind_window(sol::state& l) {
l["e2d"].get_or_create<sol::table>() l.new_usertype<window>("window",
["core"].get_or_create<sol::table>()
.new_usertype<window>("window",
sol::no_constructor, sol::no_constructor,
"hide", &window::hide, "hide", &window::hide,