Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ jobs:
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Setup Lua
uses: leafo/gh-actions-lua@v13
with:
luaVersion: "5.4"

- name: "[Linux Only]: Install Linux dependencies"
if: runner.os == 'Linux'
run: |
Expand Down Expand Up @@ -122,6 +127,7 @@ jobs:
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/.lua/"
-S ${{ github.workspace }}

- name: Build
Expand Down
46 changes: 26 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.28)
project(The-Hidden-Route VERSION 0.1.0 DESCRIPTION "迷宫,但是被隐藏的路由你定义。" LANGUAGES CXX)
project(The-Hidden-Route
VERSION 0.1.0
DESCRIPTION "迷宫,但是被隐藏的路由你定义。"
LANGUAGES CXX
)

# 取消编译器扩展
set(CMAKE_CXX_EXTENSIONS OFF "Disable C++ compiler extensions")
Expand All @@ -11,8 +15,14 @@ set(CMAKE_CXX_SCAN_FOR_MODULES OFF "Disable CMake C++ modules support")
enable_testing()

# 添加版本
configure_file(${PROJECT_SOURCE_DIR}/include/thr/base/config.hpp.in ${PROJECT_SOURCE_DIR}/include/thr/base/config.hpp)
configure_file(${PROJECT_SOURCE_DIR}/Doxyfile.internal.in ${PROJECT_SOURCE_DIR}/Doxyfile.internal)
configure_file(
${PROJECT_SOURCE_DIR}/include/thr/base/config.hpp.in
${PROJECT_SOURCE_DIR}/include/thr/base/config.hpp
)
configure_file(
${PROJECT_SOURCE_DIR}/Doxyfile.internal.in
${PROJECT_SOURCE_DIR}/Doxyfile.internal
)
configure_file(${PROJECT_SOURCE_DIR}/Doxyfile.in ${PROJECT_SOURCE_DIR}/Doxyfile)

# 添加编译器标志
Expand All @@ -25,44 +35,40 @@ target_compile_features(thr_compiler_flags INTERFACE cxx_std_23)
set(gcc_like_cxx $<COMPILE_LANG_AND_ID:CXX,ARMClang,AppleClang,Clang,GNU,LCC>)
set(msvc_cxx $<COMPILE_LANG_AND_ID:CXX,MSVC>)
target_compile_options(thr_compiler_flags
INTERFACE
$<${gcc_like_cxx}:$<BUILD_INTERFACE:-Wall;-Wextra;-Wpedantic>>
$<${msvc_cxx}:$<BUILD_INTERFACE:-W3>>
INTERFACE
$<${gcc_like_cxx}:$<BUILD_INTERFACE:-Wall;-Wextra;-Wpedantic>>
$<${msvc_cxx}:$<BUILD_INTERFACE:-W3>>
)

# 添加优化
target_compile_options(thr_compiler_flags
INTERFACE
$<${gcc_like_cxx}:$<BUILD_INTERFACE:$<$<CONFIG:Release>:-O2>>>
INTERFACE $<${gcc_like_cxx}:$<BUILD_INTERFACE:$<$<CONFIG:Release>:-O2>>>
)

# 添加对 gcc 的 c++23 `print` / `println` 函数的 `Windows` 版本的支持
set(gcc_cxx $<COMPILE_LANG_AND_ID:CXX,GNU>)
if(gcc_cxx)
target_link_libraries(thr_compiler_flags
INTERFACE
$<BUILD_INTERFACE:-lstdc++exp>
)
target_link_libraries(thr_compiler_flags
INTERFACE $<BUILD_INTERFACE:-lstdc++exp>
)
endif()

# 添加对 MSVC 的支持
target_compile_options(thr_compiler_flags
INTERFACE
$<${msvc_cxx}:$<BUILD_INTERFACE:/Zc:preprocessor>>
INTERFACE $<${msvc_cxx}:$<BUILD_INTERFACE:/Zc:preprocessor>>
)

# 包含头文件目录
target_include_directories(thr_compiler_flags
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
)

