Author SHA1 Message Date
Chris Thrasher e0b3a8e28d Add more sfKeyboard tests 2025-01-13 15:53:31 -07:00
244 changed files with 695 additions and 6097 deletions

No files matched your search

-1
View File
@@ -23,7 +23,6 @@ Checks: >
-cppcoreguidelines-pro-type-const-cast,
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-special-member-functions,
-cppcoreguidelines-use-enum-class,
-modernize-avoid-c-arrays,
-modernize-macro-to-enum,
-modernize-redundant-void-arg,
+27 -74
View File
@@ -2,14 +2,12 @@ name: CI
on: [push, pull_request, workflow_dispatch]
permissions: {}
concurrency:
group: environment-${{github.ref}}
cancel-in-progress: true
env:
SFML_VERSION: 3.1.0
SFML_VERSION: 3.0.0
defaults:
run:
@@ -24,13 +22,15 @@ jobs:
fail-fast: false
matrix:
platform:
- { name: Windows VS2026 x86, os: windows-2025-vs2026, flags: -AWin32 }
- { name: Windows VS2026 x64, os: windows-2025-vs2026, flags: -Ax64 }
- { name: Windows ClangCL, os: windows-2025-vs2026, flags: -T ClangCL }
- { name: Windows Clang, os: windows-2025-vs2026, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
- { name: Linux GCC, os: ubuntu-24.04, flags: -GNinja }
- { name: Linux Clang, os: ubuntu-24.04, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
- { name: MacOS, os: macos-15, flags: -GNinja }
- { name: Windows VS2019 x86, os: windows-2019, flags: -AWin32 }
- { name: Windows VS2019 x64, os: windows-2019, flags: -Ax64 }
- { name: Windows VS2022 x86, os: windows-2022, flags: -AWin32 }
- { name: Windows VS2022 x64, os: windows-2022, flags: -Ax64 }
- { name: Windows ClangCL, os: windows-2022, flags: -T ClangCL }
- { 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 Clang, os: ubuntu-22.04, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
- { name: MacOS, os: macos-14, flags: -GNinja }
config:
- { name: Shared, flags: -DBUILD_SHARED_LIBS=ON, csfml_flags: -DCSFML_LINK_SFML_STATICALLY=OFF }
- { name: Static, flags: -DBUILD_SHARED_LIBS=OFF, csfml_flags: -DCSFML_LINK_SFML_STATICALLY=ON }
@@ -42,67 +42,38 @@ jobs:
- name: Get CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: ${{ runner.os == 'Windows' && '4.2' || '3.28' }} # Visual Studio 2026 generator requires CMake 4.2 or later
ninjaVersion: latest
- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libxi-dev libudev-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libfreetype-dev libharfbuzz-dev libmbedtls-dev libssh2-1-dev
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libxi-dev libudev-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libfreetype-dev
- name: Checkout SFML
uses: actions/checkout@v7
uses: actions/checkout@v4
with:
persist-credentials: false
repository: SFML/SFML
ref: ${{env.SFML_VERSION}}
path: SFML
- name: Configure SFML CMake
env:
BUILD_TYPE: ${{ matrix.type.name }}
CMAKE_FLAGS: ${{ matrix.platform.flags }} ${{ matrix.config.flags }}
run: |
# Let the installed SFML libraries find each other, same as tools/nuget/build.linux.sh
RPATH_FLAGS=()
if [ "$RUNNER_OS" = "Linux" ]; then RPATH_FLAGS=('-DCMAKE_INSTALL_RPATH=$ORIGIN'); fi
cmake -S SFML -B SFML/build \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DCMAKE_INSTALL_PREFIX=SFML/install \
"${RPATH_FLAGS[@]}" \
$CMAKE_FLAGS
run: cmake -S SFML -B SFML/build -DCMAKE_INSTALL_PREFIX=SFML/install ${{matrix.platform.flags}} ${{matrix.config.flags}} -DCMAKE_BUILD_TYPE=${{matrix.type.name}}
- name: Build SFML
env:
BUILD_TYPE: ${{ matrix.type.name }}
run: cmake --build SFML/build --config "$BUILD_TYPE" --target install
run: cmake --build SFML/build --config ${{matrix.type.name}} --target install
- name: Checkout CSFML
uses: actions/checkout@v7
uses: actions/checkout@v4
with:
persist-credentials: false
path: CSFML
- name: Configure CSFML CMake
env:
BUILD_TYPE: ${{ matrix.type.name }}
CMAKE_FLAGS: ${{ matrix.platform.flags }} ${{ matrix.config.flags }} ${{ matrix.config.csfml_flags }}
run: |
cmake --preset dev -S CSFML -B CSFML/build \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DCMAKE_INSTALL_PREFIX=CSFML/install \
-DSFML_ROOT=SFML/install \
-DCMAKE_VERBOSE_MAKEFILE=ON \
$CMAKE_FLAGS
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}}
- name: Build CSFML
env:
BUILD_TYPE: ${{ matrix.type.name }}
run: cmake --build CSFML/build --config "$BUILD_TYPE" --target install
run: cmake --build CSFML/build --config ${{matrix.type.name}} --target install
- name: Test
env:
BUILD_TYPE: ${{ matrix.type.name }}
run: ctest --test-dir CSFML/build -C "$BUILD_TYPE" --output-on-failure
run: ctest --test-dir CSFML/build -C ${{matrix.type.name}} --output-on-failure
format:
name: Formatting
@@ -113,9 +84,7 @@ jobs:
run: sudo apt-get install clang-format-17
- name: Checkout Code
uses: actions/checkout@v7
with:
persist-credentials: false
uses: actions/checkout@v4
- name: Format Code
run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-17 -P cmake/Format.cmake
@@ -125,25 +94,18 @@ jobs:
tidy:
name: Analyze
runs-on: macos-15
runs-on: macos-14
steps:
- name: Get CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: ${{ runner.os == 'Windows' && '4.2' || '3.28' }} # Visual Studio 2026 generator requires CMake 4.2 or later
ninjaVersion: latest
- name: Install Dependencies
run: |
brew update
brew install llvm@18 ninja
echo "$(brew --prefix llvm@18)/bin" >> $GITHUB_PATH
brew install llvm ninja
echo /opt/homebrew/opt/llvm/bin >> $GITHUB_PATH
- name: Checkout SFML
uses: actions/checkout@v7
uses: actions/checkout@v4
with:
persist-credentials: false
repository: SFML/SFML
ref: ${{env.SFML_VERSION}}
path: SFML
@@ -155,9 +117,8 @@ jobs:
run: cmake --build SFML/build --target install
- name: Checkout CSFML
uses: actions/checkout@v7
uses: actions/checkout@v4
with:
persist-credentials: false
path: CSFML
- name: Configure CSFML CMake
@@ -168,24 +129,17 @@ jobs:
docs:
name: Documentation
runs-on: macos-15
runs-on: macos-14
steps:
- name: Get CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: ${{ runner.os == 'Windows' && '4.2' || '3.28' }} # Visual Studio 2026 generator requires CMake 4.2 or later
ninjaVersion: latest
- name: Install Doxygen
run: |
brew update
brew install doxygen ninja || true
- name: Checkout SFML
uses: actions/checkout@v7
uses: actions/checkout@v4
with:
persist-credentials: false
repository: SFML/SFML
ref: ${{env.SFML_VERSION}}
path: SFML
@@ -197,9 +151,8 @@ jobs:
run: cmake --build SFML/build --target install
- name: Checkout CSFML
uses: actions/checkout@v7
uses: actions/checkout@v4
with:
persist-credentials: false
path: CSFML
- name: Configure CSFML
+212 -216
View File
@@ -1,256 +1,252 @@
name: NuGet Release
on:
push:
branches:
- master
- 2.6.x
tags:
- "**"
workflow_dispatch: {}
permissions: {}
push:
branches:
- master
- 2.6.x
workflow_dispatch: {}
concurrency:
group: nuget-${{github.ref}}
cancel-in-progress: true
group: nuget-${{github.ref}}
cancel-in-progress: true
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
jobs:
windows-x86-x64:
name: Windows x86 x64
runs-on: windows-2025-vs2026
windows:
name: Windows VS2022
runs-on: windows-2022
steps:
- name: Checkout CSFML
uses: actions/checkout@v7
with:
persist-credentials: false
path: CSFML
steps:
- name: Checkout CSFML
uses: actions/checkout@v4
with:
path: CSFML
- name: Build x86
shell: pwsh
run: |
cd CSFML/tools/nuget
./build.win.ps1 "win-x86"
- name: Build x86
shell: pwsh
run: |
cd CSFML/tools/nuget
./build.win.ps1 "win-x86"
- name: Build x64
shell: pwsh
run: |
cd CSFML/tools/nuget
./build.win.ps1 "win-x64"
- name: Build x64
shell: pwsh
run: |
cd CSFML/tools/nuget
./build.win.ps1 "win-x64"
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: CSFML-win-x86-x64
path: CSFML/tools/nuget/CSFML/runtimes
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: CSFML-win-x86-x64
path: CSFML/tools/nuget/CSFML/runtimes
windows-arm64:
name: Windows ARM64
runs-on: windows-11-vs2026-arm
linux-x64:
name: Linux x64
runs-on: ubuntu-22.04
container:
image: ubuntu:22.04
steps:
- name: Checkout CSFML
uses: actions/checkout@v7
with:
persist-credentials: false
path: CSFML
steps:
- name: Checkout CSFML
uses: actions/checkout@v4
with:
path: CSFML
- name: Build ARM64
shell: pwsh
run: |
cd CSFML/tools/nuget
./build.win.ps1 "win-arm64"
- name: Build
shell: bash
run: |
cd ./CSFML/tools/nuget
chmod +x ./docker.linux-x64.sh
./docker.linux-x64.sh
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: CSFML-win-arm64
path: CSFML/tools/nuget/CSFML/runtimes
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: CSFML-linux-x64
path: CSFML/tools/nuget/CSFML/runtimes
linux-x64:
name: Linux x64
runs-on: ubuntu-24.04
container:
image: ubuntu:24.04
linux-arm:
name: Linux ARM
runs-on: ubuntu-22.04
steps:
- name: Checkout CSFML
uses: actions/checkout@v7
with:
persist-credentials: false
path: CSFML
steps:
- name: Checkout CSFML
uses: actions/checkout@v4
with:
path: CSFML
- name: Build
shell: bash
run: |
cd ./CSFML/tools/nuget
chmod +x ./docker.linux-x64.sh
./docker.linux-x64.sh
- name: Build in an ARM container
uses: uraimo/run-on-arch-action@v2.7.2
with:
arch: armv7
distro: ubuntu22.04
githubToken: ${{ github.token }}
dockerRunArgs: |
--volume "${PWD}/CSFML:/CSFML"
install: |
apt-get update -y
apt-get install -y git libfreetype6-dev xorg-dev libxrandr-dev libxcursor-dev libxi-dev libudev-dev libgl1-mesa-dev libflac-dev libogg-dev libvorbis-dev cmake g++
run: |
cd /CSFML/tools/nuget
chmod +x ./build.linux.sh
./build.linux.sh linux-arm
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: CSFML-linux-x64
path: CSFML/tools/nuget/CSFML/runtimes
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: CSFML-linux-arm
path: CSFML/tools/nuget/CSFML/runtimes
linux-arm:
name: Linux ARM
runs-on: ubuntu-24.04-arm
linux-arm64:
name: Linux ARM64
runs-on: ubuntu-22.04
steps:
- name: Checkout CSFML
uses: actions/checkout@v7
with:
persist-credentials: false
path: CSFML
steps:
- name: Checkout CSFML
uses: actions/checkout@v4
with:
path: CSFML
- name: Install dependencies & cross compiler
run: |
sudo dpkg --add-architecture armhf
sudo apt-get update
sudo apt-get install -y git libfreetype6-dev:armhf xorg-dev libxrandr-dev:armhf libxcursor-dev:armhf libxi-dev:armhf libudev-dev:armhf libgl1-mesa-dev:armhf libflac-dev:armhf libogg-dev:armhf libvorbis-dev:armhf cmake g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf
- name: Build in an ARM64 container
uses: uraimo/run-on-arch-action@v2.7.2
with:
arch: aarch64
distro: ubuntu22.04
githubToken: ${{ github.token }}
dockerRunArgs: |
--volume "${PWD}/CSFML:/CSFML"
install: |
apt-get update -y
apt-get install -y git libfreetype6-dev xorg-dev libxrandr-dev libxcursor-dev libudev-dev libgl1-mesa-dev libflac-dev libogg-dev libvorbis-dev cmake g++
run: |
cd /CSFML/tools/nuget
chmod +x ./build.linux.sh
./build.linux.sh linux-arm64
- name: Build
shell: bash
run: |
cd ./CSFML/tools/nuget
chmod +x ./build.linux.sh
./build.linux.sh linux-arm arm-linux-gnueabihf-g++ arm-linux-gnueabihf-gcc
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: CSFML-linux-arm64
path: CSFML/tools/nuget/CSFML/runtimes
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: CSFML-linux-arm
path: CSFML/tools/nuget/CSFML/runtimes
linux-musl-x64:
name: Linux MUSL x64
runs-on: ubuntu-22.04
container:
image: alpine:3.20.3
linux-arm64:
name: Linux ARM64
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout CSFML
uses: actions/checkout@v4
with:
path: CSFML
steps:
- name: Checkout CSFML
uses: actions/checkout@v7
with:
persist-credentials: false
path: CSFML
- name: Build
shell: sh
run: |
cd ./CSFML/tools/nuget
chmod +x ./docker.linux-musl-x64.sh
./docker.linux-musl-x64.sh
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y git libfreetype6-dev xorg-dev libxrandr-dev libxcursor-dev libxi-dev libudev-dev libgl1-mesa-dev libflac-dev libogg-dev libvorbis-dev cmake gcc g++
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: CSFML-linux-musl-x64
path: CSFML/tools/nuget/CSFML/runtimes
- name: Build
shell: bash
run: |
cd ./CSFML/tools/nuget
chmod +x ./build.linux.sh
./build.linux.sh linux-arm64
fedora-x64:
name: Fedora x64
runs-on: ubuntu-22.04
container:
image: fedora:37
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: CSFML-linux-arm64
path: CSFML/tools/nuget/CSFML/runtimes
steps:
- name: Checkout CSFML
uses: actions/checkout@v4
with:
path: CSFML
linux-musl-x64:
name: Linux MUSL x64
runs-on: ubuntu-24.04
container:
image: alpine:3.20.7
- name: Build
shell: bash
run: |
cd ./CSFML/tools/nuget
chmod +x ./docker.fedora-x64.sh
./docker.fedora-x64.sh
steps:
- name: Checkout CSFML
uses: actions/checkout@v7
with:
persist-credentials: false
path: CSFML
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: CSFML-fedora-x64
path: CSFML/tools/nuget/CSFML/runtimes
- name: Build
shell: sh
run: |
cd ./CSFML/tools/nuget
chmod +x ./docker.linux-musl-x64.sh
./docker.linux-musl-x64.sh
macos:
name: macOS
runs-on: macos-14
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: CSFML-linux-musl-x64
path: CSFML/tools/nuget/CSFML/runtimes
steps:
- name: Checkout CSFML
uses: actions/checkout@v4
with:
path: CSFML
macos-x64-arm64:
name: macOS x64 and ARM64
runs-on: macos-15
- name: Install necessary tooling
run: brew install coreutils
steps:
- name: Checkout CSFML
uses: actions/checkout@v7
with:
persist-credentials: false
path: CSFML
- name: Build x64
run: |
cd CSFML/tools/nuget
./build.macos.sh "osx-x64"
- name: Install necessary tooling
run: brew install coreutils
- name: Build ARM64
run: |
cd CSFML/tools/nuget
./build.macos.sh "osx-arm64"
- name: Build x64
run: |
cd CSFML/tools/nuget
./build.macos.sh "osx-x64"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: CSFML-macOS-x64-arm64
path: CSFML/tools/nuget/CSFML/runtimes
- name: Build ARM64
run: |
cd CSFML/tools/nuget
./build.macos.sh "osx-arm64"
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: CSFML-macOS-x64-arm64
path: CSFML/tools/nuget/CSFML/runtimes
package:
name: Package Builds
runs-on: ubuntu-24.04
needs:
- windows-x86-x64
- windows-arm64
- linux-x64
- linux-arm
- linux-arm64
- linux-musl-x64
- macos-x64-arm64
steps:
- name: Checkout CSFML
uses: actions/checkout@v7
with:
persist-credentials: false
path: CSFML
- name: Download Artifacts
uses: actions/download-artifact@v8
with:
path: CSFML/tools/nuget/CSFML/runtimes
merge-multiple: true
- name: Setup .NET 10 SDK
id: setup-dotnet
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Enforce SDK Version
env:
DOTNET_VERSION: ${{ steps.setup-dotnet.outputs.dotnet-version }}
run: dotnet new globaljson --sdk-version "$DOTNET_VERSION" --force
- name: Verify SDK Installation
run: dotnet --info
- name: Build NuGet Package
run: |
cd CSFML/tools/nuget
dotnet build --configuration Release --verbosity detailed
- name: Upload NuGet Package
uses: actions/upload-artifact@v7
with:
name: CSFML-NuGet-Package
path: CSFML/tools/nuget/CSFML/bin/Release/*.nupkg
package:
name: Package Builds
runs-on: ubuntu-22.04
needs:
- windows
- linux-x64
- linux-arm
- linux-arm64
- linux-musl-x64
- fedora-x64
- macos
steps:
- name: Checkout CSFML
uses: actions/checkout@v4
with:
path: CSFML
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: CSFML/tools/nuget/CSFML/runtimes
merge-multiple: true
- name: Setup .NET 8 SDK
id: setup-dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Enforce SDK Version
run: dotnet new globaljson --sdk-version ${{ steps.setup-dotnet.outputs.dotnet-version }} --force
- name: Verify SDK Installation
run: dotnet --info
- name: Build NuGet Package
run: |
cd CSFML/tools/nuget
dotnet build --configuration Release --verbosity detailed
- name: Upload NuGet Package
uses: actions/upload-artifact@v4
with:
name: CSFML-NuGet-Package
path: CSFML/tools/nuget/CSFML/bin/Release/*.nupkg
-356
View File
@@ -1,356 +0,0 @@
name: Release Builds
on:
push:
branches:
- master
- 2.6.x
tags:
- "**"
workflow_dispatch: {}
permissions: {}
concurrency:
group: release-${{github.ref}}
cancel-in-progress: true
env:
SFML_VERSION: 3.1.0
defaults:
run:
shell: bash
jobs:
windows-x86:
name: Windows x86
runs-on: windows-2025-vs2026
steps:
- name: Install MinGW x86
uses: bwoodsend/setup-winlibs-action@v1
id: winlibs-32
with:
tag: 15.2.0posix-13.0.0-ucrt-r1
with_clang: false
architecture: 32
destination: ${{ github.workspace }}
add_to_path: false
- name: Checkout SFML
uses: actions/checkout@v7
with:
persist-credentials: false
repository: SFML/SFML
ref: ${{ env.SFML_VERSION }}
path: SFML
- name: Checkout CSFML
uses: actions/checkout@v7
with:
persist-credentials: false
path: CSFML
- name: Build SFML
run: |
cmake -S SFML -B SFML-build -A Win32 -G "Visual Studio 18 2026" -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 Win32 -G "Visual Studio 18 2026" -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: Add MinGW to PATH
shell: bash
run: echo "$GITHUB_WORKSPACE\mingw32\bin" >> "$GITHUB_PATH"
- name: Generate Import Libs for MinGW
shell: pwsh
run: |
New-Item -ItemType "directory" -PATH "CSFML-install\lib\gcc"
New-Item -ItemType "directory" -PATH "CSFML-install\lib\msvc"
Move-Item -Path "CSFML-install\lib\*.lib" -Destination "CSFML-install\lib\msvc"
Push-Location CSFML-install\lib\gcc
& gendef.exe "..\..\bin\csfml-graphics-3.dll"
& dlltool.exe -d "csfml-graphics-3.def" -D "..\..\bin\csfml-graphics-3.dll" -l "libcsfml-graphics.a"
Remove-Item -Path "csfml-graphics-3.def"
& gendef.exe "..\..\bin\csfml-window-3.dll"
& dlltool.exe -d "csfml-window-3.def" -D "..\..\bin\csfml-window-3.dll" -l "libcsfml-window.a"
Remove-Item -Path "csfml-window-3.def"
& gendef.exe "..\..\bin\csfml-audio-3.dll"
& dlltool.exe -d "csfml-audio-3.def" -D "..\..\bin\csfml-audio-3.dll" -l "libcsfml-audio.a"
Remove-Item -Path "csfml-audio-3.def"
& gendef.exe "..\..\bin\csfml-network-3.dll"
& dlltool.exe -d "csfml-network-3.def" -D "..\..\bin\csfml-network-3.dll" -l "libcsfml-network.a"
Remove-Item -Path "csfml-network-3.def"
& gendef.exe "..\..\bin\csfml-system-3.dll"
& dlltool.exe -d "csfml-system-3.def" -D "..\..\bin\csfml-system-3.dll" -l "libcsfml-system.a"
Remove-Item -Path "csfml-system-3.def"
Pop-Location
New-Item -ItemType "directory" -PATH "install\CSFML"
Move-Item -Path "CSFML-install\*" -Destination "install\CSFML"
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: CSFML-windows-32-bit
path: install/CSFML
windows-x64:
name: Windows x64
runs-on: windows-2025-vs2026
steps:
- name: Install MinGW x64
uses: bwoodsend/setup-winlibs-action@v1
id: winlibs-64
with:
tag: 15.2.0posix-13.0.0-ucrt-r1
with_clang: false
architecture: 64
destination: ${{ github.workspace }}
add_to_path: false
- name: Checkout SFML
uses: actions/checkout@v7
with:
persist-credentials: false
repository: SFML/SFML
ref: ${{ env.SFML_VERSION }}
path: SFML
- name: Checkout CSFML
uses: actions/checkout@v7
with:
persist-credentials: false
path: CSFML
- name: Build SFML
run: |
cmake -S SFML -B SFML-build -A x64 -G "Visual Studio 18 2026" -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 x64 -G "Visual Studio 18 2026" -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: Add MinGW to PATH
shell: bash
run: echo "$GITHUB_WORKSPACE\mingw64\bin" >> "$GITHUB_PATH"
- name: Generate Import Libs for MinGW
shell: pwsh
run: |
New-Item -ItemType "directory" -PATH "CSFML-install\lib\gcc"
New-Item -ItemType "directory" -PATH "CSFML-install\lib\msvc"
Move-Item -Path "CSFML-install\lib\*.lib" -Destination "CSFML-install\lib\msvc"
Push-Location CSFML-install\lib\gcc
& gendef.exe "..\..\bin\csfml-graphics-3.dll"
& dlltool.exe -d "csfml-graphics-3.def" -D "..\..\bin\csfml-graphics-3.dll" -l "libcsfml-graphics.a"
Remove-Item -Path "csfml-graphics-3.def"
& gendef.exe "..\..\bin\csfml-window-3.dll"
& dlltool.exe -d "csfml-window-3.def" -D "..\..\bin\csfml-window-3.dll" -l "libcsfml-window.a"
Remove-Item -Path "csfml-window-3.def"
& gendef.exe "..\..\bin\csfml-audio-3.dll"
& dlltool.exe -d "csfml-audio-3.def" -D "..\..\bin\csfml-audio-3.dll" -l "libcsfml-audio.a"
Remove-Item -Path "csfml-audio-3.def"
& gendef.exe "..\..\bin\csfml-network-3.dll"
& dlltool.exe -d "csfml-network-3.def" -D "..\..\bin\csfml-network-3.dll" -l "libcsfml-network.a"
Remove-Item -Path "csfml-network-3.def"
& gendef.exe "..\..\bin\csfml-system-3.dll"
& dlltool.exe -d "csfml-system-3.def" -D "..\..\bin\csfml-system-3.dll" -l "libcsfml-system.a"
Remove-Item -Path "csfml-system-3.def"
Pop-Location
New-Item -ItemType "directory" -PATH "install\CSFML"
Move-Item -Path "CSFML-install\*" -Destination "install\CSFML"
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: CSFML-windows-64-bit
path: install/CSFML
windows-arm64:
name: Windows ARM64
runs-on: windows-2025-vs2026
steps:
- name: Checkout SFML
uses: actions/checkout@v7
with:
persist-credentials: false
repository: SFML/SFML
ref: ${{ env.SFML_VERSION }}
path: SFML
- name: Checkout CSFML
uses: actions/checkout@v7
with:
persist-credentials: false
path: CSFML
- name: Build SFML
run: |
cmake -S SFML -B SFML-build -A ARM64 -G "Visual Studio 18 2026" -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 18 2026" -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@v7
with:
name: CSFML-windows-arm64
path: install/CSFML
macos-x64:
name: macOS x64
runs-on: macos-15
steps:
- name: Checkout SFML
uses: actions/checkout@v7
with:
persist-credentials: false
repository: SFML/SFML
ref: ${{ env.SFML_VERSION }}
path: SFML
- name: Checkout CSFML
uses: actions/checkout@v7
with:
persist-credentials: false
path: CSFML
- name: Build SFML
run: |
cmake -S SFML -B SFML-build -G "Unix Makefiles" \
-DCMAKE_C_COMPILER="/usr/bin/clang" \
-DCMAKE_CXX_COMPILER="/usr/bin/clang++" \
-DCMAKE_C_FLAGS="-stdlib=libc++" \
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
"-DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/SFML-install" \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
-DSFML_BUILD_FRAMEWORKS=OFF \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build SFML-build --config Release --target install
- name: Build CSFML
run: |
cmake -S CSFML -B CSFML-build -G "Unix Makefiles" \
-DCMAKE_C_COMPILER="/usr/bin/clang" \
-DCMAKE_CXX_COMPILER="/usr/bin/clang++" \
-DCMAKE_C_FLAGS="-stdlib=libc++" \
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
"-DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/CSFML-install" \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
"-DSFML_ROOT=$GITHUB_WORKSPACE/SFML-install" \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build CSFML-build --config Release --target install
- name: Create Archive
run: |
mkdir CSFML-macOS-clang-64-bit
cp -R CSFML-install/include CSFML-macOS-clang-64-bit
cp -R CSFML-install/lib CSFML-macOS-clang-64-bit
cp CSFML-install/share/CSFML/* CSFML-macOS-clang-64-bit
tar -zcvf CSFML-macOS-clang-64-bit.tar.gz CSFML-macOS-clang-64-bit
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: CSFML-macOS-clang-64-bit
path: CSFML-macOS-clang-64-bit.tar.gz
macos-arm64:
name: macOS ARM64
runs-on: macos-15
steps:
- name: Checkout SFML
uses: actions/checkout@v7
with:
persist-credentials: false
repository: SFML/SFML
ref: ${{ env.SFML_VERSION }}
path: SFML
- name: Checkout CSFML
uses: actions/checkout@v7
with:
persist-credentials: false
path: CSFML
- name: Build SFML
run: |
cmake -S SFML -B SFML-build -G "Unix Makefiles" \
-DCMAKE_C_COMPILER="/usr/bin/clang" \
-DCMAKE_CXX_COMPILER="/usr/bin/clang++" \
-DCMAKE_C_FLAGS="-stdlib=libc++" \
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
"-DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/SFML-install" \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DSFML_BUILD_FRAMEWORKS=OFF \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build SFML-build --config Release --target install
- name: Build CSFML
run: |
cmake -S CSFML -B CSFML-build -G "Unix Makefiles" \
-DCMAKE_C_COMPILER="/usr/bin/clang" \
-DCMAKE_CXX_COMPILER="/usr/bin/clang++" \
-DCMAKE_C_FLAGS="-stdlib=libc++" \
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
"-DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/CSFML-install" \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
"-DSFML_ROOT=$GITHUB_WORKSPACE/SFML-install" \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build CSFML-build --config Release --target install
- name: Create Archive
run: |
mkdir CSFML-macOS-clang-arm64
cp -R CSFML-install/include CSFML-macOS-clang-arm64
cp -R CSFML-install/lib CSFML-macOS-clang-arm64
cp CSFML-install/share/CSFML/* CSFML-macOS-clang-arm64
tar -zcvf CSFML-macOS-clang-arm64.tar.gz CSFML-macOS-clang-arm64
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: CSFML-macOS-clang-arm64
path: CSFML-macOS-clang-arm64.tar.gz
+3 -3
View File
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.28)
cmake_minimum_required(VERSION 3.22)
# define a macro that helps defining an option
macro(csfml_set_option var default type docstring)
@@ -13,7 +13,7 @@ endmacro()
csfml_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debug or Release)")
# project name
project(CSFML VERSION 3.1.0)
project(CSFML VERSION 3.0.0)
# we use the paths from the cmake GNUInstallDirs module as defaults
# you can override these if you like
@@ -66,7 +66,7 @@ endif()
if(CSFML_BUILD_NETWORK)
list(PREPEND SFML_MODULES "Network")
endif()
find_package(SFML 3.1 COMPONENTS ${SFML_MODULES} REQUIRED)
find_package(SFML 3.0.0 COMPONENTS ${SFML_MODULES} REQUIRED)
# add the subdirectories
add_subdirectory(src/CSFML)
+2 -2
View File
@@ -38,8 +38,8 @@ add_custom_target(doc ALL
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
DESTINATION ${INSTALL_MISC_DIR}/doc
COMPONENT doc)
if(DOXYGEN_GENERATE_HTMLHELP)
install(FILES ${DOXYGEN_OUTPUT_DIR}/CSFML.chm
if(DOXYGEN_HHC_PROGRAM)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CSFML.chm
DESTINATION ${INSTALL_MISC_DIR}/doc
COMPONENT doc)
endif()
+2 -1
View File
@@ -42,8 +42,9 @@
/// font = sfFont_createFromFile("arial.ttf");
/// if (!font)
/// return EXIT_FAILURE;
/// text = sfText_create(font);
/// text = sfText_create();
/// sfText_setString(text, "Hello SFML");
/// sfText_setFont(text, font);
/// sfText_setCharacterSize(text, 50);
///
/// /* Load a music to play */
+1 -2
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -30,7 +30,6 @@
#include <CSFML/Audio/Listener.h>
#include <CSFML/Audio/Music.h>
#include <CSFML/Audio/PlaybackDevice.h>
#include <CSFML/Audio/Sound.h>
#include <CSFML/Audio/SoundBuffer.h>
#include <CSFML/Audio/SoundBufferRecorder.h>
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
-205
View File
@@ -1,205 +0,0 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////
#pragma once
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <CSFML/Audio/Export.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
////////////////////////////////////////////////////////////
/// \brief Enumeration of the playback device notifications
///
////////////////////////////////////////////////////////////
typedef enum
{
sfPlaybackDeviceStarted, ///< Playback device has been started
sfPlaybackDeviceStopped, ///< Playback device has been stopped
sfPlaybackDeviceRerouted, ///< Playback device has been rerouted (Generated on platforms that support automatic stream routing)
sfPlaybackDeviceInterruptionBegan, ///< Playback device interruption has begun (Generated on Apple mobile platforms)
sfPlaybackDeviceInterruptionEnded, ///< Playback device interruption has ended (Generated on Apple mobile platforms)
sfPlaybackDeviceUnlocked ///< Playback device has been unlocked (Generated by Emscripten/WebAudio)
} sfPlaybackDeviceNotification;
////////////////////////////////////////////////////////////
/// \brief Callback that is called to notify of changes to the playback device state
///
/// \param notification The notification
/// \param userData User data passed to sfPlaybackDevice_setNotificationCallback
///
////////////////////////////////////////////////////////////
typedef void (*sfPlaybackDeviceNotificationCallback)(sfPlaybackDeviceNotification notification, void* userData);
////////////////////////////////////////////////////////////
/// \brief Get a list of the names of all available audio playback devices
///
/// If the operating system reports multiple devices with
/// the same name, a number will be appended to the name
/// of all subsequent devices to distinguish them from each
/// other. This guarantees that every entry returned by this
/// function will represent a unique device.
///
/// The default device, if one is marked as such, will be
/// placed at the beginning of the list.
///
/// The returned array and strings stay valid until the next
/// call to this function.
///
/// \param count Pointer to a variable that will be filled with the number of devices
///
/// \return An array of strings containing the device names or NULL if no devices are available
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API const char* const* sfPlaybackDevice_getAvailableDevices(size_t* count);
////////////////////////////////////////////////////////////
/// \brief Get the name of the default audio playback device
///
/// Note that depending on when this function is called, the
/// default device reported by the operating system might
/// change e.g. when a USB audio device is plugged into or
/// unplugged from the system.
///
/// The returned string stays valid until the next call to
/// this function.
///
/// \return The name of the default audio playback device or NULL if there is none
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API const char* sfPlaybackDevice_getDefaultDevice(void);
////////////////////////////////////////////////////////////
/// \brief Set the audio playback device
///
/// This function sets the audio playback device to the device
/// with the given name. It can be called on the fly (i.e:
/// while sounds are playing).
///
/// If there are sounds playing when the audio playback
/// device is switched, the sounds will continue playing
/// uninterrupted on the new audio playback device.
///
/// \param name The name of the audio playback device
///
/// \return True, if it was able to set the requested device
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API bool sfPlaybackDevice_setDevice(const char* name);
////////////////////////////////////////////////////////////
/// \brief Set the audio playback device to the default
///
/// This function sets the audio playback device to the
/// default device. It can be called on the fly (i.e:
/// while sounds are playing).
///
/// When certain backends are used, using the default device
/// will enable automatic stream routing. When automatic
/// stream routing is enabled, audio data is automatically
/// sent to whichever physical audio device is currently
/// marked as the default on the system.
///
/// Automatic stream routing is currently supported when using
/// the WASAPI or DirectSound backend on Windows or the
/// Core Audio backend on macOS and iOS.
///
/// \return True, if it was able to set the audio playback device to the default device
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API bool sfPlaybackDevice_setDeviceToDefault(void);
////////////////////////////////////////////////////////////
/// \brief Set the audio playback device to the null device
///
/// This function sets the audio playback device to the
/// null device. It can be called on the fly (i.e:
/// while sounds are playing).
///
/// Audio data routed to the null device will be discarded
/// by the backend. This can be used to keep sounds playing
/// without having them actually output on a physical
/// audio playback device.
///
/// \return True, if it was able to set the audio playback device to the null device
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API bool sfPlaybackDevice_setDeviceToNull(void);
////////////////////////////////////////////////////////////
/// \brief Get the name of the current audio playback device
///
/// The returned string stays valid until the next call to
/// this function.
///
/// \return The name of the current audio playback device or NULL if there is none
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API const char* sfPlaybackDevice_getDevice(void);
////////////////////////////////////////////////////////////
/// \brief Get the sample rate of the current audio playback device
///
/// \return The sample rate of the current audio playback device or 0 if there is none
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API uint32_t sfPlaybackDevice_getDeviceSampleRate(void);
////////////////////////////////////////////////////////////
/// \brief Check if the current playback device is the default device
///
/// This function will return false if there is no
/// current playback device.
///
/// \return True, if the current playback device is the default device
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API bool sfPlaybackDevice_isDefaultDevice(void);
////////////////////////////////////////////////////////////
/// \brief Set a callback that should be called to notify of changes to the playback device state
///
/// Warning: Do not attempt to alter the device state from
/// within this callback. This includes changing the device
/// and even creating/destroying sound objects since that
/// could indirectly cause the playback device to be
/// created/destroyed. Also do not attempt to set the
/// notification callback from within this callback. Doing
/// so will result in a deadlock.
///
/// When receiving a notification via this callback, store
/// the information somewhere and react on it from another
/// thread e.g. the main thread within the application.
///
/// \param callback The callback to be called, pass NULL to remove the current callback
/// \param userData User data that will be passed to the callback
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfPlaybackDevice_setNotificationCallback(sfPlaybackDeviceNotificationCallback callback, void* userData);
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+2 -2
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -36,7 +36,7 @@
// Define the CSFML version
////////////////////////////////////////////////////////////
#define CSFML_VERSION_MAJOR 3
#define CSFML_VERSION_MINOR 1
#define CSFML_VERSION_MINOR 0
#define CSFML_VERSION_PATCH 0
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -41
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -292,36 +292,6 @@ CSFML_GRAPHICS_API void sfCircleShape_setOutlineColor(sfCircleShape* shape, sfCo
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfCircleShape_setOutlineThickness(sfCircleShape* shape, float thickness);
////////////////////////////////////////////////////////////
/// \brief Set the limit on the ratio between miter length and outline thickness of a circle shape
///
/// Outline segments around each corner are joined either
/// with a miter or a bevel join.
/// - A miter join is formed by extending outline segments until
/// they intersect. The distance between the point of
/// intersection and the shape's corner is the miter length.
/// - A bevel join is formed by connecting outline segments with
/// a straight line perpendicular to the corner's bisector.
///
/// The miter limit is used to determine whether outline segments
/// around a corner are joined with a bevel or a miter.
/// When the ratio between the miter length and outline thickness
/// exceeds the miter limit, a bevel is used instead of a miter.
///
/// The miter limit is linked to the maximum inner angle of a
/// corner below which a bevel is used by the following formula:
///
/// miterLimit = 1 / sin(angle / 2)
///
/// The miter limit must be greater than or equal to 1.
/// By default, the miter limit is 10.
///
/// \param shape Shape object
/// \param miterLimit New miter limit
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfCircleShape_setMiterLimit(sfCircleShape* shape, float miterLimit);
////////////////////////////////////////////////////////////
/// \brief Get the source texture of a circle shape
///
@@ -376,16 +346,6 @@ CSFML_GRAPHICS_API sfColor sfCircleShape_getOutlineColor(const sfCircleShape* sh
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfCircleShape_getOutlineThickness(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the limit on the ratio between miter length and outline thickness of a circle shape
///
/// \param shape Shape object
///
/// \return Limit on the ratio between miter length and outline thickness
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfCircleShape_getMiterLimit(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the total number of points of a circle shape
///
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -41
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -292,36 +292,6 @@ CSFML_GRAPHICS_API void sfConvexShape_setOutlineColor(sfConvexShape* shape, sfCo
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfConvexShape_setOutlineThickness(sfConvexShape* shape, float thickness);
////////////////////////////////////////////////////////////
/// \brief Set the limit on the ratio between miter length and outline thickness of a convex shape
///
/// Outline segments around each corner are joined either
/// with a miter or a bevel join.
/// - A miter join is formed by extending outline segments until
/// they intersect. The distance between the point of
/// intersection and the shape's corner is the miter length.
/// - A bevel join is formed by connecting outline segments with
/// a straight line perpendicular to the corner's bisector.
///
/// The miter limit is used to determine whether outline segments
/// around a corner are joined with a bevel or a miter.
/// When the ratio between the miter length and outline thickness
/// exceeds the miter limit, a bevel is used instead of a miter.
///
/// The miter limit is linked to the maximum inner angle of a
/// corner below which a bevel is used by the following formula:
///
/// miterLimit = 1 / sin(angle / 2)
///
/// The miter limit must be greater than or equal to 1.
/// By default, the miter limit is 10.
///
/// \param shape Shape object
/// \param miterLimit New miter limit
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfConvexShape_setMiterLimit(sfConvexShape* shape, float miterLimit);
////////////////////////////////////////////////////////////
/// \brief Get the source texture of a convex shape
///
@@ -376,16 +346,6 @@ CSFML_GRAPHICS_API sfColor sfConvexShape_getOutlineColor(const sfConvexShape* sh
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfConvexShape_getOutlineThickness(const sfConvexShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the limit on the ratio between miter length and outline thickness of a convex shape
///
/// \param shape Shape object
///
/// \return Limit on the ratio between miter length and outline thickness
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfConvexShape_getMiterLimit(const sfConvexShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the total number of points of a convex shape
///
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -64
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -101,31 +101,6 @@ CSFML_GRAPHICS_API void sfFont_destroy(const sfFont* font);
CSFML_GRAPHICS_API sfGlyph
sfFont_getGlyph(const sfFont* font, uint32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness);
////////////////////////////////////////////////////////////
/// \brief Get a glyph in a font by glyph ID
///
/// If the font is a bitmap font, not all character sizes
/// might be available. If the glyph is not available at the
/// requested size, an empty glyph is returned.
///
/// Glyph IDs are font specific and are for example
/// provided by the shaped glyphs of a text.
///
/// Be aware that using a negative value for the outline
/// thickness will cause distorted rendering.
///
/// \param font Source font
/// \param id ID of the glyph to get
/// \param characterSize Character size, in pixels
/// \param bold Retrieve the bold version or the regular one?
/// \param outlineThickness Thickness of outline (when != 0 the glyph will not be filled)
///
/// \return The corresponding glyph
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfGlyph
sfFont_getGlyphById(const sfFont* font, uint32_t id, unsigned int characterSize, bool bold, float outlineThickness);
////////////////////////////////////////////////////////////
/// \brief Determine if this font has a glyph representing the requested code point
///
@@ -182,44 +157,6 @@ CSFML_GRAPHICS_API float sfFont_getBoldKerning(const sfFont* font, uint32_t firs
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfFont_getLineSpacing(const sfFont* font, unsigned int characterSize);
////////////////////////////////////////////////////////////
/// \brief Get the ascent of a font
///
/// The ascent is the largest distance between the baseline and
/// the top of all glyphs in the font.
///
/// Be aware that there is no uniform definition of how the
/// ascent is calculated. It can vary from font to font.
///
/// \param font Source font
/// \param characterSize Reference character size
///
/// \return Ascent, in pixels
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfFont_getAscent(const sfFont* font, unsigned int characterSize);
////////////////////////////////////////////////////////////
/// \brief Get the descent of a font
///
/// The descent is the largest distance between the baseline and
/// the bottom of all glyphs in the font.
///
/// Be aware that there is no uniform definition of how the
/// descent is calculated. It can vary from font to font.
///
/// The descent shares the same coordinate system as the
/// ascent. This means that it will be negative for distances
/// below the baseline.
///
/// \param font Source font
/// \param characterSize Reference character size
///
/// \return Descent, in pixels
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfFont_getDescent(const sfFont* font, unsigned int characterSize);
////////////////////////////////////////////////////////////
/// \brief Get the position of the underline
///
+2 -8
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -29,16 +29,10 @@
////////////////////////////////////////////////////////////
#include <CSFML/Graphics/Export.h>
#include <stdbool.h>
#include <stdint.h>
////////////////////////////////////////////////////////////
/// sfFontInfo holds various information about a font
////////////////////////////////////////////////////////////
typedef struct
{
uint64_t id; ///< A unique ID that identifies the font
const char* family; ///< The font family
bool hasKerning; ///< Has kerning information
bool hasVerticalMetrics; ///< Has native vertical metrics
const char* family;
} sfFontInfo;
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+9 -9
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -82,8 +82,8 @@ CSFML_GRAPHICS_API sfImage* sfImage_createFromPixels(sfVector2u size, const uint
/// \brief Create an image from a file on disk
///
/// The supported image formats are bmp, png, tga, jpg, gif,
/// psd, hdr, pic, pnm and qoi. Some format options are not supported,
/// like jpeg with arithmetic coding or ASCII pnm.
/// psd, hdr and pic. Some format options are not supported,
/// like progressive jpeg.
/// If this function fails, the image is left unchanged.
///
/// \param filename Path of the image file to load
@@ -97,8 +97,8 @@ CSFML_GRAPHICS_API sfImage* sfImage_createFromFile(const char* filename);
/// \brief Create an image from a file in memory
///
/// The supported image formats are bmp, png, tga, jpg, gif,
/// psd, hdr, pic, pnm and qoi. Some format options are not supported,
/// like jpeg with arithmetic coding or ASCII pnm.
/// psd, hdr and pic. Some format options are not supported,
/// like progressive jpeg.
/// If this function fails, the image is left unchanged.
///
/// \param data Pointer to the file data in memory
@@ -113,8 +113,8 @@ CSFML_GRAPHICS_API sfImage* sfImage_createFromMemory(const void* data, size_t si
/// \brief Create an image from a custom stream
///
/// The supported image formats are bmp, png, tga, jpg, gif,
/// psd, hdr, pic, pnm and qoi. Some format options are not supported,
/// like jpeg with arithmetic coding or ASCII pnm.
/// psd, hdr and pic. Some format options are not supported,
/// like progressive jpeg.
/// If this function fails, the image is left unchanged.
///
/// \param stream Source stream to read from
@@ -147,7 +147,7 @@ CSFML_GRAPHICS_API void sfImage_destroy(const sfImage* image);
///
/// The format of the image is automatically deduced from
/// the extension. The supported image formats are bmp, png,
/// tga, jpg and qoi. The destination file is overwritten
/// tga and jpg. The destination file is overwritten
/// if it already exists. This function fails if the image is empty.
///
/// \param image Image object
@@ -164,7 +164,7 @@ CSFML_GRAPHICS_API bool sfImage_saveToFile(const sfImage* image, const char* fil
/// \brief Save the image to a buffer in memory
///
/// The format of the image must be specified.
/// The supported image formats are bmp, png, tga, jpg and qoi.
/// The supported image formats are bmp, png, tga and jpg.
/// This function fails if the image is empty, or if
/// the format was invalid.
///
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -41
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -292,36 +292,6 @@ CSFML_GRAPHICS_API void sfRectangleShape_setOutlineColor(sfRectangleShape* shape
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_setOutlineThickness(sfRectangleShape* shape, float thickness);
////////////////////////////////////////////////////////////
/// \brief Set the limit on the ratio between miter length and outline thickness of a rectangle shape
///
/// Outline segments around each corner are joined either
/// with a miter or a bevel join.
/// - A miter join is formed by extending outline segments until
/// they intersect. The distance between the point of
/// intersection and the shape's corner is the miter length.
/// - A bevel join is formed by connecting outline segments with
/// a straight line perpendicular to the corner's bisector.
///
/// The miter limit is used to determine whether outline segments
/// around a corner are joined with a bevel or a miter.
/// When the ratio between the miter length and outline thickness
/// exceeds the miter limit, a bevel is used instead of a miter.
///
/// The miter limit is linked to the maximum inner angle of a
/// corner below which a bevel is used by the following formula:
///
/// miterLimit = 1 / sin(angle / 2)
///
/// The miter limit must be greater than or equal to 1.
/// By default, the miter limit is 10.
///
/// \param shape Shape object
/// \param miterLimit New miter limit
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_setMiterLimit(sfRectangleShape* shape, float miterLimit);
////////////////////////////////////////////////////////////
/// \brief Get the source texture of a rectangle shape
///
@@ -376,16 +346,6 @@ CSFML_GRAPHICS_API sfColor sfRectangleShape_getOutlineColor(const sfRectangleSha
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfRectangleShape_getOutlineThickness(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the limit on the ratio between miter length and outline thickness of a rectangle shape
///
/// \param shape Shape object
///
/// \return Limit on the ratio between miter length and outline thickness
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfRectangleShape_getMiterLimit(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the total number of points of a rectangle shape
///
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+2 -27
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -216,28 +216,6 @@ CSFML_GRAPHICS_API bool sfRenderWindow_isSrgb(const sfRenderWindow* renderWindow
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setSize(sfRenderWindow* renderWindow, sfVector2u size);
////////////////////////////////////////////////////////////
/// \brief Set the minimum window rendering region size
///
/// Pass a `NULL` vector to unset the minimum size
///
/// \param renderWindow Render window object
/// \param minimumSize New minimum size, in pixels
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setMinimumSize(sfRenderWindow* renderWindow, const sfVector2u* minimumSize);
////////////////////////////////////////////////////////////
/// \brief Set the maximum window rendering region size
///
/// Pass a `NULL` vector to unset the maximum size
///
/// \param renderWindow Render window object
/// \param maximumSize New maximum size, in pixels
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setMaximumSize(sfRenderWindow* renderWindow, const sfVector2u* maximumSize);
////////////////////////////////////////////////////////////
/// \brief Change the title of a render window
///
@@ -708,11 +686,8 @@ CSFML_GRAPHICS_API void sfMouse_setPositionRenderWindow(sfVector2i position, con
///
/// \return Current position of \a finger, or undefined if it's not down
///
/// \deprecated Use the position of the touch events (sfEvtTouchBegan, sfEvtTouchMoved and sfEvtTouchEnded) instead
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API CSFML_DEPRECATED sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger,
const sfRenderWindow* relativeTo);
CSFML_GRAPHICS_API sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWindow* relativeTo);
////////////////////////////////////////////////////////////
/// \brief Create a Vulkan rendering surface
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -41
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -291,36 +291,6 @@ CSFML_GRAPHICS_API void sfShape_setOutlineColor(sfShape* shape, sfColor color);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShape_setOutlineThickness(sfShape* shape, float thickness);
////////////////////////////////////////////////////////////
/// \brief Set the limit on the ratio between miter length and outline thickness of a shape
///
/// Outline segments around each corner are joined either
/// with a miter or a bevel join.
/// - A miter join is formed by extending outline segments until
/// they intersect. The distance between the point of
/// intersection and the shape's corner is the miter length.
/// - A bevel join is formed by connecting outline segments with
/// a straight line perpendicular to the corner's bisector.
///
/// The miter limit is used to determine whether outline segments
/// around a corner are joined with a bevel or a miter.
/// When the ratio between the miter length and outline thickness
/// exceeds the miter limit, a bevel is used instead of a miter.
///
/// The miter limit is linked to the maximum inner angle of a
/// corner below which a bevel is used by the following formula:
///
/// miterLimit = 1 / sin(angle / 2)
///
/// The miter limit must be greater than or equal to 1.
/// By default, the miter limit is 10.
///
/// \param shape Shape object
/// \param miterLimit New miter limit
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShape_setMiterLimit(sfShape* shape, float miterLimit);
////////////////////////////////////////////////////////////
/// \brief Get the source texture of a shape
///
@@ -375,16 +345,6 @@ CSFML_GRAPHICS_API sfColor sfShape_getOutlineColor(const sfShape* shape);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfShape_getOutlineThickness(const sfShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the limit on the ratio between miter length and outline thickness of a shape
///
/// \param shape Shape object
///
/// \return Limit on the ratio between miter length and outline thickness
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfShape_getMiterLimit(const sfShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the total number of points of a shape
///
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+2 -251
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -30,15 +30,12 @@
#include <CSFML/Graphics/Export.h>
#include <CSFML/Graphics/Color.h>
#include <CSFML/Graphics/Glyph.h>
#include <CSFML/Graphics/Rect.h>
#include <CSFML/Graphics/Transform.h>
#include <CSFML/Graphics/Types.h>
#include <CSFML/Graphics/Vertex.h>
#include <CSFML/System/Vector2.h>
#include <stddef.h>
#include <stdint.h>
////////////////////////////////////////////////////////////
@@ -53,102 +50,6 @@ typedef enum
sfTextStrikeThrough = 1 << 3 ///< Strike through characters
} sfTextStyle;
////////////////////////////////////////////////////////////
/// \brief Line alignment of a multi-line text
///
////////////////////////////////////////////////////////////
typedef enum
{
sfTextLineAlignmentDefault, ///< Automatically align lines by script direction, left-align left-to-right text and right-align right-to-left text
sfTextLineAlignmentLeft, ///< Force align all lines to the left, regardless of script direction
sfTextLineAlignmentCenter, ///< Force align all lines centrally
sfTextLineAlignmentRight ///< Force align lines to the right, regardless of script direction
} sfTextLineAlignment;
////////////////////////////////////////////////////////////
/// \brief Cluster grouping algorithm
///
////////////////////////////////////////////////////////////
typedef enum
{
sfTextClusterGroupingGrapheme, ///< Group clusters by grapheme
sfTextClusterGroupingCharacter, ///< Group clusters by character
sfTextClusterGroupingNone ///< Do not group clusters
} sfTextClusterGrouping;
////////////////////////////////////////////////////////////
/// \brief Direction of the text a glyph belongs to
///
////////////////////////////////////////////////////////////
typedef enum
{
sfTextDirectionUnspecified, ///< Unspecified
sfTextDirectionLeftToRight, ///< Left-to-right
sfTextDirectionRightToLeft, ///< Right-to-left
sfTextDirectionTopToBottom, ///< Top-to-bottom
sfTextDirectionBottomToTop ///< Bottom-to-top
} sfTextDirection;
////////////////////////////////////////////////////////////
/// \brief Text orientation
///
////////////////////////////////////////////////////////////
typedef enum
{
sfTextOrientationDefault, ///< Default (left-to-right or right-to-left depending on detected script)
sfTextOrientationTopToBottom, ///< Top-to-bottom
sfTextOrientationBottomToTop ///< Bottom-to-top
} sfTextOrientation;
////////////////////////////////////////////////////////////
/// \brief Glyph that has been positioned by the shaper
///
////////////////////////////////////////////////////////////
typedef struct
{
sfGlyph glyph; ///< The glyph
sfVector2f position; ///< Position of the glyph within a text
uint32_t cluster; ///< Cluster ID
sfTextDirection textDirection; ///< Text direction
float baseline; ///< The baseline position of the line this glyph is a part of
size_t vertexOffset; ///< Starting offset of the vertex data belonging to this glyph
size_t vertexCount; ///< Count of vertices belonging to this glyph
} sfShapedGlyph;
////////////////////////////////////////////////////////////
/// \brief Callback that is provided with glyph data for pre-processing
///
/// The callback is called once per glyph whenever the text
/// geometry is regenerated, in the order in which the glyph
/// geometry is generated. The style, fill color, outline color
/// and outline thickness of the glyph can be modified through
/// the given pointers.
///
/// To map glyphs back to the input string, use the cluster
/// value of the shaped glyph. See sf::Text::GlyphPreProcessor
/// in the SFML documentation for a detailed explanation.
///
/// Changing the style or outline thickness might lead to
/// slight inconsistencies of the text bounds, changing the
/// fill or outline color is always safe. It is not safe to
/// query the text bounds from within the callback.
///
/// \param shapedGlyph The shaped glyph to pre-process
/// \param style Style of the glyph (see sfTextStyle enum)
/// \param fillColor Fill color of the glyph
/// \param outlineColor Outline color of the glyph
/// \param outlineThickness Outline thickness of the glyph
/// \param userData User data passed to sfText_setGlyphPreProcessor
///
////////////////////////////////////////////////////////////
typedef void (*sfGlyphPreProcessor)(
const sfShapedGlyph* shapedGlyph,
uint32_t* style,
sfColor* fillColor,
sfColor* outlineColor,
float* outlineThickness,
void* userData);
////////////////////////////////////////////////////////////
/// \brief Create a new text
@@ -466,31 +367,6 @@ CSFML_GRAPHICS_API void sfText_setOutlineColor(sfText* text, sfColor color);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setOutlineThickness(sfText* text, float thickness);
////////////////////////////////////////////////////////////
/// \brief Set the line alignment for a multi-line text
///
/// By default, the line alignment is sfTextLineAlignmentDefault.
///
/// \param text Text object
/// \param lineAlignment New line alignment
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setLineAlignment(sfText* text, sfTextLineAlignment lineAlignment);
////////////////////////////////////////////////////////////
/// \brief Set the text orientation
///
/// By default, the text orientation is sfTextOrientationDefault.
///
/// Vertical text orientations require the font to provide
/// vertical metrics, see sfFontInfo.
///
/// \param text Text object
/// \param textOrientation New text orientation
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setTextOrientation(sfText* text, sfTextOrientation textOrientation);
////////////////////////////////////////////////////////////
/// \brief Get the string of a text (returns an ANSI string)
///
@@ -599,26 +475,6 @@ CSFML_GRAPHICS_API sfColor sfText_getOutlineColor(const sfText* text);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfText_getOutlineThickness(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the line alignment for a multi-line text
///
/// \param text Text object
///
/// \return Line alignment
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfTextLineAlignment sfText_getLineAlignment(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the text orientation
///
/// \param text Text object
///
/// \return Text orientation
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfTextOrientation sfText_getTextOrientation(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Return the position of the \a index-th character in a text
///
@@ -634,113 +490,8 @@ CSFML_GRAPHICS_API sfTextOrientation sfText_getTextOrientation(const sfText* tex
///
/// \return Position of the character
///
/// \deprecated Use sfText_getShapedGlyphs instead
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API CSFML_DEPRECATED sfVector2f sfText_findCharacterPos(const sfText* text, size_t index);
////////////////////////////////////////////////////////////
/// \brief Get the shaped glyphs that make up a text
///
/// The result of shaping, i.e. positioning individual glyphs
/// based on the properties of the font and the input text,
/// is a sequence of shaped glyphs. In addition to the glyph
/// information that is available by looking up a glyph from
/// a font, the glyph position, glyph cluster ID and direction
/// of the text represented by the glyph is provided.
///
/// When positioning e.g. a cursor within the text, grapheme
/// clusters can be treated as the basic units of which the
/// text is composed. See sfText_setClusterGrouping.
///
/// The returned glyph positions are in local coordinates
/// (translation, rotation, scale and origin are not applied).
///
/// The returned array is owned by the text and stays valid
/// until the next call to this function or until the text
/// is destroyed.
///
/// \param text Text object
/// \param count Pointer to a variable that will be filled with the number of shaped glyphs
///
/// \return Pointer to the array of shaped glyphs
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfShapedGlyph* sfText_getShapedGlyphs(const sfText* text, size_t* count);
////////////////////////////////////////////////////////////
/// \brief Get the cluster grouping algorithm in use
///
/// \param text Text object
///
/// \return The cluster grouping algorithm in use
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfTextClusterGrouping sfText_getClusterGrouping(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Set the cluster grouping algorithm to use
///
/// By default, character cluster grouping is used.
///
/// Character cluster grouping is good enough to be able to
/// position cursors in most scenarios. If more coarse-grained
/// grouping is required, grapheme grouping can be selected.
///
/// Cluster grouping can also be disabled if necessary.
///
/// \param text Text object
/// \param clusterGrouping The cluster grouping algorithm to use
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setClusterGrouping(sfText* text, sfTextClusterGrouping clusterGrouping);
////////////////////////////////////////////////////////////
/// \brief Set the glyph pre-processor to be called per glyph
///
/// The glyph pre-processor is called with glyph data to be
/// pre-processed whenever the text geometry is regenerated.
///
/// \param text Text object
/// \param glyphPreProcessor The glyph pre-processor to be called per glyph, pass NULL to disable pre-processing
/// \param userData User data that will be passed to the glyph pre-processor
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setGlyphPreProcessor(sfText* text, sfGlyphPreProcessor glyphPreProcessor, void* userData);
////////////////////////////////////////////////////////////
/// \brief Get the vertex data of a text
///
/// The vertices form triangles (sfTriangles).
///
/// The vertex data is regenerated by the text whenever it is
/// necessary. Any changes made to the vertex data will be
/// discarded whenever this happens.
///
/// \param text Text object
/// \param count Pointer to a variable that will be filled with the number of vertices
///
/// \return Pointer to the vertex data of the text
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVertex* sfText_getVertexData(const sfText* text, size_t* count);
////////////////////////////////////////////////////////////
/// \brief Get the outline vertex data of a text
///
/// The vertices form triangles (sfTriangles).
///
/// The outline vertex data is regenerated by the text whenever
/// it is necessary. Any changes made to the outline vertex data
/// will be discarded whenever this happens.
///
/// \param text Text object
/// \param count Pointer to a variable that will be filled with the number of vertices
///
/// \return Pointer to the outline vertex data of the text
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVertex* sfText_getOutlineVertexData(const sfText* text, size_t* count);
CSFML_GRAPHICS_API sfVector2f sfText_findCharacterPos(const sfText* text, size_t index);
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of a text
+1 -27
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -178,32 +178,6 @@ CSFML_GRAPHICS_API sfTexture* sfTexture_copy(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
///
/// \return `true` if resizing was successful, `false` if it failed
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API bool sfTexture_resize(sfTexture* texture, sfVector2u size);
////////////////////////////////////////////////////////////
/// \brief Resize the texture with sRGB-enabled
///
/// If this function fails, the texture is left unchanged.
///
/// \param texture Texture to resize
/// \param size Width and height of the texture
///
/// \return `true` if resizing was successful, `false` if it failed
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API bool sfTexture_resizeSrgb(sfTexture* texture, sfVector2u size);
////////////////////////////////////////////////////////////
/// \brief Return the size of the texture
///
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -3
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -28,12 +28,10 @@
// Headers
////////////////////////////////////////////////////////////
#include <CSFML/Network/Dns.h>
#include <CSFML/Network/Ftp.h>
#include <CSFML/Network/Http.h>
#include <CSFML/Network/IpAddress.h>
#include <CSFML/Network/Packet.h>
#include <CSFML/Network/Sftp.h>
#include <CSFML/Network/SocketSelector.h>
#include <CSFML/Network/SocketStatus.h>
#include <CSFML/Network/TcpListener.h>
-288
View File
@@ -1,288 +0,0 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////
#pragma once
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <CSFML/Network/Export.h>
#include <CSFML/Network/IpAddress.h>
#include <CSFML/Network/Types.h>
#include <CSFML/System/Time.h>
#include <stddef.h>
#include <stdint.h>
////////////////////////////////////////////////////////////
/// \brief A DNS MX record
///
////////////////////////////////////////////////////////////
typedef struct
{
const char* exchange; ///< Host willing to act as mail exchange
uint16_t preference; ///< Preference of this record among others, lower values are preferred
} sfDnsMxRecord;
////////////////////////////////////////////////////////////
/// \brief A DNS SRV record
///
////////////////////////////////////////////////////////////
typedef struct
{
const char* target; ///< The domain name of the target host
uint16_t port; ///< The port on the target host of the service
uint16_t weight; ///< Server selection mechanism, larger weights should be given a proportionately higher probability of being selected
uint16_t priority; ///< The priority of the target host, a client must attempt to contact the target host with the lowest-numbered priority it can reach
} sfDnsSrvRecord;
////////////////////////////////////////////////////////////
/// \brief Resolve a hostname into a list of IP addresses
///
/// The returned array must be freed with sfFree.
///
/// \param hostname Hostname to resolve, encoded in UTF-8
/// \param servers The list of servers to query, NULL to use the default servers
/// \param serverCount Number of servers in \a servers
/// \param timeout Query timeout if using a provided list of servers, use 0 to wait forever
/// \param count Pointer to a variable that will be filled with the number of addresses
///
/// \return Array of IP addresses the given hostname resolves to, NULL if name resolution fails or no address was found
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfIpAddress* sfDns_resolve(
const char* hostname,
const sfIpAddress* servers,
size_t serverCount,
sfTime timeout,
size_t* count);
////////////////////////////////////////////////////////////
/// \brief Query NS records for a hostname
///
/// \param hostname Hostname to query NS records for, encoded in UTF-8
/// \param servers The list of servers to query, NULL to use the default servers
/// \param serverCount Number of servers in \a servers
/// \param timeout Query timeout if using a provided list of servers, use 0 to wait forever
///
/// \return New list of NS records, which can be empty
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfDnsNsRecords* sfDns_queryNs(const char* hostname, const sfIpAddress* servers, size_t serverCount, sfTime timeout);
////////////////////////////////////////////////////////////
/// \brief Query MX records for a hostname
///
/// \param hostname Hostname to query MX records for, encoded in UTF-8
/// \param servers The list of servers to query, NULL to use the default servers
/// \param serverCount Number of servers in \a servers
/// \param timeout Query timeout if using a provided list of servers, use 0 to wait forever
///
/// \return New list of MX records, which can be empty
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfDnsMxRecords* sfDns_queryMx(const char* hostname, const sfIpAddress* servers, size_t serverCount, sfTime timeout);
////////////////////////////////////////////////////////////
/// \brief Query SRV records for a hostname
///
/// \param hostname Hostname to query SRV records for, encoded in UTF-8
/// \param servers The list of servers to query, NULL to use the default servers
/// \param serverCount Number of servers in \a servers
/// \param timeout Query timeout if using a provided list of servers, use 0 to wait forever
///
/// \return New list of SRV records, which can be empty
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfDnsSrvRecords* sfDns_querySrv(const char* hostname, const sfIpAddress* servers, size_t serverCount, sfTime timeout);
////////////////////////////////////////////////////////////
/// \brief Query TXT records for a hostname
///
/// \param hostname Hostname to query TXT records for, encoded in UTF-8
/// \param servers The list of servers to query, NULL to use the default servers
/// \param serverCount Number of servers in \a servers
/// \param timeout Query timeout if using a provided list of servers, use 0 to wait forever
///
/// \return New list of TXT records, which can be empty
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfDnsTxtRecords* sfDns_queryTxt(const char* hostname, const sfIpAddress* servers, size_t serverCount, sfTime timeout);
////////////////////////////////////////////////////////////
/// \brief Get the computer's public address via DNS
///
/// The public address is the address of the computer from the
/// point of view of the internet, i.e. something like 89.54.1.169
/// or 2600:1901:0:13e0::1 as opposed to a private or local address
/// like 192.168.1.56 or fe80::1234:5678:9abc.
///
/// This function depends on both your network connection and
/// the server, and may be very slow. You should try to use it
/// as little as possible.
///
/// \param timeout Maximum time to wait, use 0 to wait forever
/// \param type The type of public address to get
///
/// \return Public IP address of the computer on success, sfIpAddress_None otherwise
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfIpAddress sfDns_getPublicAddress(sfTime timeout, sfIpAddressType type);
////////////////////////////////////////////////////////////
/// \brief Destroy a list of NS records
///
/// \param records List of NS records to destroy
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfDnsNsRecords_destroy(const sfDnsNsRecords* records);
////////////////////////////////////////////////////////////
/// \brief Get the number of NS records in a list
///
/// \param records List of NS records
///
/// \return Number of NS records
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API size_t sfDnsNsRecords_getCount(const sfDnsNsRecords* records);
////////////////////////////////////////////////////////////
/// \brief Get a NS record of a list
///
/// \param records List of NS records
/// \param index Index of the NS record to get
///
/// \return The NS record, encoded in UTF-8
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const char* sfDnsNsRecords_getRecord(const sfDnsNsRecords* records, size_t index);
////////////////////////////////////////////////////////////
/// \brief Destroy a list of MX records
///
/// \param records List of MX records to destroy
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfDnsMxRecords_destroy(const sfDnsMxRecords* records);
////////////////////////////////////////////////////////////
/// \brief Get the number of MX records in a list
///
/// \param records List of MX records
///
/// \return Number of MX records
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API size_t sfDnsMxRecords_getCount(const sfDnsMxRecords* records);
////////////////////////////////////////////////////////////
/// \brief Get a MX record of a list
///
/// The strings of the record stay valid until the list
/// is destroyed.
///
/// \param records List of MX records
/// \param index Index of the MX record to get
///
/// \return The MX record
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfDnsMxRecord sfDnsMxRecords_getRecord(const sfDnsMxRecords* records, size_t index);
////////////////////////////////////////////////////////////
/// \brief Destroy a list of SRV records
///
/// \param records List of SRV records to destroy
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfDnsSrvRecords_destroy(const sfDnsSrvRecords* records);
////////////////////////////////////////////////////////////
/// \brief Get the number of SRV records in a list
///
/// \param records List of SRV records
///
/// \return Number of SRV records
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API size_t sfDnsSrvRecords_getCount(const sfDnsSrvRecords* records);
////////////////////////////////////////////////////////////
/// \brief Get a SRV record of a list
///
/// The strings of the record stay valid until the list
/// is destroyed.
///
/// \param records List of SRV records
/// \param index Index of the SRV record to get
///
/// \return The SRV record
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfDnsSrvRecord sfDnsSrvRecords_getRecord(const sfDnsSrvRecords* records, size_t index);
////////////////////////////////////////////////////////////
/// \brief Destroy a list of TXT records
///
/// \param records List of TXT records to destroy
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfDnsTxtRecords_destroy(const sfDnsTxtRecords* records);
////////////////////////////////////////////////////////////
/// \brief Get the number of TXT records in a list
///
/// \param records List of TXT records
///
/// \return Number of TXT records
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API size_t sfDnsTxtRecords_getCount(const sfDnsTxtRecords* records);
////////////////////////////////////////////////////////////
/// \brief Get the number of strings in a TXT record
///
/// \param records List of TXT records
/// \param index Index of the TXT record
///
/// \return Number of strings in the TXT record
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API size_t sfDnsTxtRecords_getStringCount(const sfDnsTxtRecords* records, size_t index);
////////////////////////////////////////////////////////////
/// \brief Get a string of a TXT record
///
/// \param records List of TXT records
/// \param index Index of the TXT record
/// \param stringIndex Index of the string within the TXT record
///
/// \return The string, encoded in UTF-8
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const char* sfDnsTxtRecords_getString(const sfDnsTxtRecords* records, size_t index, size_t stringIndex);
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+35 -112
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -119,10 +119,8 @@ typedef enum
///
/// \param ftpListingResponse Ftp listing response to destroy
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED void sfFtpListingResponse_destroy(const sfFtpListingResponse* ftpListingResponse);
CSFML_NETWORK_API void sfFtpListingResponse_destroy(const sfFtpListingResponse* ftpListingResponse);
////////////////////////////////////////////////////////////
/// \brief Check if a FTP listing response status code means a success
@@ -134,10 +132,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED void sfFtpListingResponse_destroy(const sfFtp
///
/// \return true if the status is a success, false if it is a failure
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED bool sfFtpListingResponse_isOk(const sfFtpListingResponse* ftpListingResponse);
CSFML_NETWORK_API bool sfFtpListingResponse_isOk(const sfFtpListingResponse* ftpListingResponse);
////////////////////////////////////////////////////////////
/// \brief Get the status code of a FTP listing response
@@ -146,10 +142,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED bool sfFtpListingResponse_isOk(const sfFtpLis
///
/// \return Status code
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpStatus sfFtpListingResponse_getStatus(const sfFtpListingResponse* ftpListingResponse);
CSFML_NETWORK_API sfFtpStatus sfFtpListingResponse_getStatus(const sfFtpListingResponse* ftpListingResponse);
////////////////////////////////////////////////////////////
/// \brief Get the full message contained in a FTP listing response
@@ -158,10 +152,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpStatus sfFtpListingResponse_getStatus(co
///
/// \return The response message
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED const char* sfFtpListingResponse_getMessage(const sfFtpListingResponse* ftpListingResponse);
CSFML_NETWORK_API const char* sfFtpListingResponse_getMessage(const sfFtpListingResponse* ftpListingResponse);
////////////////////////////////////////////////////////////
/// \brief Return the number of directory/file names contained in a FTP listing response
@@ -170,10 +162,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED const char* sfFtpListingResponse_getMessage(c
///
/// \return Total number of names available
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED size_t sfFtpListingResponse_getCount(const sfFtpListingResponse* ftpListingResponse);
CSFML_NETWORK_API size_t sfFtpListingResponse_getCount(const sfFtpListingResponse* ftpListingResponse);
////////////////////////////////////////////////////////////
/// \brief Return a directory/file name contained in a FTP listing response
@@ -183,21 +173,16 @@ CSFML_NETWORK_API CSFML_DEPRECATED size_t sfFtpListingResponse_getCount(const sf
///
/// \return The requested name
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED const char* sfFtpListingResponse_getName(const sfFtpListingResponse* ftpListingResponse,
size_t index);
CSFML_NETWORK_API const char* sfFtpListingResponse_getName(const sfFtpListingResponse* ftpListingResponse, size_t index);
////////////////////////////////////////////////////////////
/// \brief Destroy a FTP directory response
///
/// \param ftpDirectoryResponse Ftp directory response to destroy
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED void sfFtpDirectoryResponse_destroy(const sfFtpDirectoryResponse* ftpDirectoryResponse);
CSFML_NETWORK_API void sfFtpDirectoryResponse_destroy(const sfFtpDirectoryResponse* ftpDirectoryResponse);
////////////////////////////////////////////////////////////
/// \brief Check if a FTP directory response status code means a success
@@ -209,10 +194,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED void sfFtpDirectoryResponse_destroy(const sfF
///
/// \return true if the status is a success, false if it is a failure
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED bool sfFtpDirectoryResponse_isOk(const sfFtpDirectoryResponse* ftpDirectoryResponse);
CSFML_NETWORK_API bool sfFtpDirectoryResponse_isOk(const sfFtpDirectoryResponse* ftpDirectoryResponse);
////////////////////////////////////////////////////////////
/// \brief Get the status code of a FTP directory response
@@ -221,11 +204,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED bool sfFtpDirectoryResponse_isOk(const sfFtpD
///
/// \return Status code
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpStatus
sfFtpDirectoryResponse_getStatus(const sfFtpDirectoryResponse* ftpDirectoryResponse);
CSFML_NETWORK_API sfFtpStatus sfFtpDirectoryResponse_getStatus(const sfFtpDirectoryResponse* ftpDirectoryResponse);
////////////////////////////////////////////////////////////
/// \brief Get the full message contained in a FTP directory response
@@ -234,11 +214,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpStatus
///
/// \return The response message
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED const char* sfFtpDirectoryResponse_getMessage(
const sfFtpDirectoryResponse* ftpDirectoryResponse);
CSFML_NETWORK_API const char* sfFtpDirectoryResponse_getMessage(const sfFtpDirectoryResponse* ftpDirectoryResponse);
////////////////////////////////////////////////////////////
/// \brief Get the directory returned in a FTP directory response
@@ -250,11 +227,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED const char* sfFtpDirectoryResponse_getMessage
///
/// \return Directory name or NULL if it failed
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED const char* sfFtpDirectoryResponse_getDirectory(
const sfFtpDirectoryResponse* ftpDirectoryResponse);
CSFML_NETWORK_API const char* sfFtpDirectoryResponse_getDirectory(const sfFtpDirectoryResponse* ftpDirectoryResponse);
////////////////////////////////////////////////////////////
@@ -267,11 +241,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED const char* sfFtpDirectoryResponse_getDirecto
///
/// \return Directory name or NULL if it failed
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED const sfChar32* sfFtpDirectoryResponse_getDirectoryUnicode(
const sfFtpDirectoryResponse* ftpDirectoryResponse);
CSFML_NETWORK_API const sfChar32* sfFtpDirectoryResponse_getDirectoryUnicode(const sfFtpDirectoryResponse* ftpDirectoryResponse);
////////////////////////////////////////////////////////////
@@ -279,10 +250,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED const sfChar32* sfFtpDirectoryResponse_getDir
///
/// \param ftpResponse Ftp response to destroy
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED void sfFtpResponse_destroy(const sfFtpResponse* ftpResponse);
CSFML_NETWORK_API void sfFtpResponse_destroy(const sfFtpResponse* ftpResponse);
////////////////////////////////////////////////////////////
/// \brief Check if a FTP response status code means a success
@@ -294,10 +263,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED void sfFtpResponse_destroy(const sfFtpRespons
///
/// \return true if the status is a success, false if it is a failure
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED bool sfFtpResponse_isOk(const sfFtpResponse* ftpResponse);
CSFML_NETWORK_API bool sfFtpResponse_isOk(const sfFtpResponse* ftpResponse);
////////////////////////////////////////////////////////////
/// \brief Get the status code of a FTP response
@@ -306,10 +273,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED bool sfFtpResponse_isOk(const sfFtpResponse*
///
/// \return Status code
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpStatus sfFtpResponse_getStatus(const sfFtpResponse* ftpResponse);
CSFML_NETWORK_API sfFtpStatus sfFtpResponse_getStatus(const sfFtpResponse* ftpResponse);
////////////////////////////////////////////////////////////
/// \brief Get the full message contained in a FTP response
@@ -318,30 +283,24 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpStatus sfFtpResponse_getStatus(const sfF
///
/// \return The response message
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED const char* sfFtpResponse_getMessage(const sfFtpResponse* ftpResponse);
CSFML_NETWORK_API const char* sfFtpResponse_getMessage(const sfFtpResponse* ftpResponse);
////////////////////////////////////////////////////////////
/// \brief Create a new Ftp object
///
/// \return A new sfFtp object
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtp* sfFtp_create(void);
CSFML_NETWORK_API sfFtp* sfFtp_create(void);
////////////////////////////////////////////////////////////
/// \brief Destroy a Ftp object
///
/// \param ftp Ftp object to destroy
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED void sfFtp_destroy(const sfFtp* ftp);
CSFML_NETWORK_API void sfFtp_destroy(const sfFtp* ftp);
////////////////////////////////////////////////////////////
/// \brief Connect to the specified FTP server
@@ -362,10 +321,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED void sfFtp_destroy(const sfFtp* ftp);
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_connect(sfFtp* ftp, sfIpAddress server, unsigned short port, sfTime timeout);
CSFML_NETWORK_API sfFtpResponse* sfFtp_connect(sfFtp* ftp, sfIpAddress server, unsigned short port, sfTime timeout);
////////////////////////////////////////////////////////////
/// \brief Log in using an anonymous account
@@ -377,10 +334,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_connect(sfFtp* ftp, sfIp
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_loginAnonymous(sfFtp* ftp);
CSFML_NETWORK_API sfFtpResponse* sfFtp_loginAnonymous(sfFtp* ftp);
////////////////////////////////////////////////////////////
/// \brief Log in using a username and a password
@@ -394,10 +349,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_loginAnonymous(sfFtp* ft
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_login(sfFtp* ftp, const char* name, const char* password);
CSFML_NETWORK_API sfFtpResponse* sfFtp_login(sfFtp* ftp, const char* name, const char* password);
////////////////////////////////////////////////////////////
/// \brief Close the connection with the server
@@ -406,10 +359,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_login(sfFtp* ftp, const
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_disconnect(sfFtp* ftp);
CSFML_NETWORK_API sfFtpResponse* sfFtp_disconnect(sfFtp* ftp);
////////////////////////////////////////////////////////////
/// \brief Send a null command to keep the connection alive
@@ -421,10 +372,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_disconnect(sfFtp* ftp);
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_keepAlive(sfFtp* ftp);
CSFML_NETWORK_API sfFtpResponse* sfFtp_keepAlive(sfFtp* ftp);
////////////////////////////////////////////////////////////
/// \brief Get the current working directory
@@ -436,10 +385,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_keepAlive(sfFtp* ftp);
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpDirectoryResponse* sfFtp_getWorkingDirectory(sfFtp* ftp);
CSFML_NETWORK_API sfFtpDirectoryResponse* sfFtp_getWorkingDirectory(sfFtp* ftp);
////////////////////////////////////////////////////////////
/// \brief Get the contents of the given directory
@@ -454,10 +401,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpDirectoryResponse* sfFtp_getWorkingDirec
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpListingResponse* sfFtp_getDirectoryListing(sfFtp* ftp, const char* directory);
CSFML_NETWORK_API sfFtpListingResponse* sfFtp_getDirectoryListing(sfFtp* ftp, const char* directory);
////////////////////////////////////////////////////////////
/// \brief Change the current working directory
@@ -469,10 +414,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpListingResponse* sfFtp_getDirectoryListi
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_changeDirectory(sfFtp* ftp, const char* directory);
CSFML_NETWORK_API sfFtpResponse* sfFtp_changeDirectory(sfFtp* ftp, const char* directory);
////////////////////////////////////////////////////////////
/// \brief Go to the parent directory of the current one
@@ -481,10 +424,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_changeDirectory(sfFtp* f
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_parentDirectory(sfFtp* ftp);
CSFML_NETWORK_API sfFtpResponse* sfFtp_parentDirectory(sfFtp* ftp);
////////////////////////////////////////////////////////////
/// \brief Create a new directory
@@ -497,10 +438,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_parentDirectory(sfFtp* f
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_createDirectory(sfFtp* ftp, const char* name);
CSFML_NETWORK_API sfFtpResponse* sfFtp_createDirectory(sfFtp* ftp, const char* name);
////////////////////////////////////////////////////////////
/// \brief Remove an existing directory
@@ -515,10 +454,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_createDirectory(sfFtp* f
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_deleteDirectory(sfFtp* ftp, const char* name);
CSFML_NETWORK_API sfFtpResponse* sfFtp_deleteDirectory(sfFtp* ftp, const char* name);
////////////////////////////////////////////////////////////
/// \brief Rename an existing file
@@ -532,10 +469,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_deleteDirectory(sfFtp* f
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_renameFile(sfFtp* ftp, const char* file, const char* newName);
CSFML_NETWORK_API sfFtpResponse* sfFtp_renameFile(sfFtp* ftp, const char* file, const char* newName);
////////////////////////////////////////////////////////////
/// \brief Remove an existing file
@@ -550,10 +485,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_renameFile(sfFtp* ftp, c
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_deleteFile(sfFtp* ftp, const char* name);
CSFML_NETWORK_API sfFtpResponse* sfFtp_deleteFile(sfFtp* ftp, const char* name);
////////////////////////////////////////////////////////////
/// \brief Download a file from a FTP server
@@ -570,14 +503,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_deleteFile(sfFtp* ftp, c
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_download(
sfFtp* ftp,
const char* remoteFile,
const char* localPath,
sfFtpTransferMode mode);
CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* remoteFile, const char* localPath, sfFtpTransferMode mode);
////////////////////////////////////////////////////////////
/// \brief Upload a file to a FTP server
@@ -595,10 +522,8 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_download(
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_upload(
CSFML_NETWORK_API sfFtpResponse* sfFtp_upload(
sfFtp* ftp,
const char* localFile,
const char* remotePath,
@@ -622,7 +547,5 @@ CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_upload(
///
/// \return Server response to the request
///
/// \deprecated Use sfSftp if possible
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfFtpResponse* sfFtp_sendCommand(sfFtp* ftp, const char* command, const char* parameter);
CSFML_NETWORK_API sfFtpResponse* sfFtp_sendCommand(sfFtp* ftp, const char* command, const char* parameter);
+2 -48
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -29,12 +29,9 @@
////////////////////////////////////////////////////////////
#include <CSFML/Network/Export.h>
#include <CSFML/Network/IpAddress.h>
#include <CSFML/Network/Types.h>
#include <CSFML/System/Time.h>
#include <stdbool.h>
////////////////////////////////////////////////////////////
/// \brief Enumerate the available HTTP methods for a request
@@ -275,35 +272,12 @@ CSFML_NETWORK_API void sfHttp_destroy(const sfHttp* http);
/// leave it like this unless you really need a port other
/// than the standard one, or use an unknown protocol.
///
/// The host is resolved immediately. To use HTTPS, prefix
/// the host with "https://".
///
/// \param http Http object
/// \param host Web server to connect to
/// \param port Port to use for connection
///
/// \return True if the host has been resolved and is valid, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API bool sfHttp_setHost(sfHttp* http, const char* host, unsigned short port);
////////////////////////////////////////////////////////////
/// \brief Set the target host of a HTTP object with a given address type
///
/// See sfHttp_setHost for details.
///
/// \param http Http object
/// \param host Web server to connect to
/// \param port Port to use for connection
/// \param addressType Address type to use for the connection, NULL to specify no preference
///
/// \return True if the host has been resolved and is valid, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API bool sfHttp_setHostWithAddressType(sfHttp* http,
const char* host,
unsigned short port,
const sfIpAddressType* addressType);
CSFML_NETWORK_API void sfHttp_setHost(sfHttp* http, const char* host, unsigned short port);
////////////////////////////////////////////////////////////
/// \brief Send a HTTP request and return the server's response.
@@ -325,23 +299,3 @@ CSFML_NETWORK_API bool sfHttp_setHostWithAddressType(sfHttp* http
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfHttpResponse* sfHttp_sendRequest(sfHttp* http, const sfHttpRequest* request, sfTime timeout);
////////////////////////////////////////////////////////////
/// \brief Send a HTTP request and return the server's response, optionally without verifying the server
///
/// See sfHttp_sendRequest for details. sfHttp_sendRequest
/// always verifies the server when using HTTPS.
///
/// \param http Http object
/// \param request Request to send
/// \param timeout Maximum time to wait
/// \param verifyServer Verify the server if using HTTPS
///
/// \return Server's response
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfHttpResponse* sfHttp_sendRequestWithVerification(
const sfHttp* http,
const sfHttpRequest* request,
sfTime timeout,
bool verifyServer);
+11 -175
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -31,34 +31,17 @@
#include <CSFML/System/Time.h>
#include <stdbool.h>
#include <stdint.h>
////////////////////////////////////////////////////////////
/// \brief Encapsulate an IPv4 or IPv6 network address
///
/// The address is stored as its string representation,
/// which is large enough to hold any IPv6 address.
/// \brief Encapsulate an IPv4 network address
///
////////////////////////////////////////////////////////////
typedef struct
{
char address[46];
char address[16];
} sfIpAddress;
////////////////////////////////////////////////////////////
/// \brief Type of an IP address
///
////////////////////////////////////////////////////////////
typedef enum
{
sfIpAddressV4, ///< IPv4 address
sfIpAddressV6 ///< IPv6 address
} sfIpAddressType;
////////////////////////////////////////////////////////////
/// \brief Empty object that represents invalid addresses
///
@@ -66,84 +49,35 @@ typedef enum
CSFML_NETWORK_API const sfIpAddress sfIpAddress_None;
////////////////////////////////////////////////////////////
/// \brief The same as sfIpAddress_AnyV4
/// \brief Value representing any address (0.0.0.0)
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const sfIpAddress sfIpAddress_Any;
////////////////////////////////////////////////////////////
/// \brief The same as sfIpAddress_LocalHostV4
/// \brief Local host IP address (127.0.0.1, or "localhost")
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const sfIpAddress sfIpAddress_LocalHost;
////////////////////////////////////////////////////////////
/// \brief The same as sfIpAddress_BroadcastV4
/// \brief UDP broadcast address (255.255.255.255)
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const sfIpAddress sfIpAddress_Broadcast;
////////////////////////////////////////////////////////////
/// \brief Value representing any IPv4 address (0.0.0.0)
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const sfIpAddress sfIpAddress_AnyV4;
////////////////////////////////////////////////////////////
/// \brief Local host IPv4 address (127.0.0.1)
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const sfIpAddress sfIpAddress_LocalHostV4;
////////////////////////////////////////////////////////////
/// \brief UDP broadcast IPv4 address (255.255.255.255)
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const sfIpAddress sfIpAddress_BroadcastV4;
////////////////////////////////////////////////////////////
/// \brief Value representing any IPv6 address (::)
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const sfIpAddress sfIpAddress_AnyV6;
////////////////////////////////////////////////////////////
/// \brief Local host IPv6 address (::1)
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const sfIpAddress sfIpAddress_LocalHostV6;
////////////////////////////////////////////////////////////
/// \brief Create an address from a string representation
///
/// Here \a address can be either an IPv4 address in
/// dotted-decimal notation (ex: "192.168.1.56") or an IPv6
/// address in standard notation (ex: "2606:4700:4700::1111").
/// Network names are not resolved, use sfDns_resolve or
/// sfIpAddress_resolve for that.
///
/// \param address IP address string
///
/// \return Resulting address or sfIpAddress_None if the string is not a valid address
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfIpAddress sfIpAddress_fromString(const char* address);
////////////////////////////////////////////////////////////
/// \brief Create an IPv4 address from a string or by resolving a network name
/// \brief Create an address from a string
///
/// Here \a address can be either a decimal address
/// (ex: "192.168.1.56") or a network name (ex: "localhost").
/// Only IPv4 addresses are returned.
///
/// \param address IP address or network name
///
/// \return Resulting address or sfIpAddress_None if the address could not be resolved
///
/// \deprecated Use sfDns_resolve instead
/// \return Resulting address
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API CSFML_DEPRECATED sfIpAddress sfIpAddress_resolve(const char* address);
CSFML_NETWORK_API sfIpAddress sfIpAddress_fromString(const char* address);
////////////////////////////////////////////////////////////
/// \brief Create an address from 4 bytes
@@ -178,24 +112,12 @@ CSFML_NETWORK_API sfIpAddress sfIpAddress_fromBytes(uint8_t byte0, uint8_t byte1
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfIpAddress sfIpAddress_fromInteger(uint32_t address);
////////////////////////////////////////////////////////////
/// \brief Create an IPv6 address from 16 bytes
///
/// \param bytes Array of 16 bytes containing the address
///
/// \return Resulting address
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfIpAddress sfIpAddress_fromV6Bytes(const uint8_t bytes[16]);
////////////////////////////////////////////////////////////
/// \brief Get a string representation of an address
///
/// The returned string is the decimal representation of the
/// IPv4 address (like "192.168.1.56") or the standard
/// representation of the IPv6 address (like "2606:4700:4700::1111"),
/// even if it was constructed from a host name.
/// The string must be able to hold at least 46 characters.
/// IP address (like "192.168.1.56"), even if it was constructed
/// from a host name.
///
/// \param address Address object
/// \param string String where the string representation will be stored
@@ -212,9 +134,6 @@ CSFML_NETWORK_API void sfIpAddress_toString(sfIpAddress address, char* string);
/// The integer produced by this function can then be converted
/// back to a sfIpAddress with sfIpAddress_fromInteger.
///
/// Only IPv4 addresses can be converted to an integer, 0 is
/// returned for IPv6 addresses.
///
/// \param address Address object
///
/// \return 32-bits unsigned integer representation of the address
@@ -222,50 +141,6 @@ CSFML_NETWORK_API void sfIpAddress_toString(sfIpAddress address, char* string);
////////////////////////////////////////////////////////////
CSFML_NETWORK_API uint32_t sfIpAddress_toInteger(sfIpAddress address);
////////////////////////////////////////////////////////////
/// \brief Get a 16-byte representation of an IPv6 address
///
/// The bytes produced by this function can then be converted
/// back to a sfIpAddress with sfIpAddress_fromV6Bytes.
///
/// \param address Address object
/// \param bytes Array of 16 bytes that will be filled with the address
///
/// \return True if the address is a valid IPv6 address and the bytes have been written, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API bool sfIpAddress_toV6Bytes(sfIpAddress address, uint8_t bytes[16]);
////////////////////////////////////////////////////////////
/// \brief Get the type of an address
///
/// \param address Address object
///
/// \return The type of the address, sfIpAddressV4 is returned for invalid addresses
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfIpAddressType sfIpAddress_getType(sfIpAddress address);
////////////////////////////////////////////////////////////
/// \brief Check if an address is a valid IPv4 address
///
/// \param address Address object
///
/// \return True if the address is a valid IPv4 address
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API bool sfIpAddress_isV4(sfIpAddress address);
////////////////////////////////////////////////////////////
/// \brief Check if an address is a valid IPv6 address
///
/// \param address Address object
///
/// \return True if the address is a valid IPv6 address
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API bool sfIpAddress_isV6(sfIpAddress address);
////////////////////////////////////////////////////////////
/// \brief Get the computer's local address
///
@@ -275,28 +150,11 @@ CSFML_NETWORK_API bool sfIpAddress_isV6(sfIpAddress address);
/// Unlike sfIpAddress_getPublicAddress, this function is fast
/// and may be used safely anywhere.
///
/// This returns the local IPv4 address.
///
/// \return Local IP address of the computer
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfIpAddress sfIpAddress_getLocalAddress(void);
////////////////////////////////////////////////////////////
/// \brief Get the computer's local address of a given type
///
/// The local address is the address of the computer from the
/// LAN point of view, i.e. something like 192.168.1.56 or
/// fe80::1234:5678:9abc. It is meaningful only for
/// communications over the local network.
///
/// \param type The type of local address to get
///
/// \return Local IP address of the computer or sfIpAddress_None if there is none
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfIpAddress sfIpAddress_getLocalAddressOfType(sfIpAddressType type);
////////////////////////////////////////////////////////////
/// \brief Get the computer's public address
///
@@ -312,31 +170,9 @@ CSFML_NETWORK_API sfIpAddress sfIpAddress_getLocalAddressOfType(sfIpAddressType
/// to be possibly stuck waiting in case there is a problem; use
/// 0 to deactivate this limit.
///
/// This returns the public IPv4 address.
///
/// \param timeout Maximum time to wait
///
/// \return Public IP address of the computer
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfIpAddress sfIpAddress_getPublicAddress(sfTime timeout);
////////////////////////////////////////////////////////////
/// \brief Get the computer's public address of a given type
///
/// The public address is the address of the computer from the
/// internet point of view, i.e. something like 89.54.1.169 or
/// 2600:1901:0:13e0::1. See sfIpAddress_getPublicAddress for
/// details.
///
/// If tamper resistance is required, setting \a secure to true
/// will make use of verified HTTPS connections to get the address.
///
/// \param timeout Maximum time to wait, use 0 to deactivate the limit
/// \param type The type of public address to get, NULL to specify no preference
/// \param secure True to retrieve the public address via a secure HTTPS connection, false to retrieve via DNS or an insecure connection
///
/// \return Public IP address of the computer or sfIpAddress_None on failure
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfIpAddress sfIpAddress_getPublicAddressOfType(sfTime timeout, const sfIpAddressType* type, bool secure);
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
-778
View File
@@ -1,778 +0,0 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////
#pragma once
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <CSFML/Network/Export.h>
#include <CSFML/Network/IpAddress.h>
#include <CSFML/Network/Types.h>
#include <CSFML/System/TimeoutWithPredicate.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
////////////////////////////////////////////////////////////
/// \brief Values of a SFTP result
///
////////////////////////////////////////////////////////////
typedef enum
{
// General result values
sfSftpSuccess, ///< Operation completed successfully
sfSftpDisconnected, ///< The TCP socket has been disconnected
sfSftpTimeout, ///< Operation timed out
sfSftpRefused, ///< Connection refused
sfSftpError, ///< Generic error
// SSH result values
sfSftpBannerReceive, ///< Error during banner receive
sfSftpBannerSend, ///< Error during banner send
sfSftpInvalidMac, ///< Invalid message authentication code
sfSftpAllocationFailure, ///< Allocation failure
sfSftpSocketSend, ///< Error sending on socket
sfSftpKeyExchangeFailure, ///< Key exchange failed
sfSftpHostKeyInitialization, ///< Host key initialization failed
sfSftpHostKeySign, ///< Host key signing failed
sfSftpDecryptError, ///< Decryption failed
sfSftpProtocolError, ///< SSH protocol error
sfSftpPasswordExpired, ///< Password expired
sfSftpFileError, ///< File error
sfSftpMethodNone, ///< No method found
sfSftpAuthenticationFailed, ///< Authentication failed
sfSftpPublicKeyUnverified, ///< Public key unverified
sfSftpChannelOutOfOrder, ///< Channel out of order
sfSftpChannelFailure, ///< Channel failure
sfSftpChannelRequestDenied, ///< Channel request denied
sfSftpChannelUnknown, ///< Channel unknown
sfSftpChannelWindowExceeded, ///< Channel window exceeded
sfSftpChannelPacketExceeded, ///< Channel packet exceeded
sfSftpChannelClosed, ///< Channel closed
sfSftpChannelEofSent, ///< Channel EOF sent
sfSftpScpProtocol, ///< SCP protocol error
sfSftpZlibError, ///< Zlib error
sfSftpRequestDenied, ///< Request denied
sfSftpMethodNotSupported, ///< Method not supported
sfSftpInvalidData, ///< Invalid data
sfSftpPublicKeyProtocol, ///< Public key protocol error
sfSftpBufferTooSmall, ///< Buffer too small
sfSftpBadUse, ///< Bad usage
sfSftpCompressError, ///< Compression error
sfSftpOutOfBoundary, ///< Out of boundary
sfSftpAgentProtocol, ///< Agent protocol error
sfSftpSocketRecv, ///< Socket receive error
sfSftpEncryptError, ///< Encryption failed
sfSftpBadSocket, ///< Bad socket
sfSftpKnownHosts, ///< Known hosts error
sfSftpChannelWindowFull, ///< Channel window full
sfSftpKeyFileAuthenticationFailed, ///< Key file authentication failed
// SFTP result values
sfSftpEndOfFile, ///< End of file
sfSftpNoSuchFile, ///< No such file
sfSftpPermissionDenied, ///< Permission denied
sfSftpFailure, ///< Failure
sfSftpBadMessage, ///< Bad message
sfSftpNoConnection, ///< No connection
sfSftpConnectionLost, ///< Connection lost
sfSftpOperationUnsupported, ///< Operation unsupported
sfSftpInvalidHandle, ///< Invalid handle
sfSftpNoSuchPath, ///< No such path
sfSftpFileAlreadyExists, ///< File already exists
sfSftpWriteProtect, ///< Write protect
sfSftpNoMedia, ///< No media
sfSftpNoSpaceOnFileSystem, ///< No space on filesystem
sfSftpQuotaExceeded, ///< Quota exceeded
sfSftpUnknownPrincipal, ///< Unknown principal
sfSftpLockConflict, ///< Lock conflict
sfSftpDirectoryNotEmpty, ///< Directory not empty
sfSftpNotADirectory, ///< Not a directory
sfSftpInvalidFilename, ///< Invalid filename
sfSftpLinkLoop, ///< Link loop
sfSftpSftpError ///< Generic SFTP error
} sfSftpResultValue;
////////////////////////////////////////////////////////////
/// \brief Type of a remote file system entry
///
////////////////////////////////////////////////////////////
typedef enum
{
sfSftpFileNone, ///< No type
sfSftpFileNotFound, ///< The file does not exist
sfSftpFileRegular, ///< Regular file
sfSftpFileDirectory, ///< Directory
sfSftpFileSymlink, ///< Symbolic link
sfSftpFileBlock, ///< Block special file
sfSftpFileCharacter, ///< Character special file
sfSftpFileFifo, ///< FIFO or pipe
sfSftpFileSocket, ///< Socket
sfSftpFileUnknown ///< Unknown type
} sfSftpFileType;
////////////////////////////////////////////////////////////
/// \brief Attributes of a remote file system entry
///
/// Each attribute is only valid if the corresponding
/// has-flag is set.
///
/// Permissions use the POSIX permission bits, e.g. 0755.
/// Times are given in seconds since the Unix epoch.
///
////////////////////////////////////////////////////////////
typedef struct
{
const char* path; ///< Path to the entry, encoded in UTF-8
uint64_t size; ///< Size of the entry
uint64_t userId; ///< Owner user ID
uint64_t groupId; ///< Group ID
int64_t accessTime; ///< Last access time
int64_t modificationTime; ///< Last modification time
sfSftpFileType type; ///< Type of the entry
uint32_t permissions; ///< Permissions
bool hasType; ///< Whether the type is available
bool hasSize; ///< Whether the size is available
bool hasPermissions; ///< Whether the permissions are available
bool hasUserId; ///< Whether the owner user ID is available
bool hasGroupId; ///< Whether the group ID is available
bool hasAccessTime; ///< Whether the last access time is available
bool hasModificationTime; ///< Whether the last modification time is available
} sfSftpAttributes;
////////////////////////////////////////////////////////////
/// \brief Type of a SSH host key
///
////////////////////////////////////////////////////////////
typedef enum
{
sfSftpHostKeyUnknown, ///< Unknown key type
sfSftpHostKeyRsa, ///< RSA
sfSftpHostKeyDsa, ///< DSA
sfSftpHostKeyEcdsa256, ///< NIST P-256 ECDSA
sfSftpHostKeyEcdsa384, ///< NIST P-384 ECDSA
sfSftpHostKeyEcdsa521, ///< NIST P-521 ECDSA
sfSftpHostKeyEd25519 ///< ED25519
} sfSftpHostKeyType;
////////////////////////////////////////////////////////////
/// \brief SSH session information
///
/// The algorithm identifiers follow the RFC 4253 specification.
///
////////////////////////////////////////////////////////////
typedef struct
{
sfSftpHostKeyType hostKeyType; ///< Host key type
const uint8_t* hostKeyData; ///< Host key data
size_t hostKeySize; ///< Size of the host key data
uint8_t hostKeySha1[20]; ///< Host key SHA1 hash
uint8_t hostKeySha256[32]; ///< Host key SHA256 hash
const char* keyExchangeAlgorithm; ///< Key exchange algorithm used in the session
const char* hostKeyAlgorithm; ///< Host key algorithm used in the session
const char* clientToServerEncryptionAlgorithm; ///< Client to server encryption algorithm used in the session
const char* serverToClientEncryptionAlgorithm; ///< Server to client encryption algorithm used in the session
const char* clientToServerMacAlgorithm; ///< Client to server message authentication code algorithm used in the session
const char* serverToClientMacAlgorithm; ///< Server to client message authentication code algorithm used in the session
const char* clientToServerCompressionAlgorithm; ///< Client to server compression algorithm used in the session
const char* serverToClientCompressionAlgorithm; ///< Server to client compression algorithm used in the session
} sfSftpSessionInfo;
////////////////////////////////////////////////////////////
/// \brief Callback receiving the data of a downloaded file
///
/// The data is transferred in sequential blocks. The size of
/// the blocks can change over time.
///
/// \param data Pointer to the received data block
/// \param size Size of the received data block
/// \param userData User data passed to sfSftp_download
///
/// \return True to continue the transfer, false to abort it
///
////////////////////////////////////////////////////////////
typedef bool (*sfSftpDownloadCallback)(const void* data, size_t size, void* userData);
////////////////////////////////////////////////////////////
/// \brief Callback providing the data of a file to upload
///
/// Data to be sent should be copied into the data block and
/// \a size set to the actual number of bytes copied. When
/// called, \a size contains the size of the data block, which
/// can change over time.
///
/// \param data Pointer to the data block to fill
/// \param size Size of the data block, to be set to the number of bytes copied
/// \param userData User data passed to sfSftp_upload
///
/// \return True to continue the transfer, false to stop it e.g. because there is no more data to send
///
////////////////////////////////////////////////////////////
typedef bool (*sfSftpUploadCallback)(void* data, size_t* size, void* userData);
////////////////////////////////////////////////////////////
/// \brief Destroy a SFTP result
///
/// \param result SFTP result to destroy
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfSftpResult_destroy(const sfSftpResult* result);
////////////////////////////////////////////////////////////
/// \brief Check if a SFTP result is a success
///
/// \param result SFTP result
///
/// \return True if the result is sfSftpSuccess
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API bool sfSftpResult_isOk(const sfSftpResult* result);
////////////////////////////////////////////////////////////
/// \brief Get the value of a SFTP result
///
/// \param result SFTP result
///
/// \return Result value
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpResultValue sfSftpResult_getValue(const sfSftpResult* result);
////////////////////////////////////////////////////////////
/// \brief Get the message of a SFTP result
///
/// \param result SFTP result
///
/// \return The result message
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const char* sfSftpResult_getMessage(const sfSftpResult* result);
////////////////////////////////////////////////////////////
/// \brief Destroy a SFTP path result
///
/// \param result SFTP path result to destroy
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfSftpPathResult_destroy(const sfSftpPathResult* result);
////////////////////////////////////////////////////////////
/// \brief Check if a SFTP path result is a success
///
/// \param result SFTP path result
///
/// \return True if the result is sfSftpSuccess
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API bool sfSftpPathResult_isOk(const sfSftpPathResult* result);
////////////////////////////////////////////////////////////
/// \brief Get the value of a SFTP path result
///
/// \param result SFTP path result
///
/// \return Result value
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpResultValue sfSftpPathResult_getValue(const sfSftpPathResult* result);
////////////////////////////////////////////////////////////
/// \brief Get the message of a SFTP path result
///
/// \param result SFTP path result
///
/// \return The result message
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const char* sfSftpPathResult_getMessage(const sfSftpPathResult* result);
////////////////////////////////////////////////////////////
/// \brief Get the path of a SFTP path result
///
/// \param result SFTP path result
///
/// \return The path, encoded in UTF-8
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const char* sfSftpPathResult_getPath(const sfSftpPathResult* result);
////////////////////////////////////////////////////////////
/// \brief Destroy a SFTP attributes result
///
/// \param result SFTP attributes result to destroy
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfSftpAttributesResult_destroy(const sfSftpAttributesResult* result);
////////////////////////////////////////////////////////////
/// \brief Check if a SFTP attributes result is a success
///
/// \param result SFTP attributes result
///
/// \return True if the result is sfSftpSuccess
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API bool sfSftpAttributesResult_isOk(const sfSftpAttributesResult* result);
////////////////////////////////////////////////////////////
/// \brief Get the value of a SFTP attributes result
///
/// \param result SFTP attributes result
///
/// \return Result value
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpResultValue sfSftpAttributesResult_getValue(const sfSftpAttributesResult* result);
////////////////////////////////////////////////////////////
/// \brief Get the message of a SFTP attributes result
///
/// \param result SFTP attributes result
///
/// \return The result message
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const char* sfSftpAttributesResult_getMessage(const sfSftpAttributesResult* result);
////////////////////////////////////////////////////////////
/// \brief Get the attributes of a SFTP attributes result
///
/// The strings of the attributes stay valid until the
/// result is destroyed.
///
/// \param result SFTP attributes result
///
/// \return The attributes
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpAttributes sfSftpAttributesResult_getAttributes(const sfSftpAttributesResult* result);
////////////////////////////////////////////////////////////
/// \brief Destroy a SFTP listing result
///
/// \param result SFTP listing result to destroy
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfSftpListingResult_destroy(const sfSftpListingResult* result);
////////////////////////////////////////////////////////////
/// \brief Check if a SFTP listing result is a success
///
/// \param result SFTP listing result
///
/// \return True if the result is sfSftpSuccess
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API bool sfSftpListingResult_isOk(const sfSftpListingResult* result);
////////////////////////////////////////////////////////////
/// \brief Get the value of a SFTP listing result
///
/// \param result SFTP listing result
///
/// \return Result value
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpResultValue sfSftpListingResult_getValue(const sfSftpListingResult* result);
////////////////////////////////////////////////////////////
/// \brief Get the message of a SFTP listing result
///
/// \param result SFTP listing result
///
/// \return The result message
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const char* sfSftpListingResult_getMessage(const sfSftpListingResult* result);
////////////////////////////////////////////////////////////
/// \brief Get the number of entries in a SFTP listing result
///
/// \param result SFTP listing result
///
/// \return Number of directory entries
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API size_t sfSftpListingResult_getCount(const sfSftpListingResult* result);
////////////////////////////////////////////////////////////
/// \brief Get the attributes of an entry in a SFTP listing result
///
/// The strings of the attributes stay valid until the
/// result is destroyed.
///
/// \param result SFTP listing result
/// \param index Index of the entry to get
///
/// \return The attributes of the entry
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpAttributes sfSftpListingResult_getAttributes(const sfSftpListingResult* result, size_t index);
////////////////////////////////////////////////////////////
/// \brief Create a new SFTP object
///
/// \return A new sfSftp object
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftp* sfSftp_create(void);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing SFTP object
///
/// \param sftp SFTP object to destroy
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfSftp_destroy(const sfSftp* sftp);
////////////////////////////////////////////////////////////
/// \brief Connect to the specified SFTP server
///
/// \param sftp SFTP object
/// \param server Address of the server to connect to
/// \param port Port used for the connection, the default SFTP port is 22
/// \param timeout Maximum time to wait, optionally a predicate can be provided for more fine-grained control
///
/// \return Result of the connection attempt
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpResult* sfSftp_connect(sfSftp* sftp, sfIpAddress server, unsigned short port, sfTimeoutWithPredicate timeout);
////////////////////////////////////////////////////////////
/// \brief Disconnect the connection with the server
///
/// \param sftp SFTP object
/// \param timeout Maximum time to wait, optionally a predicate can be provided for more fine-grained control
///
/// \return Result of disconnecting the connection with the server
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpResult* sfSftp_disconnect(sfSftp* sftp, sfTimeoutWithPredicate timeout);
////////////////////////////////////////////////////////////
/// \brief Get SSH session information
///
/// After connecting to the server and before actually
/// logging in the SSH session information of the underlying
/// connection will be available.
///
/// The session information contains among other things the
/// public key identifying the remote host and the connection
/// parameters such as encryption and compression used.
///
/// Relying on the user to check the authenticity of the host
/// key is the typical method used to verify the connection
/// to the legitimate host. If connection security is a high
/// priority, examining the parameters and aborting the
/// connection if any weak algorithms are used is also possible.
///
/// The pointers in the session information stay valid until
/// the next call to this function or until the SFTP object
/// is destroyed.
///
/// \param sftp SFTP object
/// \param info Session information to fill
///
/// \return True if the session information is available, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API bool sfSftp_getSessionInfo(const sfSftp* sftp, sfSftpSessionInfo* info);
////////////////////////////////////////////////////////////
/// \brief Log in using a username and a password
///
/// Logging in is mandatory after connecting to the server.
/// Users that are not logged in cannot perform any operation.
///
/// \param sftp SFTP object
/// \param name User name
/// \param password Password
/// \param timeout Maximum time to wait, optionally a predicate can be provided for more fine-grained control
///
/// \return Result of attempting to log in to the server
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpResult* sfSftp_login(sfSftp* sftp, const char* name, const char* password, sfTimeoutWithPredicate timeout);
////////////////////////////////////////////////////////////
/// \brief Log in using a public/private key pair
///
/// Logging in is mandatory after connecting to the server.
/// Users that are not logged in cannot perform any operation.
///
/// The public and private key data should be provided in PEM
/// format. Even though it is technically possible to derive
/// the public key from the private key, due to backend
/// limitations, providing a pre-generated public key as well
/// is necessary for this function to be able to succeed.
///
/// If the private key is not protected by a passphrase the
/// passphrase should be set to the empty string or NULL.
///
/// \param sftp SFTP object
/// \param name User name
/// \param publicKeyData Public key data
/// \param publicKeyLength Public key data length
/// \param privateKeyData Private key data
/// \param privateKeyLength Private key data length
/// \param privateKeyPassphrase Private key passphrase, NULL terminated
/// \param timeout Maximum time to wait, optionally a predicate can be provided for more fine-grained control
///
/// \return Result of attempting to log in to the server
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpResult* sfSftp_loginWithKey(
sfSftp* sftp,
const char* name,
const char* publicKeyData,
size_t publicKeyLength,
const char* privateKeyData,
size_t privateKeyLength,
const char* privateKeyPassphrase,
sfTimeoutWithPredicate timeout);
////////////////////////////////////////////////////////////
/// \brief Resolve a remote path into an absolute remote path
///
/// Paths can contain links and other reserved path identifiers
/// such as . and .. referring to the current directory and
/// parent directory respectively. This function determines
/// the absolute path, which does not contain links or . or ..
///
/// Resolving "." will return the absolute path to the current
/// working directory of the user after logging in to the SFTP
/// server.
///
/// \param sftp SFTP object
/// \param path Path to convert into an absolute path, encoded in UTF-8
/// \param timeout Maximum time to wait, optionally a predicate can be provided for more fine-grained control
///
/// \return Result of converting the path into an absolute path
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpPathResult* sfSftp_resolvePath(sfSftp* sftp, const char* path, sfTimeoutWithPredicate timeout);
////////////////////////////////////////////////////////////
/// \brief Get the current working directory on the server
///
/// This is an alias for calling sfSftp_resolvePath with ".".
///
/// \param sftp SFTP object
/// \param timeout Maximum time to wait, optionally a predicate can be provided for more fine-grained control
///
/// \return Result of getting the current working directory
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpPathResult* sfSftp_getWorkingDirectory(sfSftp* sftp, sfTimeoutWithPredicate timeout);
////////////////////////////////////////////////////////////
/// \brief Get the attributes of a remote file or directory
///
/// Depending on whether \a path refers to a file or directory,
/// the attributes can contain e.g. the type of file, the file
/// owner, group, file size, modification and access times.
///
/// If links are not to be followed, \a followLinks can be set
/// to false. In this case the attributes of the link itself
/// will be returned.
///
/// \param sftp SFTP object
/// \param path Path to the remote file or directory whose attributes to get, encoded in UTF-8
/// \param followLinks True to follow links, false to return attributes of the link itself
/// \param timeout Maximum time to wait, optionally a predicate can be provided for more fine-grained control
///
/// \return Result of getting the attributes
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpAttributesResult* sfSftp_getAttributes(
sfSftp* sftp,
const char* path,
bool followLinks,
sfTimeoutWithPredicate timeout);
////////////////////////////////////////////////////////////
/// \brief Get the contents of the given directory
///
/// This function retrieves the sub-directories and files
/// contained in the given directory. It is not recursive.
///
/// \param sftp SFTP object
/// \param path Path of the directory whose contents to list, encoded in UTF-8
/// \param timeout Maximum time to wait, optionally a predicate can be provided for more fine-grained control
///
/// \return Result of getting the contents of the given directory
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpListingResult* sfSftp_getDirectoryListing(sfSftp* sftp, const char* path, sfTimeoutWithPredicate timeout);
////////////////////////////////////////////////////////////
/// \brief Create a new directory
///
/// The new directory is created as a child of the current
/// working directory.
///
/// A common permissions value is 0755 (rwxr-xr-x).
///
/// \param sftp SFTP object
/// \param path Path of the directory to create, encoded in UTF-8
/// \param permissions POSIX permissions of the directory to create
/// \param timeout Maximum time to wait, optionally a predicate can be provided for more fine-grained control
///
/// \return Result of creating the directory
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpResult* sfSftp_createDirectory(sfSftp* sftp,
const char* path,
uint32_t permissions,
sfTimeoutWithPredicate timeout);
////////////////////////////////////////////////////////////
/// \brief Remove an existing directory
///
/// Use this function with caution, the directory will
/// be removed permanently!
///
/// \param sftp SFTP object
/// \param path Path of the directory to remove, encoded in UTF-8
/// \param timeout Maximum time to wait, optionally a predicate can be provided for more fine-grained control
///
/// \return Result of removing the directory
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpResult* sfSftp_deleteDirectory(sfSftp* sftp, const char* path, sfTimeoutWithPredicate timeout);
////////////////////////////////////////////////////////////
/// \brief Rename an existing file or directory
///
/// In POSIX renaming and moving are synonymous. If you want
/// to move a file or directory from one place to another
/// you rename it from an old to a new path.
///
/// If a file exists at the specified new path, depending
/// on whether \a overwrite is set to true, the rename operation
/// will overwrite it or not. Non-empty directories cannot be
/// overwritten by this operation.
///
/// \param sftp SFTP object
/// \param oldPath Old path to the file or directory, encoded in UTF-8
/// \param newPath New path to the file or directory, encoded in UTF-8
/// \param overwrite True to allow overwriting a file that exists at \a newPath
/// \param timeout Maximum time to wait, optionally a predicate can be provided for more fine-grained control
///
/// \return Result of the operation
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpResult* sfSftp_rename(
sfSftp* sftp,
const char* oldPath,
const char* newPath,
bool overwrite,
sfTimeoutWithPredicate timeout);
////////////////////////////////////////////////////////////
/// \brief Remove an existing file
///
/// Use this function with caution, the file will be
/// removed permanently!
///
/// \param sftp SFTP object
/// \param path Path to the file to remove, encoded in UTF-8
/// \param timeout Maximum time to wait, optionally a predicate can be provided for more fine-grained control
///
/// \return Result of removing the file
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpResult* sfSftp_deleteFile(sfSftp* sftp, const char* path, sfTimeoutWithPredicate timeout);
////////////////////////////////////////////////////////////
/// \brief Download a file from the server
///
/// The file data is transferred in sequential blocks. For
/// every block of data transferred, the provided callback
/// is called.
///
/// The function returns once all the data in the remote file
/// has been transferred or an error occurs or the function
/// times out.
///
/// \param sftp SFTP object
/// \param remotePath Path of the remote file whose data to download, encoded in UTF-8
/// \param callback Callback to be called for every available data block
/// \param userData User data that will be passed to the callback
/// \param offset Byte offset into the remote file at which reading should start
/// \param timeout Maximum time to wait, optionally a predicate can be provided for more fine-grained control
///
/// \return Result of downloading the file
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpResult* sfSftp_download(
sfSftp* sftp,
const char* remotePath,
sfSftpDownloadCallback callback,
void* userData,
uint64_t offset,
sfTimeoutWithPredicate timeout);
////////////////////////////////////////////////////////////
/// \brief Upload a file to the server
///
/// The file data is transferred in sequential blocks. Every
/// time the function wants to send a new block of data the
/// provided callback is called.
///
/// The function returns once all the data has been sent or
/// an error occurs or the function times out.
///
/// If a file does not exist at the remote path yet, it will
/// be created with the provided permissions. A common
/// permissions value is 0644 (rw-r--r--).
///
/// \param sftp SFTP object
/// \param remotePath Path of the remote file in which to upload the data, encoded in UTF-8
/// \param callback Callback to be called for every data block to send
/// \param userData User data that will be passed to the callback
/// \param permissions POSIX permissions of the remote file if it has to be created
/// \param truncate True to truncate the remote file if it already exists
/// \param append True to append to the remote file if it already exists
/// \param offset Byte offset into the remote file at which writing should start
/// \param timeout Maximum time to wait, optionally a predicate can be provided for more fine-grained control
///
/// \return Result of uploading the file
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSftpResult* sfSftp_upload(
sfSftp* sftp,
const char* remotePath,
sfSftpUploadCallback callback,
void* userData,
uint32_t permissions,
bool truncate,
bool append,
uint64_t offset,
sfTimeoutWithPredicate timeout);
+11 -129
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -32,31 +32,6 @@
#include <CSFML/Network/Types.h>
#include <CSFML/System/Time.h>
#include <stdbool.h>
#include <stdint.h>
////////////////////////////////////////////////////////////
/// \brief Readiness types a socket selector can check for
///
/// The values can be combined with a bitwise OR.
///
////////////////////////////////////////////////////////////
typedef enum
{
sfSocketSelectorReceive = 1 << 0, ///< Check if sockets are ready to be received from
sfSocketSelectorSend = 1 << 1 ///< Check if sockets are ready to be sent to
} sfSocketSelectorReadiness;
////////////////////////////////////////////////////////////
/// \brief Callback that is called when a socket is ready
///
/// \param readiness Readiness of the socket, a combination of sfSocketSelectorReadiness values
/// \param userData User data passed when adding the socket
///
////////////////////////////////////////////////////////////
typedef void (*sfSocketSelectorCallback)(uint32_t readiness, void* userData);
////////////////////////////////////////////////////////////
/// \brief Create a new selector
@@ -91,64 +66,13 @@ CSFML_NETWORK_API void sfSocketSelector_destroy(const sfSocketSelector* selector
/// so you have to make sure that the socket is not destroyed
/// while it is stored in the selector.
///
/// The socket is checked for being ready to receive.
///
/// \param selector Socket selector object
/// \param socket Pointer to the socket to add
///
/// \return True if the socket was successfully added
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API bool sfSocketSelector_addTcpListener(sfSocketSelector* selector, sfTcpListener* socket);
CSFML_NETWORK_API bool sfSocketSelector_addTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket);
CSFML_NETWORK_API bool sfSocketSelector_addUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket);
////////////////////////////////////////////////////////////
/// \brief Add a new socket to a socket selector with the readiness to check for and an optional callback
///
/// This function keeps a weak pointer to the socket,
/// so you have to make sure that the socket is not destroyed
/// while it is stored in the selector.
///
/// The readiness to wait for can be specified as a combination
/// of sfSocketSelectorReceive and sfSocketSelectorSend.
///
/// If a callback is provided, it will be called with the
/// readiness of the socket when sfSocketSelector_dispatchReadyCallbacks
/// is called after sfSocketSelector_wait returned true. Using
/// callbacks scales better than checking every socket with
/// sfSocketSelector_isXxxReadyFor.
///
/// Adding a socket that has already been added updates its
/// readiness and callback.
///
/// \param selector Socket selector object
/// \param socket Pointer to the socket to add
/// \param readiness Readiness to wait for, combination of sfSocketSelectorReadiness values
/// \param callback Callback to call when the socket is ready, can be NULL
/// \param userData User data that will be passed to the callback
///
/// \return True if the socket was successfully added
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API bool sfSocketSelector_addTcpListenerWithReadiness(
sfSocketSelector* selector,
sfTcpListener* socket,
uint32_t readiness,
sfSocketSelectorCallback callback,
void* userData);
CSFML_NETWORK_API bool sfSocketSelector_addTcpSocketWithReadiness(
sfSocketSelector* selector,
sfTcpSocket* socket,
uint32_t readiness,
sfSocketSelectorCallback callback,
void* userData);
CSFML_NETWORK_API bool sfSocketSelector_addUdpSocketWithReadiness(
sfSocketSelector* selector,
sfUdpSocket* socket,
uint32_t readiness,
sfSocketSelectorCallback callback,
void* userData);
CSFML_NETWORK_API void sfSocketSelector_addTcpListener(sfSocketSelector* selector, sfTcpListener* socket);
CSFML_NETWORK_API void sfSocketSelector_addTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket);
CSFML_NETWORK_API void sfSocketSelector_addUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket);
////////////////////////////////////////////////////////////
/// \brief Remove a socket from a socket selector
@@ -159,12 +83,10 @@ CSFML_NETWORK_API bool sfSocketSelector_addUdpSocketWithReadiness(
/// \param selector Socket selector object
/// \param socket Pointer to the socket to remove
///
/// \return True if the socket was successfully removed
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API bool sfSocketSelector_removeTcpListener(sfSocketSelector* selector, sfTcpListener* socket);
CSFML_NETWORK_API bool sfSocketSelector_removeTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket);
CSFML_NETWORK_API bool sfSocketSelector_removeUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket);
CSFML_NETWORK_API void sfSocketSelector_removeTcpListener(sfSocketSelector* selector, sfTcpListener* socket);
CSFML_NETWORK_API void sfSocketSelector_removeTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket);
CSFML_NETWORK_API void sfSocketSelector_removeUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket);
////////////////////////////////////////////////////////////
/// \brief Remove all the sockets stored in a selector
@@ -179,13 +101,11 @@ CSFML_NETWORK_API bool sfSocketSelector_removeUdpSocket(sfSocketSelector* select
CSFML_NETWORK_API void sfSocketSelector_clear(sfSocketSelector* selector);
////////////////////////////////////////////////////////////
/// \brief Wait until one or more sockets are ready
/// \brief Wait until one or more sockets are ready to receive
///
/// This function returns as soon as at least one socket is
/// ready for the readiness it was added with (by default
/// having some data available to be received). To know which
/// sockets are ready, use the sfSocketSelector_isXxxReady
/// functions or sfSocketSelector_dispatchReadyCallbacks.
/// This function returns as soon as at least one socket has
/// some data available to be received. To know which sockets are
/// ready, use the sfSocketSelector_isXxxReady functions.
/// If you use a timeout and no socket is ready before the timeout
/// is over, the function returns false.
///
@@ -216,41 +136,3 @@ CSFML_NETWORK_API bool sfSocketSelector_wait(sfSocketSelector* selector, sfTime
CSFML_NETWORK_API bool sfSocketSelector_isTcpListenerReady(const sfSocketSelector* selector, sfTcpListener* socket);
CSFML_NETWORK_API bool sfSocketSelector_isTcpSocketReady(const sfSocketSelector* selector, sfTcpSocket* socket);
CSFML_NETWORK_API bool sfSocketSelector_isUdpSocketReady(const sfSocketSelector* selector, sfUdpSocket* socket);
////////////////////////////////////////////////////////////
/// \brief Test a socket to know if it is ready for the given readiness
///
/// This function must be used after a call to
/// sfSocketSelector_wait, to know which sockets are ready.
///
/// \param selector Socket selector object
/// \param socket Socket to test
/// \param readiness Readiness to check for, combination of sfSocketSelectorReadiness values
///
/// \return true if the socket is ready, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API bool sfSocketSelector_isTcpListenerReadyFor(const sfSocketSelector* selector,
sfTcpListener* socket,
uint32_t readiness);
CSFML_NETWORK_API bool sfSocketSelector_isTcpSocketReadyFor(const sfSocketSelector* selector,
sfTcpSocket* socket,
uint32_t readiness);
CSFML_NETWORK_API bool sfSocketSelector_isUdpSocketReadyFor(const sfSocketSelector* selector,
sfUdpSocket* socket,
uint32_t readiness);
////////////////////////////////////////////////////////////
/// \brief Call the callbacks of all sockets that are ready
///
/// After sfSocketSelector_wait returned true, at least one
/// socket is ready. Calling this function will call the
/// callbacks of all the sockets that became ready during
/// the wait. Calling this function multiple times after a
/// single call to sfSocketSelector_wait will run the callbacks
/// multiple times.
///
/// \param selector Socket selector object
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfSocketSelector_dispatchReadyCallbacks(sfSocketSelector* selector);
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -133
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -34,23 +34,9 @@
#include <CSFML/Network/Types.h>
#include <CSFML/System/Time.h>
#include <stdbool.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
/// \brief Transport layer security status codes
///
////////////////////////////////////////////////////////////
typedef enum
{
sfTlsNotConnected, ///< TCP connection not yet connected
sfTlsHandshakeStarted, ///< TLS handshake has been started
sfTlsHandshakeComplete, ///< TLS handshake is complete, stream is encrypted
sfTlsError ///< An unexpected error happened
} sfTlsStatus;
////////////////////////////////////////////////////////////
/// \brief Create a new TCP socket
///
@@ -243,121 +229,3 @@ CSFML_NETWORK_API sfSocketStatus sfTcpSocket_sendPacket(sfTcpSocket* socket, sfP
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_receivePacket(sfTcpSocket* socket, sfPacket* packet);
////////////////////////////////////////////////////////////
/// \brief Set up transport layer security as a client
///
/// Once the TCP connection is connected, transport layer
/// security can be set up.
///
/// If this function is called before the TCP connection is
/// connected, it will return sfTlsNotConnected and must be
/// called again once the TCP connection is connected.
///
/// If this function started TLS setup but could not finish
/// it within this call e.g. because this socket was set to
/// non-blocking, it will return sfTlsHandshakeStarted and
/// this function will have to be called repeatedly until
/// sfTlsHandshakeComplete is returned. If this socket is
/// blocking, sfTlsHandshakeComplete should be returned
/// within the same function call if TLS setup was successful.
///
/// If sfTlsError is returned, something went wrong with TLS
/// setup and the connection must be reconnected and TLS setup
/// reattempted after it is connected again.
///
/// If verification is enabled, this function verifies the peer
/// using the system provided certificate store. If the peer
/// does not have a certificate that was signed by a certificate
/// authority i.e. a self-signed certificate, the entire certificate
/// chain can be provided using sfTcpSocket_setupTlsClientWithCertificate.
///
/// The hostname is sent to the server via server name indication
/// (SNI) and used to verify the certificate chain returned by the
/// server.
///
/// \param socket TCP socket object
/// \param hostname Hostname of the remote peer, encoded in UTF-8, used for verification
/// \param verifyPeer True to enable peer verification, false to disable it
///
/// \return TLS status code
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfTlsStatus sfTcpSocket_setupTlsClient(sfTcpSocket* socket, const char* hostname, bool verifyPeer);
////////////////////////////////////////////////////////////
/// \brief Set up transport layer security as a client with a given certificate chain
///
/// When calling this function, the certificate chain to verify
/// the host with has to be provided. Verification is always
/// enabled when calling this function.
///
/// The certificate data can be provided in PEM or DER format.
///
/// See sfTcpSocket_setupTlsClient for details on the returned
/// status codes.
///
/// \param socket TCP socket object
/// \param hostname Hostname of the remote peer, encoded in UTF-8, used for verification
/// \param certificateChainData Certificate chain data in PEM or DER encoding
/// \param certificateChainSize Size of the certificate chain data
///
/// \return TLS status code
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfTlsStatus sfTcpSocket_setupTlsClientWithCertificate(
sfTcpSocket* socket,
const char* hostname,
const void* certificateChainData,
size_t certificateChainSize);
////////////////////////////////////////////////////////////
/// \brief Set up transport layer security as a server
///
/// Once the TCP connection is connected, transport layer
/// security can be set up.
///
/// As a server, a certificate chain as well as a private key
/// must be provided. The certificate and private key data can
/// be provided in PEM or DER format. If the private key is
/// secured by a password, the password must be provided.
///
/// If sfTlsError is returned, something went wrong with TLS
/// setup and the connection must be disconnected. The client
/// must reconnect and reattempt TLS setup again.
///
/// See sfTcpSocket_setupTlsClient for details on the other
/// returned status codes.
///
/// \param socket TCP socket object
/// \param certificateChainData Certificate chain data in PEM or DER encoding
/// \param certificateChainSize Size of the certificate chain data
/// \param privateKeyData Private key data in PEM or DER encoding
/// \param privateKeySize Size of the private key data
/// \param privateKeyPasswordData Private key password data, can be NULL if there is no password
/// \param privateKeyPasswordSize Size of the private key password data
///
/// \return TLS status code
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfTlsStatus sfTcpSocket_setupTlsServer(
sfTcpSocket* socket,
const void* certificateChainData,
size_t certificateChainSize,
const void* privateKeyData,
size_t privateKeySize,
const void* privateKeyPasswordData,
size_t privateKeyPasswordSize);
////////////////////////////////////////////////////////////
/// \brief Get the name of the TLS ciphersuite currently in use
///
/// The returned string stays valid until the next call to
/// this function or until the socket is destroyed.
///
/// \param socket TCP socket object
///
/// \return TLS ciphersuite currently in use or NULL if TLS is not set up
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const char* sfTcpSocket_getCurrentCiphersuiteName(const sfTcpSocket* socket);
+1 -10
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -25,10 +25,6 @@
#pragma once
typedef struct sfDnsMxRecords sfDnsMxRecords;
typedef struct sfDnsNsRecords sfDnsNsRecords;
typedef struct sfDnsSrvRecords sfDnsSrvRecords;
typedef struct sfDnsTxtRecords sfDnsTxtRecords;
typedef struct sfFtpDirectoryResponse sfFtpDirectoryResponse;
typedef struct sfFtpListingResponse sfFtpListingResponse;
typedef struct sfFtpResponse sfFtpResponse;
@@ -37,11 +33,6 @@ typedef struct sfHttpRequest sfHttpRequest;
typedef struct sfHttpResponse sfHttpResponse;
typedef struct sfHttp sfHttp;
typedef struct sfPacket sfPacket;
typedef struct sfSftpAttributesResult sfSftpAttributesResult;
typedef struct sfSftpListingResult sfSftpListingResult;
typedef struct sfSftpPathResult sfSftpPathResult;
typedef struct sfSftpResult sfSftpResult;
typedef struct sfSftp sfSftp;
typedef struct sfSocketSelector sfSocketSelector;
typedef struct sfTcpListener sfTcpListener;
typedef struct sfTcpSocket sfTcpSocket;
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -3
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -35,7 +35,5 @@
#include <CSFML/System/InputStream.h>
#include <CSFML/System/Sleep.h>
#include <CSFML/System/Time.h>
#include <CSFML/System/TimeoutWithPredicate.h>
#include <CSFML/System/Vector2.h>
#include <CSFML/System/Vector3.h>
#include <CSFML/System/Version.h>
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -1,66 +0,0 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////
#pragma once
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <CSFML/System/Time.h>
#include <stdbool.h>
////////////////////////////////////////////////////////////
/// \brief Predicate that returns true to continue or false to time out
///
/// \param userData User data stored in the sfTimeoutWithPredicate
///
/// \return True to continue, false to time out
///
////////////////////////////////////////////////////////////
typedef bool (*sfTimeoutPredicate)(void* userData);
////////////////////////////////////////////////////////////
/// \brief Hybrid of a timeout and a continuation predicate
///
/// Functions taking a timeout parameter that is specified
/// solely by a time cannot be easily interrupted. A predicate
/// allows interrupting the operation at any time, e.g. when
/// the user cancels it.
///
/// If \a predicate is NULL, the operation times out after
/// \a timeout (0 meaning no timeout). If \a predicate is set,
/// \a timeout is ignored and the operation times out once the
/// predicate returns false. The predicate is checked every
/// \a period, a period of 0 checks it every millisecond.
///
////////////////////////////////////////////////////////////
typedef struct
{
sfTime timeout; ///< Time to time out after, if no predicate is set
sfTimeoutPredicate predicate; ///< Predicate that returns true to continue or false to time out, can be NULL
void* userData; ///< User data passed to the predicate
sfTime period; ///< The period between checks of the predicate
} sfTimeoutWithPredicate;
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
-64
View File
@@ -1,64 +0,0 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////
#pragma once
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <CSFML/System/Export.h>
#include <stdbool.h>
#include <stdint.h>
////////////////////////////////////////////////////////////
/// \brief Version information of the SFML library
///
////////////////////////////////////////////////////////////
typedef struct
{
int8_t major; ///< SFML major version
int8_t minor; ///< SFML minor version
int8_t patch; ///< SFML patch version
bool isRelease; ///< true if this is a release version, false if this is a development version
const char* string; ///< String representation of the SFML version, e.g. 3.1.0 or 3.1.0-dev
} sfVersion;
////////////////////////////////////////////////////////////
/// \brief Get the version of the SFML library loaded at runtime
///
/// This is the version of the SFML library CSFML is linked
/// against at runtime, which can differ from the version
/// CSFML was compiled with (see CSFML_VERSION_MAJOR,
/// CSFML_VERSION_MINOR and CSFML_VERSION_PATCH).
///
/// The returned string is owned by SFML and stays valid
/// for the whole lifetime of the program.
///
/// \return Version information of the SFML library
///
////////////////////////////////////////////////////////////
CSFML_SYSTEM_API sfVersion sfGetVersion(void);
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+4 -10
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -40,10 +40,8 @@
///
/// \return true if \a finger is currently touching the screen, false otherwise
///
/// \deprecated Use the touch events (sfEvtTouchBegan, sfEvtTouchMoved and sfEvtTouchEnded) instead
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API CSFML_DEPRECATED bool sfTouch_isDown(unsigned int finger);
CSFML_WINDOW_API bool sfTouch_isDown(unsigned int finger);
////////////////////////////////////////////////////////////
/// \brief Get the current position of a touch in window coordinates
@@ -56,10 +54,8 @@ CSFML_WINDOW_API CSFML_DEPRECATED bool sfTouch_isDown(unsigned int finger);
///
/// \return Current position of \a finger, or undefined if it's not down
///
/// \deprecated Use the touch events (sfEvtTouchBegan, sfEvtTouchMoved and sfEvtTouchEnded) instead
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API CSFML_DEPRECATED sfVector2i sfTouch_getPosition(unsigned int finger, const sfWindow* relativeTo);
CSFML_WINDOW_API sfVector2i sfTouch_getPosition(unsigned int finger, const sfWindow* relativeTo);
////////////////////////////////////////////////////////////
/// \brief Get the current position of a touch in window coordinates
@@ -72,7 +68,5 @@ CSFML_WINDOW_API CSFML_DEPRECATED sfVector2i sfTouch_getPosition(unsigned int fi
///
/// \return Current position of \a finger, or undefined if it's not down
///
/// \deprecated Use the touch events (sfEvtTouchBegan, sfEvtTouchMoved and sfEvtTouchEnded) instead
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API CSFML_DEPRECATED sfVector2i sfTouch_getPositionWindowBase(unsigned int finger, const sfWindowBase* relativeTo);
CSFML_WINDOW_API sfVector2i sfTouch_getPositionWindowBase(unsigned int finger, const sfWindowBase* relativeTo);
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
+1 -23
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -280,28 +280,6 @@ CSFML_WINDOW_API sfVector2u sfWindow_getSize(const sfWindow* window);
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setSize(sfWindow* window, sfVector2u size);
////////////////////////////////////////////////////////////
/// \brief Set the minimum window rendering region size
///
/// Pass a `NULL` vector to unset the minimum size
///
/// \param window Window object
/// \param minimumSize New minimum size, in pixels
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setMinimumSize(sfWindow* window, const sfVector2u* minimumSize);
////////////////////////////////////////////////////////////
/// \brief Set the maximum window rendering region size
///
/// Pass a `NULL` vector to unset the maximum size
///
/// \param window Window object
/// \param maximumSize New maximum size, in pixels
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setMaximumSize(sfWindow* window, const sfVector2u* maximumSize);
////////////////////////////////////////////////////////////
/// \brief Change the title of a window
///
+1 -23
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -236,28 +236,6 @@ CSFML_WINDOW_API sfVector2u sfWindowBase_getSize(const sfWindowBase* windowBase)
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindowBase_setSize(sfWindowBase* windowBase, sfVector2u size);
////////////////////////////////////////////////////////////
/// \brief Set the minimum window rendering region size
///
/// Pass a `NULL` vector to unset the minimum size
///
/// \param windowBase Window object
/// \param minimumSize New minimum size, in pixels
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindowBase_setMinimumSize(sfWindowBase* windowBase, const sfVector2u* minimumSize);
////////////////////////////////////////////////////////////
/// \brief Set the maximum window rendering region size
///
/// Pass a `NULL` vector to unset the maximum size
///
/// \param windowBase Window object
/// \param maximumSize New maximum size, in pixels
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindowBase_setMaximumSize(sfWindowBase* windowBase, const sfVector2u* maximumSize);
////////////////////////////////////////////////////////////
/// \brief Change the title of a window
///
Loaded 100 of 244 files, more files were not shown because too many files have changed in this diff. Show more