mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 13:06:13 +01:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf80a809f3 |
No files matched your search
@@ -23,7 +23,6 @@ Checks: >
|
|||||||
-cppcoreguidelines-pro-type-const-cast,
|
-cppcoreguidelines-pro-type-const-cast,
|
||||||
-cppcoreguidelines-pro-type-reinterpret-cast,
|
-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||||
-cppcoreguidelines-special-member-functions,
|
-cppcoreguidelines-special-member-functions,
|
||||||
-cppcoreguidelines-use-enum-class,
|
|
||||||
-modernize-avoid-c-arrays,
|
-modernize-avoid-c-arrays,
|
||||||
-modernize-macro-to-enum,
|
-modernize-macro-to-enum,
|
||||||
-modernize-redundant-void-arg,
|
-modernize-redundant-void-arg,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
SFML_VERSION: 3.0.1
|
SFML_VERSION: 3.0.0
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
@@ -22,10 +22,10 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
platform:
|
platform:
|
||||||
- { name: Windows VS2022 x86, os: windows-2025, flags: -AWin32 }
|
- { name: Windows VS2022 x86, os: windows-2022, flags: -AWin32 }
|
||||||
- { name: Windows VS2022 x64, os: windows-2025, flags: -Ax64 }
|
- { name: Windows VS2022 x64, os: windows-2022, flags: -Ax64 }
|
||||||
- { name: Windows ClangCL, os: windows-2025, flags: -T ClangCL }
|
- { name: Windows ClangCL, os: windows-2022, flags: -T ClangCL }
|
||||||
- { name: Windows Clang, os: windows-2025, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
|
- { name: Windows Clang, os: windows-2022, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
|
||||||
- { name: Linux GCC, os: ubuntu-22.04, flags: -GNinja }
|
- { name: Linux GCC, os: ubuntu-22.04, flags: -GNinja }
|
||||||
- { name: Linux Clang, os: ubuntu-22.04, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
|
- { name: Linux Clang, os: ubuntu-22.04, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
|
||||||
- { name: MacOS, os: macos-14, flags: -GNinja }
|
- { name: MacOS, os: macos-14, flags: -GNinja }
|
||||||
@@ -55,12 +55,7 @@ jobs:
|
|||||||
path: SFML
|
path: SFML
|
||||||
|
|
||||||
- name: Configure SFML CMake
|
- name: Configure SFML CMake
|
||||||
run: |
|
run: cmake -S SFML -B SFML/build -DCMAKE_INSTALL_PREFIX=SFML/install ${{matrix.platform.flags}} ${{matrix.config.flags}} -DCMAKE_BUILD_TYPE=${{matrix.type.name}}
|
||||||
cmake -S SFML -B SFML/build \
|
|
||||||
-DCMAKE_BUILD_TYPE=${{matrix.type.name}} \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=SFML/install \
|
|
||||||
${{matrix.platform.flags}} \
|
|
||||||
${{matrix.config.flags}}
|
|
||||||
|
|
||||||
- name: Build SFML
|
- name: Build SFML
|
||||||
run: cmake --build SFML/build --config ${{matrix.type.name}} --target install
|
run: cmake --build SFML/build --config ${{matrix.type.name}} --target install
|
||||||
@@ -71,15 +66,7 @@ jobs:
|
|||||||
path: CSFML
|
path: CSFML
|
||||||
|
|
||||||
- name: Configure CSFML CMake
|
- name: Configure CSFML CMake
|
||||||
run: |
|
run: cmake --preset dev -S CSFML -B CSFML/build -DCMAKE_INSTALL_PREFIX=CSFML/install -DSFML_ROOT=SFML/install -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}} ${{matrix.config.flags}} ${{matrix.config.csfml_flags}} -DCMAKE_BUILD_TYPE=${{matrix.type.name}}
|
||||||
cmake --preset dev -S CSFML -B CSFML/build \
|
|
||||||
-DCMAKE_BUILD_TYPE=${{matrix.type.name}} \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=CSFML/install \
|
|
||||||
-DSFML_ROOT=SFML/install \
|
|
||||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
|
||||||
${{matrix.platform.flags}} \
|
|
||||||
${{matrix.config.flags}} \
|
|
||||||
${{matrix.config.csfml_flags}}
|
|
||||||
|
|
||||||
- name: Build CSFML
|
- name: Build CSFML
|
||||||
run: cmake --build CSFML/build --config ${{matrix.type.name}} --target install
|
run: cmake --build CSFML/build --config ${{matrix.type.name}} --target install
|
||||||
|
|||||||
+32
-14
@@ -5,8 +5,6 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- 2.6.x
|
- 2.6.x
|
||||||
tags:
|
|
||||||
- "**"
|
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
@@ -19,7 +17,7 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
windows:
|
windows:
|
||||||
name: Windows VS2022
|
name: Windows VS2022
|
||||||
runs-on: windows-2025
|
runs-on: windows-2022
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout CSFML
|
- name: Checkout CSFML
|
||||||
@@ -39,16 +37,10 @@ jobs:
|
|||||||
cd CSFML/tools/nuget
|
cd CSFML/tools/nuget
|
||||||
./build.win.ps1 "win-x64"
|
./build.win.ps1 "win-x64"
|
||||||
|
|
||||||
- name: Build ARM64
|
|
||||||
shell: pwsh
|
|
||||||
run: |
|
|
||||||
cd CSFML/tools/nuget
|
|
||||||
./build.win.ps1 "win-arm64"
|
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: CSFML-win-x86-x64-arm64
|
name: CSFML-win-x86-x64
|
||||||
path: CSFML/tools/nuget/CSFML/runtimes
|
path: CSFML/tools/nuget/CSFML/runtimes
|
||||||
|
|
||||||
linux-x64:
|
linux-x64:
|
||||||
@@ -87,7 +79,7 @@ jobs:
|
|||||||
path: CSFML
|
path: CSFML
|
||||||
|
|
||||||
- name: Build in an ARM container
|
- name: Build in an ARM container
|
||||||
uses: uraimo/run-on-arch-action@v3.0.1
|
uses: uraimo/run-on-arch-action@v2.8.1
|
||||||
with:
|
with:
|
||||||
arch: armv7
|
arch: armv7
|
||||||
distro: ubuntu22.04
|
distro: ubuntu22.04
|
||||||
@@ -119,7 +111,7 @@ jobs:
|
|||||||
path: CSFML
|
path: CSFML
|
||||||
|
|
||||||
- name: Build in an ARM64 container
|
- name: Build in an ARM64 container
|
||||||
uses: uraimo/run-on-arch-action@v3.0.1
|
uses: uraimo/run-on-arch-action@v2.8.1
|
||||||
with:
|
with:
|
||||||
arch: aarch64
|
arch: aarch64
|
||||||
distro: ubuntu22.04
|
distro: ubuntu22.04
|
||||||
@@ -144,7 +136,7 @@ jobs:
|
|||||||
name: Linux MUSL x64
|
name: Linux MUSL x64
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
container:
|
container:
|
||||||
image: alpine:3.20.7
|
image: alpine:3.20.3
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout CSFML
|
- name: Checkout CSFML
|
||||||
@@ -165,6 +157,31 @@ jobs:
|
|||||||
name: CSFML-linux-musl-x64
|
name: CSFML-linux-musl-x64
|
||||||
path: CSFML/tools/nuget/CSFML/runtimes
|
path: CSFML/tools/nuget/CSFML/runtimes
|
||||||
|
|
||||||
|
fedora-x64:
|
||||||
|
name: Fedora x64
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
container:
|
||||||
|
image: fedora:37
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout CSFML
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
path: CSFML
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd ./CSFML/tools/nuget
|
||||||
|
chmod +x ./docker.fedora-x64.sh
|
||||||
|
./docker.fedora-x64.sh
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: CSFML-fedora-x64
|
||||||
|
path: CSFML/tools/nuget/CSFML/runtimes
|
||||||
|
|
||||||
macos:
|
macos:
|
||||||
name: macOS
|
name: macOS
|
||||||
runs-on: macos-14
|
runs-on: macos-14
|
||||||
@@ -196,13 +213,14 @@ jobs:
|
|||||||
|
|
||||||
package:
|
package:
|
||||||
name: Package Builds
|
name: Package Builds
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-22.04
|
||||||
needs:
|
needs:
|
||||||
- windows
|
- windows
|
||||||
- linux-x64
|
- linux-x64
|
||||||
- linux-arm
|
- linux-arm
|
||||||
- linux-arm64
|
- linux-arm64
|
||||||
- linux-musl-x64
|
- linux-musl-x64
|
||||||
|
- fedora-x64
|
||||||
- macos
|
- macos
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout CSFML
|
- name: Checkout CSFML
|
||||||
|
|||||||
@@ -13,13 +13,10 @@ concurrency:
|
|||||||
group: release-${{github.ref}}
|
group: release-${{github.ref}}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
|
||||||
SFML_VERSION: 3.0.1
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
windows-x86:
|
windows-x86:
|
||||||
name: Windows x86
|
name: Windows x86
|
||||||
runs-on: windows-2025
|
runs-on: windows-2022
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Cache MinGW x86
|
- name: Cache MinGW x86
|
||||||
@@ -27,14 +24,14 @@ jobs:
|
|||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}/mingw32
|
path: ${{ github.workspace }}/mingw32
|
||||||
key: 15.2.0posix-13.0.0-ucrt-r1-x86
|
key: 14.2.0posix-19.1.1-12.0.0-ucrt-r2-x86
|
||||||
|
|
||||||
- name: Install MinGW x86
|
- name: Install MinGW x86
|
||||||
if: steps.mingw-x86-cache.outputs.cache-hit != 'true'
|
if: steps.mingw-x86-cache.outputs.cache-hit != 'true'
|
||||||
uses: bwoodsend/setup-winlibs-action@v1
|
uses: bwoodsend/setup-winlibs-action@v1
|
||||||
id: winlibs-32
|
id: winlibs-32
|
||||||
with:
|
with:
|
||||||
tag: 15.2.0posix-13.0.0-ucrt-r1
|
tag: 14.2.0posix-19.1.1-12.0.0-ucrt-r2
|
||||||
with_clang: false
|
with_clang: false
|
||||||
architecture: 32
|
architecture: 32
|
||||||
destination: ${{ github.workspace }}
|
destination: ${{ github.workspace }}
|
||||||
@@ -44,7 +41,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: SFML/SFML
|
repository: SFML/SFML
|
||||||
ref: ${{ env.SFML_VERSION }}
|
ref: 3.0.0
|
||||||
path: SFML
|
path: SFML
|
||||||
|
|
||||||
- name: Checkout CSFML
|
- name: Checkout CSFML
|
||||||
@@ -106,7 +103,7 @@ jobs:
|
|||||||
|
|
||||||
windows-x64:
|
windows-x64:
|
||||||
name: Windows x64
|
name: Windows x64
|
||||||
runs-on: windows-2025
|
runs-on: windows-2022
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Cache MinGW x64
|
- name: Cache MinGW x64
|
||||||
@@ -114,14 +111,14 @@ jobs:
|
|||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}/mingw64
|
path: ${{ github.workspace }}/mingw64
|
||||||
key: 15.2.0posix-13.0.0-ucrt-r1-x64
|
key: 14.2.0posix-19.1.1-12.0.0-ucrt-r2-x64
|
||||||
|
|
||||||
- name: Install MinGW x64
|
- name: Install MinGW x64
|
||||||
if: steps.mingw-x64-cache.outputs.cache-hit != 'true'
|
if: steps.mingw-x64-cache.outputs.cache-hit != 'true'
|
||||||
uses: bwoodsend/setup-winlibs-action@v1
|
uses: bwoodsend/setup-winlibs-action@v1
|
||||||
id: winlibs-64
|
id: winlibs-64
|
||||||
with:
|
with:
|
||||||
tag: 15.2.0posix-13.0.0-ucrt-r1
|
tag: 14.2.0posix-19.1.1-12.0.0-ucrt-r2
|
||||||
with_clang: false
|
with_clang: false
|
||||||
architecture: 64
|
architecture: 64
|
||||||
destination: ${{ github.workspace }}
|
destination: ${{ github.workspace }}
|
||||||
@@ -131,7 +128,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: SFML/SFML
|
repository: SFML/SFML
|
||||||
ref: ${{ env.SFML_VERSION }}
|
ref: 3.0.0
|
||||||
path: SFML
|
path: SFML
|
||||||
|
|
||||||
- name: Checkout CSFML
|
- name: Checkout CSFML
|
||||||
@@ -191,45 +188,6 @@ jobs:
|
|||||||
name: CSFML-windows-64-bit
|
name: CSFML-windows-64-bit
|
||||||
path: install/CSFML
|
path: install/CSFML
|
||||||
|
|
||||||
windows-arm64:
|
|
||||||
name: Windows ARM64
|
|
||||||
runs-on: windows-2025
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout SFML
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: SFML/SFML
|
|
||||||
ref: ${{ env.SFML_VERSION }}
|
|
||||||
path: SFML
|
|
||||||
|
|
||||||
- name: Checkout CSFML
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
path: CSFML
|
|
||||||
|
|
||||||
- name: Build SFML
|
|
||||||
run: |
|
|
||||||
cmake -S SFML -B SFML-build -A ARM64 -G "Visual Studio 17 2022" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/SFML-install -DCMAKE_VERBOSE_MAKEFILE=ON
|
|
||||||
cmake --build SFML-build --config Release --target install
|
|
||||||
|
|
||||||
- name: Build CSFML
|
|
||||||
run: |
|
|
||||||
cmake -S CSFML -B CSFML-build -A ARM64 -G "Visual Studio 17 2022" -DBUILD_SHARED_LIBS=ON -DCSFML_LINK_SFML_STATICALLY=OFF -DCMAKE_BUILD_TYPE=Release -DSFML_ROOT=${{ github.workspace }}/SFML-install -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/CSFML-install -DCMAKE_VERBOSE_MAKEFILE=ON
|
|
||||||
cmake --build CSFML-build --config Release --target install
|
|
||||||
|
|
||||||
- name: Move Files
|
|
||||||
shell: pwsh
|
|
||||||
run: |
|
|
||||||
New-Item -ItemType "directory" -PATH "install\CSFML"
|
|
||||||
Move-Item -Path "CSFML-install\*" -Destination "install\CSFML"
|
|
||||||
|
|
||||||
- name: Upload Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: CSFML-windows-arm64
|
|
||||||
path: install/CSFML
|
|
||||||
|
|
||||||
macos-x64:
|
macos-x64:
|
||||||
name: macOS x64
|
name: macOS x64
|
||||||
runs-on: macos-13
|
runs-on: macos-13
|
||||||
@@ -239,7 +197,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: SFML/SFML
|
repository: SFML/SFML
|
||||||
ref: ${{ env.SFML_VERSION }}
|
ref: 3.0.0
|
||||||
path: SFML
|
path: SFML
|
||||||
|
|
||||||
- name: Checkout CSFML
|
- name: Checkout CSFML
|
||||||
@@ -302,7 +260,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: SFML/SFML
|
repository: SFML/SFML
|
||||||
ref: ${{ env.SFML_VERSION }}
|
ref: 3.0.0
|
||||||
path: SFML
|
path: SFML
|
||||||
|
|
||||||
- name: Checkout CSFML
|
- name: Checkout CSFML
|
||||||
|
|||||||
@@ -178,20 +178,6 @@ CSFML_GRAPHICS_API sfTexture* sfTexture_copy(const sfTexture* texture);
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfTexture_destroy(const sfTexture* texture);
|
CSFML_GRAPHICS_API void sfTexture_destroy(const sfTexture* texture);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Resize the texture
|
|
||||||
///
|
|
||||||
/// If this function fails, the texture is left unchanged.
|
|
||||||
///
|
|
||||||
/// \param texture Texture to resize
|
|
||||||
/// \param size Width and height of the texture
|
|
||||||
/// \param sRgb `true` to enable sRGB conversion, `false` to disable it
|
|
||||||
///
|
|
||||||
/// \return `true` if resizing was successful, `false` if it failed
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
CSFML_GRAPHICS_API bool sfTexture_resize(sfTexture* texture, sfVector2u size, bool sRgb);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Return the size of the texture
|
/// \brief Return the size of the texture
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -170,15 +170,6 @@ void sfTexture_destroy(const sfTexture* texture)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
bool sfTexture_resize(sfTexture* texture, sfVector2u size, bool sRgb)
|
|
||||||
{
|
|
||||||
assert(texture);
|
|
||||||
assert(texture->This);
|
|
||||||
return texture->This->resize(convertVector2(size), sRgb);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfVector2u sfTexture_getSize(const sfTexture* texture)
|
sfVector2u sfTexture_getSize(const sfTexture* texture)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -48,12 +48,12 @@ add_executable(test-csfml-graphics
|
|||||||
Graphics/BlendMode.test.cpp
|
Graphics/BlendMode.test.cpp
|
||||||
Graphics/Color.test.cpp
|
Graphics/Color.test.cpp
|
||||||
Graphics/CoordinateType.test.cpp
|
Graphics/CoordinateType.test.cpp
|
||||||
Graphics/Image.test.cpp
|
|
||||||
Graphics/PrimitiveType.test.cpp
|
Graphics/PrimitiveType.test.cpp
|
||||||
Graphics/Rect.test.cpp
|
Graphics/Rect.test.cpp
|
||||||
Graphics/RenderStates.test.cpp
|
Graphics/RenderStates.test.cpp
|
||||||
Graphics/Shape.test.cpp
|
Graphics/Shape.test.cpp
|
||||||
Graphics/StencilMode.test.cpp
|
Graphics/StencilMode.test.cpp
|
||||||
|
Graphics/Texture.test.cpp
|
||||||
Graphics/Transform.test.cpp
|
Graphics/Transform.test.cpp
|
||||||
Graphics/VertexArray.test.cpp
|
Graphics/VertexArray.test.cpp
|
||||||
Graphics/View.test.cpp
|
Graphics/View.test.cpp
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
#include <CSFML/Graphics/Image.h>
|
|
||||||
|
|
||||||
#include <catch2/catch_test_macros.hpp>
|
|
||||||
#include <catch2/generators/catch_generators.hpp>
|
|
||||||
|
|
||||||
TEST_CASE("[Graphics] sfImage")
|
|
||||||
{
|
|
||||||
SECTION("sfImage_create")
|
|
||||||
{
|
|
||||||
const sfImage* image = sfImage_create({100, 100});
|
|
||||||
REQUIRE(image);
|
|
||||||
const auto size = sfImage_getSize(image);
|
|
||||||
CHECK(size.x == 100);
|
|
||||||
CHECK(size.y == 100);
|
|
||||||
const auto pixel = sfImage_getPixel(image, {50, 50});
|
|
||||||
CHECK(pixel.r == sfBlack.r);
|
|
||||||
CHECK(pixel.g == sfBlack.g);
|
|
||||||
CHECK(pixel.b == sfBlack.b);
|
|
||||||
CHECK(pixel.a == sfBlack.a);
|
|
||||||
CHECK(sfImage_getPixelsPtr(image));
|
|
||||||
sfImage_destroy(image);
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("sfImage_createFromColor")
|
|
||||||
{
|
|
||||||
const sfImage* image = sfImage_createFromColor({100, 100}, sfMagenta);
|
|
||||||
REQUIRE(image);
|
|
||||||
const auto size = sfImage_getSize(image);
|
|
||||||
CHECK(size.x == 100);
|
|
||||||
CHECK(size.y == 100);
|
|
||||||
const auto pixel = sfImage_getPixel(image, {50, 50});
|
|
||||||
CHECK(pixel.r == sfMagenta.r);
|
|
||||||
CHECK(pixel.g == sfMagenta.g);
|
|
||||||
CHECK(pixel.b == sfMagenta.b);
|
|
||||||
CHECK(pixel.a == sfMagenta.a);
|
|
||||||
CHECK(sfImage_getPixelsPtr(image));
|
|
||||||
sfImage_destroy(image);
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("sfImage_createFromFile")
|
|
||||||
{
|
|
||||||
const auto filename = std::string("Graphics/sfml-logo-big.") + GENERATE("bmp", "gif", "jpg", "png", "psd");
|
|
||||||
INFO("Filename: " << filename);
|
|
||||||
const sfImage* image = sfImage_createFromFile(filename.c_str());
|
|
||||||
REQUIRE(image);
|
|
||||||
const auto size = sfImage_getSize(image);
|
|
||||||
CHECK(size.x == 1001);
|
|
||||||
CHECK(size.y == 304);
|
|
||||||
const auto pixel = sfImage_getPixel(image, {0, 0});
|
|
||||||
CHECK(pixel.r == sfWhite.r);
|
|
||||||
CHECK(pixel.g == sfWhite.g);
|
|
||||||
CHECK(pixel.b == sfWhite.b);
|
|
||||||
CHECK(sfImage_getPixelsPtr(image));
|
|
||||||
sfImage_destroy(image);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
#include <CSFML/Graphics/Texture.h>
|
||||||
|
|
||||||
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
#include <catch2/generators/catch_generators.hpp>
|
||||||
|
|
||||||
|
TEST_CASE("[Graphics] sfTexture")
|
||||||
|
{
|
||||||
|
SECTION("sfTexture_create")
|
||||||
|
{
|
||||||
|
const sfTexture* texture = sfTexture_create({100, 100});
|
||||||
|
REQUIRE(texture);
|
||||||
|
CHECK(sfTexture_getSize(texture).x == 100);
|
||||||
|
CHECK(sfTexture_getSize(texture).y == 100);
|
||||||
|
CHECK(!sfTexture_isSmooth(texture));
|
||||||
|
CHECK(!sfTexture_isSrgb(texture));
|
||||||
|
CHECK(!sfTexture_isRepeated(texture));
|
||||||
|
CHECK(sfTexture_getNativeHandle(texture) != 0);
|
||||||
|
sfTexture_destroy(texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("sfTexture_createSrgb")
|
||||||
|
{
|
||||||
|
const sfTexture* texture = sfTexture_createSrgb({100, 100});
|
||||||
|
REQUIRE(texture);
|
||||||
|
CHECK(sfTexture_getSize(texture).x == 100);
|
||||||
|
CHECK(sfTexture_getSize(texture).y == 100);
|
||||||
|
CHECK(!sfTexture_isSmooth(texture));
|
||||||
|
CHECK(sfTexture_isSrgb(texture));
|
||||||
|
CHECK(!sfTexture_isRepeated(texture));
|
||||||
|
CHECK(sfTexture_getNativeHandle(texture) != 0);
|
||||||
|
sfTexture_destroy(texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("sfTexture_createFromFile")
|
||||||
|
{
|
||||||
|
const char* fileExtension = GENERATE("bmp", "gif", "jpg", "png", "psd");
|
||||||
|
const auto filename = std::string("Graphics/sfml-logo-big.") + fileExtension;
|
||||||
|
INFO("Filename: " << filename);
|
||||||
|
const sfTexture* texture = sfTexture_createFromFile(filename.c_str(), nullptr);
|
||||||
|
REQUIRE(texture);
|
||||||
|
CHECK(sfTexture_getSize(texture).x > 0);
|
||||||
|
CHECK(sfTexture_getSize(texture).y > 0);
|
||||||
|
CHECK(!sfTexture_isSmooth(texture));
|
||||||
|
CHECK(!sfTexture_isSrgb(texture));
|
||||||
|
CHECK(!sfTexture_isRepeated(texture));
|
||||||
|
CHECK(sfTexture_getNativeHandle(texture) != 0);
|
||||||
|
sfTexture_destroy(texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("sfTexture_createSrgbFromFile")
|
||||||
|
{
|
||||||
|
const char* fileExtension = GENERATE("bmp", "gif", "jpg", "png", "psd");
|
||||||
|
const auto filename = std::string("Graphics/sfml-logo-big.") + fileExtension;
|
||||||
|
INFO("Filename: " << filename);
|
||||||
|
const sfTexture* texture = sfTexture_createSrgbFromFile(filename.c_str(), nullptr);
|
||||||
|
REQUIRE(texture);
|
||||||
|
CHECK(sfTexture_getSize(texture).x > 0);
|
||||||
|
CHECK(sfTexture_getSize(texture).y > 0);
|
||||||
|
CHECK(!sfTexture_isSmooth(texture));
|
||||||
|
CHECK(sfTexture_isSrgb(texture));
|
||||||
|
CHECK(!sfTexture_isRepeated(texture));
|
||||||
|
CHECK(sfTexture_getNativeHandle(texture) != 0);
|
||||||
|
sfTexture_destroy(texture);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,7 +42,7 @@ echo "Please note that all SFML dependencies must be installed and available to
|
|||||||
|
|
||||||
RID="$1"
|
RID="$1"
|
||||||
|
|
||||||
SFMLBranch="3.0.1" # The branch or tag of the SFML repository to be cloned
|
SFMLBranch="3.0.0" # The branch or tag of the SFML repository to be cloned
|
||||||
CSFMLDir="$(realpath ../../)" # The directory of the source code of CSFML
|
CSFMLDir="$(realpath ../../)" # The directory of the source code of CSFML
|
||||||
|
|
||||||
OutDir="./CSFML/runtimes/$RID/native" # The base directory of all CSFML modules, used to copy the final libraries
|
OutDir="./CSFML/runtimes/$RID/native" # The base directory of all CSFML modules, used to copy the final libraries
|
||||||
@@ -94,7 +94,6 @@ cmake -E env LDFLAGS="-z origin" \
|
|||||||
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$SFMLLibDir" \
|
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$SFMLLibDir" \
|
||||||
'-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON' \
|
'-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON' \
|
||||||
'-DCMAKE_INSTALL_RPATH=$ORIGIN' \
|
'-DCMAKE_INSTALL_RPATH=$ORIGIN' \
|
||||||
'-DSFML_USE_SYSTEM_DEPS=OFF' \
|
|
||||||
'-DSFML_BUILD_NETWORK=OFF' \
|
'-DSFML_BUILD_NETWORK=OFF' \
|
||||||
"$SFMLDir"
|
"$SFMLDir"
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ echo "Please note that all SFML dependencies must be installed and available to
|
|||||||
|
|
||||||
RID="$1"
|
RID="$1"
|
||||||
|
|
||||||
SFMLBranch="3.0.1" # The branch or tag of the SFML repository to be cloned
|
SFMLBranch="3.0.0" # The branch or tag of the SFML repository to be cloned
|
||||||
CSFMLDir="$(grealpath "$(git rev-parse --show-toplevel)")" # The directory of the source code of CSFML
|
CSFMLDir="$(grealpath "$(git rev-parse --show-toplevel)")" # The directory of the source code of CSFML
|
||||||
|
|
||||||
OutDir="./CSFML/runtimes/$RID/native" # The base directory of all CSFML modules, used to copy the final libraries
|
OutDir="./CSFML/runtimes/$RID/native" # The base directory of all CSFML modules, used to copy the final libraries
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ if (-not $RID) {
|
|||||||
|
|
||||||
$Generator = 'Visual Studio 17 2022'
|
$Generator = 'Visual Studio 17 2022'
|
||||||
|
|
||||||
# See also: https://learn.microsoft.com/en-us/dotnet/core/rid-catalog#known-rids
|
|
||||||
switch ($RID) {
|
switch ($RID) {
|
||||||
'win-x86' {
|
'win-x86' {
|
||||||
$Architecture = 'Win32'
|
$Architecture = 'Win32'
|
||||||
@@ -26,9 +25,6 @@ switch ($RID) {
|
|||||||
'win-x64' {
|
'win-x64' {
|
||||||
$Architecture = 'x64'
|
$Architecture = 'x64'
|
||||||
}
|
}
|
||||||
'win-arm64' {
|
|
||||||
$Architecture = 'ARM64'
|
|
||||||
}
|
|
||||||
Default {
|
Default {
|
||||||
Write-Error "Unknown RID '$RID'"
|
Write-Error "Unknown RID '$RID'"
|
||||||
exit
|
exit
|
||||||
@@ -39,7 +35,7 @@ Write-Output "Building $RID"
|
|||||||
Write-Output "Using $Generator as the cmake generator"
|
Write-Output "Using $Generator as the cmake generator"
|
||||||
Write-Output "Using architecture $Architecture"
|
Write-Output "Using architecture $Architecture"
|
||||||
|
|
||||||
$SFMLBranch = "3.0.1" # The branch or tag of the SFML repository to be cloned
|
$SFMLBranch = "3.0.0" # The branch or tag of the SFML repository to be cloned
|
||||||
$CSFMLDir = (Get-Item (git rev-parse --show-toplevel)).FullName # The directory of the source code of CSFML
|
$CSFMLDir = (Get-Item (git rev-parse --show-toplevel)).FullName # The directory of the source code of CSFML
|
||||||
|
|
||||||
$OutDir = "./CSFML/runtimes/$RID/native" # The directory of all CSFML modules, used to copy the final dlls
|
$OutDir = "./CSFML/runtimes/$RID/native" # The directory of all CSFML modules, used to copy the final dlls
|
||||||
@@ -87,7 +83,7 @@ Push-Location "SFML"
|
|||||||
|
|
||||||
$SFMLDir = (Get-Item .).FullName
|
$SFMLDir = (Get-Item .).FullName
|
||||||
|
|
||||||
IF ($RID -ne 'win-x86' -and $RID -ne 'win-x64' -and $RID -ne 'win-arm64') {
|
IF ($RID -ne 'win-x86' -and $RID -ne 'win-x64') {
|
||||||
Write-Error "Unknown RID '$RID'"
|
Write-Error "Unknown RID '$RID'"
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user