From 92b50030b743793e2aa8f0af33a6a2eff42d9935 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Thu, 14 Nov 2019 03:47:31 +0700 Subject: [PATCH] core binds without e2d namespace --- .../high/bindings/core_binds/_core_binds.hpp | 8 ++++---- .../high/bindings/core_binds/dbgui_binds.cpp | 12 +++++------ .../high/bindings/core_binds/debug_binds.cpp | 20 +++++++++---------- .../high/bindings/core_binds/engine_binds.cpp | 12 +++++------ .../high/bindings/core_binds/input_binds.cpp | 20 +++++++------------ .../high/bindings/core_binds/window_binds.cpp | 12 +++++------ 6 files changed, 35 insertions(+), 49 deletions(-) diff --git a/sources/enduro2d/high/bindings/core_binds/_core_binds.hpp b/sources/enduro2d/high/bindings/core_binds/_core_binds.hpp index 0cad61e1..b2920948 100644 --- a/sources/enduro2d/high/bindings/core_binds/_core_binds.hpp +++ b/sources/enduro2d/high/bindings/core_binds/_core_binds.hpp @@ -1,8 +1,8 @@ /******************************************************************************* -* This file is part of the "Enduro2D" -* For conditions of distribution and use, see copyright notice in LICENSE.md -* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) -******************************************************************************/ + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) + ******************************************************************************/ #pragma once diff --git a/sources/enduro2d/high/bindings/core_binds/dbgui_binds.cpp b/sources/enduro2d/high/bindings/core_binds/dbgui_binds.cpp index 4db7e9cf..91a68dd3 100644 --- a/sources/enduro2d/high/bindings/core_binds/dbgui_binds.cpp +++ b/sources/enduro2d/high/bindings/core_binds/dbgui_binds.cpp @@ -1,17 +1,15 @@ /******************************************************************************* -* This file is part of the "Enduro2D" -* For conditions of distribution and use, see copyright notice in LICENSE.md -* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) -******************************************************************************/ + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) + ******************************************************************************/ #include "_core_binds.hpp" namespace e2d::bindings::core { void bind_dbgui(sol::state& l) { - l["e2d"].get_or_create() - ["core"].get_or_create() - .new_usertype("dbgui", + l.new_usertype("dbgui", sol::no_constructor, "visible", sol::property( diff --git a/sources/enduro2d/high/bindings/core_binds/debug_binds.cpp b/sources/enduro2d/high/bindings/core_binds/debug_binds.cpp index e0e90e91..e3770a27 100644 --- a/sources/enduro2d/high/bindings/core_binds/debug_binds.cpp +++ b/sources/enduro2d/high/bindings/core_binds/debug_binds.cpp @@ -1,32 +1,30 @@ /******************************************************************************* -* This file is part of the "Enduro2D" -* For conditions of distribution and use, see copyright notice in LICENSE.md -* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) -******************************************************************************/ + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) + ******************************************************************************/ #include "_core_binds.hpp" namespace e2d::bindings::core { void bind_debug(sol::state& l) { - l["e2d"].get_or_create() - ["core"].get_or_create() - .new_usertype("debug", + l.new_usertype("debug", sol::no_constructor, - "trace", [](debug& d, const char* s){ + "trace", [](debug& d, str_view s){ d.trace(s); }, - "warning", [](debug& d, const char* s){ + "warning", [](debug& d, str_view s){ d.warning(s); }, - "error", [](debug& d, const char* s){ + "error", [](debug& d, str_view s){ d.error(s); }, - "fatal", [](debug& d, const char* s){ + "fatal", [](debug& d, str_view s){ d.fatal(s); } ); diff --git a/sources/enduro2d/high/bindings/core_binds/engine_binds.cpp b/sources/enduro2d/high/bindings/core_binds/engine_binds.cpp index d27d9954..bb7d2c74 100644 --- a/sources/enduro2d/high/bindings/core_binds/engine_binds.cpp +++ b/sources/enduro2d/high/bindings/core_binds/engine_binds.cpp @@ -1,17 +1,15 @@ /******************************************************************************* -* This file is part of the "Enduro2D" -* For conditions of distribution and use, see copyright notice in LICENSE.md -* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) -******************************************************************************/ + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) + ******************************************************************************/ #include "_core_binds.hpp" namespace e2d::bindings::core { void bind_engine(sol::state& l) { - l["e2d"].get_or_create() - ["core"].get_or_create() - .new_usertype("engine", + l.new_usertype("engine", sol::no_constructor, "time", sol::property(&engine::time), diff --git a/sources/enduro2d/high/bindings/core_binds/input_binds.cpp b/sources/enduro2d/high/bindings/core_binds/input_binds.cpp index 5ad40c30..8269d2fc 100644 --- a/sources/enduro2d/high/bindings/core_binds/input_binds.cpp +++ b/sources/enduro2d/high/bindings/core_binds/input_binds.cpp @@ -1,8 +1,8 @@ /******************************************************************************* -* This file is part of the "Enduro2D" -* For conditions of distribution and use, see copyright notice in LICENSE.md -* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) -******************************************************************************/ + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) + ******************************************************************************/ #include "_core_binds.hpp" @@ -36,18 +36,14 @@ namespace namespace e2d::bindings::core { void bind_input(sol::state& l) { - l["e2d"].get_or_create() - ["core"].get_or_create() - .new_usertype("input", + l.new_usertype("input", sol::no_constructor, "mouse", sol::property(&input::mouse), "keyboard", sol::property(&input::keyboard) ); - l["e2d"].get_or_create() - ["core"].get_or_create() - .new_usertype("mouse", + l.new_usertype("mouse", sol::no_constructor, "cursor_pos", sol::property([](const mouse& m){ @@ -111,9 +107,7 @@ namespace e2d::bindings::core }) ); - l["e2d"].get_or_create() - ["core"].get_or_create() - .new_usertype("keyboard", + l.new_usertype("keyboard", sol::no_constructor, "input_text", sol::property([](const keyboard& k){ diff --git a/sources/enduro2d/high/bindings/core_binds/window_binds.cpp b/sources/enduro2d/high/bindings/core_binds/window_binds.cpp index 6d6f8360..325d1d63 100644 --- a/sources/enduro2d/high/bindings/core_binds/window_binds.cpp +++ b/sources/enduro2d/high/bindings/core_binds/window_binds.cpp @@ -1,17 +1,15 @@ /******************************************************************************* -* This file is part of the "Enduro2D" -* For conditions of distribution and use, see copyright notice in LICENSE.md -* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) -******************************************************************************/ + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) + ******************************************************************************/ #include "_core_binds.hpp" namespace e2d::bindings::core { void bind_window(sol::state& l) { - l["e2d"].get_or_create() - ["core"].get_or_create() - .new_usertype("window", + l.new_usertype("window", sol::no_constructor, "hide", &window::hide,