refactor: 重构项目结构和资源管理

- 将主程序代码和资源文件移动到Game目录下
- 更新构建脚本以适配新的目录结构
- 重构应用初始化流程,移除冗余代码
- 更新着色器文件路径和资源管理逻辑
- 删除废弃的windows.lua构建脚本
- 优化Switch平台构建配置
This commit is contained in:
2026-03-16 02:45:52 +08:00
parent f8c2c26cdc
commit 092a28c30e
18 changed files with 82 additions and 181 deletions

View File

@@ -4,6 +4,9 @@ target("Frostbite2D")
add_files(path.join(os.projectdir(), "Frostbite2D/src/**.cpp"))
add_files(path.join(os.projectdir(), "Frostbite2D/src/**.c"))
add_includedirs(path.join(os.projectdir(), "Frostbite2D/include"))
add_files(path.join(os.projectdir(), "Game/src/**.cpp"))
add_includedirs(path.join(os.projectdir(), "Game/include"))
-- 检查 DEVKITPRO 环境变量Windows 上使用 C:/devkitPro
local devkitPro = os.getenv("DEVKITPRO") or "L:/Switch/devkitPro"
@@ -42,7 +45,9 @@ target("Frostbite2D")
{public = true})
add_syslinks("nx", "m")
-- 构建后生成 NRO 文件
-- 复制着色器文件到输出目录
after_build(function (target)
local elf_file = target:targetfile()
local output_dir = path.directory(elf_file)
@@ -63,5 +68,24 @@ target("Frostbite2D")
end
print("Generated NRO: " .. nro_file)
end
-- 复制 shaders 目录
local shaders_dir = path.join(os.projectdir(), "Game/shaders")
local target_shaders_dir = path.join(output_dir, "shaders")
if os.isdir(shaders_dir) then
-- 确保目标目录存在
if not os.isdir(target_shaders_dir) then
os.mkdir(target_shaders_dir)
end
-- 复制所有着色器文件
for _, file in ipairs(os.files(path.join(shaders_dir, "*.*"))) do
local filename = path.filename(file)
local target_file = path.join(target_shaders_dir, filename)
os.cp(file, target_file)
print("Copy shader: " .. filename)
end
end
end)
target_end()