初始化内容

This commit is contained in:
2026-09-16 14:07:40 +08:00
parent 6934b390bf
commit 4f643c1e7c
18350 changed files with 6088489 additions and 305 deletions
+11
View File
@@ -0,0 +1,11 @@
/log
/*.ilk
/*.pdb
/*.exe
/memory_leak_report.txt
/vld.ini
/temp
/binary
/dl
/Microsoft.DTfW.DHL.manifest
/out
+7
View File
@@ -0,0 +1,7 @@
cmake_minimum_required (VERSION 3.12)
project ("dl_console")
set (PATH_SRC ${PROJECT_SOURCE_DIR})
set (PATH_RES ${PROJECT_SOURCE_DIR}/res)
set (USE_RENDER ON)
include ("../project.cmake")
+85
View File
@@ -0,0 +1,85 @@
#include <dl.h>
using namespace dl;
int main(int argc, char* argv[])
{
Engine::Init();
//TestScriptAll();
//TestScript(SCRIPT_TEST_VECTOR);
//TestScript(SCRIPT_TEST_EXPR);
//while (true)
//{
// log_msg("{:x}", UidGenerator::CreateUid());
//}
log_info("程序名: {}", CodeCvt::MultiByteToUtf8(argv[0]));
log_info("参数总数: {}", argc - 1);
for (int i = 1; i < argc; i++) {
log_info("参数{}: {}", i, CodeCvt::MultiByteToUtf8(argv[i]));
}
std::string lua_file;
#ifndef NDEBUG
//lua_file = "批量小写文件名.lua";
//lua_file = "批量清除图片透明色.lua";
//lua_file = "窗口示例.lua";
//lua_file = "批量缩放图片.lua";
//lua_file = "批量转换图片为PNG格式.lua";
//lua_file = "压缩文件(lz4.lua";
//lua_file = "解压文件(lz4.lua";
//lua_file = "批量计算文件哈希.lua";
//lua_file = "加密(AES-256.lua";
//lua_file = "解密(AES-256.lua";
#else
if(argc > 1)
lua_file = CodeCvt::MultiByteToUtf8(argv[1]);
#endif
//
if (lua_file.empty())
{
std::vector<std::string> all_lua;
File::SearchRule r;
r._vecFmt = { "lua" };
r._vecFilter = { "dl_api.lua" };
File::GetPathFileAll("./", all_lua, r);
if (!all_lua.empty())
{
std::string str = "《dl lua工具库》\n";
str+="你可以直接拖拽lua文件到exe上执行,也可以执行以下操作\n\n";
while (true)
{
str += "输入数字,选择要执行的lua脚本(0表示退出):\n";
for (size_t i = 0; i < all_lua.size(); ++i)
{
str += fmt::format("{}.{}\n", i + 1, all_lua[i]);
}
log_msg0(str);
str.clear();
int n = -1;
std::cin >> n;
if (n == 0)
break;
--n;
if (n < 0 || n >= all_lua.size())
std::cout << "输入无效,请重新输入:" << std::endl;
else
{
g_lua->DoFile(all_lua[n]);
}
}
}
}
else
{
g_lua->DoFile(lua_file);
}
Engine::Release();
return 0;
}
+11
View File
@@ -0,0 +1,11 @@
/log
/*.ilk
/*.pdb
/*.exe
/memory_leak_report.txt
/vld.ini
/temp
/binary
/dl
/Microsoft.DTfW.DHL.manifest
/out
Binary file not shown.
Binary file not shown.
+347
View File
@@ -0,0 +1,347 @@
---@meta
--- 基础函数
---@param ... any
function log(...)
end
---@param ... any
function delete(...)
end
---* buf转为utf8字符串(不进行检查)
---@param buf userdata
---@return string
function to_string(buf)
end
--- File命名空间
File = {}
---* 获取文件夹所有文件
---@return nil 返回相对路径
---@param path string 路径
---@param ret string 返回的文件名
---@param rule table 匹配规则
---@param recursion boolean 递归文件夹
function File.GetPathFileAll(path, ret, rule, recursion)
end
---* 返回绝对路径
---*
---* 空路径返回空
---@param path_name string *
---@return string
function File.GetAbsolute(path_name)
end
---* 返回相对路径
---@return string 返回值带有./
---* 效率较低,可以使用String::ErasePath移除头部字符串
---@param path_name string * @param[in] path_base
---@param path_base string
function File.GetRelative(path_name, path_base)
end
---* 创建目录
---@return boolean 目录存在也返回真
---@param path string 路径
function File.CreateFolder(path)
end
---* 删除文件夹内容,但不删除文件夹
---* 文件夹不存在则什么都不做
---@param path_name string 路径名称
---@return nil
function File.DeleteContent(path_name)
end
---* 重命名文件
---@param src string 路径名称
---@param tar string 修改为
---@return boolean
function File.Rename(src, tar)
end
---* memcpy_s的替代品
---@param target nil
---@param size number
---@param source nil
---@param size_source number
---@return nil
function File.Copy(target, size, source, size_source)
end
---* 返回文件所在路径
---* a/b返回a/a/b/返回a/b/a/b/c.txt返回a/b/
---@param path_name string 必须传入右斜杠
---@return string
function File.GetFilePath(path_name)
end
---* 返回文件名
---* a/b返回ba/b/返回空
---@param path_name string * @note a/b返回ba/b/返回空
---@return string
function File.GetFileName(path_name)
end
---* 按文本读文件
---@param path_name string 路径名称
---@return string
function File.GetString(path_name)
end
---* 将字符串保存为文件
---@param str string 字符串
---@param path_name string 保存路径(文件夹必须存在)
---@return boolean
function File.SaveString(str, path_name)
end
---@type any
File.GetAbsolute = nil
---@type any
File.GetRelative = nil
---@type any
File.CreateFolder = nil
---@type any
File.DeleteContent = nil
---@type any
File.Rename = nil
---@type any
File.Copy = nil
---@type any
File.GetFilePath = nil
---@type any
File.GetFileName = nil
---@type any
File.GetString = nil
--- String命名空间
String = {}
---* 移除路径(第一个子串)
---@param path_name string
---@param path string
---@return string
function String.ErasePath(path_name, path)
end
---* 获取文件名不含后缀
---@param path_name string
---@return string
function String.GetFileStem(path_name)
end
---@param ... any
function String.toPosition2(...)
end
---* 替换后缀格式,没有则添加
---* 例如 "img/dog.ani.png" -> "img/dot.ani.jpg"
---* 例如 "img/dog" -> "img/dot.jpg"
---@param path_name string
---@param fmt string 格式,不含点号
---@return nil
function String.ReplaceExtension(path_name, fmt)
end
---* 移除 路径末尾名称(返回文件所在目录,移除后末尾为/)
---* 例如 "img/dog.ani.png" -> "img/"
---@param path_name string
---@return nil
function String.EraseFilename(path_name)
end
---@type any
String.ErasePath = nil
---@type any
String.GetFileStem = nil
---@type any
String.toPosition2 = nil
--- Img命名空间
Img = {}
---
---@return string
function Img.REGEX_FORMAT(...)
end
---* 调整为指定大小
---* 保留原有值
---@param size Size
---@return nil
function Img.Resize(size)
end
---* 设置透明色颜色为0,针对于某些颜色透明,但是其他通道非0
---@param img Image
---@param a number 阈值,小于等于a就认为是透明的
---@param col_new number 替换为颜色
---@return nil
function Img.SetAlphaZero(img, a, col_new)
end
---* 创建一个声音
---* 不会返回空指针
---@param name string 资源名
---@return any
function Img.Create(name)
end
---* 保存到图像
---@param img Image
---@param path_name string
---@return boolean
function Img.Save(img, path_name)
end
---@type string
Img.REGEX_FORMAT = ".(jpg|jpeg|png|tag|bmp|gif|hdr|pic)$"
---@type any
Img.Save = nil
--- ParamWindow类
---@class ParamWindow
ParamWindow = {}
---@param ... any
function ParamWindow:title(...)
end
--- Sprite类
---@class Sprite
Sprite = {}
---* @brief 绘制一帧
---@param window any
function Sprite:Render(window)
end
---* @brief 设置颜色
---@param col Color
---@param type UIText
function Sprite:SetColor(col, type)
end
--- Text类
---@class Text
Text = {}
---* @brief 绘制一帧
---@param window any
function Text:Render(window)
end
---* @brief 设置内容
--- * @retval 未修改返回false
--- *
--- * @remarks 格式化标签如下
--- * @remarks [c_red] 颜色 红色,可以有3个,额外指定描边和阴影的颜色
--- * @remarks [f_0] 字体 id为0的字体
--- * @remarks [s_24_2_1] 字体大小 24大小,2描边大小,1阴影偏移
--- * @remarks [spr_test_0_1] 精灵 test, [0, 1]
--- * @remarks [v_money] 变量 money
--- * @remarks [t_8] 对齐 tab对齐到8个字体大小,默认为2个(即4个英文字母宽度)
--- * @remarks [l] 左中括号
--- * @remarks [r] 右中括号
--- * @remarks [n_2] 换行 换行2次,默认为1次
--- * @remarks [b_white] 背景颜色 白色
--- * @remarks 特殊的 [c]、[f] 还原到字体本身颜色和字体
---@param str string 要设置的内容
function Text:SetString(str)
end
--- Factory类
---@class Factory
Factory = {}
---* @brief 设置资源路径(不设置则不会加载)
---@param path string 路径
function Factory:SetPath(path)
end
---* @brief 创建一个文本
--- * @retval 失败返回nullptr
---@param font_id number 字体编号
---@param font_size number 字体大小(单位为像素,英文字母大约为一半大小)
---@param col Color 颜色
---@param font_outline number 描边大小
---@param col_outline Color 描边颜色
---@param font_shadow number 阴影偏移
---@param col_shadow Color 阴影颜色
function Factory:CreateText(font_id, font_size, col, font_outline, col_outline, font_shadow, col_shadow)
end
---@param ... any
function Factory:CreateTextDefault(...)
end
---* @brief 创建一个精灵
--- * @retval 失败返回默认精灵,错误产生日志。
---@param name string 名字,例如“ui.btn0”
---@param index number 下标
function Factory:CreateSprite(name, index)
end
--- System类
---@class System
System = {}
---* @brief 设置 初始化函数
---@param func any
function System:SetFuncInit(func)
end
---* @brief 设置 帧函数
---@param func any
function System:SetFuncRun(func)
end
--- Graphics类
---@class Graphics
Graphics = {}
---* @brief 绘制2D矩形
---@param p0 Position2 矩形左上角的2D坐标
---@param p1 Position2 矩形右下角的2D坐标
function Graphics:Rectangle2D(p0, p1)
end
--- Position类
---@class Position
Position = {}
---@param ... any
function Position:x(...)
end
---@param ... any
function Position:y(...)
end
--- 全局g_system实例
g_system = nil --[[@type System]]
---* 设置 初始化函数
---@param func any
function g_system.SetFuncInit(func)
end
---* 设置 帧函数
---@param func any
function g_system.SetFuncRun(func)
end
--- 全局g_gfx实例
g_gfx = nil --[[@type Graphics]]
---* 绘制2D矩形
---@param p0 Position2 矩形左上角的2D坐标
---@param p1 Position2 矩形右下角的2D坐标
function g_gfx.Rectangle2D(p0, p1)
end
--- 全局g_factory实例
g_factory = nil --[[@type Factory]]
---* 设置资源路径(不设置则不会加载)
---@param path string 路径
function g_factory.SetPath(path)
end
---* 创建一个文本
---@return gcText 失败返回nullptr
---@param font_id number 字体编号
---@param font_size number 字体大小(单位为像素,英文字母大约为一半大小)
---@param col Color 颜色
---@param font_outline number 描边大小
---@param col_outline Color 描边颜色
---@param font_shadow number 阴影偏移
---@param col_shadow Color 阴影颜色
function g_factory.CreateText(font_id, font_size, col, font_outline, col_outline, font_shadow, col_shadow)
end
---@param ... any
function g_factory.CreateTextDefault(...)
end
---* 创建一个精灵
---@return any 失败返回默认精灵,错误产生日志。
---@param name string 名字,例如“ui.btn0”
---@param index number 下标
function g_factory.CreateSprite(name, index)
end
--- 辅助类型定义
---@class Position2
---@field x number X坐标
---@field y number Y坐标
---@class Size
---@field w number 宽度
---@field h number 高度
---@class Color
---@field r number 红色通道 (0-1)
---@field g number 绿色通道 (0-1)
---@field b number 蓝色通道 (0-1)
---@field a number 透明度 (0-1)
Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File
View File
@@ -0,0 +1,2 @@
-618
-645
@@ -0,0 +1,2 @@
-97
-97
@@ -0,0 +1,2 @@
-41
-24
@@ -0,0 +1,2 @@
-41
-24
@@ -0,0 +1,2 @@
-41
-24
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 673 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

+13
View File
@@ -0,0 +1,13 @@
{
"iv": "2b09e44eba4be2a100040201",
"key": "f69eae225cbb91d0791fc3d5eefae1e7dfb707f82c358220e1af95380500d3e9",
"tag": "10782dfe5f6d008ce41618ffe72a1ff5",
"test": {
"a": "xxx",
"arr": [
1,
2,
3
]
}
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- $Id -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable />
<assemblyIdentity type="win32" name="Microsoft.DTfW.DHL" version="6.11.1.404" processorArchitecture="amd64" />
<file name="dbghelp.dll" />
</assembly>
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- $Id -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable />
<assemblyIdentity type="win32" name="Microsoft.DTfW.DHL" version="6.11.1.404" processorArchitecture="x86" />
<file name="dbghelp.dll" />
</assembly>
@@ -0,0 +1,47 @@
local path_src = File.GetAbsolute("./src/")
local path_out = File.GetAbsolute("./out/")
-- 创建输出目录
File.CreateFolder(path_out)
local path_key = path_src .. "key.json"
if File.IsExist(path_key) then
local key = Crypto.GenerateKeyAes256()
local j = {}
j["key"] = to_string_hex(key._key)
j["iv"] = to_string_hex(key._iv, true)
j["tag"] = to_string(key._tag)
-- test json
local j1= {}
j1["a"] = "xxx"
j1["arr"] = {1, 2, 3}
j["test"] = j1
if File.SaveString(json.encode(j), path_key) then
print(path_key .. "已保存")
else
print(path_key .. "保存失败")
end
end
local str = File.GetString(path_src .. "key.json")
local j = json.decode(str)
print(j.key)
print(j.test.arr)
print(j.test.arr[1])
local key = Crypto.Aes256Key()
key._key = CreateBufferHex(j.key)
key._iv = CreateBufferHex(j.iv)
key._tag = CreateBufferHex(j.tag)
local out = Crypto.EncryptAes256(File.GetBuffer(path_src .. "apple.png"), key)
File.SaveBuffer(out, path_out .. "apple.aes256")
-- print(param._src.."->"..param._out)
print "此工具会将src文件夹的apple.png加密为 apple.aes256"
pause()
@@ -0,0 +1,16 @@
local path_src = File.GetAbsolute("./src/")
local path_out = File.GetAbsolute("./out/")
-- 创建输出目录
File.CreateFolder(path_out)
local param = ToolArchiverParam()
param._src = path_src
param._out = path_out .. "a.lz4"
param._compressMode = Memory.CompressMode.LZ4
param._bCrc = true
ToolArchiver.Compress(param)
print(param._src.."->"..param._out)
print "此工具会批量转src文件夹的所有文件压缩为 a.lz4"
pause()
@@ -0,0 +1,31 @@
-- 你的资源根目录
local rootPath = "D:/work/base_actor/image/ani/"
-- 所有需要压缩的文件夹列表
local folders = {
"刀盾兵重甲",
"双刀兵",
"大刀兵中甲",
"大锤兵",
"女琴师",
"弓箭手",
"弓箭手中甲",
"弓箭手轻甲",
"弓船",
"搬运工",
"标枪",
"树木倒塌",
"武将",
"祭司",
"蛮族侦察兵",
"蛮族步兵",
"酒者",
"黑骑士"
}
-- 遍历并压缩
for _, folder in ipairs(folders) do
local fullPath = rootPath .. folder
g_factory:CompressMir2Res(fullPath)
print("已压缩: " .. folder)
end
@@ -0,0 +1,25 @@
local path_src = File.GetAbsolute("./src/")
local path_out = File.GetAbsolute("./out/")
-- 创建输出目录
File.CreateFolder(path_out)
File.Copy(path_src, path_out, File.CopyMode.OVERRIDE, true)
-- 第二个参数可以填入正则表达式过滤 例如 ".(png|jpg)$"
local ret_files = File.GetPathFileAll(path_out)
for key, value in pairs(ret_files) do
local path = File.GetFilePath(value)
local filename = File.GetFileName(value)
-- 保留路径,则将下一行的 path_out替换为 path
local out = path_out .. string.lower(filename)
File.Rename(value, out)
print(value.."->"..out)
end
print "此工具会批量修改src文件夹的所有文件名为小写"
pause()
@@ -0,0 +1,30 @@
local path_src = File.GetAbsolute("./src/")
local path_out = File.GetAbsolute("./out/")
-- 创建输出目录
File.DeleteContent(path_out)
File.CreateFolder(path_out)
local ret_files = File.GetPathFileAll(path_src, Img.REGEX_FORMAT, false)
for key, value in pairs(ret_files) do
local path = File.GetFilePath(value)
local filename = File.GetFileName(value)
local out = path_out .. string.lower(filename)
local img = Img.Create(value)
if img then
-- 参数为 透明度阈值、替换后颜色argb
Img.SetAlphaZero(img, 1, 4278255360)
Img.Save(img, out)
delete(img)
print(value.."->"..out)
end
end
print "此工具会将src文件夹的所有图片的透明颜色置0"
pause()
@@ -0,0 +1,46 @@
local path_src = File.GetAbsolute("./src/")
local path_out = File.GetAbsolute("./out/")
local scale = 0.5
-- 创建输出目录
File.CreateFolder(path_out)
local ret_files = File.GetPathFileAll(path_src, Img.REGEX_FORMAT, false)
for key, value in pairs(ret_files) do
--
local img = Img.Create(value)
local out = path_out .. File.GetRelative(value, path_src)
out = String.ReplaceExtension(out, "png")
local img_out = Img.Resize(img, scale)
delete(img)
Img.Save(img_out, out)
delete(img_out)
-- 锚点文件处理
local mata_name = String.EraseFilename(value)
mata_name = mata_name .. "Placements/".. String.GetFileStem(value) .. ".txt"
local out_name = String.EraseFilename(out)
File.CreateFolder(out_name .. "Placements/")
out_name = out_name .. "Placements/".. String.GetFileStem(value) .. ".txt"
local str = File.GetString(mata_name)
if #str > 0 then
print(str)
local pos = String.toPosition2(str, '\n')
pos.y = math.floor(pos.y * scale)
print(pos.y)
pos.y = math.floor(pos.y * scale)
str = pos.x..'\n'..pos.y
File.SaveString(str, out_name)
end
print(value .. "->" .. out)
end
print "此工具会批量缩放src文件夹的所有图片,若只是统一转换为png,则scale填1"
pause()
@@ -0,0 +1,55 @@
local path_src = File.GetAbsolute("./src/")
local path_out = File.GetAbsolute("./out/")
local scale = 0.5
-- 创建输出目录
File.CreateFolder(path_out)
local ret_files = File.GetPathFileAll(path_src, Img.REGEX_FORMAT, false)
for key, value in pairs(ret_files) do
--
local img = Img.Create(value)
local out = path_out .. File.GetRelative(value, path_src)
out = String.ReplaceExtension(out, "png")
-- 锚点文件处理
local mata_name = String.EraseFilename(value)
mata_name = mata_name .. "Placements/".. String.GetFileStem(value) .. ".txt"
local out_name = String.EraseFilename(out)
File.CreateFolder(out_name .. "Placements/")
out_name = out_name .. "Placements/".. String.GetFileStem(value) .. ".txt"
-- 读取旧锚点
local anchor = Point()
local str = File.GetString(mata_name)
if #str > 0 then
-- print(str)
anchor = -String.toPoint2(str, '\n')
end
-- 裁切
local rect = RectU()
local pos_lt = Align.GetLT(rect)
Img.CalcLeastRect(img, rect)
local new_size = Align.GetSize(rect)
local img_out = Img.Create(new_size, ColorDef.WHITE)
Img.AddRect(img_out, img, rect, PointU())
delete(img)
Img.Save(img_out, out)
-- 新锚点
local pos_lt_out = Align.GetLT(rect)
local anchor_out = anchor - (toPoint(pos_lt_out) - toPoint(pos_lt))
local str = -anchor_out.x..'\n'..-anchor_out.y
File.SaveString(str, out_name)
print(value .. "->" .. out)
end
print "此工具会批量裁切src文件夹的所有图片,去除透明色并计算新锚点"
pause()
@@ -0,0 +1,39 @@
local path_src = File.GetAbsolute("./src/")
local path_out = File.GetAbsolute("./out/")
-- 创建输出目录
File.DeleteContent(path_out)
File.CreateFolder(path_out)
local ret_files = File.GetPathFileAll(path_src)
local vec_crc32 = {}
local vec_md5 = {}
local vec_sha256 = {}
for key, value in pairs(ret_files) do
local buf = File.GetBuffer(value)
local crc32 = Crypto.HashCrc32(buf, 0)
local md5 = Crypto.HashMd5(buf)
local sha256 = Crypto.HashSha256(buf)
value = File.GetRelative(value, path_src)
vec_crc32[value] = crc32
vec_md5[value] = md5
vec_sha256[value] = sha256
end
local func_save = function(vec, name)
local str = ""
for key, value in pairs(vec) do
str = str .. to_string(value) .. "\t" .. key .. "\n"
end
File.SaveString(str, path_out .. name)
end
func_save(vec_crc32, "crc32.txt")
func_save(vec_md5, "md5.txt")
func_save(vec_sha256, "sha256.txt")
print "此工具将src文件夹内的文件,计算出crc32、md5、sha256,保存到out文件夹内"
pause()
@@ -0,0 +1,28 @@
local path_src = File.GetAbsolute("./src/")
local path_out = File.GetAbsolute("./out/")
-- 创建输出目录
File.CreateFolder(path_out)
local ret_files = File.GetPathFileAll(path_src, Img.REGEX_FORMAT, false)
for key, value in pairs(ret_files) do
print("识别到图片:"..value)
end
print("识别到图片数量:"..#ret_files)
for key, value in pairs(ret_files) do
--
local img = Img.Create(value)
local out = path_out .. File.GetRelative(value, path_src)
out = String.ReplaceExtension(out, "png")
Img.Save(img, out)
delete(img)
print(value .. "->" .. out)
end
print "此工具会批量转src文件夹的所有图片为png格式"
pause()
@@ -0,0 +1,30 @@
local path_src = File.GetAbsolute("./src/")
local path_out = File.GetAbsolute("./out/")
-- 创建输出目录
File.DeleteContent(path_out)
File.CreateFolder(path_out)
local ret_files = File.GetPathFileAll(path_src, Img.REGEX_FORMAT, false)
for key, value in pairs(ret_files) do
local path = File.GetFilePath(value)
local filename = File.GetFileName(value)
local out = path_out .. string.lower(filename)
local img = Img.Create(value)
if img then
-- 参数为 透明度阈值、替换后颜色argb
Img.CvtEffect2Normal(img)
Img.Save(img, out)
delete(img)
print(value.."->"..out)
end
end
print "此工具会将src文件夹的所有图片(特效)转换为带alpha的透明图片"
pause()
+38
View File
@@ -0,0 +1,38 @@
local spr
local txt
function Init()
--print("init call")
spr = g_factory:CreateSprite("apple", 0)
txt = g_factory:CreateTextDefault()
txt:SetString("文本绘制测试")
end
function Run()
--print("run call")
g_gfx:Rectangle2D({50, 100}, {950, 1000})
spr:SetColor(ColorDef.NONE, 0)
spr:Render()
txt:Render()
print("run call")
end
print("hello dl!")
g_factory:SetPath("src/", "model/", "binary/", "temp/");
local param = ParamWindow()
param.title = "dl lua"
g_system:SetFuncInit(Init)
g_system:SetFuncRun(Run)
g_system:Start(param)
log("end")
@@ -0,0 +1,11 @@
local path_src = File.GetAbsolute("./")
local path_out = File.GetAbsolute("./out/")
-- 创建输出目录
File.CreateFolder(path_out)
ToolArchiver.Decompress(path_src.."a.lz4", path_out)
print(path_src.."a.lz4".."->"..path_out)
print "此工具会批量转src中的 a.lz4解压到 out目录"
pause()
@@ -0,0 +1,28 @@
local path_src = File.GetAbsolute("./src/")
local path_out = File.GetAbsolute("./out/")
-- 创建输出目录
File.CreateFolder(path_out)
local path_key = path_src .. "key.json"
if not File.IsExist(path_key) then
print("密钥文件不存在:"..path_key)
return
end
local str = File.GetString(path_src .. "key.json")
local j = json.decode(str)
local key = Crypto.Aes256Key()
key._key = CreateBufferHex(j.key)
key._iv = CreateBufferHex(j.iv)
key._tag = CreateBufferHex(j.tag)
local out = Crypto.DecryptAes256(File.GetBuffer(path_src .. "apple.aes256"), key)
File.SaveBuffer(out, path_out .. "apple.png")
-- print(param._src.."->"..param._out)
print "此工具会将src文件夹的apple.aes256解密为 apple.png"
pause()
+84
View File
@@ -0,0 +1,84 @@
#include <dl.h>
using namespace dl;
//Client client;
//void client_send(void*)
//{
// while (true)
// {
// //client.Send("客户端发送数据");
// std::this_thread::sleep_for(std::chrono::seconds(2));
// }
//}
int main()
{
//String::TestSplit();
Engine::Init();
//Mat::Test();
/*Thread* t = g_thread->Create();
t->Start(client_send, nullptr);*/
//{
// Server server;
// if (!server.Accept())
// {
// log_err("服务器Accept失败!");
// return -1;
// }
// server.Run();
// Client client;
// if (!client.Connent())
// {
// log_err("客户端Connect失败!");
// return -1;
// }
// size_t i = 0;
// while (i++ < 10)
// {
// log_info("客户端发送!");
// client.Send(CreateBufferView("Hello dl!"));
// std::this_thread::sleep_for(std::chrono::seconds(1));
// }
//}
//TestScript(SCRIPT_TEST_SCOPE);
//Buffer buf = File::GetBuffer("E:/logo.png");
//std::string str;
//str += "constexpr std::vector<unsigned char> g_logoImage = {\n";
//size_t i = 0;
//for (auto& ch : buf)
//{
// str += fmt::format("0x{:02x}, ", ch);
// ++i;
// if (i % 10 == 0)
// str += "\n";
//}
//str += "};\n";
//File::SaveString(str, "E:/logo.h");
Value v = 100;
log_msg("{}", to_string(v));
Value v1 = "nnnnn";
log_msg("{}", v1.GetString());
std::array<float, 2> xy{ 10,2 };
Value v2 = xy;
log_msg("{}", v2.GetString());
g_lua = new LuaScript;
g_lua->DoFile("main.lua");
delete g_lua;
Engine::Release();
return 0;
}