mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-24 21:53:37 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72c1979aed | ||
|
|
4f75550692 | ||
|
|
fb9fb941b4 | ||
|
|
58b6342d1b | ||
|
|
e153a8a4ce | ||
|
|
17f42be80c | ||
|
|
586fb28b9d | ||
|
|
46ce1943b7 | ||
|
|
71c3fea199 | ||
|
|
714e95a56e | ||
|
|
a9cdb1ad4d | ||
|
|
7fd47811cb | ||
|
|
2ec9764ac4 | ||
|
|
8c02b89a93 | ||
|
|
3c0f1aebec | ||
|
|
8e81e6223d | ||
|
|
933cb6d67a | ||
|
|
d31809042b | ||
|
|
30a5cd508a | ||
|
|
7c88140df2 | ||
|
|
d43e93eb81 | ||
|
|
d1a8cfb861 | ||
|
|
428bddade9 | ||
|
|
f8a6d27b27 | ||
|
|
df75efa78d | ||
|
|
e0589c302b | ||
|
|
16ae40d383 | ||
|
|
ad9edb0256 | ||
|
|
0f4b9a4383 | ||
|
|
8074b3a004 | ||
|
|
b7826c5f9a | ||
|
|
fb9b3aeab7 | ||
|
|
160e764c4c | ||
|
|
dfa5fbf92d | ||
|
|
b1d02ce571 | ||
|
|
0601d5fa8d | ||
|
|
5ccbbdf61b | ||
|
|
83b44e3feb | ||
|
|
1c4aba1d43 | ||
|
|
9a355d784b | ||
|
|
4f540b9cbb | ||
|
|
b231c6c269 | ||
|
|
e92cc49459 | ||
|
|
3e24bb1dc9 | ||
|
|
b8a63eb73d | ||
|
|
bba0bf3726 | ||
|
|
bf29112d56 | ||
|
|
843deb2f6b | ||
|
|
76c1e643fa | ||
|
|
a7e7ea4ccf | ||
|
|
e2401417ef | ||
|
|
d90cd6f5ee | ||
|
|
509d4f2cec | ||
|
|
49310cd5a6 | ||
|
|
3a1ea97cb4 | ||
|
|
072a4680be | ||
|
|
0eec0f8ec9 | ||
|
|
725811baa9 | ||
|
|
39dd578d45 | ||
|
|
37b809b296 | ||
|
|
a80542d67d | ||
|
|
a3657e112a | ||
|
|
7d7375556c | ||
|
|
c97c71951c | ||
|
|
81c7fb1a26 | ||
|
|
b63eddd4cd | ||
|
|
d536b3d2cc | ||
|
|
e8776bc80d | ||
|
|
920ff4d072 | ||
|
|
1d56c6ed0f | ||
|
|
2a20bc7209 | ||
|
|
df0040791e | ||
|
|
cc8c7fc4de | ||
|
|
7e2f6d4af8 | ||
|
|
4c15108233 | ||
|
|
1667644e3d | ||
|
|
6476e9442e | ||
|
|
a05be24b48 | ||
|
|
7d2ebaf265 | ||
|
|
e606b52c39 | ||
|
|
7cbcd8f9fa | ||
|
|
d270e9a513 | ||
|
|
fe8145e750 | ||
|
|
39d7c47f04 | ||
|
|
be2714672b | ||
|
|
ccc159b3d9 | ||
|
|
3a88df2c38 | ||
|
|
fbf4b000ef | ||
|
|
356eeb3ae6 | ||
|
|
a2418218a6 | ||
|
|
ac4f02c4ac | ||
|
|
371d2ca1e7 | ||
|
|
4c3997e7a2 | ||
|
|
e40235ffb0 | ||
|
|
8d14b53047 | ||
|
|
47cf45ad54 | ||
|
|
30dbf80507 | ||
|
|
c27917ebf9 | ||
|
|
0c79d19b48 | ||
|
|
1402537900 | ||
|
|
aa13651a03 | ||
|
|
980a165dc9 | ||
|
|
317f58fa31 | ||
|
|
1d05e82f25 | ||
|
|
c5a37aed84 |
No files matched your search
+32
-15
@@ -1,50 +1,67 @@
|
||||
name: CI
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
concurrency:
|
||||
group: environment-${{github.ref}}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: ${{ matrix.platform.name }} ${{ matrix.config.name }}
|
||||
name: ${{ matrix.platform.name }} ${{ matrix.type.name }}
|
||||
runs-on: ${{ matrix.platform.os }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- { name: Windows VS2017, os: windows-2016 }
|
||||
- { name: Windows VS2019, os: windows-latest }
|
||||
- { name: Linux GCC, os: ubuntu-latest }
|
||||
- { name: Linux Clang, os: ubuntu-latest, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
|
||||
- { name: MacOS XCode, os: macos-latest, flags: -DSFML_BUILD_FRAMEWORKS=FALSE, prefix: sudo }
|
||||
- { 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-13, flags: -GNinja }
|
||||
type:
|
||||
- { name: Debug }
|
||||
- { name: Release }
|
||||
|
||||
steps:
|
||||
- name: Get CMake and Ninja
|
||||
uses: lukka/get-cmake@latest
|
||||
with:
|
||||
ninjaVersion: latest
|
||||
|
||||
- name: Install Linux Dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev
|
||||
|
||||
- name: Checkout SFML
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: SFML/SFML
|
||||
ref: 2.5.1
|
||||
ref: 2.6.2
|
||||
path: SFML
|
||||
|
||||
- name: Configure SFML CMake
|
||||
shell: bash
|
||||
run: cmake -S $GITHUB_WORKSPACE/SFML -B $GITHUB_WORKSPACE/SFML/build -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/SFML/install -DBUILD_SHARED_LIBS=TRUE -DSFML_BUILD_EXAMPLES=FALSE -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}}
|
||||
|
||||
run: cmake -S $GITHUB_WORKSPACE/SFML -B $GITHUB_WORKSPACE/SFML/build -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/SFML/install -DBUILD_SHARED_LIBS=TRUE -DSFML_BUILD_EXAMPLES=FALSE -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}} -DCMAKE_BUILD_TYPE=${{matrix.type.name}}
|
||||
|
||||
- name: Build SFML
|
||||
shell: bash
|
||||
run: ${{matrix.platform.prefix}} cmake --build $GITHUB_WORKSPACE/SFML/build --config Release --target install
|
||||
run: cmake --build $GITHUB_WORKSPACE/SFML/build --config ${{matrix.type.name}} --target install
|
||||
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Configure CSFML CMake
|
||||
shell: bash
|
||||
run: cmake -S $GITHUB_WORKSPACE/CSFML -B $GITHUB_WORKSPACE/CSFML/build -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/CSFML/install -DBUILD_SHARED_LIBS=TRUE -DCSFML_LINK_SFML_STATICALLY=FALSE -DSFML_DIR=$GITHUB_WORKSPACE/SFML/install/lib/cmake/SFML -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}}
|
||||
run: cmake -S $GITHUB_WORKSPACE/CSFML -B $GITHUB_WORKSPACE/CSFML/build -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/CSFML/install -DBUILD_SHARED_LIBS=TRUE -DCSFML_BUILD_EXAMPLES=TRUE -DCSFML_LINK_SFML_STATICALLY=FALSE -DSFML_DIR=$GITHUB_WORKSPACE/SFML/install/lib/cmake/SFML -DCMAKE_VERBOSE_MAKEFILE=ON -DWARNINGS_AS_ERRORS=TRUE ${{matrix.platform.flags}} -DCMAKE_BUILD_TYPE=${{matrix.type.name}}
|
||||
|
||||
- name: Build CSFML
|
||||
shell: bash
|
||||
run: cmake --build $GITHUB_WORKSPACE/CSFML/build --config Release --target install
|
||||
run: cmake --build $GITHUB_WORKSPACE/CSFML/build --config ${{matrix.type.name}} --target install
|
||||
@@ -0,0 +1,252 @@
|
||||
name: NuGet Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- 2.6.x
|
||||
workflow_dispatch: {}
|
||||
|
||||
concurrency:
|
||||
group: nuget-${{github.ref}}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
||||
|
||||
jobs:
|
||||
windows:
|
||||
name: Windows VS2022
|
||||
runs-on: windows-2022
|
||||
|
||||
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 x64
|
||||
shell: pwsh
|
||||
run: |
|
||||
cd CSFML/tools/nuget
|
||||
./build.win.ps1 "win-x64"
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-win-x86-x64
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
|
||||
linux-x64:
|
||||
name: Linux x64
|
||||
runs-on: ubuntu-22.04
|
||||
container:
|
||||
image: ubuntu:22.04
|
||||
|
||||
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: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-linux-x64
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
|
||||
linux-arm:
|
||||
name: Linux ARM
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- 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 libudev-dev libgl1-mesa-dev libflac-dev libogg-dev libvorbis-dev libopenal-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@v4
|
||||
with:
|
||||
name: CSFML-linux-arm
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
|
||||
linux-arm64:
|
||||
name: Linux ARM64
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- 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 libopenal-dev cmake g++
|
||||
run: |
|
||||
cd /CSFML/tools/nuget
|
||||
chmod +x ./build.linux.sh
|
||||
./build.linux.sh linux-arm64
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-linux-arm64
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
|
||||
linux-musl-x64:
|
||||
name: Linux MUSL x64
|
||||
runs-on: ubuntu-22.04
|
||||
container:
|
||||
image: alpine:3.15
|
||||
|
||||
steps:
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Build
|
||||
shell: sh
|
||||
run: |
|
||||
cd ./CSFML/tools/nuget
|
||||
chmod +x ./docker.linux-musl-x64.sh
|
||||
./docker.linux-musl-x64.sh
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-linux-musl-x64
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
|
||||
fedora-x64:
|
||||
name: Fedora x64
|
||||
runs-on: ubuntu-22.04
|
||||
container:
|
||||
image: fedora:37
|
||||
|
||||
steps:
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: |
|
||||
cd ./CSFML/tools/nuget
|
||||
chmod +x ./docker.fedora-x64.sh
|
||||
./docker.fedora-x64.sh
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-fedora-x64
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
|
||||
macos:
|
||||
name: macOS
|
||||
runs-on: macos-14
|
||||
|
||||
steps:
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Install necessary tooling
|
||||
run: brew install coreutils
|
||||
|
||||
- name: Build x64
|
||||
run: |
|
||||
cd CSFML/tools/nuget
|
||||
./build.macos.sh "osx-x64"
|
||||
|
||||
- name: Build ARM64
|
||||
run: |
|
||||
cd CSFML/tools/nuget
|
||||
./build.macos.sh "osx-arm64"
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-macOS-x64-arm64
|
||||
path: CSFML/tools/nuget/CSFML/runtimes
|
||||
|
||||
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
|
||||
@@ -0,0 +1,316 @@
|
||||
name: Release Builds
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- 2.6.x
|
||||
tags:
|
||||
- "**"
|
||||
workflow_dispatch: {}
|
||||
|
||||
concurrency:
|
||||
group: release-${{github.ref}}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
windows-x86:
|
||||
name: Windows x86
|
||||
runs-on: windows-2022
|
||||
|
||||
steps:
|
||||
- name: Cache MinGW x86
|
||||
id: mingw-x86-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/mingw32
|
||||
key: 14.1.0posix-18.1.5-11.0.1-msvcrt-r1-x86
|
||||
|
||||
- name: Install MinGW x86
|
||||
if: steps.mingw-x86-cache.outputs.cache-hit != 'true'
|
||||
uses: bwoodsend/setup-winlibs-action@v1
|
||||
id: winlibs-32
|
||||
with:
|
||||
tag: 14.1.0posix-18.1.5-11.0.1-msvcrt-r1
|
||||
with_clang: false
|
||||
architecture: 32
|
||||
destination: ${{ github.workspace }}
|
||||
add_to_path: false
|
||||
|
||||
- name: Checkout SFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: SFML/SFML
|
||||
ref: 2.6.1
|
||||
path: SFML
|
||||
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Build SFML
|
||||
run: |
|
||||
cmake -S SFML -B SFML-build -A Win32 -G "Visual Studio 17 2022" -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_STATIC_STD_LIBS=TRUE -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 17 2022" -DBUILD_SHARED_LIBS=TRUE -DSTATIC_STD_LIBS=TRUE -DCSFML_LINK_SFML_STATICALLY=TRUE -DCMAKE_BUILD_TYPE=Release -DSFML_DIR=${{ github.workspace }}/SFML-install/lib/cmake/SFML -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-2.dll"
|
||||
& dlltool.exe -d "csfml-graphics-2.def" -D "..\..\bin\csfml-graphics-2.dll" -l "libcsfml-graphics.a"
|
||||
Remove-Item -Path "csfml-graphics-2.def"
|
||||
|
||||
& gendef.exe "..\..\bin\csfml-window-2.dll"
|
||||
& dlltool.exe -d "csfml-window-2.def" -D "..\..\bin\bin\csfml-window-2.dll" -l "libcsfml-window.a"
|
||||
Remove-Item -Path "csfml-window-2.def"
|
||||
|
||||
& gendef.exe "..\..\bin\csfml-audio-2.dll"
|
||||
& dlltool.exe -d "csfml-audio-2.def" -D "..\..\bin\bin\csfml-audio-2.dll" -l "libcsfml-audio.a"
|
||||
Remove-Item -Path "csfml-audio-2.def"
|
||||
|
||||
& gendef.exe "..\..\bin\csfml-network-2.dll"
|
||||
& dlltool.exe -d "csfml-network-2.def" -D "..\..\bin\bin\csfml-network-2.dll" -l "libcsfml-network.a"
|
||||
Remove-Item -Path "csfml-network-2.def"
|
||||
|
||||
& gendef.exe "..\..\bin\csfml-system-2.dll"
|
||||
& dlltool.exe -d "csfml-system-2.def" -D "..\..\bin\bin\csfml-system-2.dll" -l "libcsfml-system.a"
|
||||
Remove-Item -Path "csfml-system-2.def"
|
||||
Pop-Location
|
||||
|
||||
New-Item -ItemType "directory" -PATH "install"
|
||||
Move-Item -Path "CSFML-install\*" -Destination "install\CSFML"
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-windows-32-bit
|
||||
path: install/CSFML
|
||||
|
||||
windows-x64:
|
||||
name: Windows x64
|
||||
runs-on: windows-2022
|
||||
|
||||
steps:
|
||||
- name: Cache MinGW x64
|
||||
id: mingw-x64-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/mingw64
|
||||
key: 14.1.0posix-18.1.5-11.0.1-msvcrt-r1-x64
|
||||
|
||||
- name: Install MinGW x64
|
||||
if: steps.mingw-x64-cache.outputs.cache-hit != 'true'
|
||||
uses: bwoodsend/setup-winlibs-action@v1
|
||||
id: winlibs-64
|
||||
with:
|
||||
tag: 14.1.0posix-18.1.5-11.0.1-msvcrt-r1
|
||||
with_clang: false
|
||||
architecture: 64
|
||||
destination: ${{ github.workspace }}
|
||||
add_to_path: false
|
||||
|
||||
- name: Checkout SFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: SFML/SFML
|
||||
ref: 2.6.1
|
||||
path: SFML
|
||||
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: CSFML
|
||||
|
||||
- name: Build SFML
|
||||
run: |
|
||||
cmake -S SFML -B SFML-build -A x64 -G "Visual Studio 17 2022" -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_STATIC_STD_LIBS=TRUE -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 17 2022" -DBUILD_SHARED_LIBS=TRUE -DSTATIC_STD_LIBS=TRUE -DCSFML_LINK_SFML_STATICALLY=TRUE -DCMAKE_BUILD_TYPE=Release -DSFML_DIR=${{ github.workspace }}/SFML-install/lib/cmake/SFML -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-2.dll"
|
||||
& dlltool.exe -d "csfml-graphics-2.def" -D "..\..\bin\csfml-graphics-2.dll" -l "libcsfml-graphics.a"
|
||||
Remove-Item -Path "csfml-graphics-2.def"
|
||||
|
||||
& gendef.exe "..\..\bin\csfml-window-2.dll"
|
||||
& dlltool.exe -d "csfml-window-2.def" -D "..\..\bin\bin\csfml-window-2.dll" -l "libcsfml-window.a"
|
||||
Remove-Item -Path "csfml-window-2.def"
|
||||
|
||||
& gendef.exe "..\..\bin\csfml-audio-2.dll"
|
||||
& dlltool.exe -d "csfml-audio-2.def" -D "..\..\bin\bin\csfml-audio-2.dll" -l "libcsfml-audio.a"
|
||||
Remove-Item -Path "csfml-audio-2.def"
|
||||
|
||||
& gendef.exe "..\..\bin\csfml-network-2.dll"
|
||||
& dlltool.exe -d "csfml-network-2.def" -D "..\..\bin\bin\csfml-network-2.dll" -l "libcsfml-network.a"
|
||||
Remove-Item -Path "csfml-network-2.def"
|
||||
|
||||
& gendef.exe "..\..\bin\csfml-system-2.dll"
|
||||
& dlltool.exe -d "csfml-system-2.def" -D "..\..\bin\bin\csfml-system-2.dll" -l "libcsfml-system.a"
|
||||
Remove-Item -Path "csfml-system-2.def"
|
||||
Pop-Location
|
||||
|
||||
New-Item -ItemType "directory" -PATH "install"
|
||||
Move-Item -Path "CSFML-install\*" -Destination "install\CSFML"
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CSFML-windows-64-bit
|
||||
path: install/CSFML
|
||||
|
||||
macos-x64:
|
||||
name: macOS x64
|
||||
runs-on: macos-12
|
||||
|
||||
steps:
|
||||
- name: Checkout SFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: SFML/SFML
|
||||
ref: 2.6.1
|
||||
path: SFML
|
||||
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
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=TRUE \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/SFML-install/Library/Frameworks \
|
||||
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
|
||||
-DSFML_BUILD_FRAMEWORKS=TRUE \
|
||||
-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=TRUE \
|
||||
-DCSFML_LINK_SFML_STATICALLY=FALSE \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/CSFML-install \
|
||||
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
|
||||
-DSFML_DIR=${{ github.workspace }}/SFML-install/Library/Frameworks/SFML.framework/Resources/CMake \
|
||||
-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@v4
|
||||
with:
|
||||
name: CSFML-macOS-clang-64-bit
|
||||
path: CSFML-macOS-clang-64-bit.tar.gz
|
||||
|
||||
macos-arm64:
|
||||
name: macOS ARM64
|
||||
runs-on: macos-14
|
||||
|
||||
steps:
|
||||
- name: Checkout SFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: SFML/SFML
|
||||
ref: 2.6.1
|
||||
path: SFML
|
||||
|
||||
- name: Checkout CSFML
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
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=TRUE \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/SFML-install/Library/Frameworks \
|
||||
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
|
||||
-DSFML_BUILD_FRAMEWORKS=TRUE \
|
||||
-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=TRUE \
|
||||
-DCSFML_LINK_SFML_STATICALLY=FALSE \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/CSFML-install \
|
||||
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
|
||||
-DSFML_DIR=${{ github.workspace }}/SFML-install/Library/Frameworks/SFML.framework/Resources/CMake \
|
||||
-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@v4
|
||||
with:
|
||||
name: CSFML-macOS-clang-arm64
|
||||
path: CSFML-macOS-clang-arm64.tar.gz
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
# Build folders
|
||||
build/
|
||||
cmake-build-*/
|
||||
|
||||
# Cache/IDE folders
|
||||
.cache/
|
||||
.vscode/
|
||||
.idea/
|
||||
.vs/
|
||||
|
||||
# System files
|
||||
.DS_Store
|
||||
+46
-17
@@ -1,5 +1,4 @@
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.3)
|
||||
cmake_minimum_required(VERSION 3.7.2)
|
||||
|
||||
# define a macro that helps defining an option
|
||||
macro(csfml_set_option var default type docstring)
|
||||
@@ -14,18 +13,21 @@ endmacro()
|
||||
csfml_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debug or Release)")
|
||||
|
||||
# project name
|
||||
project(CSFML)
|
||||
project(CSFML VERSION 2.6.1)
|
||||
|
||||
# we use the paths from the cmake GNUInstallDirs module as defaults
|
||||
# you can override these if you like
|
||||
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# include the configuration file
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/Config.cmake)
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/Config.cmake)
|
||||
|
||||
# setup version numbers
|
||||
set(VERSION_MAJOR 2)
|
||||
set(VERSION_MINOR 5)
|
||||
set(VERSION_PATCH 1)
|
||||
|
||||
# add the CSFML header path
|
||||
include_directories(${CMAKE_SOURCE_DIR}/include)
|
||||
# add options to select which modules to build
|
||||
csfml_set_option(CSFML_BUILD_WINDOW TRUE BOOL "TRUE to build CSFML's Window module. This setting is ignored, if the graphics module is built.")
|
||||
csfml_set_option(CSFML_BUILD_GRAPHICS TRUE BOOL "TRUE to build CSFML's Graphics module.")
|
||||
csfml_set_option(CSFML_BUILD_AUDIO TRUE BOOL "TRUE to build CSFML's Audio module.")
|
||||
csfml_set_option(CSFML_BUILD_NETWORK TRUE BOOL "TRUE to build CSFML's Network module.")
|
||||
|
||||
# add an option for choosing the build type (shared or static)
|
||||
csfml_set_option(BUILD_SHARED_LIBS TRUE BOOL "TRUE to build CSFML as shared libraries, FALSE to build it as static libraries")
|
||||
@@ -67,10 +69,37 @@ if(CSFML_BUILD_DOC)
|
||||
add_subdirectory(doc)
|
||||
endif()
|
||||
|
||||
# on Linux and BSD-like OS, install pkg-config files by default
|
||||
set(CSFML_INSTALL_PKGCONFIG_DEFAULT FALSE)
|
||||
|
||||
if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
|
||||
set(CSFML_INSTALL_PKGCONFIG_DEFAULT TRUE)
|
||||
endif()
|
||||
|
||||
csfml_set_option(CSFML_INSTALL_PKGCONFIG_FILES ${CSFML_INSTALL_PKGCONFIG_DEFAULT} BOOL "TRUE to automatically install pkg-config files so other projects can find SFML")
|
||||
|
||||
if(CSFML_INSTALL_PKGCONFIG_FILES)
|
||||
csfml_set_option(CSFML_PKGCONFIG_INSTALL_DIR "${CSFML_PKGCONFIG_DIR}" PATH "Install directory for CSFML's pkg-config .pc files")
|
||||
|
||||
foreach(csfml_module IN ITEMS all system window graphics audio network)
|
||||
configure_file(
|
||||
"tools/pkg-config/csfml-${csfml_module}.pc.in"
|
||||
"tools/pkg-config/csfml-${csfml_module}.pc"
|
||||
@ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/csfml-${csfml_module}.pc"
|
||||
DESTINATION "${CSFML_PKGCONFIG_INSTALL_DIR}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# setup the install rules
|
||||
install(DIRECTORY include
|
||||
DESTINATION .
|
||||
COMPONENT devel
|
||||
PATTERN ".svn" EXCLUDE)
|
||||
install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR})
|
||||
install(FILES readme.txt DESTINATION ${INSTALL_MISC_DIR})
|
||||
install(DIRECTORY include/
|
||||
DESTINATION include
|
||||
COMPONENT devel)
|
||||
install(FILES license.md DESTINATION ${INSTALL_MISC_DIR})
|
||||
install(FILES readme.md DESTINATION ${INSTALL_MISC_DIR})
|
||||
|
||||
# add an option for building the examples
|
||||
csfml_set_option(CSFML_BUILD_EXAMPLES FALSE BOOL "TRUE to build the CSFML examples, FALSE to ignore them")
|
||||
if(CSFML_BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
@@ -0,0 +1,104 @@
|
||||
# from here:
|
||||
#
|
||||
# https://github.com/lefticus/cppbestpractices/blob/master/02-Use_the_Tools_Available.md
|
||||
|
||||
# Helper function to enable compiler warnings for a specific set of files
|
||||
function(set_file_warnings)
|
||||
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" FALSE)
|
||||
|
||||
set(MSVC_WARNINGS
|
||||
/W4 # Baseline reasonable warnings
|
||||
/w14242 # 'identifier': conversion from 'type1' to 'type1', possible loss of data
|
||||
/w14254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
|
||||
/w14263 # 'function': member function does not override any base class virtual member function
|
||||
/w14265 # 'classname': class has virtual functions, but destructor is not virtual instances of this class may not be destructed correctly
|
||||
/w14287 # 'operator': unsigned/negative constant mismatch
|
||||
/we4289 # nonstandard extension used: 'variable': loop control variable declared in the for-loop is used outside the for-loop scope
|
||||
/w14296 # 'operator': expression is always 'boolean_value'
|
||||
/w14311 # 'variable': pointer truncation from 'type1' to 'type2'
|
||||
/w14545 # expression before comma evaluates to a function which is missing an argument list
|
||||
/w14546 # function call before comma missing argument list
|
||||
/w14547 # 'operator': operator before comma has no effect; expected operator with side-effect
|
||||
/w14549 # 'operator': operator before comma has no effect; did you intend 'operator'?
|
||||
/w14555 # expression has no effect; expected expression with side- effect
|
||||
/w14619 # pragma warning: there is no warning number 'number'
|
||||
/w14640 # Enable warning on thread un-safe static member initialization
|
||||
/w14826 # Conversion from 'type1' to 'type_2' is sign-extended. This may cause unexpected runtime behavior.
|
||||
/w14905 # wide string literal cast to 'LPSTR'
|
||||
/w14906 # string literal cast to 'LPWSTR'
|
||||
/w14928 # illegal copy-initialization; more than one user-defined conversion has been implicitly applied
|
||||
# /permissive- # standards conformance mode for MSVC compiler. Disabled until all out-of-the-box Windows SDKs can successfully build with it.
|
||||
|
||||
# Disables, remove when appropriate
|
||||
/wd4996 # disable warnings about deprecated functions
|
||||
/wd4068 # disable warnings about unknown pragmas (e.g. #pragma GCC)
|
||||
/wd4505 # disable warnings about unused functions that might be platform-specific
|
||||
/wd4800 # disable warnings regarding implicit conversions to bool
|
||||
)
|
||||
|
||||
set(CLANG_AND_GCC_WARNINGS
|
||||
-Wall
|
||||
-Wextra # reasonable and standard
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Wnon-virtual-dtor> # warn the user if a class with virtual functions has a non-virtual destructor. This helps catch hard to track down memory errors
|
||||
-Wcast-align # warn for potential performance problem casts
|
||||
-Wunused # warn on anything being unused
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Woverloaded-virtual> # warn if you overload (not override) a virtual function
|
||||
-Wconversion # warn on type conversions that may lose data
|
||||
-Wsign-conversion # warn on sign conversions
|
||||
-Wdouble-promotion # warn if float is implicit promoted to double
|
||||
-Wformat=2 # warn on security issues around functions that format output (ie printf)
|
||||
# -Wimplicit-fallthrough # warn when a missing break causes control flow to continue at the next case in a switch statement (disabled until better compiler support for explicit fallthrough is available)
|
||||
-Wnull-dereference # warn if a null dereference is detected
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast> # warn for c-style casts
|
||||
-Wpedantic # warn if non-standard C++ is used
|
||||
-Wno-deprecated-declarations # do not warning about deprecated declarations
|
||||
-Wno-language-extension-token # ignore use of __int64 compiler extension
|
||||
)
|
||||
|
||||
# Disable warnings as errors when using Clang on Windows to work around deprecation warnings in Windows APIs
|
||||
if(SFML_OS_WINDOWS AND (SFML_COMPILER_CLANG OR SFML_COMPILER_CLANG_CL))
|
||||
set(WARNINGS_AS_ERRORS FALSE)
|
||||
endif()
|
||||
|
||||
if(WARNINGS_AS_ERRORS)
|
||||
set(CLANG_AND_GCC_WARNINGS ${CLANG_AND_GCC_WARNINGS} -Werror)
|
||||
set(MSVC_WARNINGS ${MSVC_WARNINGS} /WX)
|
||||
endif()
|
||||
|
||||
set(CLANG_WARNINGS
|
||||
${CLANG_AND_GCC_WARNINGS}
|
||||
-Wno-unknown-warning-option # do not warn on GCC-specific warning diagnostic pragmas
|
||||
-Wno-c++11-long-long # do not warn on uses of long long
|
||||
)
|
||||
|
||||
set(GCC_WARNINGS
|
||||
${CLANG_AND_GCC_WARNINGS}
|
||||
-Wmisleading-indentation # warn if indentation implies blocks where blocks do not exist
|
||||
-Wduplicated-cond # warn if if / else chain has duplicated conditions
|
||||
-Wlogical-op # warn about logical operations being used where bitwise were probably wanted
|
||||
# -Wuseless-cast # warn if you perform a cast to the same type (disabled because it is not portable as some typedefs might vary between platforms)
|
||||
)
|
||||
|
||||
# Don't enable -Wduplicated-branches for GCC < 8.1 since it will lead to false positives
|
||||
# https://github.com/gcc-mirror/gcc/commit/6bebae75035889a4844eb4d32a695bebf412bcd7
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
|
||||
set(GCC_WARNINGS
|
||||
${GCC_WARNINGS}
|
||||
-Wduplicated-branches # warn if if / else branches have duplicated code
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
set(FILE_WARNINGS ${MSVC_WARNINGS})
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
|
||||
set(FILE_WARNINGS ${CLANG_WARNINGS})
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(FILE_WARNINGS ${GCC_WARNINGS})
|
||||
else()
|
||||
message(AUTHOR_WARNING "No compiler warnings set for '${CMAKE_CXX_COMPILER_ID}' compiler.")
|
||||
endif()
|
||||
|
||||
foreach(WARNING ${FILE_WARNINGS})
|
||||
set_property(SOURCE ${ARGV} APPEND_STRING PROPERTY COMPILE_FLAGS " ${WARNING}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
+25
-28
@@ -32,45 +32,42 @@ else()
|
||||
return()
|
||||
endif()
|
||||
|
||||
# set pkgconfig install directory
|
||||
# this could be e.g. macports on mac or msys2 on windows etc.
|
||||
set(CSFML_PKGCONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
|
||||
if(SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
|
||||
set(CSFML_PKGCONFIG_DIR "libdata/pkgconfig")
|
||||
endif()
|
||||
|
||||
# detect the compiler and its version
|
||||
# Note: on some platforms (OS X), CMAKE_COMPILER_IS_GNUCXX is true
|
||||
# even when CLANG is used, therefore the Clang test is done first
|
||||
if(CMAKE_CXX_COMPILER MATCHES ".*clang[+][+]" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# CMAKE_CXX_COMPILER_ID is an internal CMake variable subject to change,
|
||||
# but there is no other way to detect CLang at the moment
|
||||
set(SFML_COMPILER_CLANG 1)
|
||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE CLANG_VERSION_OUTPUT)
|
||||
string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1" SFML_CLANG_VERSION "${CLANG_VERSION_OUTPUT}")
|
||||
# Note: The detection is order is important because:
|
||||
# - Visual Studio can both use MSVC and Clang
|
||||
# - GNUCXX can still be set on macOS when using Clang
|
||||
if(MSVC)
|
||||
set(SFML_COMPILER_MSVC 1)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(SFML_COMPILER_CLANG_CL 1)
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(SFML_COMPILER_CLANG 1)
|
||||
|
||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE CLANG_VERSION_OUTPUT)
|
||||
string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1" SFML_CLANG_VERSION "${CLANG_VERSION_OUTPUT}")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(SFML_COMPILER_GCC 1)
|
||||
|
||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpversion" OUTPUT_VARIABLE GCC_VERSION_OUTPUT)
|
||||
string(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" SFML_GCC_VERSION "${GCC_VERSION_OUTPUT}")
|
||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE GCC_COMPILER_VERSION)
|
||||
string(REGEX MATCHALL ".*(tdm[64]*-[1-9]).*" SFML_COMPILER_GCC_TDM "${GCC_COMPILER_VERSION}")
|
||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpmachine" OUTPUT_VARIABLE GCC_MACHINE)
|
||||
string(STRIP "${GCC_MACHINE}" GCC_MACHINE)
|
||||
if(${GCC_MACHINE} MATCHES ".*w64.*")
|
||||
|
||||
if(GCC_MACHINE MATCHES ".*w64.*")
|
||||
set(SFML_COMPILER_GCC_W64 1)
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
set(SFML_COMPILER_MSVC 1)
|
||||
if(MSVC_VERSION EQUAL 1400)
|
||||
set(SFML_MSVC_VERSION 8)
|
||||
elseif(MSVC_VERSION EQUAL 1500)
|
||||
set(SFML_MSVC_VERSION 9)
|
||||
elseif(MSVC_VERSION EQUAL 1600)
|
||||
set(SFML_MSVC_VERSION 10)
|
||||
elseif(MSVC_VERSION EQUAL 1700)
|
||||
set(SFML_MSVC_VERSION 11)
|
||||
elseif(MSVC_VERSION EQUAL 1800)
|
||||
set(SFML_MSVC_VERSION 12)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
set(SFML_MSVC_VERSION 14)
|
||||
elseif(MSVC_VERSION LESS_EQUAL 1919)
|
||||
set(SFML_MSVC_VERSION 15)
|
||||
elseif(MSVC_VERSION LESS_EQUAL 1929)
|
||||
set(SFML_MSVC_VERSION 16)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported compiler")
|
||||
return()
|
||||
|
||||
+12
-5
@@ -1,4 +1,5 @@
|
||||
include(CMakeParseArguments)
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/CompilerWarnings.cmake)
|
||||
|
||||
# add a new target which is a CSFML library
|
||||
# ex: csfml_add_library(csfml-graphics
|
||||
@@ -12,6 +13,12 @@ macro(csfml_add_library target)
|
||||
# create the target
|
||||
add_library(${target} ${THIS_SOURCES})
|
||||
|
||||
# add the CSFML header path
|
||||
target_include_directories(${target} PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
# add warnings
|
||||
set_file_warnings(${THIS_SOURCES})
|
||||
|
||||
# define the export symbol of the module
|
||||
string(REPLACE "-" "_" NAME_UPPER "${target}")
|
||||
string(TOUPPER "${NAME_UPPER}" NAME_UPPER)
|
||||
@@ -20,7 +27,7 @@ macro(csfml_add_library target)
|
||||
if(SFML_OS_WINDOWS)
|
||||
# include the major version number in Windows shared library names (but not import library names)
|
||||
set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d)
|
||||
set_target_properties(${target} PROPERTIES SUFFIX "-${VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set_target_properties(${target} PROPERTIES SUFFIX "-${PROJECT_VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
else()
|
||||
set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d)
|
||||
endif()
|
||||
@@ -32,8 +39,8 @@ macro(csfml_add_library target)
|
||||
endif()
|
||||
|
||||
# set the version and soversion of the target (for compatible systems -- mostly Linuxes)
|
||||
set_target_properties(${target} PROPERTIES SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR})
|
||||
set_target_properties(${target} PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
set_target_properties(${target} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
|
||||
set_target_properties(${target} PROPERTIES VERSION ${PROJECT_VERSION})
|
||||
|
||||
# set the target's folder (for IDEs that support it, e.g. Visual Studio)
|
||||
set_target_properties(${target} PROPERTIES FOLDER "CSFML")
|
||||
@@ -54,7 +61,7 @@ macro(csfml_add_library target)
|
||||
endif()
|
||||
|
||||
# link the target to its external dependencies (C++ SFML libraries)
|
||||
target_link_libraries(${target} ${THIS_DEPENDS})
|
||||
target_link_libraries(${target} PRIVATE ${THIS_DEPENDS})
|
||||
|
||||
# build dylibs
|
||||
if(SFML_OS_MACOSX AND BUILD_SHARED_LIBS)
|
||||
@@ -67,7 +74,7 @@ macro(csfml_add_library target)
|
||||
# add the install rule
|
||||
install(TARGETS ${target}
|
||||
RUNTIME DESTINATION bin COMPONENT bin
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT bin
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT bin
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT devel)
|
||||
|
||||
endmacro()
|
||||
+10
-3
@@ -3,7 +3,7 @@
|
||||
find_package(Doxygen REQUIRED)
|
||||
|
||||
# set the input and output documentation paths
|
||||
set(DOXYGEN_INPUT_DIR ${CMAKE_SOURCE_DIR})
|
||||
set(DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR})
|
||||
set(DOXYGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/doc)
|
||||
|
||||
# see if we can generate the CHM documentation
|
||||
@@ -14,7 +14,12 @@ if(SFML_OS_WINDOWS)
|
||||
PATHS "C:/Program Files/HTML Help Workshop" "C:/Program Files (x86)/HTML Help Workshop"
|
||||
DOC "HTML Help Compiler program")
|
||||
if(DOXYGEN_HHC_PROGRAM)
|
||||
set(DOXYGEN_GENERATE_HTMLHELP YES)
|
||||
if(DOXYGEN_VERSION VERSION_LESS "1.10.0")
|
||||
set(DOXYGEN_GENERATE_HTMLHELP YES)
|
||||
else()
|
||||
message("Due to conflicts with the HTML output settings in Doxygen ${DOXYGEN_VERSION}, the HTML Help generation will be disabled")
|
||||
set(DOXYGEN_GENERATE_HTMLHELP NO)
|
||||
endif()
|
||||
else()
|
||||
set(DOXYGEN_GENERATE_HTMLHELP NO)
|
||||
endif()
|
||||
@@ -26,9 +31,11 @@ endif()
|
||||
# configure the source Doxyfile by copying it and replacing all @variables@
|
||||
set(DOXYGEN_CONFIGURED_INPUT ${DOXYGEN_OUTPUT_DIR}/doxyfile)
|
||||
configure_file(${DOXYGEN_INPUT_DIR}/doc/doxyfile.in ${DOXYGEN_CONFIGURED_INPUT} @ONLY)
|
||||
configure_file(${DOXYGEN_INPUT_DIR}/doc/header.html.in ${DOXYGEN_OUTPUT_DIR}/header.html @ONLY)
|
||||
|
||||
# copy the files needed by the documentation
|
||||
configure_file(${DOXYGEN_INPUT_DIR}/doc/doxygen.css ${DOXYGEN_OUTPUT_DIR}/html/doxygen.css COPYONLY)
|
||||
configure_file(${DOXYGEN_INPUT_DIR}/doc/searchOverrides.css ${DOXYGEN_OUTPUT_DIR}/html/searchOverrides.css COPYONLY)
|
||||
|
||||
# target setup
|
||||
add_custom_target(doc ALL
|
||||
@@ -41,7 +48,7 @@ add_custom_target(doc ALL
|
||||
install(DIRECTORY ${DOXYGEN_OUTPUT_DIR}/html
|
||||
DESTINATION ${INSTALL_MISC_DIR}/doc
|
||||
COMPONENT doc)
|
||||
if(DOXYGEN_HHC_PROGRAM)
|
||||
if(DOXYGEN_GENERATE_HTMLHELP)
|
||||
install(FILES ${DOXYGEN_OUTPUT_DIR}/CSFML.chm
|
||||
DESTINATION ${INSTALL_MISC_DIR}/doc
|
||||
COMPONENT doc)
|
||||
|
||||
+700
-295
File diff suppressed because it is too large.
Load diff
+53
-4
@@ -147,12 +147,53 @@ div.fragment {
|
||||
|
||||
font-family: Consolas, "Liberation Mono", Courier, monospace;
|
||||
font-size: 10pt;
|
||||
position: relative;
|
||||
padding: 0.5em 1em;
|
||||
background-color: #f5f5f5;
|
||||
border: 1px solid #bbb;
|
||||
border-radius(5px);
|
||||
}
|
||||
|
||||
.clipboard {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
right: 5px;
|
||||
top: 5px;
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
display: inline;
|
||||
overflow: auto;
|
||||
fill: black;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.clipboard.success {
|
||||
border: 1px solid black;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.fragment:hover .clipboard, .clipboard.success {
|
||||
opacity: .28;
|
||||
}
|
||||
|
||||
.clipboard:hover, .clipboard.success {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
.clipboard:active:not([class~=success]) svg {
|
||||
transform: scale(.91);
|
||||
}
|
||||
|
||||
.clipboard.success svg {
|
||||
fill: #2EC82E;
|
||||
}
|
||||
|
||||
.clipboard.success {
|
||||
border-color: #2EC82E;
|
||||
}
|
||||
|
||||
div.line {
|
||||
min-height: 13px;
|
||||
text-wrap: unrestricted;
|
||||
@@ -1062,18 +1103,26 @@ tr.heading h2 {
|
||||
display: table;
|
||||
}
|
||||
|
||||
.tablist {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tablist li {
|
||||
float: left;
|
||||
display: table-cell;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#navrow1 .tablist li:last-child {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#navrow1 {
|
||||
border-top: 1px solid #999;
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
#navrow1 .tablist a, #navrow2 .tablist a, #navrow3 .tablist a, #navrow4 .tablist a {
|
||||
#navrow1 .tablist a:not(#MSearchClose), #navrow2 .tablist a, #navrow3 .tablist a, #navrow4 .tablist a {
|
||||
display: block;
|
||||
margin: 8px 0;
|
||||
padding: 0 8px;
|
||||
@@ -1246,7 +1295,7 @@ div.contents ul li {
|
||||
width: 24px;
|
||||
height: 18px;
|
||||
margin-bottom: 4px;
|
||||
background-image:url('ftv2folderopen.png');
|
||||
background-image:url('folderopen.svg');
|
||||
background-position: 0px -4px;
|
||||
background-repeat: repeat-y;
|
||||
vertical-align:top;
|
||||
@@ -1257,7 +1306,7 @@ div.contents ul li {
|
||||
width: 24px;
|
||||
height: 18px;
|
||||
margin-bottom: 4px;
|
||||
background-image:url('ftv2folderclosed.png');
|
||||
background-image:url('folderclosed.svg');
|
||||
background-position: 0px -4px;
|
||||
background-repeat: repeat-y;
|
||||
vertical-align:top;
|
||||
@@ -1268,7 +1317,7 @@ div.contents ul li {
|
||||
width: 24px;
|
||||
height: 18px;
|
||||
margin-bottom: 4px;
|
||||
background-image:url('ftv2doc.png');
|
||||
background-image:url('doc.svg');
|
||||
background-position: 0px -4px;
|
||||
background-repeat: repeat-y;
|
||||
vertical-align:top;
|
||||
|
||||
+3
-2
@@ -1,8 +1,9 @@
|
||||
</div>
|
||||
<div id="footer-container">
|
||||
<div id="footer">
|
||||
Copyright © Laurent Gomila ::
|
||||
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen</a> ::
|
||||
CSFML is licensed under the terms and conditions of the <a href="https://www.sfml-dev.org/license.php">zlib/png license</a>.<br />
|
||||
Copyright © Laurent Gomila ::
|
||||
Documentation generated by <a href="https://www.doxygen.nl/" title="doxygen website">doxygen</a> ::
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>CSFML - C binding of the Simple and Fast Multimedia Library</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
|
||||
<!--<link rel='stylesheet' type='text/css' href="http://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
|
||||
<link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="banner-container">
|
||||
<div id="banner">
|
||||
<span id="sfml">CSFML</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>CSFML - C binding of the Simple and Fast Multimedia Library</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
|
||||
<!--<link rel='stylesheet' type='text/css' href="http://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
|
||||
<link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" />
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<script type="text/javascript" src="clipboard.js"></script>
|
||||
<script type="text/javascript" src="cookie.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="search/search.css" />
|
||||
<link rel="stylesheet" type="text/css" href="searchOverrides.css" />
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function() { init_search(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="banner-container">
|
||||
<div id="banner">
|
||||
<span id="sfml">CSFML @PROJECT_VERSION@</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div>
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
///
|
||||
/// \section welcome Welcome
|
||||
/// Welcome to the official SFML documentation for C. Here you will find a detailed
|
||||
/// view of all the SFML <a href="./globals_func.htm">functions</a>.<br/>
|
||||
/// view of all the SFML <a href="./globals_func.html">functions</a>.<br/>
|
||||
/// If you are looking for tutorials, you can visit the official website
|
||||
/// at <a href="http://www.sfml-dev.org/">www.sfml-dev.org</a>.
|
||||
/// at <a href="https://www.sfml-dev.org/">www.sfml-dev.org</a>.
|
||||
///
|
||||
/// \section example Short example
|
||||
/// Here is a short example, to show you how simple it is to use SFML in C :
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/* Override search/search.css rules to adjust seach box placement */
|
||||
#MSearchBox {
|
||||
position: relative;
|
||||
display: block;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
border-width: 1px;
|
||||
border-color: #BBB;
|
||||
border-style: solid;
|
||||
}
|
||||
.right #MSearchClose {
|
||||
margin: 0;
|
||||
right: auto;
|
||||
}
|
||||
#MSearchResultsWindow {
|
||||
background-color: #EAF5DB;
|
||||
border-color: #999;
|
||||
}
|
||||
#MSearchResults > .SRPage {
|
||||
background-color: #EAF5DB;
|
||||
}
|
||||
a.SRSymbol {
|
||||
color: rgb(70, 100, 30);
|
||||
}
|
||||
a.SRSymbol:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
a.SRScope {
|
||||
color: rgb(70, 100, 30);
|
||||
}
|
||||
a.SRScope:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
#MSearchSelectWindow {
|
||||
background-color: #EAF5DB;
|
||||
}
|
||||
#MSearchSelectWindow > a.SelectItem {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
}
|
||||
#MSearchSelectWindow > a.SelectItem:hover {
|
||||
color: white;
|
||||
background-color: #8CC841;
|
||||
text-decoration: none;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
set(SRC example.c)
|
||||
|
||||
add_executable(example ${SRC})
|
||||
target_link_libraries(example PRIVATE csfml-graphics csfml-audio)
|
||||
set_file_warnings(${SRC})
|
||||
Binary file not shown.
@@ -0,0 +1,89 @@
|
||||
#include <SFML/Audio.h>
|
||||
#include <SFML/Graphics.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Create the main window
|
||||
const sfVideoMode mode = {800, 600, 32};
|
||||
sfRenderWindow* window = sfRenderWindow_create(mode, "SFML window", sfResize | sfClose, NULL);
|
||||
if (!window)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
// Load a sprite to display
|
||||
sfTexture* texture = sfTexture_createFromFile("sfml_logo.png", NULL);
|
||||
if (!texture)
|
||||
{
|
||||
sfRenderWindow_destroy(window);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
sfSprite* sprite = sfSprite_create();
|
||||
sfSprite_setTexture(sprite, texture, sfTrue);
|
||||
const sfVector2f spritePosition = {200, 200};
|
||||
sfSprite_setPosition(sprite, spritePosition);
|
||||
|
||||
// Create a graphical text to display
|
||||
sfFont* font = sfFont_createFromFile("tuffy.ttf");
|
||||
if (!font)
|
||||
{
|
||||
sfSprite_destroy(sprite);
|
||||
sfTexture_destroy(texture);
|
||||
sfRenderWindow_destroy(window);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
sfText* text = sfText_create();
|
||||
sfText_setString(text, "Hello, SFML!");
|
||||
sfText_setFont(text, font);
|
||||
sfText_setCharacterSize(text, 50);
|
||||
|
||||
// Load a music to play
|
||||
sfMusic* music = sfMusic_createFromFile("doodle_pop.ogg");
|
||||
if (!music)
|
||||
{
|
||||
sfText_destroy(text);
|
||||
sfFont_destroy(font);
|
||||
sfSprite_destroy(sprite);
|
||||
sfTexture_destroy(texture);
|
||||
sfRenderWindow_destroy(window);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Play the music
|
||||
sfMusic_play(music);
|
||||
|
||||
// Start the game loop
|
||||
sfEvent event;
|
||||
while (sfRenderWindow_isOpen(window))
|
||||
{
|
||||
// Process events
|
||||
while (sfRenderWindow_pollEvent(window, &event))
|
||||
{
|
||||
// Close window : exit
|
||||
if (event.type == sfEvtClosed)
|
||||
sfRenderWindow_close(window);
|
||||
}
|
||||
|
||||
// Clear the screen
|
||||
sfRenderWindow_clear(window, sfBlack);
|
||||
|
||||
// Draw the sprite
|
||||
sfRenderWindow_drawSprite(window, sprite, NULL);
|
||||
|
||||
// Draw the text
|
||||
sfRenderWindow_drawText(window, text, NULL);
|
||||
|
||||
// Update the window
|
||||
sfRenderWindow_display(window);
|
||||
}
|
||||
|
||||
// Cleanup resources
|
||||
sfMusic_destroy(music);
|
||||
sfText_destroy(text);
|
||||
sfFont_destroy(font);
|
||||
sfSprite_destroy(sprite);
|
||||
sfTexture_destroy(texture);
|
||||
sfRenderWindow_destroy(window);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Executable
BIN
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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-2018 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.
|
||||
@@ -68,7 +68,7 @@ CSFML_AUDIO_API void sfListener_setPosition(sfVector3f position);
|
||||
/// \return The listener's position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfListener_getPosition();
|
||||
CSFML_AUDIO_API sfVector3f sfListener_getPosition(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the orientation of the forward vector in the scene
|
||||
@@ -91,7 +91,7 @@ CSFML_AUDIO_API void sfListener_setDirection(sfVector3f direction);
|
||||
/// \return Listener's forward vector (not normalized)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfListener_getDirection();
|
||||
CSFML_AUDIO_API sfVector3f sfListener_getDirection(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the upward vector of the listener in the scene
|
||||
@@ -114,7 +114,7 @@ CSFML_AUDIO_API void sfListener_setUpVector(sfVector3f upVector);
|
||||
/// \return Listener's upward vector (not normalized)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API sfVector3f sfListener_getUpVector();
|
||||
CSFML_AUDIO_API sfVector3f sfListener_getUpVector(void);
|
||||
|
||||
|
||||
#endif // SFML_LISTENER_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
@@ -54,7 +54,7 @@ typedef struct
|
||||
/// This function doesn't start playing the music (call
|
||||
/// sfMusic_play to do so).
|
||||
/// Here is a complete list of all the supported audio formats:
|
||||
/// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// ogg, wav, flac, mp3, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||
///
|
||||
/// \param filename Path of the music file to open
|
||||
@@ -70,7 +70,7 @@ CSFML_AUDIO_API sfMusic* sfMusic_createFromFile(const char* filename);
|
||||
/// This function doesn't start playing the music (call
|
||||
/// sfMusic_play to do so).
|
||||
/// Here is a complete list of all the supported audio formats:
|
||||
/// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// ogg, wav, flac, mp3, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||
///
|
||||
/// \param data Pointer to the file data in memory
|
||||
@@ -87,7 +87,7 @@ CSFML_AUDIO_API sfMusic* sfMusic_createFromMemory(const void* data, size_t sizeI
|
||||
/// This function doesn't start playing the music (call
|
||||
/// sfMusic_play to do so).
|
||||
/// Here is a complete list of all the supported audio formats:
|
||||
/// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// ogg, wav, flac, mp3, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||
///
|
||||
/// \param stream Source stream to read from
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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.
|
||||
@@ -39,7 +39,7 @@
|
||||
/// \brief Create a new sound buffer and load it from a file
|
||||
///
|
||||
/// Here is a complete list of all the supported audio formats:
|
||||
/// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// ogg, wav, flac, mp3, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||
///
|
||||
/// \param filename Path of the sound file to load
|
||||
@@ -53,7 +53,7 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromFile(const char* filename
|
||||
/// \brief Create a new sound buffer and load it from a file in memory
|
||||
///
|
||||
/// Here is a complete list of all the supported audio formats:
|
||||
/// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// ogg, wav, flac, mp3, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||
///
|
||||
/// \param data Pointer to the file data in memory
|
||||
@@ -68,7 +68,7 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromMemory(const void* data,
|
||||
/// \brief Create a new sound buffer and load it from a custom stream
|
||||
///
|
||||
/// Here is a complete list of all the supported audio formats:
|
||||
/// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// ogg, wav, flac, mp3, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||
///
|
||||
/// \param stream Source stream to read from
|
||||
@@ -116,7 +116,7 @@ CSFML_AUDIO_API void sfSoundBuffer_destroy(sfSoundBuffer* soundBuffer);
|
||||
/// \brief Save a sound buffer to an audio file
|
||||
///
|
||||
/// Here is a complete list of all the supported audio formats:
|
||||
/// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// ogg, wav, flac, mp3, aiff, au, raw, paf, svx, nist, voc, ircam,
|
||||
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||
///
|
||||
/// \param soundBuffer Sound buffer object
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
@@ -129,5 +129,37 @@ CSFML_AUDIO_API sfBool sfSoundBufferRecorder_setDevice(sfSoundBufferRecorder* so
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API const char* sfSoundBufferRecorder_getDevice(sfSoundBufferRecorder* soundBufferRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the channel count of the audio capture device
|
||||
///
|
||||
/// This method allows you to specify the number of channels
|
||||
/// used for recording. Currently only 16-bit mono and
|
||||
/// 16-bit stereo are supported.
|
||||
///
|
||||
/// \param soundBufferRecorder Sound buffer recorder object
|
||||
/// \param channelCount Number of channels. Currently only
|
||||
/// mono (1) and stereo (2) are supported.
|
||||
///
|
||||
/// \see sfSoundBufferRecorder_getChannelCount
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API void sfSoundBufferRecorder_setChannelCount(sfSoundBufferRecorder* soundBufferRecorder,
|
||||
unsigned int channelCount);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the number of channels used by this recorder
|
||||
///
|
||||
/// Currently only mono and stereo are supported, so the
|
||||
/// value is either 1 (for mono) or 2 (for stereo).
|
||||
///
|
||||
/// \param soundBufferRecorder Sound buffer recorder object
|
||||
///
|
||||
/// \return Number of channels
|
||||
///
|
||||
/// \see sfSoundBufferRecorder_setChannelCount
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API unsigned int sfSoundBufferRecorder_getChannelCount(const sfSoundBufferRecorder* soundBufferRecorder);
|
||||
|
||||
|
||||
#endif // SFML_SOUNDBUFFERRECORDER_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
@@ -135,11 +135,11 @@ CSFML_AUDIO_API sfBool sfSoundRecorder_isAvailable(void);
|
||||
CSFML_AUDIO_API void sfSoundRecorder_setProcessingInterval(sfSoundRecorder* soundRecorder, sfTime interval);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a list of the names of all availabe audio capture devices
|
||||
/// \brief Get a list of the names of all available audio capture devices
|
||||
///
|
||||
/// This function returns an array of strings (null terminated),
|
||||
/// containing the names of all availabe audio capture devices.
|
||||
/// If no devices are available then NULL is returned.
|
||||
/// containing the names of all available audio capture devices.
|
||||
/// If no devices are available, then NULL is returned.
|
||||
///
|
||||
/// \param count Pointer to a variable that will be filled with the number of modes in the array
|
||||
///
|
||||
@@ -157,7 +157,7 @@ CSFML_AUDIO_API const char** sfSoundRecorder_getAvailableDevices(size_t* count);
|
||||
/// \return The name of the default audio capture device (null terminated)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_AUDIO_API const char* sfSoundRecorder_getDefaultDevice();
|
||||
CSFML_AUDIO_API const char* sfSoundRecorder_getDefaultDevice(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the audio capture device
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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-2018 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-2018 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,7 @@
|
||||
// Define the CSFML version
|
||||
////////////////////////////////////////////////////////////
|
||||
#define CSFML_VERSION_MAJOR 2
|
||||
#define CSFML_VERSION_MINOR 5
|
||||
#define CSFML_VERSION_MINOR 6
|
||||
#define CSFML_VERSION_PATCH 1
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
// ...
|
||||
// };
|
||||
//
|
||||
// CSFML_DEPRECATED void globalFunc();
|
||||
// CSFML_DEPRECATED void globalFunc(void);
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(CSFML_NO_DEPRECATED_WARNINGS)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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-2018 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.
|
||||
@@ -56,9 +56,11 @@ typedef enum
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfBlendEquationAdd, ///< Pixel = Src * SrcFactor + Dst * DstFactor
|
||||
sfBlendEquationSubtract, ///< Pixel = Src * SrcFactor - Dst * DstFactor
|
||||
sfBlendEquationReverseSubtract ///< Pixel = Dst * DstFactor - Src * SrcFactor
|
||||
sfBlendEquationAdd, ///< Pixel = Src * SrcFactor + Dst * DstFactor
|
||||
sfBlendEquationSubtract, ///< Pixel = Src * SrcFactor - Dst * DstFactor
|
||||
sfBlendEquationReverseSubtract, ///< Pixel = Dst * DstFactor - Src * SrcFactor
|
||||
sfBlendEquationMin, ///< Pixel = min(Dst, Src)
|
||||
sfBlendEquationMax ///< Pixel = max(Dst, Src)
|
||||
} sfBlendEquation;
|
||||
|
||||
|
||||
@@ -80,6 +82,8 @@ typedef struct
|
||||
CSFML_GRAPHICS_API const sfBlendMode sfBlendAlpha; ///< Blend source and dest according to dest alpha
|
||||
CSFML_GRAPHICS_API const sfBlendMode sfBlendAdd; ///< Add source to dest
|
||||
CSFML_GRAPHICS_API const sfBlendMode sfBlendMultiply; ///< Multiply source and dest
|
||||
CSFML_GRAPHICS_API const sfBlendMode sfBlendMin; ///< Take minimum between source and dest
|
||||
CSFML_GRAPHICS_API const sfBlendMode sfBlendMax; ///< Take maximum between source and dest
|
||||
CSFML_GRAPHICS_API const sfBlendMode sfBlendNone; ///< Overwrite dest with source
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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-2018 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-2018 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-2018 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.
|
||||
@@ -99,6 +99,25 @@ CSFML_GRAPHICS_API void sfFont_destroy(sfFont* font);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfGlyph sfFont_getGlyph(const sfFont* font, sfUint32 codePoint, unsigned int characterSize, sfBool bold, float outlineThickness);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Determine if this font has a glyph representing the requested code point
|
||||
///
|
||||
/// Most fonts only include a very limited selection of glyphs from
|
||||
/// specific Unicode subsets, like Latin, Cyrillic, or Asian characters.
|
||||
///
|
||||
/// While code points without representation will return a font specific
|
||||
/// default character, it might be useful to verify whether specific
|
||||
/// code points are included to determine whether a font is suited
|
||||
/// to display text in a specific language.
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param codePoint Unicode code point to check
|
||||
///
|
||||
/// \return sfTrue if the codepoint has a glyph representation, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfFont_hasGlyph(const sfFont* font, sfUint32 codePoint);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the kerning value corresponding to a given pair of characters in a font
|
||||
///
|
||||
@@ -112,6 +131,19 @@ CSFML_GRAPHICS_API sfGlyph sfFont_getGlyph(const sfFont* font, sfUint32 codePoin
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfFont_getKerning(const sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the bold kerning value corresponding to a given pair of characters in a font
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param first Unicode code point of the first character
|
||||
/// \param second Unicode code point of the second character
|
||||
/// \param characterSize Character size, in pixels
|
||||
///
|
||||
/// \return Kerning offset, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfFont_getBoldKerning(const sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the line spacing value
|
||||
///
|
||||
@@ -161,6 +193,35 @@ CSFML_GRAPHICS_API float sfFont_getUnderlineThickness(const sfFont* font, unsign
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTexture* sfFont_getTexture(sfFont* font, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable the smooth filter
|
||||
///
|
||||
/// When the filter is activated, the font appears smoother
|
||||
/// so that pixels are less noticeable. However if you want
|
||||
/// the font to look exactly the same as its source file,
|
||||
/// you should disable it.
|
||||
/// The smooth filter is enabled by default.
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param smooth sfTrue to enable smoothing, sfFalse to disable it
|
||||
///
|
||||
/// \see isSmooth
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfFont_setSmooth(sfFont* font, sfBool smooth);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether the smooth filter is enabled or disabled
|
||||
///
|
||||
/// \param font Source font
|
||||
///
|
||||
/// \return sfTrue if smoothing is enabled, sfFalse if it is disabled
|
||||
///
|
||||
/// \see setSmooth
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfFont_isSmooth(const sfFont* font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the font information
|
||||
///
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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-2018 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-2018 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,6 +32,7 @@
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/System/Buffer.h>
|
||||
#include <SFML/System/InputStream.h>
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <stddef.h>
|
||||
@@ -156,9 +157,30 @@ CSFML_GRAPHICS_API void sfImage_destroy(sfImage* image);
|
||||
///
|
||||
/// \return sfTrue if saving was successful
|
||||
///
|
||||
/// \see sfImage_saveToMemory
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfImage_saveToFile(const sfImage* image, const char* filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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 and jpg.
|
||||
/// This function fails if the image is empty, or if
|
||||
/// the format was invalid.
|
||||
///
|
||||
/// \param image Image object
|
||||
/// \param output Buffer to fill with encoded data
|
||||
/// \param format Encoding format to use
|
||||
///
|
||||
/// \return sfTrue if saving was successful
|
||||
///
|
||||
/// \see sfImage_saveToFile
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfImage_saveToMemory(const sfImage* image, sfBuffer* output, const char* format);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the size of an image
|
||||
///
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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,6 +30,8 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
|
||||
#include <SFML/System/Vector2.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfFloatRect and sfIntRect are utility classes for
|
||||
@@ -77,5 +79,27 @@ CSFML_GRAPHICS_API sfBool sfIntRect_contains(const sfIntRect* rect, int x, int y
|
||||
CSFML_GRAPHICS_API sfBool sfFloatRect_intersects(const sfFloatRect* rect1, const sfFloatRect* rect2, sfFloatRect* intersection);
|
||||
CSFML_GRAPHICS_API sfBool sfIntRect_intersects(const sfIntRect* rect1, const sfIntRect* rect2, sfIntRect* intersection);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of the rectangle's top-left corner
|
||||
///
|
||||
/// \return Position of rectangle
|
||||
///
|
||||
/// \see getSize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfFloatRect_getPosition(const sfFloatRect* rect);
|
||||
CSFML_GRAPHICS_API sfVector2i sfIntRect_getPosition(const sfIntRect* rect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the size of the rectangle
|
||||
///
|
||||
/// \return Size of rectangle
|
||||
///
|
||||
/// \see getPosition
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2f sfFloatRect_getSize(const sfFloatRect* rect);
|
||||
CSFML_GRAPHICS_API sfVector2i sfIntRect_getSize(const sfIntRect* rect);
|
||||
|
||||
|
||||
#endif // SFML_RECT_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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.
|
||||
@@ -46,5 +46,10 @@ typedef struct
|
||||
const sfShader* shader; ///< Shader
|
||||
} sfRenderStates;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Define the default values for a RenderState
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfRenderStates sfRenderStates_default(void);
|
||||
|
||||
#endif // SFML_RENDERSTATES_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
@@ -85,6 +85,16 @@ CSFML_GRAPHICS_API void sfRenderTexture_destroy(sfRenderTexture* renderTexture);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2u sfRenderTexture_getSize(const sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell if the render texture will use sRGB encoding when drawing on it
|
||||
///
|
||||
/// \param renderTexture Render texture object
|
||||
///
|
||||
/// \return sfTrue if the render texture use sRGB encoding, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfRenderTexture_isSrgb(const sfRenderTexture* renderTexture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Activate or deactivate a render texture as the current target for rendering
|
||||
///
|
||||
@@ -223,6 +233,20 @@ CSFML_GRAPHICS_API void sfRenderTexture_drawRectangleShape(sfRenderTexture* rend
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_drawVertexArray(sfRenderTexture* renderTexture, const sfVertexArray* object, const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_drawVertexBuffer(sfRenderTexture* renderTexture, const sfVertexBuffer* object, const sfRenderStates* states);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Draw primitives defined by a vertex buffer.
|
||||
///
|
||||
/// \param renderTexture render texture object
|
||||
/// \param object Vertex buffer object to draw
|
||||
/// \param firstVertex Index of the first vertex to render
|
||||
/// \param vertexCount Number of vertices to render
|
||||
/// \param states Render states to use for drawing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderTexture_drawVertexBufferRange(sfRenderTexture* renderTexture,
|
||||
const sfVertexBuffer* object, size_t firstVertex,
|
||||
size_t vertexCount, const sfRenderStates* states);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Draw primitives defined by an array of vertices to a render texture
|
||||
///
|
||||
@@ -302,7 +326,7 @@ CSFML_GRAPHICS_API const sfTexture* sfRenderTexture_getTexture(const sfRenderTex
|
||||
/// \return The maximum anti-aliasing level supported by the system
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfRenderTexture_getMaximumAntialiasingLevel();
|
||||
CSFML_GRAPHICS_API unsigned int sfRenderTexture_getMaximumAntialiasingLevel(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable the smooth filter on a render texture
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
@@ -161,6 +161,16 @@ CSFML_GRAPHICS_API void sfRenderWindow_setPosition(sfRenderWindow* renderWindow,
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2u sfRenderWindow_getSize(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell if the render window will use sRGB encoding when drawing on it
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
///
|
||||
/// \return sfTrue if the render window use sRGB encoding, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfRenderWindow_isSrgb(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the size of the rendering region of a render window
|
||||
///
|
||||
@@ -466,6 +476,20 @@ CSFML_GRAPHICS_API void sfRenderWindow_drawRectangleShape(sfRenderWindow* render
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_drawVertexArray(sfRenderWindow* renderWindow, const sfVertexArray* object, const sfRenderStates* states);
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_drawVertexBuffer(sfRenderWindow* renderWindow, const sfVertexBuffer* object, const sfRenderStates* states);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Draw primitives defined by a vertex buffer.
|
||||
///
|
||||
/// \param renderWindow Render window object
|
||||
/// \param object Vertex buffer object to draw
|
||||
/// \param firstVertex Index of the first vertex to render
|
||||
/// \param vertexCount Number of vertices to render
|
||||
/// \param states Render states to use for drawing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfRenderWindow_drawVertexBufferRange(sfRenderWindow* renderWindow,
|
||||
const sfVertexBuffer* object, size_t firstVertex,
|
||||
size_t vertexCount, const sfRenderStates* states);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Draw primitives defined by an array of vertices to a render window
|
||||
///
|
||||
@@ -594,5 +618,18 @@ CSFML_GRAPHICS_API void sfMouse_setPositionRenderWindow(sfVector2i position, con
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWindow* relativeTo);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a Vulkan rendering surface
|
||||
///
|
||||
/// \param renderWindow RenderWindow object
|
||||
/// \param instance Vulkan instance
|
||||
/// \param surface Created surface
|
||||
/// \param allocator Allocator to use
|
||||
///
|
||||
/// \return True if surface creation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfRenderWindow_createVulkanSurface(sfRenderWindow* renderWindow, const VkInstance* instance, VkSurfaceKHR* surface, const VkAllocationCallbacks* allocator);
|
||||
|
||||
|
||||
#endif // SFML_RENDERWINDOW_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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-2018 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-2018 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-2018 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,6 +36,15 @@
|
||||
#include <SFML/System/Vector2.h>
|
||||
#include <stddef.h>
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Types of texture coordinates that can be used for rendering.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfTextureNormalized, ///< sfTexture coordinates in range [0 .. 1].
|
||||
sfTexturePixels ///< sfTexture coordinates in range [0 .. size].
|
||||
} sfTextureCoordinateType;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new texture
|
||||
@@ -59,6 +68,29 @@ CSFML_GRAPHICS_API sfTexture* sfTexture_create(unsigned int width, unsigned int
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createFromFile(const char* filename, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sRGB-enabled texture from a file
|
||||
///
|
||||
/// When providing texture data from an image file or memory, it can
|
||||
/// either be stored in a linear color space or an sRGB color space.
|
||||
/// Most digital images account for gamma correction already, so they
|
||||
/// would need to be "uncorrected" back to linear color space before
|
||||
/// being processed by the hardware. The hardware can automatically
|
||||
/// convert it from the sRGB color space to a linear color space when
|
||||
/// it gets sampled. When the rendered image gets output to the final
|
||||
/// framebuffer, it gets converted back to sRGB.
|
||||
///
|
||||
/// This load option is only useful in conjunction with an sRGB capable
|
||||
/// framebuffer. This can be requested during window creation.
|
||||
///
|
||||
/// \param filename Path of the image file to load
|
||||
/// \param area Area of the source image to load (NULL to load the entire image)
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromFile(const char* filename, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new texture from a file in memory
|
||||
///
|
||||
@@ -71,6 +103,18 @@ CSFML_GRAPHICS_API sfTexture* sfTexture_createFromFile(const char* filename, con
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createFromMemory(const void* data, size_t sizeInBytes, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sRGB-enabled texture from a file in memory
|
||||
///
|
||||
/// \param data Pointer to the file data in memory
|
||||
/// \param sizeInBytes Size of the data to load, in bytes
|
||||
/// \param area Area of the source image to load (NULL to load the entire image)
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromMemory(const void* data, size_t sizeInBytes, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new texture from a custom stream
|
||||
///
|
||||
@@ -82,6 +126,17 @@ CSFML_GRAPHICS_API sfTexture* sfTexture_createFromMemory(const void* data, size_
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createFromStream(sfInputStream* stream, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sRGB-enabled texture from a custom stream
|
||||
///
|
||||
/// \param stream Source stream to read from
|
||||
/// \param area Area of the source image to load (NULL to load the entire image)
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromStream(sfInputStream* stream, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new texture from an image
|
||||
///
|
||||
@@ -93,6 +148,17 @@ CSFML_GRAPHICS_API sfTexture* sfTexture_createFromStream(sfInputStream* stream,
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createFromImage(const sfImage* image, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new sRGB-enabled texture from an image
|
||||
///
|
||||
/// \param image Image to upload to the texture
|
||||
/// \param area Area of the source image to load (NULL to load the entire image)
|
||||
///
|
||||
/// \return A new sfTexture object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfTexture* sfTexture_createSrgbFromImage(const sfImage* image, const sfIntRect* area);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy an existing texture
|
||||
///
|
||||
@@ -214,37 +280,15 @@ CSFML_GRAPHICS_API void sfTexture_setSmooth(sfTexture* texture, sfBool smooth);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfTexture_isSmooth(const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable conversion from sRGB
|
||||
///
|
||||
/// When providing texture data from an image file or memory, it can
|
||||
/// either be stored in a linear color space or an sRGB color space.
|
||||
/// Most digital images account for gamma correction already, so they
|
||||
/// would need to be "uncorrected" back to linear color space before
|
||||
/// being processed by the hardware. The hardware can automatically
|
||||
/// convert it from the sRGB color space to a linear color space when
|
||||
/// it gets sampled. When the rendered image gets output to the final
|
||||
/// framebuffer, it gets converted back to sRGB.
|
||||
///
|
||||
/// After enabling or disabling sRGB conversion, make sure to reload
|
||||
/// the texture data in order for the setting to take effect.
|
||||
///
|
||||
/// This option is only useful in conjunction with an sRGB capable
|
||||
/// framebuffer. This can be requested during window creation.
|
||||
///
|
||||
/// \param sRgb True to enable sRGB conversion, false to disable it
|
||||
///
|
||||
/// \see sfTexture_isSrgb
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTexture_setSrgb(sfTexture* texture, sfBool sRgb);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether the texture source is converted from sRGB or not
|
||||
///
|
||||
/// \return True if the texture source is converted from sRGB, false if not
|
||||
///
|
||||
/// \see sfTexture_setSrgb
|
||||
/// \see sfTexture_createSrgbFromFile
|
||||
/// \see sfTexture_createSrgbFromMemory
|
||||
/// \see sfTexture_createSrgbFromStream
|
||||
/// \see sfTexture_createSrgbFromImage
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfTexture_isSrgb(const sfTexture* texture);
|
||||
@@ -351,7 +395,7 @@ CSFML_GRAPHICS_API unsigned int sfTexture_getNativeHandle(const sfTexture* textu
|
||||
/// \param texture Pointer to the texture to bind, can be null to use no texture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture* texture);
|
||||
CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture* texture, sfTextureCoordinateType type);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the maximum texture size allowed
|
||||
@@ -359,7 +403,7 @@ CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture* texture);
|
||||
/// \return Maximum size allowed for textures, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfTexture_getMaximumSize();
|
||||
CSFML_GRAPHICS_API unsigned int sfTexture_getMaximumSize(void);
|
||||
|
||||
|
||||
#endif // SFML_TEXTURE_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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-2018 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-2018 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-2018 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-2018 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.
|
||||
@@ -248,7 +248,7 @@ CSFML_GRAPHICS_API void sfVertexBuffer_bind(const sfVertexBuffer* vertexBuffer);
|
||||
/// \return True if vertex buffers are supported, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfVertexBuffer_isAvailable();
|
||||
CSFML_GRAPHICS_API sfBool sfVertexBuffer_isAvailable(void);
|
||||
|
||||
|
||||
#endif // SFML_VERTEXBUFFER_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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-2018 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-2018 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-2018 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-2018 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-2018 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.
|
||||
@@ -69,6 +69,18 @@ CSFML_NETWORK_API void sfPacket_destroy(sfPacket* packet);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API void sfPacket_append(sfPacket* packet, const void* data, size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current reading position in the packet
|
||||
///
|
||||
/// The next read operation will read data from this position
|
||||
///
|
||||
/// \return The byte offset of the current read position
|
||||
///
|
||||
/// \see append
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API size_t sfPacket_getReadPosition(const sfPacket* packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Clear a packet
|
||||
///
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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-2018 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-2018 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-2018 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-2018 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.
|
||||
@@ -203,7 +203,7 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receivePacket(sfUdpSocket* socket,
|
||||
/// \return The maximum size of a UDP datagram (message)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_NETWORK_API unsigned int sfUdpSocket_maxDatagramSize();
|
||||
CSFML_NETWORK_API unsigned int sfUdpSocket_maxDatagramSize(void);
|
||||
|
||||
|
||||
#endif // SFML_UDPSOCKET_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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,6 +30,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/System/Buffer.h>
|
||||
#include <SFML/System/Clock.h>
|
||||
#include <SFML/System/InputStream.h>
|
||||
#include <SFML/System/Mutex.h>
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_ALLOC_H
|
||||
#define SFML_ALLOC_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Export.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Deallocates memory
|
||||
///
|
||||
/// This function deallocates the memory being pointed to
|
||||
/// using the free function from the C standard library.
|
||||
///
|
||||
/// The memory must have been previously allocated using a call
|
||||
/// to malloc.
|
||||
///
|
||||
/// \param ptr Pointer to the memory to deallocate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API void sfFree(void* ptr);
|
||||
|
||||
|
||||
#endif // SFML_ALLOC_H
|
||||
@@ -0,0 +1,73 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_BUFFER_H
|
||||
#define SFML_BUFFER_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Export.h>
|
||||
#include <SFML/System/Types.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create an empty buffer
|
||||
///
|
||||
/// \return A new sfBuffer object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API sfBuffer* sfBuffer_create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destroy an existing buffer
|
||||
///
|
||||
/// \param buffer Buffer to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API void sfBuffer_destroy(sfBuffer* buffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the size of a buffer
|
||||
///
|
||||
/// \param buffer Buffer object
|
||||
///
|
||||
/// \return Size in bytes
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API size_t sfBuffer_getSize(const sfBuffer* buffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a read-only pointer to the array of bytes of a buffer
|
||||
///
|
||||
/// \param buffer Buffer object
|
||||
///
|
||||
/// \return Read-only pointer to the array of bytes
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API const sfUint8* sfBuffer_getData(const sfBuffer* buffer);
|
||||
|
||||
|
||||
#endif // SFML_BUFFER_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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-2018 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-2018 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-2018 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-2018 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-2018 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-2018 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.
|
||||
@@ -26,6 +26,7 @@
|
||||
#define SFML_SYSTEM_TYPES_H
|
||||
|
||||
|
||||
typedef struct sfBuffer sfBuffer;
|
||||
typedef struct sfClock sfClock;
|
||||
typedef struct sfMutex sfMutex;
|
||||
typedef struct sfThread sfThread;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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-2018 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-2018 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.
|
||||
@@ -42,7 +42,7 @@
|
||||
/// \return Clipboard contents as a locale-dependent ANSI string
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API const char* sfClipboard_getString();
|
||||
CSFML_WINDOW_API const char* sfClipboard_getString(void);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -55,7 +55,7 @@ CSFML_WINDOW_API const char* sfClipboard_getString();
|
||||
/// \return Clipboard contents as UTF-32
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API const sfUint32* sfClipboard_getUnicodeString();
|
||||
CSFML_WINDOW_API const sfUint32* sfClipboard_getUnicodeString(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the content of the clipboard as ANSI string data
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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,6 +32,8 @@
|
||||
#include <SFML/Window/Types.h>
|
||||
#include <SFML/Window/Window.h>
|
||||
|
||||
typedef void (*GlFunctionPointer)(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new context
|
||||
///
|
||||
@@ -50,6 +52,16 @@ CSFML_WINDOW_API sfContext* sfContext_create(void);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfContext_destroy(sfContext* context);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check whether a given OpenGL extension is available.
|
||||
///
|
||||
/// \param name Name of the extension to check for
|
||||
///
|
||||
/// \return True if available, false if unavailable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfBool sfContext_isExtensionAvailable(const char* name);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Activate or deactivate explicitely a context
|
||||
///
|
||||
@@ -61,9 +73,21 @@ CSFML_WINDOW_API void sfContext_destroy(sfContext* context);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfBool sfContext_setActive(sfContext* context, sfBool active);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the address of an OpenGL function.
|
||||
///
|
||||
/// \param name Name of the function to get the address of
|
||||
///
|
||||
/// \return Address of the OpenGL function, 0 on failure
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API GlFunctionPointer sfContext_getFunction(const char* name);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the settings of the context.
|
||||
///
|
||||
/// \param context Context object
|
||||
///
|
||||
/// Note that these settings may be different than the ones passed to the
|
||||
/// constructor; they are indeed adjusted if the original settings are not
|
||||
/// directly supported by the system.
|
||||
@@ -82,6 +106,6 @@ CSFML_WINDOW_API sfContextSettings sfContext_getSettings(const sfContext* contex
|
||||
/// \return The active context's ID or 0 if no context is currently active
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfUint64 sfContext_getActiveContextId();
|
||||
CSFML_WINDOW_API sfUint64 sfContext_getActiveContextId(void);
|
||||
|
||||
#endif // SFML_CONTEXT_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
@@ -50,6 +50,14 @@
|
||||
/// sfCursorSizeVertical | yes | yes | yes
|
||||
/// sfCursorSizeTopLeftBottomRight | no | no | yes
|
||||
/// sfCursorSizeBottomLeftTopRight | no | no | yes
|
||||
/// sfCursorSizeLeft | yes | yes | yes
|
||||
/// sfCursorSizeRight | yes | yes | yes
|
||||
/// sfCursorSizeTop | yes | yes | yes
|
||||
/// sfCursorSizeBottom | yes | yes | yes
|
||||
/// sfCursorSizeTopLeft | yes | yes | yes
|
||||
/// sfCursorSizeTopRight | yes | yes | yes
|
||||
/// sfCursorSizeBottomLeft | yes | yes | yes
|
||||
/// sfCursorSizeBottomRight | yes | yes | yes
|
||||
/// sfCursorSizeAll | yes | no | yes
|
||||
/// sfCursorCross | yes | yes | yes
|
||||
/// sfCursorHelp | yes | no | yes
|
||||
@@ -67,6 +75,14 @@ typedef enum
|
||||
sfCursorSizeVertical, ///< Vertical double arrow cursor
|
||||
sfCursorSizeTopLeftBottomRight, ///< Double arrow cursor going from top-left to bottom-right
|
||||
sfCursorSizeBottomLeftTopRight, ///< Double arrow cursor going from bottom-left to top-right
|
||||
sfCursorSizeLeft, ///< Left arrow cursor on Linux, same as SizeHorizontal on other platforms
|
||||
sfCursorSizeRight, ///< Right arrow cursor on Linux, same as SizeHorizontal on other platforms
|
||||
sfCursorSizeTop, ///< Up arrow cursor on Linux, same as SizeVertical on other platforms
|
||||
sfCursorSizeBottom, ///< Down arrow cursor on Linux, same as SizeVertical on other platforms
|
||||
sfCursorSizeTopLeft, ///< Top-left arrow cursor on Linux, same as SizeTopLeftBottomRight on other platforms
|
||||
sfCursorSizeBottomRight, ///< Bottom-right arrow cursor on Linux, same as SizeTopLeftBottomRight on other platforms
|
||||
sfCursorSizeBottomLeft, ///< Bottom-left arrow cursor on Linux, same as SizeBottomLeftTopRight on other platforms
|
||||
sfCursorSizeTopRight, ///< Top-right arrow cursor on Linux, same as SizeBottomLeftTopRight on other platforms
|
||||
sfCursorSizeAll, ///< Combination of SizeHorizontal and SizeVertical
|
||||
sfCursorCross, ///< Crosshair cursor
|
||||
sfCursorHelp, ///< Help cursor
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
@@ -65,7 +65,7 @@ typedef enum
|
||||
sfEvtTouchEnded, ///< A touch event ended (data in event.touch)
|
||||
sfEvtSensorChanged, ///< A sensor value changed (data in event.sensor)
|
||||
|
||||
sfEvtCount, ///< Keep last -- the total number of event types
|
||||
sfEvtCount ///< Keep last -- the total number of event types
|
||||
} sfEventType;
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ typedef struct
|
||||
{
|
||||
sfEventType type;
|
||||
sfKeyCode code;
|
||||
sfScancode scancode;
|
||||
sfBool alt;
|
||||
sfBool control;
|
||||
sfBool shift;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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-2018 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-2018 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.
|
||||
|
||||
+257
-13
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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,6 +34,10 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Key codes
|
||||
///
|
||||
/// The enumerators refer to the "localized" key; i.e. depending
|
||||
/// on the layout set by the operating system, a key can be mapped
|
||||
/// to `Y` or `Z`.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
@@ -78,21 +82,21 @@ typedef enum
|
||||
sfKeyLControl, ///< The left Control key
|
||||
sfKeyLShift, ///< The left Shift key
|
||||
sfKeyLAlt, ///< The left Alt key
|
||||
sfKeyLSystem, ///< The left OS specific key: window (Windows and Linux), apple (MacOS X), ...
|
||||
sfKeyLSystem, ///< The left OS specific key: window (Windows and Linux), apple (macOS), ...
|
||||
sfKeyRControl, ///< The right Control key
|
||||
sfKeyRShift, ///< The right Shift key
|
||||
sfKeyRAlt, ///< The right Alt key
|
||||
sfKeyRSystem, ///< The right OS specific key: window (Windows and Linux), apple (MacOS X), ...
|
||||
sfKeyRSystem, ///< The right OS specific key: window (Windows and Linux), apple (macOS), ...
|
||||
sfKeyMenu, ///< The Menu key
|
||||
sfKeyLBracket, ///< The [ key
|
||||
sfKeyRBracket, ///< The ] key
|
||||
sfKeySemicolon, ///< The ; key
|
||||
sfKeyComma, ///< The , key
|
||||
sfKeyPeriod, ///< The . key
|
||||
sfKeyQuote, ///< The ' key
|
||||
sfKeyApostrophe, ///< The ' key
|
||||
sfKeySlash, ///< The / key
|
||||
sfKeyBackslash, ///< The \ key
|
||||
sfKeyTilde, ///< The ~ key
|
||||
sfKeyGrave, ///< The ` key
|
||||
sfKeyEqual, ///< The = key
|
||||
sfKeyHyphen, ///< The - key (hyphen)
|
||||
sfKeySpace, ///< The Space key
|
||||
@@ -144,14 +148,184 @@ typedef enum
|
||||
|
||||
// Deprecated values:
|
||||
|
||||
sfKeyDash = sfKeyHyphen, ///< \deprecated Use Hyphen instead
|
||||
sfKeyBack = sfKeyBackspace, ///< \deprecated Use Backspace instead
|
||||
sfKeyBackSlash = sfKeyBackslash, ///< \deprecated Use Backslash instead
|
||||
sfKeySemiColon = sfKeySemicolon, ///< \deprecated Use Semicolon instead
|
||||
sfKeyReturn = sfKeyEnter ///< \deprecated Use Enter instead
|
||||
sfKeyTilde = sfKeyGrave, ///< \deprecated Use Grave instead
|
||||
sfKeyDash = sfKeyHyphen, ///< \deprecated Use Hyphen instead
|
||||
sfKeyBack = sfKeyBackspace, ///< \deprecated Use Backspace instead
|
||||
sfKeyBackSlash = sfKeyBackslash, ///< \deprecated Use Backslash instead
|
||||
sfKeySemiColon = sfKeySemicolon, ///< \deprecated Use Semicolon instead
|
||||
sfKeyReturn = sfKeyEnter, ///< \deprecated Use Enter instead
|
||||
sfKeyQuote = sfKeyApostrophe ///< \deprecated Use Apostrophe instead
|
||||
} sfKeyCode;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Scancodes
|
||||
///
|
||||
/// The enumerators are bound to a physical key and do not depend on
|
||||
/// the keyboard layout used by the operating system. Usually, the AT-101
|
||||
/// keyboard can be used as reference for the physical position of the keys.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfScanUnknown = -1, //!< Represents any scancode not present in this enum
|
||||
sfScanA = 0, //!< Keyboard a and A key
|
||||
sfScanB, //!< Keyboard b and B key
|
||||
sfScanC, //!< Keyboard c and C key
|
||||
sfScanD, //!< Keyboard d and D key
|
||||
sfScanE, //!< Keyboard e and E key
|
||||
sfScanF, //!< Keyboard f and F key
|
||||
sfScanG, //!< Keyboard g and G key
|
||||
sfScanH, //!< Keyboard h and H key
|
||||
sfScanI, //!< Keyboard i and I key
|
||||
sfScanJ, //!< Keyboard j and J key
|
||||
sfScanK, //!< Keyboard k and K key
|
||||
sfScanL, //!< Keyboard l and L key
|
||||
sfScanM, //!< Keyboard m and M key
|
||||
sfScanN, //!< Keyboard n and N key
|
||||
sfScanO, //!< Keyboard o and O key
|
||||
sfScanP, //!< Keyboard p and P key
|
||||
sfScanQ, //!< Keyboard q and Q key
|
||||
sfScanR, //!< Keyboard r and R key
|
||||
sfScanS, //!< Keyboard s and S key
|
||||
sfScanT, //!< Keyboard t and T key
|
||||
sfScanU, //!< Keyboard u and U key
|
||||
sfScanV, //!< Keyboard v and V key
|
||||
sfScanW, //!< Keyboard w and W key
|
||||
sfScanX, //!< Keyboard x and X key
|
||||
sfScanY, //!< Keyboard y and Y key
|
||||
sfScanZ, //!< Keyboard z and Z key
|
||||
sfScanNum1, //!< Keyboard 1 and ! key
|
||||
sfScanNum2, //!< Keyboard 2 and @ key
|
||||
sfScanNum3, //!< Keyboard 3 and # key
|
||||
sfScanNum4, //!< Keyboard 4 and $ key
|
||||
sfScanNum5, //!< Keyboard 5 and % key
|
||||
sfScanNum6, //!< Keyboard 6 and ^ key
|
||||
sfScanNum7, //!< Keyboard 7 and & key
|
||||
sfScanNum8, //!< Keyboard 8 and * key
|
||||
sfScanNum9, //!< Keyboard 9 and ) key
|
||||
sfScanNum0, //!< Keyboard 0 and ) key
|
||||
sfScanEnter, //!< Keyboard Enter/Return key
|
||||
sfScanEscape, //!< Keyboard Escape key
|
||||
sfScanBackspace, //!< Keyboard Backspace key
|
||||
sfScanTab, //!< Keyboard Tab key
|
||||
sfScanSpace, //!< Keyboard Space key
|
||||
sfScanHyphen, //!< Keyboard - and _ key
|
||||
sfScanEqual, //!< Keyboard = and +
|
||||
sfScanLBracket, //!< Keyboard [ and { key
|
||||
sfScanRBracket, //!< Keyboard ] and } key
|
||||
// For US keyboards mapped to key 29 (Microsoft Keyboard Scan Code Specification)
|
||||
// For Non-US keyboards mapped to key 42 (Microsoft Keyboard Scan Code Specification)
|
||||
// Typical language mappings: Belg:£µ` FrCa:<>} Dan:*' Dutch:`´ Fren:µ* Ger:'# Ital:§ù LatAm:[}` Nor:*@ Span:ç} Swed:*' Swiss:$£} UK:~# Brazil:}]
|
||||
sfScanBackslash, //!< Keyboard \ and | key OR various keys for Non-US keyboards
|
||||
sfScanSemicolon, //!< Keyboard ; and : key
|
||||
sfScanApostrophe, //!< Keyboard ' and " key
|
||||
sfScanGrave, //!< Keyboard ` and ~ key
|
||||
sfScanComma, //!< Keyboard , and < key
|
||||
sfScanPeriod, //!< Keyboard . and > key
|
||||
sfScanSlash, //!< Keyboard / and ? key
|
||||
sfScanF1, //!< Keyboard F1 key
|
||||
sfScanF2, //!< Keyboard F2 key
|
||||
sfScanF3, //!< Keyboard F3 key
|
||||
sfScanF4, //!< Keyboard F4 key
|
||||
sfScanF5, //!< Keyboard F5 key
|
||||
sfScanF6, //!< Keyboard F6 key
|
||||
sfScanF7, //!< Keyboard F7 key
|
||||
sfScanF8, //!< Keyboard F8 key
|
||||
sfScanF9, //!< Keyboard F9 key
|
||||
sfScanF10, //!< Keyboard F10 key
|
||||
sfScanF11, //!< Keyboard F11 key
|
||||
sfScanF12, //!< Keyboard F12 key
|
||||
sfScanF13, //!< Keyboard F13 key
|
||||
sfScanF14, //!< Keyboard F14 key
|
||||
sfScanF15, //!< Keyboard F15 key
|
||||
sfScanF16, //!< Keyboard F16 key
|
||||
sfScanF17, //!< Keyboard F17 key
|
||||
sfScanF18, //!< Keyboard F18 key
|
||||
sfScanF19, //!< Keyboard F19 key
|
||||
sfScanF20, //!< Keyboard F20 key
|
||||
sfScanF21, //!< Keyboard F21 key
|
||||
sfScanF22, //!< Keyboard F22 key
|
||||
sfScanF23, //!< Keyboard F23 key
|
||||
sfScanF24, //!< Keyboard F24 key
|
||||
sfScanCapsLock, //!< Keyboard Caps %Lock key
|
||||
sfScanPrintScreen, //!< Keyboard Print Screen key
|
||||
sfScanScrollLock, //!< Keyboard Scroll %Lock key
|
||||
sfScanPause, //!< Keyboard Pause key
|
||||
sfScanInsert, //!< Keyboard Insert key
|
||||
sfScanHome, //!< Keyboard Home key
|
||||
sfScanPageUp, //!< Keyboard Page Up key
|
||||
sfScanDelete, //!< Keyboard Delete Forward key
|
||||
sfScanEnd, //!< Keyboard End key
|
||||
sfScanPageDown, //!< Keyboard Page Down key
|
||||
sfScanRight, //!< Keyboard Right Arrow key
|
||||
sfScanLeft, //!< Keyboard Left Arrow key
|
||||
sfScanDown, //!< Keyboard Down Arrow key
|
||||
sfScanUp, //!< Keyboard Up Arrow key
|
||||
sfScanNumLock, //!< Keypad Num %Lock and Clear key
|
||||
sfScanNumpadDivide, //!< Keypad / key
|
||||
sfScanNumpadMultiply, //!< Keypad * key
|
||||
sfScanNumpadMinus, //!< Keypad - key
|
||||
sfScanNumpadPlus, //!< Keypad + key
|
||||
sfScanNumpadEqual, //!< keypad = key
|
||||
sfScanNumpadEnter, //!< Keypad Enter/Return key
|
||||
sfScanNumpadDecimal, //!< Keypad . and Delete key
|
||||
sfScanNumpad1, //!< Keypad 1 and End key
|
||||
sfScanNumpad2, //!< Keypad 2 and Down Arrow key
|
||||
sfScanNumpad3, //!< Keypad 3 and Page Down key
|
||||
sfScanNumpad4, //!< Keypad 4 and Left Arrow key
|
||||
sfScanNumpad5, //!< Keypad 5 key
|
||||
sfScanNumpad6, //!< Keypad 6 and Right Arrow key
|
||||
sfScanNumpad7, //!< Keypad 7 and Home key
|
||||
sfScanNumpad8, //!< Keypad 8 and Up Arrow key
|
||||
sfScanNumpad9, //!< Keypad 9 and Page Up key
|
||||
sfScanNumpad0, //!< Keypad 0 and Insert key
|
||||
// For US keyboards doesn't exist
|
||||
// For Non-US keyboards mapped to key 45 (Microsoft Keyboard Scan Code Specification)
|
||||
// Typical language mappings: Belg:<\> FrCa:«°» Dan:<\> Dutch:]|[ Fren:<> Ger:<|> Ital:<> LatAm:<> Nor:<> Span:<> Swed:<|> Swiss:<\> UK:\| Brazil: \|.
|
||||
sfScanNonUsBackslash, //!< Keyboard Non-US \ and | key
|
||||
sfScanApplication, //!< Keyboard Application key
|
||||
sfScanExecute, //!< Keyboard Execute key
|
||||
sfScanModeChange, //!< Keyboard Mode Change key
|
||||
sfScanHelp, //!< Keyboard Help key
|
||||
sfScanMenu, //!< Keyboard Menu key
|
||||
sfScanSelect, //!< Keyboard Select key
|
||||
sfScanRedo, //!< Keyboard Redo key
|
||||
sfScanUndo, //!< Keyboard Undo key
|
||||
sfScanCut, //!< Keyboard Cut key
|
||||
sfScanCopy, //!< Keyboard Copy key
|
||||
sfScanPaste, //!< Keyboard Paste key
|
||||
sfScanVolumeMute, //!< Keyboard Volume Mute key
|
||||
sfScanVolumeUp, //!< Keyboard Volume Up key
|
||||
sfScanVolumeDown, //!< Keyboard Volume Down key
|
||||
sfScanMediaPlayPause, //!< Keyboard Media Play Pause key
|
||||
sfScanMediaStop, //!< Keyboard Media Stop key
|
||||
sfScanMediaNextTrack, //!< Keyboard Media Next Track key
|
||||
sfScanMediaPreviousTrack, //!< Keyboard Media Previous Track key
|
||||
sfScanLControl, //!< Keyboard Left Control key
|
||||
sfScanLShift, //!< Keyboard Left Shift key
|
||||
sfScanLAlt, //!< Keyboard Left Alt key
|
||||
sfScanLSystem, //!< Keyboard Left System key
|
||||
sfScanRControl, //!< Keyboard Right Control key
|
||||
sfScanRShift, //!< Keyboard Right Shift key
|
||||
sfScanRAlt, //!< Keyboard Right Alt key
|
||||
sfScanRSystem, //!< Keyboard Right System key
|
||||
sfScanBack, //!< Keyboard Back key
|
||||
sfScanForward, //!< Keyboard Forward key
|
||||
sfScanRefresh, //!< Keyboard Refresh key
|
||||
sfScanStop, //!< Keyboard Stop key
|
||||
sfScanSearch, //!< Keyboard Search key
|
||||
sfScanFavorites, //!< Keyboard Favorites key
|
||||
sfScanHomePage, //!< Keyboard Home Page key
|
||||
sfScanLaunchApplication1, //!< Keyboard Launch Application 1 key
|
||||
sfScanLaunchApplication2, //!< Keyboard Launch Application 2 key
|
||||
sfScanLaunchMail, //!< Keyboard Launch Mail key
|
||||
sfScanLaunchMediaSelect, //!< Keyboard Launch Media Select key
|
||||
|
||||
sfScancodeCount //!< Keep last -- the total number of scancodes
|
||||
} sfScancode;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a key is pressed
|
||||
///
|
||||
@@ -159,15 +333,85 @@ typedef enum
|
||||
///
|
||||
/// \return sfTrue if the key is pressed, sfFalse otherwise
|
||||
///
|
||||
/// \see sfKeyboard_isScancodePressed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfBool sfKeyboard_isKeyPressed(sfKeyCode key);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a key is pressed
|
||||
///
|
||||
/// \param code Scancode to check
|
||||
///
|
||||
/// \return sfTrue if the physical key is pressed, sfFalse otherwise
|
||||
///
|
||||
/// \see sfKeyboard_isKeyPressed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfBool sfKeyboard_isScancodePressed(sfScancode code);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Localize a physical key to a logical one
|
||||
///
|
||||
/// \param code Scancode to localize
|
||||
///
|
||||
/// \return The key corresponding to the scancode under the current
|
||||
/// keyboard layout used by the operating system, or
|
||||
/// sfKeyUnknown when the scancode cannot be mapped
|
||||
/// to a Key.
|
||||
///
|
||||
/// \see sfKeyboard_delocalize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfKeyCode sfKeyboard_localize(sfScancode code);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Identify the physical key corresponding to a logical one
|
||||
///
|
||||
/// \param key Key to "delocalize"
|
||||
///
|
||||
/// \return The scancode corresponding to the key under the current
|
||||
/// keyboard layout used by the operating system, or
|
||||
/// sfScanUnknown when the key cannot be mapped
|
||||
/// to a sfScancode.
|
||||
///
|
||||
/// \see sfKeyboard_localize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfScancode sfKeyboard_delocalize(sfKeyCode key);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Provide a string representation for a given scancode
|
||||
///
|
||||
/// The returned string is a short, non-technical description of
|
||||
/// the key represented with the given scancode. Most effectively
|
||||
/// used in user interfaces, as the description for the key takes
|
||||
/// the users keyboard layout into consideration.
|
||||
///
|
||||
/// \warning The result is OS-dependent: for example, sfScanLSystem
|
||||
/// is "Left Meta" on Linux, "Left Windows" on Windows and
|
||||
/// "Left Command" on macOS.
|
||||
///
|
||||
/// The current keyboard layout set by the operating system is used to
|
||||
/// interpret the scancode: for example, sfKeySemicolon is
|
||||
/// mapped to ";" for layout and to "é" for others.
|
||||
///
|
||||
/// The returned const char* owns the string and must be freed to
|
||||
/// avoid memory leaks.
|
||||
///
|
||||
/// \param code Scancode to describe
|
||||
///
|
||||
/// \return The localized description of the code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API const char* sfKeyboard_getDescription(sfScancode code);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Show or hide the virtual keyboard.
|
||||
///
|
||||
/// Warning: the virtual keyboard is not supported on all systems.
|
||||
/// It will typically be implemented on mobile OSes (Android, iOS)
|
||||
/// but not on desktop OSes (Windows, Linux, ...).
|
||||
/// \warning The virtual keyboard is not supported on all
|
||||
/// systems. It will typically be implemented on mobile OSes
|
||||
/// (Android, iOS) but not on desktop OSes (Windows, Linux, ...).
|
||||
///
|
||||
/// If the virtual keyboard is not available, this function does nothing.
|
||||
///
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
@@ -94,5 +94,30 @@ CSFML_WINDOW_API sfVector2i sfMouse_getPosition(const sfWindow* relativeTo);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfMouse_setPosition(sfVector2i position, const sfWindow* relativeTo);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of the mouse relative to a window base
|
||||
///
|
||||
/// This function returns the current position of the mouse
|
||||
/// cursor relative to the given window base, or desktop if NULL is passed.
|
||||
///
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
/// \return Position of the mouse cursor, relative to the given window base
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfVector2i sfMouse_getPositionWindowBase(const sfWindowBase* relativeTo);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the current position of the mouse relative to a window base
|
||||
///
|
||||
/// This function sets the current position of the mouse
|
||||
/// cursor relative to the given window base, or desktop if NULL is passed.
|
||||
///
|
||||
/// \param position New position of the mouse
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfMouse_setPositionWindowBase(sfVector2i position, const sfWindowBase* relativeTo);
|
||||
|
||||
|
||||
#endif // SFML_MOUSE_H
|
||||
@@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2018 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.
|
||||
|
||||
Loaded 100 of 244 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user