mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-05-10 02:09:46 +08:00
feat: 引入 Lua 配置系统实现 UI 参数热更新
- 添加 Lua 5.5 库支持,包含头文件和动态链接库 - 新增 lua_config 模块,提供配置初始化、获取字符串/整型值等功能 - 创建 config.lua 配置文件,集中管理所有 UI 文本、尺寸和布局参数 - 移除原有的硬编码 config.h,将 UI 常量迁移至 Lua 配置 - 修改主窗口、对话框和回调函数,动态读取 Lua 配置值 - 更新 CMakeLists.txt,添加 Lua 库依赖和 DLL 复制步骤 - 删除过时的 Makefile,统一使用 CMake 构建
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#ifndef LUA_CONFIG_H
|
||||
#define LUA_CONFIG_H
|
||||
|
||||
#include <lua.h>
|
||||
|
||||
// 初始化 Lua 配置系统
|
||||
// 返回值: 0 成功, -1 失败
|
||||
int lua_config_init(void);
|
||||
|
||||
// 销毁 Lua 配置系统
|
||||
void lua_config_destroy(void);
|
||||
|
||||
// 获取字符串配置值
|
||||
// section: 配置章节名 (如 "app", "dialog", "button")
|
||||
// key: 配置键名 (如 "name", "size", "rastersize")
|
||||
// 返回值: 配置值字符串, 失败时返回 NULL
|
||||
const char* lua_config_get_string(const char* section, const char* key);
|
||||
|
||||
// 获取整型配置值
|
||||
// section: 配置章节名
|
||||
// key: 配置键名
|
||||
// default_value: 默认值 (当配置不存在或转换失败时返回)
|
||||
// 返回值: 配置值或默认值
|
||||
int lua_config_get_int(const char* section, const char* key, int default_value);
|
||||
|
||||
// 重新加载配置文件
|
||||
// 返回值: 0 成功, -1 失败
|
||||
int lua_config_reload(void);
|
||||
|
||||
// 获取配置加载状态
|
||||
// 返回值: 1 已加载, 0 未加载
|
||||
int lua_config_is_loaded(void);
|
||||
|
||||
#endif // LUA_CONFIG_H
|
||||
Reference in New Issue
Block a user