Fixes build on linux

Fixes bug that prevented panels from being opened from the menu
master
Joey Pollack 4 years ago
parent 595adb717c
commit d55d28fe1b

@ -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);

@ -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)
}

@ -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);

@ -13,7 +13,7 @@
#include "content_manager.h"
#include <filesystem>
#include <string>
#include <utils\op_res.h>
#include <utils/op_res.h>
namespace lunarium { namespace editor
{

@ -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();

@ -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();
}

@ -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 <sol/sol.hpp>
#include <utils/op_res.h>
namespace lunarium
@ -27,7 +26,6 @@ namespace lunarium
private:
static ScriptManager* mpInstance;
sol::state mState;
uint32_t mCat;
friend class CoreAPI;

Loading…
Cancel
Save