# 添加调试/发行宏
target_compile_definitions(thr_compiler_flags
INTERFACE
$<BUILD_INTERFACE:$<$<CONFIG:Debug>:DEBUG=1>>
$<BUILD_INTERFACE:$<$<CONFIG:Debug>:_DEBUG=1>>
$<BUILD_INTERFACE:$<$<CONFIG:Release>:NDEBUG=1>>
INTERFACE
$<BUILD_INTERFACE:$<$<CONFIG:Debug>:DEBUG=1>>
$<BUILD_INTERFACE:$<$<CONFIG:Debug>:_DEBUG=1>>
$<BUILD_INTERFACE:$<$<CONFIG:Release>:NDEBUG=1>>
)

# 添加子目录
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions configs.json → assets/json/configs.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,10 @@
"r": 25,
"g": 125,
"b": 245
},
"font_path": "font.otf",
"game_screen_size": {
"x": 800,
"y": 600
}
}
227 changes: 227 additions & 0 deletions assets/json/level1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
{
"$schema": "../../schema/level-v0.1.0-4.schema.json",
"level_script": "level1.lua",
"segments": [
{
"start_center": {
"x": 200,
"y": 200
},
"length": 300,
"dir": "right",
"next": 1
},
{
"start_center": {
"x": 500,
"y": 200
},
"length": 100,
"dir": "down",
"prev": 0,
"next": 2
},
{
"start_center": {
"x": 500,
"y": 300
},
"length": 250,
"dir": "left",
"prev": 1,
"next": 3
},
{
"start_center": {
"x": 250,
"y": 300
},
"length": 80,
"dir": "up",
"prev": 2,
"tags": [
0
]
},
{
"start_center": {
"x": 250,
"y": 180
},
"length": 130,
"dir": "up",
"next": 5
},
{
"start_center": {
"x": 250,
"y": 50
},
"length": 250,
"dir": "right",
"prev": 4,
"next": 6
},
{
"start_center": {
"x": 500,
"y": 50
},
"length": 100,
"dir": "down",
"prev": 5,
"next": 7
},
{
"start_center": {
"x": 500,
"y": 150
},
"length": 150,
"dir": "left",
"prev": 6,
"next": 8
},
{
"start_center": {
"x": 350,
"y": 150
},
"length": 80,
"dir": "up",
"prev": 7,
"tags": [
1
]
},
{
"start_center": {
"x": 520,
"y": 50
},
"length": 80,
"dir": "right"
}
],
"line_strips": {
"vertexs": [
[
{
"x": 260,
"y": 210
},
{
"x": 260,
"y": 290
},
{
"x": 490,
"y": 290
},
{
"x": 490,
"y": 210
},
{
"x": 190,
"y": 210
},
{
"x": 190,
"y": 190
},
{
"x": 510,
"y": 190
},
{
"x": 510,
"y": 310
},
{
"x": 240,
"y": 310
},
{
"x": 240,
"y": 210
}
],
[
{
"x": 240,
"y": 190
},
{
"x": 240,
"y": 40
},
{
"x": 510,
"y": 40
},
{
"x": 510,
"y": 160
},
{
"x": 340,
"y": 160
},
{
"x": 340,
"y": 60
}
],
[
{
"x": 260,
"y": 190
},
{
"x": 260,
"y": 60
},
{
"x": 490,
"y": 60
},
{
"x": 490,
"y": 140
},
{
"x": 360,
"y": 140
},
{
"x": 360,
"y": 60
}
],
[
{
"x": 510,
"y": 40
},
{
"x": 610,
"y": 40
},
{
"x": 610,
"y": 60
},
{
"x": 510,
"y": 60
}
]
],
"width": 5
},
"level_info": {
"start_segment_entity": 0,
"end_segment_entity": 9
}
}
8 changes: 6 additions & 2 deletions main/level1.json → assets/json/level2.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"$schema": "../schema/level-v0.1.0-3.schema.json",
"$schema": "../../schema/level-v0.1.0-4.schema.json",
"level_script": "level2.lua",
"segments": [
{
"start_center": {
Expand Down Expand Up @@ -37,7 +38,10 @@
},
"length": 80,
"dir": "up",
"prev": 2
"prev": 2,
"tags": [
0
]
},
{
"start_center": {
Expand Down
2 changes: 1 addition & 1 deletion main/level_graph.json → assets/json/level_graph.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "../schema/level_graph-v0.1.0-2.schema.json",
"$schema": "../../schema/level_graph-v0.1.0-2.schema.json",
"level_nodes": [
{
"relative_entities": [
Expand Down
Loading
Loading