Skip to content

Commit 1037c15

Browse files
committed
- add action event.timeout
- add function to pack ImageContainer and return image + rects - add getTimeUVal and tests - add LazyImageContainer - add mingw presets - add option to draw whitespace in BitmapFont - add panel.AddDrawable action - add properties to Circle and Scrollable - add rectpack2D library - add reset to game constructor - add saveBytes function - add smooth fonts option - add spdlog support - add splitStringView - add startPosition and bytesToRead properties to file resource - add tests using Catch2 - fix errors caught with tests - fix loadingScreen showing background when StretchToFit is off - make getColorVal function work with json arrays of RGBA - make ParseAnimation read group and direction indexes - make Scrollable move in different directions - make Surface accept parameter not to be even aligned in size - refactor - refactor BitmapFontTexturePack to use ImageUtils::packImages - refactor GameUtils replace string functions to reuse the same code - refactor GameUtils::getTime to support negative numbers - refactor JsonUtils::replaceValuesWithGameVar to use same code as GameUtils's replace functions - refactor TexturePacks - remove custom vcpkg ports - remove DrawableText constructor from Text and replace it with Font constructor - remove endsWith function (use standard C++) - remove extra splitString and make existing accept multiple delimiters - remove getFramesKey/Val and use getRangeKey/Val - remove ParseUtilsIdx - remove ReverseIterable.h and use std::ranges - rename splitText to wordWrap - update BitmapFontTexturePack to support ImageContainers - update CMake files - update documentation - update dr_wav.h - update endian - update getTime implementation - update menu.setFont and menu.setAction to set both for all menu items by default - update NumberVector to load numbers separated by commas and whitespace too - update palette to load text based palettes - update ParseTexturePackIndexes.h to support texture index ranges - update ParseTexturePackIndexes.h to support texture indexes in reverse order - update sfeMovie to support ffmpeg 4, 5 and 6 - update SFML to official 2.6.0 release - use getSizeKey instead of getVector2fKey (rounds floats) - use getTimeU instead of GetTime - use small_vector instead of element + vector - use std::byte in FileBytes
1 parent ace9adc commit 1037c15

333 files changed

Lines changed: 33174 additions & 3649 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.

.editorconfig

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
11
root = true
22

