Skip to content

Commit

Permalink
- add action event.timeout
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
dgcor committed Dec 21, 2023
1 parent ace9adc commit 1037c15
Show file tree
Hide file tree
Showing 333 changed files with 33,174 additions and 3,649 deletions.
21 changes: 9 additions & 12 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
root = true

[CMakeLists.txt]
[{.github/**.yml,*.md,docs/**.md,test/*.md}]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true

[{*.json,.vscode/**.json,gamefiles**.json}]
[{CMakeLists.txt,test/CMakeLists.txt}]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_size = 4
indent_style = space
insert_final_newline = false
insert_final_newline = true

[gamefiles**.{frag,vert}]
[{*,.vscode/**,test/data/**}.json]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
indent_size = 2
indent_style = space
insert_final_newline = false
trim_trailing_whitespace = true

[src/**]
[{src/**,test/src/**}]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

[src/{endian,rapidjson}/**]
[src/{rapidjson,Utils/endian}/**]
indent_size = unset
indent_style = unset
insert_final_newline = unset
Expand Down
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* text=auto
* text=auto eol=lf
*.bin binary
*.bmp binary
*.c text
Expand Down
82 changes: 40 additions & 42 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,46 @@ on:
push:
branches: [ master ]
paths:
- 'src/**'
- '.github/workflows/**'
- 'CMakeLists.txt'
- 'src/**'
- 'test/**'
pull_request:
branches: [ master ]
paths:
- 'src/**'
- '.github/workflows/**'
- 'CMakeLists.txt'
- 'src/**'
- 'test/**'

env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

jobs:
build_linux:
name: linux build
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Checkout DGEngine.core
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Restore cached dependencies
id: cache-linux-x64
uses: actions/cache@v3
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v6
with:
path: /home/runner/work/sfml
key: cache-linux-x64

- name: Install dependencies
run: |
sudo apt install -yq --no-install-suggests --no-install-recommends libphysfs-dev > /dev/null
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
sudo apt install -yq --no-install-suggests --no-install-recommends libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswscale-dev > /dev/null
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: CMake + make SFML
if: steps.cache-linux-x64.outputs.cache-hit != 'true'
run: |
git clone -q --depth=1 --branch=feature/scancode https://github.com/dgcor/SFML.git /home/runner/work/sfml > /dev/null
git -C /home/runner/work/sfml pull > /dev/null
cd /home/runner/work/sfml
export CC=/usr/bin/gcc-11
export CXX=/usr/bin/g++-11
cmake /home/runner/work/sfml/CMakeLists.txt
sudo make install
- name: Install Ubuntu dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libx11-dev libxrandr-dev libxcursor-dev libxi-dev libudev-dev libgl1-mesa-dev nasm
version: 1.0
execute_install_scripts: true

- name: Install SFML
if: steps.cache-linux-x64.outputs.cache-hit == 'true'
- name: Install dependencies
run: |
cd /home/runner/work/sfml
sudo make install
vcpkg install ffmpeg[core,avcodec,avdevice,avfilter,avformat,swresample,swscale] physfs sfml --triplet=x64-linux
- name: Setup Ninja Build
uses: turtlesec-no/get-ninja@main
Expand All @@ -57,26 +52,25 @@ jobs:
run: |
export CC=/usr/bin/gcc-11
export CXX=/usr/bin/g++-11
cmake CMakeLists.txt -G "Ninja"
cmake --build .
cmake --preset linux-x64-debug-vcpkg -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build --preset linux-x64-debug-vcpkg
build_windows:
name: windows build
runs-on: windows-2022
runs-on: windows-latest
steps:
- name: Checkout DGEngine.core
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Restore cached dependencies
id: cache-windows-x64
uses: actions/cache@v3
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v6
with:
path: C:/vcpkg/installed
key: cache-windows-x64
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install dependencies
if: steps.cache-windows-x64.outputs.cache-hit != 'true'
run: vcpkg install physfs sfml --overlay-ports=vcpkg/ports --overlay-triplets=vcpkg/triplets --triplet=x64-windows
run: vcpkg install catch2 physfs sfml --triplet=x64-windows

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

- name: CMake build DGEngine.core
run: |
cmake --preset windows-x64-release -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake
cmake --build --preset windows-x64-release
cmake --preset windows-x64-debug -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake
cmake --build --preset windows-x64-debug
- name: Run tests
shell: cmd
run: cd test && ..\out\build\windows-x64-debug\test\DGEngine.core-test.exe
14 changes: 11 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
!.vscode/launch.json
.vscode/*
/*.a
/*.AppImage
/*.cbp
/*.db
Expand All @@ -7,15 +9,13 @@
/*.exe
/*.layout
/*.opendb
/*.tcl
/*.vcxproj.filters
/*.vcxproj.user
/*.zip
/.svn
/.vs
/bin
/CMakeCache.txt
/CMakeFiles
/cmake_install.cmake
/Debug
/Debug Clang
/Debug Code Analysis
Expand All @@ -30,4 +30,12 @@
/Release NoMovie
/Release Static
/Release Static NoMovie
/spdlog
/test/*.cmake
/test/Catch2
/test/DGEngine.core-test
/x64
CMakeCache.txt
CMakeFiles
cmake_install.cmake
Testing
55 changes: 25 additions & 30 deletions BUILD.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,32 @@ To compile in Windows, you can use CMake or open the folder with Visual Studio 2

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

Because SFML 2.6 is not yet released, you need to use a pre release version.
You can include it in vcpkg using a custom port for vcpkg.
https://github.com/dgcor/SFML/tree/feature/scancode

vcpkg install physfs sfml ffmpeg --overlay-ports=vcpkg/ports --triplet=x86-windows
vcpkg install physfs sfml ffmpeg --overlay-ports=vcpkg/ports --triplet=x86-windows-static
vcpkg install physfs sfml ffmpeg --overlay-ports=vcpkg/ports --triplet=x64-windows
vcpkg install physfs sfml ffmpeg --overlay-ports=vcpkg/ports --triplet=x64-windows-static
vcpkg install physfs sfml ffmpeg --triplet=x86-windows
vcpkg install physfs sfml ffmpeg --triplet=x86-windows-static
vcpkg install physfs sfml ffmpeg --triplet=x64-windows
vcpkg install physfs sfml ffmpeg --triplet=x64-windows-static

There is a custom vcpkg triplet that links ffmpeg dynamically.

vcpkg install physfs sfml ffmpeg --triplet=x86-windows-static --overlay-ports=vcpkg/ports --overlay-triplets=vcpkg/triplets
vcpkg install physfs sfml ffmpeg --triplet=x64-windows-static --overlay-ports=vcpkg/ports --overlay-triplets=vcpkg/triplets

/PhysicsFS - https://icculus.org/physfs
version >= 2.1
vcpkg install physfs sfml ffmpeg --triplet=x86-windows-static --overlay-triplets=vcpkg/triplets
vcpkg install physfs sfml ffmpeg --triplet=x64-windows-static --overlay-triplets=vcpkg/triplets

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

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

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

* Linux

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

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

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

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

Movie support is enabled by default (CMake), unless FFmpeg isn't found.
In CMake, set MOVIE_SUPPORT to FALSE to skip movie support.

* CMake

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

cmake CMakeLists.txt
cmake CMakeLists.txt -DMOVIE_SUPPORT:BOOL=FALSE
cmake CMakeLists.txt -DDGENGINE_MOVIE_SUPPORT:BOOL=FALSE

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

For logging support: spdlog
For testing support: catch2

All the CMake properties and default values:

MOVIE_SUPPORT (TRUE) Enable Movie support
FALLBACK_TO_LOWERCASE (TRUE) Enable falling back to all lowercase names if file is not found
DGENGINE_BUILD_TEST_SUITE (FALSE) Build Tests
DGENGINE_ENABLE_LOGGING (FALSE) Enable Logging in release builds
DGENGINE_MOVIE_SUPPORT (TRUE) Enable Movie support
DGENGINE_FALLBACK_TO_LOWERCASE (TRUE) Enable falling back to all lowercase names if file is not found
DGENGINE_STATIC_CRT (FALSE) Use static CRT library (Windows)
Loading

0 comments on commit 1037c15

Please sign in to comment.