diff --git a/scripts/config.sh b/scripts/config.sh old mode 100644 new mode 100755 diff --git a/src/gui/panel_manager.cpp b/src/gui/panel_manager.cpp index 29eab54..14f8d1a 100644 --- a/src/gui/panel_manager.cpp +++ b/src/gui/panel_manager.cpp @@ -62,7 +62,7 @@ namespace lunarium void PanelManager::OpenPanel(uint32_t id) { - if (mPanels.size() >= id || id < 0) + if (id >= mPanels.size() || id < 0) return; mPanels[id]->SetOpen(true); diff --git a/src/platform/terminal.cpp b/src/platform/terminal.cpp index 0ddd909..213f287 100644 --- a/src/platform/terminal.cpp +++ b/src/platform/terminal.cpp @@ -64,6 +64,7 @@ namespace lunarium std::cout << "\033[0m"; } +#if defined(LPLATFORM_WINDOWS) OpRes Terminal::InitWindowsTerm() { // This code is from microsoft docs: @@ -131,4 +132,5 @@ namespace lunarium SetConsoleMode(hOut, WinPrevOutMode); SetConsoleMode(hIn, WinPrevInMode); } +#endif // defined(LPLATFORM_WINDOWS) } \ No newline at end of file diff --git a/src/run_modes/editor/contents/content_manager.cpp b/src/run_modes/editor/contents/content_manager.cpp index 98100bf..480b71e 100644 --- a/src/run_modes/editor/contents/content_manager.cpp +++ b/src/run_modes/editor/contents/content_manager.cpp @@ -188,7 +188,8 @@ namespace lunarium { namespace editor return OpRes::Fail("Could not save asset meta data for file: %s", pAsset->GetFileLocation().string().c_str()); } - c.push_back(asset); + //c.push_back(asset); + c.emplace_back(asset); } std::ofstream ofs = std::ofstream(mContentFile.string().c_str(), std::ios_base::trunc); diff --git a/src/run_modes/editor/contents/editor_asset.h b/src/run_modes/editor/contents/editor_asset.h index 9fe328f..e35c651 100644 --- a/src/run_modes/editor/contents/editor_asset.h +++ b/src/run_modes/editor/contents/editor_asset.h @@ -13,7 +13,7 @@ #include "content_manager.h" #include #include -#include +#include namespace lunarium { namespace editor { diff --git a/src/scripting/coreAPI.cpp b/src/scripting/coreAPI.cpp index 9d4e35e..5c5b93d 100644 --- a/src/scripting/coreAPI.cpp +++ b/src/scripting/coreAPI.cpp @@ -38,8 +38,8 @@ namespace lunarium mCat = sman.mCat; // Register methods - sman.mState["SetWindowSize"] = &CoreAPI::SetWindowSize; - sman.mState["Log"] = &CoreAPI::Log; + // sman.mState["SetWindowSize"] = &CoreAPI::SetWindowSize; + // sman.mState["Log"] = &CoreAPI::Log; // return OpRes::Fail("CoreAPI::Initialize not implemented yet!"); return OpRes::OK(); diff --git a/src/scripting/script_manager.cpp b/src/scripting/script_manager.cpp index 185f3f8..aeddcaf 100644 --- a/src/scripting/script_manager.cpp +++ b/src/scripting/script_manager.cpp @@ -33,10 +33,8 @@ namespace lunarium OpRes ScriptManager::Initialize() { - mCat = Logger::RegisterCategory("LUA"); + mCat = Logger::RegisterCategory("SCRIPT"); - mState.open_libraries(sol::lib::base, sol::lib::package); - // mState.script("print('test puppy says: bark bark bark!')"); return OpRes::OK(); } @@ -49,18 +47,7 @@ namespace lunarium } // TODO: Use the state to run the script and check for errors - auto result = mpInstance->mState.script(code, [](lua_State*, sol::protected_function_result pfr) { - return pfr; - }); - - if (!result.valid()) - { - sol::error err = result; - Logger::Warn(mpInstance->mCat, "LUA script has errors"); - std::ostringstream oss; - oss << "LUA code has error. CODE:\n" << code << "\nEND CODE -- ERROR: " << err.what(); - return OpRes::Fail(oss.str().c_str()); - } + return OpRes::OK(); } diff --git a/src/scripting/script_manager.h b/src/scripting/script_manager.h index ebd9d48..e15a757 100644 --- a/src/scripting/script_manager.h +++ b/src/scripting/script_manager.h @@ -3,7 +3,7 @@ * Author - Joey Pollack * Date - 2021/08/30 (y/m/d) * Mod Date - 2021/09/02 (y/m/d) -* Description - Manage the main LUA state, Run given scripts and check for +* Description - Manage the main wren state, Run given scripts and check for * errors. Report errors in the debug log. Also keep a * history of errors that can be queried. ******************************************************************************/ @@ -11,7 +11,6 @@ #ifndef SCRIPT_MANAGER_H_ #define SCRIPT_MANAGER_H_ -#include #include namespace lunarium @@ -27,7 +26,6 @@ namespace lunarium private: static ScriptManager* mpInstance; - sol::state mState; uint32_t mCat; friend class CoreAPI;