3-
[CMakeLists.txt]
3+
[{.github/**.yml,*.md,docs/**.md,test/*.md}]
44
charset = utf-8
55
end_of_line = lf
6-
indent_size = 4
7-
indent_style = space
86
insert_final_newline = true
97

10-
[{*.json,.vscode/**.json,gamefiles**.json}]
8+
[{CMakeLists.txt,test/CMakeLists.txt}]
119
charset = utf-8
1210
end_of_line = lf
13-
indent_size = 2
11+
indent_size = 4
1412
indent_style = space
15-
insert_final_newline = false
13+
insert_final_newline = true
1614

17-
[gamefiles**.{frag,vert}]
15+
[{*,.vscode/**,test/data/**}.json]
1816
charset = utf-8
1917
end_of_line = lf
20-
indent_size = 4
21-
indent_style = tab
18+
indent_size = 2
19+
indent_style = space
2220
insert_final_newline = false
23-
trim_trailing_whitespace = true
2421

25-
[src/**]
22+
[{src/**,test/src/**}]
2623
charset = utf-8
2724
end_of_line = lf
2825
indent_size = 4
2926
indent_style = tab
3027
insert_final_newline = true
3128
trim_trailing_whitespace = true
3229

33-
[src/{endian,rapidjson}/**]
30+
[src/{rapidjson,Utils/endian}/**]
3431
indent_size = unset
3532
indent_style = unset
3633
insert_final_newline = unset

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
* text=auto
1+
* text=auto eol=lf
22
*.bin binary
33
*.bmp binary
44
*.c text

.github/workflows/main.yml

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,46 @@ on:
44
push:
55
branches: [ master ]
66
paths:
7-
- 'src/**'
7+
- '.github/workflows/**'
88
- 'CMakeLists.txt'
9+
- 'src/**'
10+
- 'test/**'
911
pull_request:
1012
branches: [ master ]
1113
paths:
12-
- 'src/**'
14+
- '.github/workflows/**'
1315
- 'CMakeLists.txt'
16+
- 'src/**'
17+
- 'test/**'
18+
19+
env:
20+
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
1421

1522
jobs:
1623
build_linux:
1724
name: linux build
18-
runs-on: ubuntu-22.04
25+
runs-on: ubuntu-latest
1926
steps:
2027
- name: Checkout DGEngine.core
21-
uses: actions/checkout@v3
28+
uses: actions/checkout@v4
2229

23-
- name: Restore cached dependencies
24-
id: cache-linux-x64
25-
uses: actions/cache@v3
30+
- name: Export GitHub Actions cache environment variables
31+
uses: actions/github-script@v6
2632
with:
27-
path: /home/runner/work/sfml
28-
key: cache-linux-x64
29-
30-
- name: Install dependencies
31-
run: |
32-
sudo apt install -yq --no-install-suggests --no-install-recommends libphysfs-dev > /dev/null
33-
sudo apt install -yq --no-install-suggests --no-install-recommends libalut-dev libflac-dev libgl1-mesa-dev libudev-dev libvorbis-dev libxcursor-dev libxrandr-dev > /dev/null
34-
sudo apt install -yq --no-install-suggests --no-install-recommends libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswscale-dev > /dev/null
33+
script: |
34+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
35+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
3536
36-
- name: CMake + make SFML
37-
if: steps.cache-linux-x64.outputs.cache-hit != 'true'
38-
run: |
39-
git clone -q --depth=1 --branch=feature/scancode https://github.com/dgcor/SFML.git /home/runner/work/sfml > /dev/null
40-
git -C /home/runner/work/sfml pull > /dev/null
41-
cd /home/runner/work/sfml
42-
export CC=/usr/bin/gcc-11
43-
export CXX=/usr/bin/g++-11
44-
cmake /home/runner/work/sfml/CMakeLists.txt
45-
sudo make install
37+
- name: Install Ubuntu dependencies
38+
uses: awalsh128/cache-apt-pkgs-action@latest
39+
with:
40+
packages: libx11-dev libxrandr-dev libxcursor-dev libxi-dev libudev-dev libgl1-mesa-dev nasm
41+
version: 1.0
42+
execute_install_scripts: true
4643

47-
- name: Install SFML
48-
if: steps.cache-linux-x64.outputs.cache-hit == 'true'
44+
- name: Install dependencies
4945
run: |
50-
cd /home/runner/work/sfml
51-
sudo make install
46+
vcpkg install ffmpeg[core,avcodec,avdevice,avfilter,avformat,swresample,swscale] physfs sfml --triplet=x64-linux
5247
5348
- name: Setup Ninja Build
5449
uses: turtlesec-no/get-ninja@main
@@ -57,26 +52,25 @@ jobs:
5752
run: |
5853
export CC=/usr/bin/gcc-11
5954
export CXX=/usr/bin/g++-11
60-
cmake CMakeLists.txt -G "Ninja"
61-
cmake --build .
55+
cmake --preset linux-x64-debug-vcpkg -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake
56+
cmake --build --preset linux-x64-debug-vcpkg
6257
6358
build_windows:
6459
name: windows build
65-
runs-on: windows-2022
60+
runs-on: windows-latest
6661
steps:
6762
- name: Checkout DGEngine.core
68-
uses: actions/checkout@v3
63+
uses: actions/checkout@v4
6964

70-
- name: Restore cached dependencies
71-
id: cache-windows-x64
72-
uses: actions/cache@v3
65+
- name: Export GitHub Actions cache environment variables
66+
uses: actions/github-script@v6
7367
with:
74-
path: C:/vcpkg/installed
75-
key: cache-windows-x64
68+
script: |
69+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
70+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
7671
7772
- name: Install dependencies
78-
if: steps.cache-windows-x64.outputs.cache-hit != 'true'
79-
run: vcpkg install physfs sfml --overlay-ports=vcpkg/ports --overlay-triplets=vcpkg/triplets --triplet=x64-windows
73+
run: vcpkg install catch2 physfs sfml --triplet=x64-windows
8074

8175
- name: Setup MSVC
8276
uses: TheMrMilchmann/setup-msvc-dev@v2
@@ -88,5 +82,9 @@ jobs:
8882

8983
- name: CMake build DGEngine.core
9084
run: |
91-
cmake --preset windows-x64-release -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake
92-
cmake --build --preset windows-x64-release
85+
cmake --preset windows-x64-debug -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake
86+
cmake --build --preset windows-x64-debug
87+
88+
- name: Run tests
89+
shell: cmd
90+
run: cd test && ..\out\build\windows-x64-debug\test\DGEngine.core-test.exe

.gitignore

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
!.vscode/launch.json
12
.vscode/*
3+
/*.a
24
/*.AppImage
35
/*.cbp
46
/*.db
@@ -7,15 +9,13 @@
79
/*.exe
810
/*.layout
911
/*.opendb
12+
/*.tcl
1013
/*.vcxproj.filters
1114
/*.vcxproj.user
1215
/*.zip
1316
/.svn
1417
/.vs
1518
/bin
16-
/CMakeCache.txt
17-
/CMakeFiles
18-
/cmake_install.cmake
1919
/Debug
2020
/Debug Clang
2121
/Debug Code Analysis
@@ -30,4 +30,12 @@
3030
/Release NoMovie
3131
/Release Static
3232
/Release Static NoMovie
33+
/spdlog
34+
/test/*.cmake
35+
/test/Catch2
36+
/test/DGEngine.core-test
3337
/x64
38+
CMakeCache.txt
39+
CMakeFiles
40+
cmake_install.cmake
41+
Testing

BUILD.txt

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,32 @@ To compile in Windows, you can use CMake or open the folder with Visual Studio 2
44

55
The easiest way to get the required dependencies is to use vcpkg.
66

7-
Because SFML 2.6 is not yet released, you need to use a pre release version.
8-
You can include it in vcpkg using a custom port for vcpkg.
9-
https://github.com/dgcor/SFML/tree/feature/scancode
10-
11-
vcpkg install physfs sfml ffmpeg --overlay-ports=vcpkg/ports --triplet=x86-windows
12-
vcpkg install physfs sfml ffmpeg --overlay-ports=vcpkg/ports --triplet=x86-windows-static
13-
vcpkg install physfs sfml ffmpeg --overlay-ports=vcpkg/ports --triplet=x64-windows
14-
vcpkg install physfs sfml ffmpeg --overlay-ports=vcpkg/ports --triplet=x64-windows-static
7+
vcpkg install physfs sfml ffmpeg --triplet=x86-windows
8+
vcpkg install physfs sfml ffmpeg --triplet=x86-windows-static
9+
vcpkg install physfs sfml ffmpeg --triplet=x64-windows
10+
vcpkg install physfs sfml ffmpeg --triplet=x64-windows-static
1511

1612
There is a custom vcpkg triplet that links ffmpeg dynamically.
1713

18-
vcpkg install physfs sfml ffmpeg --triplet=x86-windows-static --overlay-ports=vcpkg/ports --overlay-triplets=vcpkg/triplets
19-
vcpkg install physfs sfml ffmpeg --triplet=x64-windows-static --overlay-ports=vcpkg/ports --overlay-triplets=vcpkg/triplets
20-
21-
/PhysicsFS - https://icculus.org/physfs
22-
version >= 2.1
14+
vcpkg install physfs sfml ffmpeg --triplet=x86-windows-static --overlay-triplets=vcpkg/triplets
15+
vcpkg install physfs sfml ffmpeg --triplet=x64-windows-static --overlay-triplets=vcpkg/triplets
2316

24-
/SFML - https://www.sfml-dev.org/
25-
SFML 2.6.0 (in development)
26-
https://github.com/dgcor/SFML/tree/feature/scancode
17+
PhysicsFS - https://icculus.org/physfs
18+
version >= 2.1
2719

28-
/FFmpeg - https://ffmpeg.zeranoe.com/builds/
29-
Get both shared and dev packages (version 3.x or 4.x)
20+
SFML - https://www.sfml-dev.org/
21+
SFML 2.6.0
3022

31-
If you want to skip movie playback support, use the preprocessor define
32-
USE_SFML_MOVIE_STUB which uses a stub class that does nothing instead.
23+
FFmpeg - https://ffmpeg.zeranoe.com/builds/
24+
Get both shared and dev packages (version 3.x or 4.x)
3325

3426
* Linux
3527

3628
To compile in Linux (Ubuntu), you need gcc or clang with C++20 support
3729
and to have both PhysicsFS >= 2.1 and SFML >= 2.6 installed.
3830

39-
Because SFML 2.6 is not yet released, you need to use a pre release version.
40-
You will have to install it manually from this branch:
41-
https://github.com/dgcor/SFML/tree/feature/scancode
31+
Because SFML 2.6 is not yet released, you need to install it from source:
32+
https://github.com/SFML/SFML/tree/2.6.0
4233

4334
For Ubuntu, you can see which dependencies are required by analysing the CI build scripts
4435
under .github\workflows\*.yml
@@ -50,21 +41,25 @@ Optional (for movie support) FFmpeg:
5041

5142
sudo apt install libavdevice-dev libavformat-dev libavfilter-dev libavcodec-dev libswscale-dev libavutil-dev
5243

53-
Movie support is enabled by default (CMake), unless FFmpeg isn't found.
54-
In CMake, set MOVIE_SUPPORT to FALSE to skip movie support.
55-
5644
* CMake
5745

58-
A CMake project file is provided. Movie support is enabled by default.
46+
A CMake project file is provided.
47+
Movie support is enabled by default, unless FFmpeg isn't found.
5948
It will generate a project to compile on the target platform.
6049

6150
cmake CMakeLists.txt
62-
cmake CMakeLists.txt -DMOVIE_SUPPORT:BOOL=FALSE
51+
cmake CMakeLists.txt -DDGENGINE_MOVIE_SUPPORT:BOOL=FALSE
6352

6453
Both PhysicsFS and SFML must be installed.
6554
FFmpeg is also required for movie support.
6655

56+
For logging support: spdlog
57+
For testing support: catch2
58+
6759
All the CMake properties and default values:
6860

69-
MOVIE_SUPPORT (TRUE) Enable Movie support
70-
FALLBACK_TO_LOWERCASE (TRUE) Enable falling back to all lowercase names if file is not found
61+
DGENGINE_BUILD_TEST_SUITE (FALSE) Build Tests
62+
DGENGINE_ENABLE_LOGGING (FALSE) Enable Logging in release builds
63+
DGENGINE_MOVIE_SUPPORT (TRUE) Enable Movie support
64+
DGENGINE_FALLBACK_TO_LOWERCASE (TRUE) Enable falling back to all lowercase names if file is not found
65+
DGENGINE_STATIC_CRT (FALSE) Use static CRT library (Windows)

0 commit comments

Comments
 (0)