Skip to content

Commit 4c9888a

Browse files
authored
feat: use asw (#5)
* chore: migrate assets * feat: port to asw * fix: id * chore: update readme
1 parent aa4ee48 commit 4c9888a

139 files changed

Lines changed: 715 additions & 4119 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Deploy Game
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v*
9+
pull_request:
10+
branches:
11+
- main
12+
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
concurrency:
19+
group: "${{ github.workflow }}-${{ github.ref }}"
20+
cancel-in-progress: true
21+
22+
jobs:
23+
deploy:
24+
name: Deploy
25+
environment:
26+
name: github-pages
27+
url: ${{ steps.deployment.outputs.page_url }}
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Setup cache
34+
uses: actions/cache@v4
35+
with:
36+
path: "_deps"
37+
key: deps-${{ runner.os }}
38+
39+
- uses: mymindstorm/setup-emsdk@v14
40+
with:
41+
version: 4.0.6
42+
actions-cache-folder: "emsdk-cache"
43+
44+
- name: Download ports
45+
run: |
46+
embuilder build harfbuzz
47+
48+
- name: Run CMake
49+
run: emcmake cmake -G "Unix Makefiles" .
50+
51+
- name: Make
52+
run: emmake make -j4
53+
54+
- uses: actions/upload-pages-artifact@v3
55+
if: github.ref == 'refs/heads/main'
56+
with:
57+
path: ./build
58+
59+
- name: Deploy to GitHub Pages
60+
if: github.ref == 'refs/heads/main'
61+
id: deployment
62+
uses: actions/deploy-pages@v4
63+
64+
- name: Deploy to A.D.S. Games
65+
if: startsWith(github.ref, 'refs/tags/v')
66+
uses: adsgames/deploy-to-adsgames@v1.1.2
67+
with:
68+
project-id: mazes
69+
build-dir: ./build/
70+
platform: WEB
71+
bucket-access-key: ${{ secrets.LINODE_BUCKET_ACCESS_KEY }}
72+
bucket-secret-key: ${{ secrets.LINODE_BUCKET_SECRET_KEY }}
73+
api-key: ${{ secrets.ADSGAMES_API_KEY }}

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ $RECYCLE.BIN/
3232
# Icon must ends with two \r.
3333
Icon
3434

35-
3635
# Thumbnails
3736
._*
3837

@@ -49,4 +48,6 @@ install_manifest.txt
4948
bin
5049
docs
5150
lib
52-
build/Mazes*
51+
build/
52+
_deps/
53+
compile_commands.json

.vscode/settings.json

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,52 @@
11
{
22
"files.associations": {
3-
"fstream": "cpp"
3+
"fstream": "cpp",
4+
"array": "cpp",
5+
"__bit_reference": "cpp",
6+
"__config": "cpp",
7+
"__locale": "cpp",
8+
"__threading_support": "cpp",
9+
"__verbose_abort": "cpp",
10+
"bitset": "cpp",
11+
"cctype": "cpp",
12+
"clocale": "cpp",
13+
"cmath": "cpp",
14+
"cstdarg": "cpp",
15+
"cstddef": "cpp",
16+
"cstdint": "cpp",
17+
"cstdio": "cpp",
18+
"cstdlib": "cpp",
19+
"cstring": "cpp",
20+
"ctime": "cpp",
21+
"cwchar": "cpp",
22+
"cwctype": "cpp",
23+
"execution": "cpp",
24+
"initializer_list": "cpp",
25+
"iomanip": "cpp",
26+
"ios": "cpp",
27+
"iosfwd": "cpp",
28+
"istream": "cpp",
29+
"limits": "cpp",
30+
"locale": "cpp",
31+
"mutex": "cpp",
32+
"new": "cpp",
33+
"ostream": "cpp",
34+
"ratio": "cpp",
35+
"sstream": "cpp",
36+
"stdexcept": "cpp",
37+
"streambuf": "cpp",
38+
"string": "cpp",
39+
"string_view": "cpp",
40+
"tuple": "cpp",
41+
"typeinfo": "cpp",
42+
"variant": "cpp",
43+
"algorithm": "cpp",
44+
"bit": "cpp",
45+
"compare": "cpp",
46+
"type_traits": "cpp",
47+
"utility": "cpp",
48+
"*.tcc": "cpp",
49+
"cinttypes": "cpp",
50+
"random": "cpp"
451
}
5-
}
52+
}

CMakeLists.txt

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,58 @@
1-
cmake_minimum_required(VERSION 3.11)
1+
cmake_minimum_required(VERSION 3.24)
22

3-
set(CMAKE_CXX_STANDARD 14)
3+
set(CMAKE_CXX_STANDARD 17)
44
set(CMAKE_CXX_STANDARD_REQUIRED ON)
55
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build)
6+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
67

7-
project (Mazes)
8+
include(FetchContent)
9+
10+
project(Mazes)
811

912
# Source code
1013
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
14+
file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp)
1115
file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h)
1216

13-
add_executable (${PROJECT_NAME} ${SOURCES} ${HEADERS})
17+
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
1418

1519
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -pedantic)
1620

17-
# Find libs
18-
find_library(ALLEGRO_LIBRARY NAMES alleg44 alleg REQUIRED)
19-
find_library(ALLEGRO_PNG_LIBRARY NAMES loadpng REQUIRED)
20-
find_library(ALLEGRO_OGG_LIBRARY NAMES logg REQUIRED)
21-
21+
FetchContent_Declare(
22+
asw
23+
GIT_REPOSITORY https://github.com/adsgames/asw.git
24+
GIT_TAG v0.5.4
25+
)
26+
FetchContent_MakeAvailable(asw)
2227

2328
# Link Libs
24-
target_link_libraries(${PROJECT_NAME} ${ALLEGRO_LIBRARY})
25-
target_link_libraries(${PROJECT_NAME} ${ALLEGRO_PNG_LIBRARY})
26-
target_link_libraries(${PROJECT_NAME} ${ALLEGRO_OGG_LIBRARY})
27-
29+
if(MINGW)
30+
target_link_libraries(${PROJECT_NAME} -lmingw32)
31+
endif(MINGW)
32+
33+
target_link_libraries(
34+
${PROJECT_NAME}
35+
asw
36+
)
37+
38+
# Emscripten support
39+
if(EMSCRIPTEN)
40+
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "index")
41+
set(CMAKE_EXECUTABLE_SUFFIX ".html")
42+
43+
target_link_libraries(
44+
${PROJECT_NAME}
45+
-sWASM=1
46+
-sALLOW_MEMORY_GROWTH=1
47+
-sMAXIMUM_MEMORY=1gb
48+
)
49+
50+
set_target_properties(
51+
${PROJECT_NAME}
52+
PROPERTIES
53+
LINK_FLAGS
54+
"--preload-file ${CMAKE_CURRENT_LIST_DIR}/assets@/assets --use-preload-plugins --shell-file ${CMAKE_CURRENT_LIST_DIR}/index.html"
55+
)
56+
endif(EMSCRIPTEN)
57+
58+
file(COPY ${CMAKE_CURRENT_LIST_DIR}/assets DESTINATION ${CMAKE_BINARY_DIR}/build)

README.md

Lines changed: 11 additions & 43 deletions

assets/fonts/dosis.ttf

113 KB
Binary file not shown.

assets/images/background.png

4.63 KB

assets/images/blocks/2d/box.png

407 Bytes

assets/images/blocks/2d/broom.png

411 Bytes
449 Bytes

0 commit comments

Comments
 (0)