From 8a0a167adbf3d9b6f8b6f16aaf20ca39ad5549de Mon Sep 17 00:00:00 2001 From: jacqueline Date: Sun, 12 Nov 2023 19:14:09 +1100 Subject: Convert the main menu screen to lua lol --- src/lua/include/lua_thread.hpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/lua/include/lua_thread.hpp (limited to 'src/lua/include/lua_thread.hpp') diff --git a/src/lua/include/lua_thread.hpp b/src/lua/include/lua_thread.hpp new file mode 100644 index 00000000..381b1bdb --- /dev/null +++ b/src/lua/include/lua_thread.hpp @@ -0,0 +1,38 @@ +/* + * Copyright 2023 jacqueline + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#pragma once + +#include +#include + +#include "lua.hpp" +#include "lvgl.h" + +#include "bridge.hpp" +#include "service_locator.hpp" + +namespace lua { + +class Allocator; + +class LuaThread { + public: + static auto Start(system_fsm::ServiceLocator&, lv_obj_t* lvgl_root = nullptr) + -> LuaThread*; + ~LuaThread(); + + auto RunScript(const std::string& path) -> bool; + + private: + LuaThread(std::unique_ptr&, std::unique_ptr&, lua_State*); + + std::unique_ptr alloc_; + std::unique_ptr bridge_; + lua_State* state_; +}; + +} // namespace lua -- cgit v1.2.3