mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-25 05:03:36 +01:00
Compare commits
278
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2537d27991 | ||
|
|
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 | ||
|
|
f84ff413a1 | ||
|
|
76671cf453 | ||
|
|
ea8048376f | ||
|
|
063923308f | ||
|
|
99cea94aaf | ||
|
|
ffb5763206 | ||
|
|
0f8209fade | ||
|
|
7627ef1c5d | ||
|
|
cdc9bc6a21 | ||
|
|
282621e499 | ||
|
|
1c75ff0546 | ||
|
|
d6f3ec2f34 | ||
|
|
b189a4e168 | ||
|
|
d8e19e74ed | ||
|
|
61f17e3c1d | ||
|
|
93c8f8ee21 | ||
|
|
bff4a69a73 | ||
|
|
3b41d938f9 | ||
|
|
05847516fd | ||
|
|
eb4a9cfe1d | ||
|
|
7ef69e3b1c | ||
|
|
643abd95ea | ||
|
|
75f95202b7 | ||
|
|
fed0b38279 | ||
|
|
55e03e92be | ||
|
|
b4163081ba | ||
|
|
b5facb85d1 | ||
|
|
55be7dbfd6 | ||
|
|
bca82a4c6b | ||
|
|
6dca26ed3c | ||
|
|
8ec6eb094f | ||
|
|
aed28415ed | ||
|
|
2e47e5dbda | ||
|
|
1226d9db94 | ||
|
|
57eda5f923 | ||
|
|
dbc7147b47 | ||
|
|
b56ca39562 | ||
|
|
52c7de16f0 | ||
|
|
4d35e0a91c | ||
|
|
16c3b6936a | ||
|
|
2aee52d65f | ||
|
|
94558cdb63 | ||
|
|
f512854b54 | ||
|
|
d78a8bfa33 | ||
|
|
2017578197 | ||
|
|
6ec6c104a8 | ||
|
|
4e269cf863 | ||
|
|
e4e1bcb139 | ||
|
|
45fe62b7ed | ||
|
|
a192e85345 | ||
|
|
0e8c6379f0 | ||
|
|
8a7ba8ae8e | ||
|
|
9df98d8c17 | ||
|
|
14653882ae | ||
|
|
3f63678eaa | ||
|
|
ac9b33dd1a | ||
|
|
470bf3d190 | ||
|
|
41fa94478a | ||
|
|
3c70f99028 | ||
|
|
15995fa19c | ||
|
|
962a685570 | ||
|
|
ae727f0a04 | ||
|
|
784b20038f | ||
|
|
490a21fdff | ||
|
|
864d7b822a | ||
|
|
16ea259e04 | ||
|
|
36430b11c7 | ||
|
|
826ebac51a | ||
|
|
ce5e3a3891 | ||
|
|
21e8e0523f | ||
|
|
bf46c5386a | ||
|
|
da9cce8350 | ||
|
|
9d757589ba | ||
|
|
74220430ea | ||
|
|
dc3ba7cc33 | ||
|
|
19e3a18cde | ||
|
|
66451e6596 | ||
|
|
92fb5f6dc8 | ||
|
|
ef49a86942 | ||
|
|
e8224208a2 | ||
|
|
e3df1539f5 | ||
|
|
3e767dec4f | ||
|
|
068bb14937 | ||
|
|
d91b8d0dfb | ||
|
|
9bf4197e0a | ||
|
|
ee9b927dec | ||
|
|
9e1cd46c73 | ||
|
|
2e272c187f | ||
|
|
910bcc86d0 | ||
|
|
448949ef7a | ||
|
|
33bf91a1da | ||
|
|
9f4c4abaca | ||
|
|
4069448128 | ||
|
|
4720e109b6 | ||
|
|
f3153dc9c1 | ||
|
|
a424e91a54 | ||
|
|
1d0d7164c8 | ||
|
|
1486a30e2f | ||
|
|
88a59374bc | ||
|
|
78eea7face | ||
|
|
90b168aaaf | ||
|
|
2ca7fbfb61 | ||
|
|
2d9ae6cd04 | ||
|
|
0fe078ec8a | ||
|
|
10d785df80 | ||
|
|
728a0e0002 | ||
|
|
3de58bfef4 | ||
|
|
57d3ee0d89 | ||
|
|
e5c4b0927d | ||
|
|
141fbf55f6 | ||
|
|
aad6f7b2d1 | ||
|
|
944b267262 | ||
|
|
caf9aba55e | ||
|
|
109a02c829 | ||
|
|
d849c0eae5 | ||
|
|
7c6e4e64b5 | ||
|
|
93dd72dc26 | ||
|
|
91a09b3ce5 | ||
|
|
7c5a55746a | ||
|
|
a499927784 | ||
|
|
4cc30a1f21 | ||
|
|
fb1824b3b0 | ||
|
|
1193ded996 | ||
|
|
c1873e4499 | ||
|
|
6ca48631aa | ||
|
|
b7b2ed5d34 | ||
|
|
f532c0dc98 | ||
|
|
15009493e0 | ||
|
|
2636bec9a1 | ||
|
|
a7ff14c407 | ||
|
|
0e6c07a149 | ||
|
|
e10f7caecb | ||
|
|
9f4120faf4 | ||
|
|
4789261e1e | ||
|
|
58781d458e | ||
|
|
6fa1212560 | ||
|
|
62188c38ec | ||
|
|
6667deca6f | ||
|
|
302048d29e | ||
|
|
c8b2e62da0 | ||
|
|
2a2951e608 | ||
|
|
29382a4492 | ||
|
|
848b4d3aaa | ||
|
|
31ac05d8f4 | ||
|
|
8de6cde2d1 | ||
|
|
766398d86e | ||
|
|
d105eded16 | ||
|
|
59a7060088 | ||
|
|
1f8b022d17 | ||
|
|
1529d3fa34 | ||
|
|
c0b80724b4 | ||
|
|
fdf58188ca | ||
|
|
9a2c8d0ecb | ||
|
|
87d69530a0 | ||
|
|
b790fbd28f | ||
|
|
6abeaed4aa | ||
|
|
42c2fb1f5c | ||
|
|
ed44d9e0db | ||
|
|
2a1a11ca4b | ||
|
|
d6849a3d57 | ||
|
|
8478569b4b | ||
|
|
4e509ff160 | ||
|
|
a6fdf83073 | ||
|
|
4b4d84da0b | ||
|
|
ccf18cf8f9 | ||
|
|
b465c53afe | ||
|
|
bc9ae12596 | ||
|
|
6669a6590a | ||
|
|
85a648ccc6 | ||
|
|
bd0faf69c5 | ||
|
|
91e11cc095 | ||
|
|
12b7c5a6a5 | ||
|
|
acfb53c8d5 | ||
|
|
a707c5e0c7 | ||
|
|
c7cabf8fb2 | ||
|
|
f06b95526c |
No files matched your search
@@ -0,0 +1,67 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on: [push, pull_request, workflow_dispatch]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: environment-${{github.ref}}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: ${{ matrix.platform.name }} ${{ matrix.type.name }}
|
||||||
|
runs-on: ${{ matrix.platform.os }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform:
|
||||||
|
- { 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-12, 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@v4
|
||||||
|
with:
|
||||||
|
repository: SFML/SFML
|
||||||
|
ref: 2.6.1
|
||||||
|
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}} -DCMAKE_BUILD_TYPE=${{matrix.type.name}}
|
||||||
|
|
||||||
|
- name: Build SFML
|
||||||
|
shell: bash
|
||||||
|
run: cmake --build $GITHUB_WORKSPACE/SFML/build --config ${{matrix.type.name}} --target install
|
||||||
|
|
||||||
|
- name: Checkout CSFML
|
||||||
|
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_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 ${{matrix.type.name}} --target install
|
||||||
@@ -0,0 +1,249 @@
|
|||||||
|
name: NuGet Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push: {}
|
||||||
|
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,313 @@
|
|||||||
|
name: Release Builds
|
||||||
|
|
||||||
|
on:
|
||||||
|
push: {}
|
||||||
|
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=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 -DCSFML_LINK_SFML_STATICALLY=FALSE -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 "SFML-install\bin\*" -Destination "install\CSFML"
|
||||||
|
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=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 -DCSFML_LINK_SFML_STATICALLY=FALSE -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 "SFML-install\bin\*" -Destination "install\CSFML"
|
||||||
|
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
|
||||||
+70
-25
@@ -1,41 +1,58 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.7.2)
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8)
|
# define a macro that helps defining an option
|
||||||
|
macro(csfml_set_option var default type docstring)
|
||||||
|
if(NOT DEFINED ${var})
|
||||||
|
set(${var} ${default})
|
||||||
|
endif()
|
||||||
|
set(${var} ${${var}} CACHE ${type} ${docstring} FORCE)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# set a default build type if none was provided
|
# set a default build type if none was provided
|
||||||
# this has to be done before the project() instruction!
|
# this has to be done before the project() instruction!
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
csfml_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debug or Release)")
|
||||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# project name
|
# 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 the configuration file
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/Config.cmake)
|
include(${PROJECT_SOURCE_DIR}/cmake/Config.cmake)
|
||||||
|
|
||||||
# setup version numbers
|
# add options to select which modules to build
|
||||||
set(VERSION_MAJOR 2)
|
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.")
|
||||||
set(VERSION_MINOR 0)
|
csfml_set_option(CSFML_BUILD_GRAPHICS TRUE BOOL "TRUE to build CSFML's Graphics module.")
|
||||||
set(VERSION_PATCH 0)
|
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 the CSFML header path
|
# add an option for choosing the build type (shared or static)
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/include)
|
csfml_set_option(BUILD_SHARED_LIBS TRUE BOOL "TRUE to build CSFML as shared libraries, FALSE to build it as static libraries")
|
||||||
|
|
||||||
# force dynamic build (static build is not supported)
|
|
||||||
set(BUILD_SHARED_LIBS TRUE)
|
|
||||||
|
|
||||||
# add an option for building the API documentation
|
# add an option for building the API documentation
|
||||||
set(BUILD_DOC FALSE CACHE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
|
csfml_set_option(CSFML_BUILD_DOC FALSE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
|
||||||
|
|
||||||
|
# add an option for linking to sfml either statically or dynamically
|
||||||
|
# default on windows to static and on other platforms to dynamic
|
||||||
|
if(SFML_OS_WINDOWS)
|
||||||
|
set(LINK_STATICALLY_DEFAULT TRUE)
|
||||||
|
else()
|
||||||
|
set(LINK_STATICALLY_DEFAULT FALSE)
|
||||||
|
endif()
|
||||||
|
csfml_set_option(CSFML_LINK_SFML_STATICALLY ${LINK_STATICALLY_DEFAULT} BOOL "TRUE to link to a static version of SFML, FALSE to link dynamically")
|
||||||
|
|
||||||
# disable the rpath stuff
|
# disable the rpath stuff
|
||||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||||
|
|
||||||
# define an option for choosing between static and dynamic C runtime (Windows only)
|
# define an option for choosing between static and dynamic C runtime (Windows only)
|
||||||
if(WINDOWS)
|
if(SFML_OS_WINDOWS)
|
||||||
set(STATIC_STD_LIBS FALSE CACHE BOOL "TRUE to statically link to the standard libraries, FALSE to use them as DLLs")
|
set(STATIC_STD_LIBS FALSE CACHE BOOL "TRUE to statically link to the standard libraries, FALSE to use them as DLLs")
|
||||||
|
|
||||||
# for VC++, we can apply it globally by modifying the compiler flags
|
# for VC++, we can apply it globally by modifying the compiler flags
|
||||||
if(COMPILER_MSVC AND STATIC_STD_LIBS)
|
if(SFML_COMPILER_MSVC AND STATIC_STD_LIBS)
|
||||||
foreach(flag
|
foreach(flag
|
||||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||||
@@ -48,13 +65,41 @@ endif()
|
|||||||
|
|
||||||
# add the subdirectories
|
# add the subdirectories
|
||||||
add_subdirectory(src/SFML)
|
add_subdirectory(src/SFML)
|
||||||
if(BUILD_DOC)
|
if(CSFML_BUILD_DOC)
|
||||||
add_subdirectory(doc)
|
add_subdirectory(doc)
|
||||||
endif()
|
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
|
# setup the install rules
|
||||||
install(DIRECTORY include
|
install(DIRECTORY include/
|
||||||
DESTINATION .
|
DESTINATION include
|
||||||
COMPONENT devel
|
COMPONENT devel)
|
||||||
PATTERN ".svn" EXCLUDE)
|
install(FILES license.md DESTINATION ${INSTALL_MISC_DIR})
|
||||||
install(FILES license.txt 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()
|
||||||
+41
-31
@@ -1,30 +1,28 @@
|
|||||||
|
|
||||||
# detect the OS
|
# detect the OS
|
||||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||||
set(WINDOWS 1)
|
set(SFML_OS_WINDOWS 1)
|
||||||
|
|
||||||
# detect the architecture (note: this test won't work for cross-compilation)
|
# detect the architecture (note: this test won't work for cross-compilation)
|
||||||
include(CheckTypeSize)
|
include(CheckTypeSize)
|
||||||
check_type_size(void* SIZEOF_VOID_PTR)
|
check_type_size(void* SIZEOF_VOID_PTR)
|
||||||
if(${SIZEOF_VOID_PTR} EQUAL "4")
|
if("${SIZEOF_VOID_PTR}" STREQUAL "4")
|
||||||
set(ARCH_32BITS 1)
|
set(ARCH_32BITS 1)
|
||||||
elseif(${SIZEOF_VOID_PTR} EQUAL "8")
|
elseif("${SIZEOF_VOID_PTR}" STREQUAL "8")
|
||||||
set(ARCH_64BITS 1)
|
set(ARCH_64BITS 1)
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Unsupported architecture")
|
message(FATAL_ERROR "Unsupported architecture")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
set(LINUX 1)
|
set(SFML_OS_LINUX 1)
|
||||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||||
# FreeBSD compile path is the same as Linux
|
set(SFML_OS_FREEBSD 1)
|
||||||
set(LINUX 1)
|
|
||||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
set(MACOSX 1)
|
set(SFML_OS_MACOSX 1)
|
||||||
|
|
||||||
# detect OS X version. (use '/usr/bin/sw_vers -productVersion' to extract V from '10.V.x'.)
|
# detect OS X version. (use '/usr/bin/sw_vers -productVersion' to extract V from '10.V.x'.)
|
||||||
EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW)
|
EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW)
|
||||||
STRING(REGEX REPLACE "10\\.([0-9]).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}")
|
STRING(REGEX REPLACE "10\\.([0-9]+).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}")
|
||||||
if(${MACOSX_VERSION} LESS 5)
|
if(${MACOSX_VERSION} LESS 5)
|
||||||
message(FATAL_ERROR "Unsupported version of OS X : ${MACOSX_VERSION_RAW}")
|
message(FATAL_ERROR "Unsupported version of OS X : ${MACOSX_VERSION_RAW}")
|
||||||
return()
|
return()
|
||||||
@@ -34,29 +32,41 @@ else()
|
|||||||
return()
|
return()
|
||||||
endif()
|
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
|
# detect the compiler and its version
|
||||||
# Note: on some platforms (OS X), CMAKE_COMPILER_IS_GNUCXX is true
|
# Note: The detection is order is important because:
|
||||||
# even when CLANG is used, therefore the Clang test is done first
|
# - Visual Studio can both use MSVC and Clang
|
||||||
if(CMAKE_CXX_COMPILER MATCHES ".*clang[+][+]" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
# - GNUCXX can still be set on macOS when using Clang
|
||||||
# CMAKE_CXX_COMPILER_ID is an internal CMake variable subject to change,
|
if(MSVC)
|
||||||
# but there is no other way to detect CLang at the moment
|
set(SFML_COMPILER_MSVC 1)
|
||||||
set(COMPILER_CLANG 1)
|
|
||||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE CLANG_VERSION_OUTPUT)
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1" CLANG_VERSION "${CLANG_VERSION_OUTPUT}")
|
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)
|
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set(COMPILER_GCC 1)
|
set(SFML_COMPILER_GCC 1)
|
||||||
|
|
||||||
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpversion" OUTPUT_VARIABLE GCC_VERSION_OUTPUT)
|
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpversion" OUTPUT_VARIABLE GCC_VERSION_OUTPUT)
|
||||||
string(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" GCC_VERSION "${GCC_VERSION_OUTPUT}")
|
string(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" SFML_GCC_VERSION "${GCC_VERSION_OUTPUT}")
|
||||||
elseif(MSVC)
|
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE GCC_COMPILER_VERSION)
|
||||||
set(COMPILER_MSVC 1)
|
string(REGEX MATCHALL ".*(tdm[64]*-[1-9]).*" SFML_COMPILER_GCC_TDM "${GCC_COMPILER_VERSION}")
|
||||||
if(MSVC_VERSION EQUAL 1400)
|
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpmachine" OUTPUT_VARIABLE GCC_MACHINE)
|
||||||
set(MSVC_VERSION 2005)
|
string(STRIP "${GCC_MACHINE}" GCC_MACHINE)
|
||||||
elseif(MSVC_VERSION EQUAL 1500)
|
|
||||||
set(MSVC_VERSION 2008)
|
if(GCC_MACHINE MATCHES ".*w64.*")
|
||||||
elseif(MSVC_VERSION EQUAL 1600)
|
set(SFML_COMPILER_GCC_W64 1)
|
||||||
set(MSVC_VERSION 2010)
|
|
||||||
elseif(MSVC_VERSION EQUAL 1700)
|
|
||||||
set(MSVC_VERSION 2011)
|
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Unsupported compiler")
|
message(FATAL_ERROR "Unsupported compiler")
|
||||||
@@ -64,8 +74,8 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# define the install directory for miscellaneous files
|
# define the install directory for miscellaneous files
|
||||||
if(WINDOWS)
|
if(SFML_OS_WINDOWS)
|
||||||
set(INSTALL_MISC_DIR .)
|
set(INSTALL_MISC_DIR .)
|
||||||
elseif(UNIX)
|
elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_MACOSX)
|
||||||
set(INSTALL_MISC_DIR share/CSFML)
|
set(INSTALL_MISC_DIR share/CSFML)
|
||||||
endif()
|
endif()
|
||||||
+34
-60
@@ -1,49 +1,5 @@
|
|||||||
|
include(CMakeParseArguments)
|
||||||
# some of these macros are inspired from the boost/cmake macros
|
include(${PROJECT_SOURCE_DIR}/cmake/CompilerWarnings.cmake)
|
||||||
|
|
||||||
# check if a value is contained in a list
|
|
||||||
# sets ${var} to TRUE if the value is found
|
|
||||||
macro(csfml_list_contains var value)
|
|
||||||
set(${var})
|
|
||||||
foreach(value2 ${ARGN})
|
|
||||||
if(${value} STREQUAL ${value2})
|
|
||||||
set(${var} TRUE)
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# parse a list of arguments and options
|
|
||||||
# ex: sfml_parse_arguments(THIS "SOURCES;DEPENDS" "FLAG" FLAG SOURCES s1 s2 s3 DEPENDS d1 d2)
|
|
||||||
# will define the following variables:
|
|
||||||
# - THIS_SOURCES (s1 s2 s3)
|
|
||||||
# - THIS_DEPENDS (d1 d2)
|
|
||||||
# - THIS_FLAG TRUE
|
|
||||||
macro(csfml_parse_arguments prefix arg_names option_names)
|
|
||||||
foreach(arg_name ${arg_names})
|
|
||||||
set(${prefix}_${arg_name})
|
|
||||||
endforeach()
|
|
||||||
foreach(option_name ${option_names})
|
|
||||||
set(${prefix}_${option_name} FALSE)
|
|
||||||
endforeach()
|
|
||||||
set(current_arg_name)
|
|
||||||
set(current_arg_list)
|
|
||||||
foreach(arg ${ARGN})
|
|
||||||
csfml_list_contains(is_arg_name ${arg} ${arg_names})
|
|
||||||
if(is_arg_name)
|
|
||||||
set(${prefix}_${current_arg_name} ${current_arg_list})
|
|
||||||
set(current_arg_name ${arg})
|
|
||||||
set(current_arg_list)
|
|
||||||
else()
|
|
||||||
csfml_list_contains(is_option ${arg} ${option_names})
|
|
||||||
if(is_option)
|
|
||||||
set(${prefix}_${arg} TRUE)
|
|
||||||
else()
|
|
||||||
set(current_arg_list ${current_arg_list} ${arg})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
set(${prefix}_${current_arg_name} ${current_arg_list})
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# add a new target which is a CSFML library
|
# add a new target which is a CSFML library
|
||||||
# ex: csfml_add_library(csfml-graphics
|
# ex: csfml_add_library(csfml-graphics
|
||||||
@@ -52,25 +8,30 @@ endmacro()
|
|||||||
macro(csfml_add_library target)
|
macro(csfml_add_library target)
|
||||||
|
|
||||||
# parse the arguments
|
# parse the arguments
|
||||||
csfml_parse_arguments(THIS "SOURCES;DEPENDS" "" ${ARGN})
|
cmake_parse_arguments(THIS "" "" "SOURCES;DEPENDS;EXTERNAL_LIBS" ${ARGN})
|
||||||
|
|
||||||
# create the target
|
# create the target
|
||||||
add_library(${target} ${THIS_SOURCES})
|
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
|
# define the export symbol of the module
|
||||||
string(REPLACE "-" "_" NAME_UPPER "${target}")
|
string(REPLACE "-" "_" NAME_UPPER "${target}")
|
||||||
string(TOUPPER "${NAME_UPPER}" NAME_UPPER)
|
string(TOUPPER "${NAME_UPPER}" NAME_UPPER)
|
||||||
set_target_properties(${target} PROPERTIES DEFINE_SYMBOL ${NAME_UPPER}_EXPORTS)
|
set_target_properties(${target} PROPERTIES DEFINE_SYMBOL ${NAME_UPPER}_EXPORTS)
|
||||||
|
|
||||||
# adjust the output file prefix/suffix to match our conventions
|
if(SFML_OS_WINDOWS)
|
||||||
if(WINDOWS)
|
|
||||||
# include the major version number in Windows shared library names (but not import library names)
|
# 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 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()
|
else()
|
||||||
set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d)
|
set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d)
|
||||||
endif()
|
endif()
|
||||||
if (WINDOWS AND COMPILER_GCC)
|
if (SFML_OS_WINDOWS AND SFML_COMPILER_GCC)
|
||||||
# on Windows/gcc get rid of "lib" prefix for shared libraries,
|
# on Windows/gcc get rid of "lib" prefix for shared libraries,
|
||||||
# and transform the ".dll.a" suffix into ".a" for import libraries
|
# and transform the ".dll.a" suffix into ".a" for import libraries
|
||||||
set_target_properties(${target} PROPERTIES PREFIX "")
|
set_target_properties(${target} PROPERTIES PREFIX "")
|
||||||
@@ -78,29 +39,42 @@ macro(csfml_add_library target)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# set the version and soversion of the target (for compatible systems -- mostly Linuxes)
|
# set the version and soversion of the target (for compatible systems -- mostly Linuxes)
|
||||||
set_target_properties(${target} PROPERTIES SOVERSION ${VERSION_MAJOR})
|
set_target_properties(${target} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
|
||||||
set_target_properties(${target} PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR})
|
set_target_properties(${target} PROPERTIES VERSION ${PROJECT_VERSION})
|
||||||
|
|
||||||
# for gcc >= 4.0 on Windows, apply the STATIC_STD_LIBS option if it is enabled
|
# set the target's folder (for IDEs that support it, e.g. Visual Studio)
|
||||||
if(WINDOWS AND COMPILER_GCC AND STATIC_STD_LIBS)
|
set_target_properties(${target} PROPERTIES FOLDER "CSFML")
|
||||||
if(NOT GCC_VERSION VERSION_LESS "4")
|
|
||||||
|
# for gcc >= 4.0 on Windows, apply the SFML_USE_STATIC_STD_LIBS option if it is enabled
|
||||||
|
if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND NOT SFML_GCC_VERSION VERSION_LESS "4")
|
||||||
|
if(SFML_USE_STATIC_STD_LIBS AND NOT SFML_COMPILER_GCC_TDM)
|
||||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
|
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
|
||||||
|
elseif(NOT SFML_USE_STATIC_STD_LIBS AND SFML_COMPILER_GCC_TDM)
|
||||||
|
set_target_properties(${target} PROPERTIES LINK_FLAGS "-shared-libgcc -shared-libstdc++")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# If using gcc >= 4.0 or clang >= 3.0 on a non-Windows platform, we must hide public symbols by default
|
# if using gcc >= 4.0 or clang >= 3.0 on a non-Windows platform, we must hide public symbols by default
|
||||||
# (exported ones are explicitely marked)
|
# (exported ones are explicitely marked)
|
||||||
if(NOT WINDOWS AND ((COMPILER_GCC AND NOT GCC_VERSION VERSION_LESS "4") OR (COMPILER_CLANG AND NOT CLANG_VERSION VERSION_LESS "3")))
|
if(NOT SFML_OS_WINDOWS AND ((SFML_COMPILER_GCC AND NOT SFML_GCC_VERSION VERSION_LESS "4") OR (SFML_COMPILER_CLANG AND NOT SFML_CLANG_VERSION VERSION_LESS "3")))
|
||||||
set_target_properties(${target} PROPERTIES COMPILE_FLAGS -fvisibility=hidden)
|
set_target_properties(${target} PROPERTIES COMPILE_FLAGS -fvisibility=hidden)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# link the target to its external dependencies (C++ SFML libraries)
|
# 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)
|
||||||
|
# adapt install directory to allow distributing dylibs in user’s application bundle
|
||||||
|
set_target_properties(${target} PROPERTIES
|
||||||
|
BUILD_WITH_INSTALL_RPATH 1
|
||||||
|
INSTALL_NAME_DIR "@rpath")
|
||||||
|
endif()
|
||||||
|
|
||||||
# add the install rule
|
# add the install rule
|
||||||
install(TARGETS ${target}
|
install(TARGETS ${target}
|
||||||
RUNTIME DESTINATION bin COMPONENT bin
|
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)
|
ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT devel)
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
+12
-7
@@ -3,18 +3,23 @@
|
|||||||
find_package(Doxygen REQUIRED)
|
find_package(Doxygen REQUIRED)
|
||||||
|
|
||||||
# set the input and output documentation paths
|
# 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)
|
set(DOXYGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/doc)
|
||||||
|
|
||||||
# see if we can generate the CHM documentation
|
# see if we can generate the CHM documentation
|
||||||
if(WINDOWS)
|
if(SFML_OS_WINDOWS)
|
||||||
# if HHC is found, we can generate the CHM (compressed HTML) output
|
# if HHC is found, we can generate the CHM (compressed HTML) output
|
||||||
find_program(DOXYGEN_HHC_PROGRAM
|
find_program(DOXYGEN_HHC_PROGRAM
|
||||||
NAMES hhc.exe
|
NAMES hhc.exe
|
||||||
PATHS "c:/Program Files/HTML Help Workshop"
|
PATHS "C:/Program Files/HTML Help Workshop" "C:/Program Files (x86)/HTML Help Workshop"
|
||||||
DOC "HTML Help Compiler program")
|
DOC "HTML Help Compiler program")
|
||||||
if(DOXYGEN_HHC_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()
|
else()
|
||||||
set(DOXYGEN_GENERATE_HTMLHELP NO)
|
set(DOXYGEN_GENERATE_HTMLHELP NO)
|
||||||
endif()
|
endif()
|
||||||
@@ -26,11 +31,11 @@ endif()
|
|||||||
# configure the source Doxyfile by copying it and replacing all @variables@
|
# configure the source Doxyfile by copying it and replacing all @variables@
|
||||||
set(DOXYGEN_CONFIGURED_INPUT ${DOXYGEN_OUTPUT_DIR}/doxyfile)
|
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/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
|
# 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/doxygen.css ${DOXYGEN_OUTPUT_DIR}/html/doxygen.css COPYONLY)
|
||||||
configure_file(${DOXYGEN_INPUT_DIR}/doc/logo.jpg ${DOXYGEN_OUTPUT_DIR}/html/logo.jpg COPYONLY)
|
configure_file(${DOXYGEN_INPUT_DIR}/doc/searchOverrides.css ${DOXYGEN_OUTPUT_DIR}/html/searchOverrides.css COPYONLY)
|
||||||
configure_file(${DOXYGEN_INPUT_DIR}/doc/logo-bg.jpg ${DOXYGEN_OUTPUT_DIR}/html/logo-bg.jpg COPYONLY)
|
|
||||||
|
|
||||||
# target setup
|
# target setup
|
||||||
add_custom_target(doc ALL
|
add_custom_target(doc ALL
|
||||||
@@ -44,7 +49,7 @@ install(DIRECTORY ${DOXYGEN_OUTPUT_DIR}/html
|
|||||||
DESTINATION ${INSTALL_MISC_DIR}/doc
|
DESTINATION ${INSTALL_MISC_DIR}/doc
|
||||||
COMPONENT doc)
|
COMPONENT doc)
|
||||||
if(DOXYGEN_HHC_PROGRAM)
|
if(DOXYGEN_HHC_PROGRAM)
|
||||||
install(FILES ${DOXYGEN_OUTPUT_DIR}/SFML.chm
|
install(FILES ${DOXYGEN_OUTPUT_DIR}/CSFML.chm
|
||||||
DESTINATION ${INSTALL_MISC_DIR}/doc
|
DESTINATION ${INSTALL_MISC_DIR}/doc
|
||||||
COMPONENT doc)
|
COMPONENT doc)
|
||||||
endif()
|
endif()
|
||||||
+2270
-900
File diff suppressed because it is too large.
Load diff
+1237
-419
File diff suppressed because it is too large.
Load diff
@@ -1,8 +0,0 @@
|
|||||||
|
|
||||||
<p id="footer">
|
|
||||||
:: Copyright © 2007 Laurent Gomila, all rights reserved ::
|
|
||||||
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.5.2</a> ::
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
</div>
|
||||||
|
<div id="footer-container">
|
||||||
|
<div id="footer">
|
||||||
|
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>
|
||||||
|
</html>
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>SFML - Simple and Fast Multimedia Library</title>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
|
|
||||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
||||||
<link href="tabs.css" rel="stylesheet" type="text/css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="logo">
|
|
||||||
<img src="./logo.jpg" width="770" height="200" title="SFML home" alt="SFML logo" />
|
|
||||||
</div>
|
|
||||||
@@ -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>
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 114 KiB |
+2
-2
@@ -3,9 +3,9 @@
|
|||||||
///
|
///
|
||||||
/// \section welcome Welcome
|
/// \section welcome Welcome
|
||||||
/// Welcome to the official SFML documentation for C. Here you will find a detailed
|
/// 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
|
/// 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
|
/// \section example Short example
|
||||||
/// Here is a short example, to show you how simple it is to use SFML in C :
|
/// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -36,6 +36,8 @@
|
|||||||
#include <SFML/Audio/SoundBuffer.h>
|
#include <SFML/Audio/SoundBuffer.h>
|
||||||
#include <SFML/Audio/SoundBufferRecorder.h>
|
#include <SFML/Audio/SoundBufferRecorder.h>
|
||||||
#include <SFML/Audio/SoundRecorder.h>
|
#include <SFML/Audio/SoundRecorder.h>
|
||||||
|
#include <SFML/Audio/SoundStatus.h>
|
||||||
|
#include <SFML/Audio/SoundStream.h>
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_AUDIO_H
|
#endif // SFML_AUDIO_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -68,28 +68,53 @@ CSFML_AUDIO_API void sfListener_setPosition(sfVector3f position);
|
|||||||
/// \return The listener's 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 listener in the scene
|
/// \brief Set the orientation of the forward vector in the scene
|
||||||
///
|
///
|
||||||
/// The orientation defines the 3D axes of the listener
|
/// The direction (also called "at vector") is the vector
|
||||||
/// (left, up, front) in the scene. The orientation vector
|
/// pointing forward from the listener's perspective. Together
|
||||||
/// doesn't have to be normalized.
|
/// with the up vector, it defines the 3D orientation of the
|
||||||
/// The default listener's orientation is (0, 0, -1).
|
/// listener in the scene. The direction vector doesn't
|
||||||
|
/// have to be normalized.
|
||||||
|
/// The default listener's direction is (0, 0, -1).
|
||||||
///
|
///
|
||||||
/// \param position New direction of the listener
|
/// \param direction New listener's direction
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_AUDIO_API void sfListener_setDirection(sfVector3f orientation);
|
CSFML_AUDIO_API void sfListener_setDirection(sfVector3f direction);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the current orientation of the listener in the scene
|
/// \brief Get the current forward vector of the listener in the scene
|
||||||
///
|
///
|
||||||
/// \return The listener's 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
|
||||||
|
///
|
||||||
|
/// The up vector is the vector that points upward from the
|
||||||
|
/// listener's perspective. Together with the direction, it
|
||||||
|
/// defines the 3D orientation of the listener in the scene.
|
||||||
|
/// The up vector doesn't have to be normalized.
|
||||||
|
/// The default listener's up vector is (0, 1, 0). It is usually
|
||||||
|
/// not necessary to change it, especially in 2D scenarios.
|
||||||
|
///
|
||||||
|
/// \param upVector New listener's up vector
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_AUDIO_API void sfListener_setUpVector(sfVector3f upVector);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the current upward vector of the listener in the scene
|
||||||
|
///
|
||||||
|
/// \return Listener's upward vector (not normalized)
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_AUDIO_API sfVector3f sfListener_getUpVector(void);
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_LISTENER_H
|
#endif // SFML_LISTENER_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -37,13 +37,24 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Structure defining a time range
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
sfTime offset; ///< The beginning offset of the time range
|
||||||
|
sfTime length; ///< The length of the time range
|
||||||
|
} sfTimeSpan;
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Create a new music and load it from a file
|
/// \brief Create a new music and load it from a file
|
||||||
///
|
///
|
||||||
/// This function doesn't start playing the music (call
|
/// This function doesn't start playing the music (call
|
||||||
/// sfMusic_play to do so).
|
/// sfMusic_play to do so).
|
||||||
/// Here is a complete list of all the supported audio formats:
|
/// 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.
|
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||||
///
|
///
|
||||||
/// \param filename Path of the music file to open
|
/// \param filename Path of the music file to open
|
||||||
@@ -59,7 +70,7 @@ CSFML_AUDIO_API sfMusic* sfMusic_createFromFile(const char* filename);
|
|||||||
/// This function doesn't start playing the music (call
|
/// This function doesn't start playing the music (call
|
||||||
/// sfMusic_play to do so).
|
/// sfMusic_play to do so).
|
||||||
/// Here is a complete list of all the supported audio formats:
|
/// 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.
|
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||||
///
|
///
|
||||||
/// \param data Pointer to the file data in memory
|
/// \param data Pointer to the file data in memory
|
||||||
@@ -76,7 +87,7 @@ CSFML_AUDIO_API sfMusic* sfMusic_createFromMemory(const void* data, size_t sizeI
|
|||||||
/// This function doesn't start playing the music (call
|
/// This function doesn't start playing the music (call
|
||||||
/// sfMusic_play to do so).
|
/// sfMusic_play to do so).
|
||||||
/// Here is a complete list of all the supported audio formats:
|
/// 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.
|
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||||
///
|
///
|
||||||
/// \param stream Source stream to read from
|
/// \param stream Source stream to read from
|
||||||
@@ -128,6 +139,45 @@ CSFML_AUDIO_API sfBool sfMusic_getLoop(const sfMusic* music);
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_AUDIO_API sfTime sfMusic_getDuration(const sfMusic* music);
|
CSFML_AUDIO_API sfTime sfMusic_getDuration(const sfMusic* music);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the positions of the of the sound's looping sequence
|
||||||
|
///
|
||||||
|
/// \return Loop Time position class.
|
||||||
|
///
|
||||||
|
/// \warning Since sfMusic_setLoopPoints() performs some adjustments on the
|
||||||
|
/// provided values and rounds them to internal samples, a call to
|
||||||
|
/// sfMusic_getLoopPoints() is not guaranteed to return the same times passed
|
||||||
|
/// into a previous call to sfMusic_setLoopPoints(). However, it is guaranteed
|
||||||
|
/// to return times that will map to the valid internal samples of
|
||||||
|
/// this Music if they are later passed to sfMusic_setLoopPoints().
|
||||||
|
///
|
||||||
|
/// \see setLoopPoints
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_AUDIO_API sfTimeSpan sfMusic_getLoopPoints(const sfMusic* music);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Sets the beginning and end of the sound's looping sequence using sf::Time
|
||||||
|
///
|
||||||
|
/// Loop points allow one to specify a pair of positions such that, when the music
|
||||||
|
/// is enabled for looping, it will seamlessly seek to the beginning whenever it
|
||||||
|
/// encounters the end. Valid ranges for timePoints.offset and timePoints.length are
|
||||||
|
/// [0, Dur) and (0, Dur-offset] respectively, where Dur is the value returned by sfMusic_getDuration().
|
||||||
|
/// Note that the EOF "loop point" from the end to the beginning of the stream is still honored,
|
||||||
|
/// in case the caller seeks to a point after the end of the loop range. This function can be
|
||||||
|
/// safely called at any point after a stream is opened, and will be applied to a playing sound
|
||||||
|
/// without affecting the current playing offset.
|
||||||
|
///
|
||||||
|
/// \warning Setting the loop points while the stream's status is Paused
|
||||||
|
/// will set its status to Stopped. The playing offset will be unaffected.
|
||||||
|
///
|
||||||
|
/// \param timePoints The definition of the loop. Can be any time points within the sound's length
|
||||||
|
///
|
||||||
|
/// \see getLoopPoints
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_AUDIO_API void sfMusic_setLoopPoints(sfMusic* music, sfTimeSpan timePoints);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Start or resume playing a music
|
/// \brief Start or resume playing a music
|
||||||
///
|
///
|
||||||
@@ -246,7 +296,7 @@ CSFML_AUDIO_API void sfMusic_setVolume(sfMusic* music, float volume);
|
|||||||
///
|
///
|
||||||
/// \param music Music object
|
/// \param music Music object
|
||||||
/// \param position Position of the music in the scene
|
/// \param position Position of the music in the scene
|
||||||
//
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_AUDIO_API void sfMusic_setPosition(sfMusic* music, sfVector3f position);
|
CSFML_AUDIO_API void sfMusic_setPosition(sfMusic* music, sfVector3f position);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
/// \brief Create a new sound buffer and load it from a file
|
||||||
///
|
///
|
||||||
/// Here is a complete list of all the supported audio formats:
|
/// 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.
|
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||||
///
|
///
|
||||||
/// \param filename Path of the sound file to load
|
/// \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
|
/// \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:
|
/// 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.
|
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||||
///
|
///
|
||||||
/// \param data Pointer to the file data in memory
|
/// \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
|
/// \brief Create a new sound buffer and load it from a custom stream
|
||||||
///
|
///
|
||||||
/// Here is a complete list of all the supported audio formats:
|
/// 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.
|
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||||
///
|
///
|
||||||
/// \param stream Source stream to read from
|
/// \param stream Source stream to read from
|
||||||
@@ -92,7 +92,7 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* str
|
|||||||
/// \return A new sfSoundBuffer object (NULL if failed)
|
/// \return A new sfSoundBuffer object (NULL if failed)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* samples, size_t sampleCount, unsigned int channelCount, unsigned int sampleRate);
|
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* samples, sfUint64 sampleCount, unsigned int channelCount, unsigned int sampleRate);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Create a new sound buffer by copying an existing one
|
/// \brief Create a new sound buffer by copying an existing one
|
||||||
@@ -116,7 +116,7 @@ CSFML_AUDIO_API void sfSoundBuffer_destroy(sfSoundBuffer* soundBuffer);
|
|||||||
/// \brief Save a sound buffer to an audio file
|
/// \brief Save a sound buffer to an audio file
|
||||||
///
|
///
|
||||||
/// Here is a complete list of all the supported audio formats:
|
/// 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.
|
/// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
|
||||||
///
|
///
|
||||||
/// \param soundBuffer Sound buffer object
|
/// \param soundBuffer Sound buffer object
|
||||||
@@ -152,7 +152,7 @@ CSFML_AUDIO_API const sfInt16* sfSoundBuffer_getSamples(const sfSoundBuffer* sou
|
|||||||
/// \return Number of samples
|
/// \return Number of samples
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_AUDIO_API size_t sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer);
|
CSFML_AUDIO_API sfUint64 sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the sample rate of a sound buffer
|
/// \brief Get the sample rate of a sound buffer
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -61,8 +61,10 @@ CSFML_AUDIO_API void sfSoundBufferRecorder_destroy(sfSoundBufferRecorder* soundB
|
|||||||
/// \param soundBufferRecorder Sound buffer recorder object
|
/// \param soundBufferRecorder Sound buffer recorder object
|
||||||
/// \param sampleRate Desired capture rate, in number of samples per second
|
/// \param sampleRate Desired capture rate, in number of samples per second
|
||||||
///
|
///
|
||||||
|
/// \return sfTrue, if it was able to start recording
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_AUDIO_API void sfSoundBufferRecorder_start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate);
|
CSFML_AUDIO_API sfBool sfSoundBufferRecorder_start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Stop the capture of a sound recorder
|
/// \brief Stop the capture of a sound recorder
|
||||||
@@ -101,5 +103,31 @@ CSFML_AUDIO_API unsigned int sfSoundBufferRecorder_getSampleRate(const sfSoundBu
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_AUDIO_API const sfSoundBuffer* sfSoundBufferRecorder_getBuffer(const sfSoundBufferRecorder* soundBufferRecorder);
|
CSFML_AUDIO_API const sfSoundBuffer* sfSoundBufferRecorder_getBuffer(const sfSoundBufferRecorder* soundBufferRecorder);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Set the audio capture device
|
||||||
|
///
|
||||||
|
/// This function sets the audio capture device to the device
|
||||||
|
/// with the given name. It can be called on the fly (i.e:
|
||||||
|
/// while recording). If you do so while recording and
|
||||||
|
/// opening the device fails, it stops the recording.
|
||||||
|
///
|
||||||
|
/// \param soundBufferRecorder Sound buffer recorder object
|
||||||
|
/// \param name The name of the audio capture device
|
||||||
|
///
|
||||||
|
/// \return sfTrue, if it was able to set the requested device
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_AUDIO_API sfBool sfSoundBufferRecorder_setDevice(sfSoundBufferRecorder* soundBufferRecorder, const char* name);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the name of the current audio capture device
|
||||||
|
///
|
||||||
|
/// \param soundBufferRecorder Sound buffer recorder object
|
||||||
|
///
|
||||||
|
/// \return The name of the current audio capture device
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_AUDIO_API const char* sfSoundBufferRecorder_getDevice(sfSoundBufferRecorder* soundBufferRecorder);
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_SOUNDBUFFERRECORDER_H
|
#endif // SFML_SOUNDBUFFERRECORDER_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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/Audio/Export.h>
|
#include <SFML/Audio/Export.h>
|
||||||
#include <SFML/Audio/Types.h>
|
#include <SFML/Audio/Types.h>
|
||||||
|
#include <SFML/System/Time.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -75,8 +76,10 @@ CSFML_AUDIO_API void sfSoundRecorder_destroy(sfSoundRecorder* soundRecorder);
|
|||||||
/// \param soundRecorder Sound recorder object
|
/// \param soundRecorder Sound recorder object
|
||||||
/// \param sampleRate Desired capture rate, in number of samples per second
|
/// \param sampleRate Desired capture rate, in number of samples per second
|
||||||
///
|
///
|
||||||
|
/// \return True, if start of capture was successful
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_AUDIO_API void sfSoundRecorder_start(sfSoundRecorder* soundRecorder, unsigned int sampleRate);
|
CSFML_AUDIO_API sfBool sfSoundRecorder_start(sfSoundRecorder* soundRecorder, unsigned int sampleRate);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Stop the capture of a sound recorder
|
/// \brief Stop the capture of a sound recorder
|
||||||
@@ -112,5 +115,103 @@ CSFML_AUDIO_API unsigned int sfSoundRecorder_getSampleRate(const sfSoundRecorder
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_AUDIO_API sfBool sfSoundRecorder_isAvailable(void);
|
CSFML_AUDIO_API sfBool sfSoundRecorder_isAvailable(void);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Set the processing interval
|
||||||
|
///
|
||||||
|
/// The processing interval controls the period
|
||||||
|
/// between calls to the onProcessSamples function. You may
|
||||||
|
/// want to use a small interval if you want to process the
|
||||||
|
/// recorded data in real time, for example.
|
||||||
|
///
|
||||||
|
/// Note: this is only a hint, the actual period may vary.
|
||||||
|
/// So don't rely on this parameter to implement precise timing.
|
||||||
|
///
|
||||||
|
/// The default processing interval is 100 ms.
|
||||||
|
///
|
||||||
|
/// \param soundRecorder Sound recorder object
|
||||||
|
/// \param interval Processing interval
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_AUDIO_API void sfSoundRecorder_setProcessingInterval(sfSoundRecorder* soundRecorder, sfTime interval);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \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 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
|
||||||
|
///
|
||||||
|
/// \return An array of strings containing the names
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_AUDIO_API const char** sfSoundRecorder_getAvailableDevices(size_t* count);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the name of the default audio capture device
|
||||||
|
///
|
||||||
|
/// This function returns the name of the default audio
|
||||||
|
/// capture device. If none is available, NULL is returned.
|
||||||
|
///
|
||||||
|
/// \return The name of the default audio capture device (null terminated)
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_AUDIO_API const char* sfSoundRecorder_getDefaultDevice(void);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Set the audio capture device
|
||||||
|
///
|
||||||
|
/// This function sets the audio capture device to the device
|
||||||
|
/// with the given name. It can be called on the fly (i.e:
|
||||||
|
/// while recording). If you do so while recording and
|
||||||
|
/// opening the device fails, it stops the recording.
|
||||||
|
///
|
||||||
|
/// \param soundRecorder Sound recorder object
|
||||||
|
/// \param name The name of the audio capture device
|
||||||
|
///
|
||||||
|
/// \return sfTrue, if it was able to set the requested device
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_AUDIO_API sfBool sfSoundRecorder_setDevice(sfSoundRecorder* soundRecorder, const char* name);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the name of the current audio capture device
|
||||||
|
///
|
||||||
|
/// \param soundRecorder Sound recorder object
|
||||||
|
///
|
||||||
|
/// \return The name of the current audio capture device
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_AUDIO_API const char* sfSoundRecorder_getDevice(sfSoundRecorder* soundRecorder);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \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 channelCount Number of channels. Currently only
|
||||||
|
/// mono (1) and stereo (2) are supported.
|
||||||
|
///
|
||||||
|
/// \see sfSoundRecorder_getChannelCount
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_AUDIO_API void sfSoundRecorder_setChannelCount(sfSoundRecorder* soundRecorder, 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).
|
||||||
|
///
|
||||||
|
/// \return Number of channels
|
||||||
|
///
|
||||||
|
/// \see sfSoundRecorder_setChannelCount
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_AUDIO_API unsigned int sfSoundRecorder_getChannelCount(const sfSoundRecorder* soundRecorder);
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_SOUNDRECORDER_H
|
#endif // SFML_SOUNDRECORDER_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)//
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
|
|||||||
+52
-5
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -30,7 +30,18 @@
|
|||||||
// Define the CSFML version
|
// Define the CSFML version
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#define CSFML_VERSION_MAJOR 2
|
#define CSFML_VERSION_MAJOR 2
|
||||||
#define CSFML_VERSION_MINOR 0
|
#define CSFML_VERSION_MINOR 6
|
||||||
|
#define CSFML_VERSION_PATCH 1
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Check if we need to mark functions as extern "C"
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define CSFML_EXTERN_C extern "C"
|
||||||
|
#else
|
||||||
|
#define CSFML_EXTERN_C extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -71,7 +82,7 @@
|
|||||||
|
|
||||||
// Windows compilers need specific (and different) keywords for export and import
|
// Windows compilers need specific (and different) keywords for export and import
|
||||||
#define CSFML_API_EXPORT extern "C" __declspec(dllexport)
|
#define CSFML_API_EXPORT extern "C" __declspec(dllexport)
|
||||||
#define CSFML_API_IMPORT extern __declspec(dllimport)
|
#define CSFML_API_IMPORT CSFML_EXTERN_C __declspec(dllimport)
|
||||||
|
|
||||||
// For Visual C++ compilers, we also need to turn off this annoying C4251 warning
|
// For Visual C++ compilers, we also need to turn off this annoying C4251 warning
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -87,18 +98,54 @@
|
|||||||
// GCC 4 has special keywords for showing/hidding symbols,
|
// GCC 4 has special keywords for showing/hidding symbols,
|
||||||
// the same keyword is used for both importing and exporting
|
// the same keyword is used for both importing and exporting
|
||||||
#define CSFML_API_EXPORT extern "C" __attribute__ ((__visibility__ ("default")))
|
#define CSFML_API_EXPORT extern "C" __attribute__ ((__visibility__ ("default")))
|
||||||
#define CSFML_API_IMPORT extern __attribute__ ((__visibility__ ("default")))
|
#define CSFML_API_IMPORT CSFML_EXTERN_C __attribute__ ((__visibility__ ("default")))
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// GCC < 4 has no mechanism to explicitely hide symbols, everything's exported
|
// GCC < 4 has no mechanism to explicitely hide symbols, everything's exported
|
||||||
#define CSFML_API_EXPORT extern "C"
|
#define CSFML_API_EXPORT extern "C"
|
||||||
#define CSFML_API_IMPORT extern
|
#define CSFML_API_IMPORT CSFML_EXTERN_C
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Cross-platform warning for deprecated functions and classes
|
||||||
|
//
|
||||||
|
// Usage:
|
||||||
|
// struct CSFML_DEPRECATED MyStruct
|
||||||
|
// {
|
||||||
|
// ...
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// CSFML_DEPRECATED void globalFunc(void);
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
#if defined(CSFML_NO_DEPRECATED_WARNINGS)
|
||||||
|
|
||||||
|
// User explicitly requests to disable deprecation warnings
|
||||||
|
#define CSFML_DEPRECATED
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
|
||||||
|
// Microsoft C++ compiler
|
||||||
|
// Note: On newer MSVC versions, using deprecated functions causes a compiler error. In order to
|
||||||
|
// trigger a warning instead of an error, the compiler flag /sdl- (instead of /sdl) must be specified.
|
||||||
|
#define CSFML_DEPRECATED __declspec(deprecated)
|
||||||
|
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
|
||||||
|
// g++ and Clang
|
||||||
|
#define CSFML_DEPRECATED __attribute__ ((deprecated))
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// Other compilers are not supported, leave class or function as-is.
|
||||||
|
// With a bit of luck, the #pragma directive works, otherwise users get a warning (no error!) for unrecognized #pragma.
|
||||||
|
#pragma message("CSFML_DEPRECATED is not supported for your compiler, please contact the CSFML team")
|
||||||
|
#define CSFML_DEPRECATED
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Define a portable boolean type
|
// Define a portable boolean type
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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_GPUPREFERENCE_H
|
||||||
|
#define SFML_GPUPREFERENCE_H
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// Headers
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
#include <SFML/Config.h>
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \file
|
||||||
|
///
|
||||||
|
/// \brief File containing SFML_DEFINE_DISCRETE_GPU_PREFERENCE
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \def SFML_DEFINE_DISCRETE_GPU_PREFERENCE
|
||||||
|
///
|
||||||
|
/// \brief A macro to encourage usage of the discrete GPU
|
||||||
|
///
|
||||||
|
/// In order to inform the Nvidia/AMD driver that an SFML
|
||||||
|
/// application could benefit from using the more powerful
|
||||||
|
/// discrete GPU, special symbols have to be publicly
|
||||||
|
/// exported from the final executable.
|
||||||
|
///
|
||||||
|
/// SFML defines a helper macro to easily do this.
|
||||||
|
///
|
||||||
|
/// Place SFML_DEFINE_DISCRETE_GPU_PREFERENCE in the
|
||||||
|
/// global scope of a source file that will be linked into
|
||||||
|
/// the final executable. Typically it is best to place it
|
||||||
|
/// where the main function is also defined.
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
#if defined(SFML_SYSTEM_WINDOWS)
|
||||||
|
|
||||||
|
#define SFML_DEFINE_DISCRETE_GPU_PREFERENCE \
|
||||||
|
CSFML_EXTERN_C __declspec(dllexport) unsigned long NvOptimusEnablement = 1; \
|
||||||
|
CSFML_EXTERN_C __declspec(dllexport) unsigned long AmdPowerXpressRequestHighPerformance = 1;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define SFML_DEFINE_DISCRETE_GPU_PREFERENCE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif // SFML_GPUPREFERENCE_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -35,14 +35,15 @@
|
|||||||
#include <SFML/Graphics/Color.h>
|
#include <SFML/Graphics/Color.h>
|
||||||
#include <SFML/Graphics/ConvexShape.h>
|
#include <SFML/Graphics/ConvexShape.h>
|
||||||
#include <SFML/Graphics/Font.h>
|
#include <SFML/Graphics/Font.h>
|
||||||
|
#include <SFML/Graphics/FontInfo.h>
|
||||||
#include <SFML/Graphics/Glyph.h>
|
#include <SFML/Graphics/Glyph.h>
|
||||||
#include <SFML/Graphics/Image.h>
|
#include <SFML/Graphics/Image.h>
|
||||||
#include <SFML/Graphics/PrimitiveType.h>
|
#include <SFML/Graphics/PrimitiveType.h>
|
||||||
#include <SFML/Graphics/Rect.h>
|
#include <SFML/Graphics/Rect.h>
|
||||||
#include <SFML/Graphics/RectangleShape.h>
|
#include <SFML/Graphics/RectangleShape.h>
|
||||||
#include <SFML/Graphics/RenderStates.h>
|
#include <SFML/Graphics/RenderStates.h>
|
||||||
#include <SFML/Graphics/RenderWindow.h>
|
|
||||||
#include <SFML/Graphics/RenderTexture.h>
|
#include <SFML/Graphics/RenderTexture.h>
|
||||||
|
#include <SFML/Graphics/RenderWindow.h>
|
||||||
#include <SFML/Graphics/Shader.h>
|
#include <SFML/Graphics/Shader.h>
|
||||||
#include <SFML/Graphics/Shape.h>
|
#include <SFML/Graphics/Shape.h>
|
||||||
#include <SFML/Graphics/Sprite.h>
|
#include <SFML/Graphics/Sprite.h>
|
||||||
@@ -52,6 +53,7 @@
|
|||||||
#include <SFML/Graphics/Transformable.h>
|
#include <SFML/Graphics/Transformable.h>
|
||||||
#include <SFML/Graphics/Vertex.h>
|
#include <SFML/Graphics/Vertex.h>
|
||||||
#include <SFML/Graphics/VertexArray.h>
|
#include <SFML/Graphics/VertexArray.h>
|
||||||
|
#include <SFML/Graphics/VertexBuffer.h>
|
||||||
#include <SFML/Graphics/View.h>
|
#include <SFML/Graphics/View.h>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -32,16 +32,59 @@
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Available blending modes for drawing
|
/// \brief Enumeration of the blending factors
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
sfBlendAlpha, ///< Pixel = Src * a + Dest * (1 - a)
|
sfBlendFactorZero, ///< (0, 0, 0, 0)
|
||||||
sfBlendAdd, ///< Pixel = Src + Dest
|
sfBlendFactorOne, ///< (1, 1, 1, 1)
|
||||||
sfBlendMultiply, ///< Pixel = Src * Dest
|
sfBlendFactorSrcColor, ///< (src.r, src.g, src.b, src.a)
|
||||||
sfBlendNone ///< No blending
|
sfBlendFactorOneMinusSrcColor, ///< (1, 1, 1, 1) - (src.r, src.g, src.b, src.a)
|
||||||
|
sfBlendFactorDstColor, ///< (dst.r, dst.g, dst.b, dst.a)
|
||||||
|
sfBlendFactorOneMinusDstColor, ///< (1, 1, 1, 1) - (dst.r, dst.g, dst.b, dst.a)
|
||||||
|
sfBlendFactorSrcAlpha, ///< (src.a, src.a, src.a, src.a)
|
||||||
|
sfBlendFactorOneMinusSrcAlpha, ///< (1, 1, 1, 1) - (src.a, src.a, src.a, src.a)
|
||||||
|
sfBlendFactorDstAlpha, ///< (dst.a, dst.a, dst.a, dst.a)
|
||||||
|
sfBlendFactorOneMinusDstAlpha ///< (1, 1, 1, 1) - (dst.a, dst.a, dst.a, dst.a)
|
||||||
|
} sfBlendFactor;
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Enumeration of the blending equations
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Blending mode for drawing
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
sfBlendFactor colorSrcFactor; ///< Source blending factor for the color channels
|
||||||
|
sfBlendFactor colorDstFactor; ///< Destination blending factor for the color channels
|
||||||
|
sfBlendEquation colorEquation; ///< Blending equation for the color channels
|
||||||
|
sfBlendFactor alphaSrcFactor; ///< Source blending factor for the alpha channel
|
||||||
|
sfBlendFactor alphaDstFactor; ///< Destination blending factor for the alpha channel
|
||||||
|
sfBlendEquation alphaEquation; ///< Blending equation for the alpha channel
|
||||||
} sfBlendMode;
|
} sfBlendMode;
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_BLENDMODE_H
|
#endif // SFML_BLENDMODE_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <SFML/Graphics/Transform.h>
|
#include <SFML/Graphics/Transform.h>
|
||||||
#include <SFML/Graphics/Types.h>
|
#include <SFML/Graphics/Types.h>
|
||||||
#include <SFML/System/Vector2.h>
|
#include <SFML/System/Vector2.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -57,7 +58,7 @@ CSFML_GRAPHICS_API sfCircleShape* sfCircleShape_copy(const sfCircleShape* shape)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Destroy an existing circle Shape
|
/// \brief Destroy an existing circle Shape
|
||||||
///
|
///
|
||||||
/// \param Shape Shape to delete
|
/// \param shape Shape to delete
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfCircleShape_destroy(sfCircleShape* shape);
|
CSFML_GRAPHICS_API void sfCircleShape_destroy(sfCircleShape* shape);
|
||||||
@@ -352,7 +353,7 @@ CSFML_GRAPHICS_API float sfCircleShape_getOutlineThickness(const sfCircleShape*
|
|||||||
/// \return Number of points of the shape
|
/// \return Number of points of the shape
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API unsigned int sfCircleShape_getPointCount(const sfCircleShape* shape);
|
CSFML_GRAPHICS_API size_t sfCircleShape_getPointCount(const sfCircleShape* shape);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get a point of a circle shape
|
/// \brief Get a point of a circle shape
|
||||||
@@ -365,7 +366,7 @@ CSFML_GRAPHICS_API unsigned int sfCircleShape_getPointCount(const sfCircleShape*
|
|||||||
/// \return Index-th point of the shape
|
/// \return Index-th point of the shape
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, unsigned int index);
|
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, size_t index);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set the radius of a circle
|
/// \brief Set the radius of a circle
|
||||||
@@ -393,7 +394,7 @@ CSFML_GRAPHICS_API float sfCircleShape_getRadius(const sfCircleShape* shape);
|
|||||||
/// \param count New number of points of the circle
|
/// \param count New number of points of the circle
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfCircleShape_setPointCount(sfCircleShape* shape, unsigned int count);
|
CSFML_GRAPHICS_API void sfCircleShape_setPointCount(sfCircleShape* shape, size_t count);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the local bounding rectangle of a circle shape
|
/// \brief Get the local bounding rectangle of a circle shape
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -80,6 +80,24 @@ CSFML_GRAPHICS_API sfColor sfColor_fromRGB(sfUint8 red, sfUint8 green, sfUint8 b
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfColor sfColor_fromRGBA(sfUint8 red, sfUint8 green, sfUint8 blue, sfUint8 alpha);
|
CSFML_GRAPHICS_API sfColor sfColor_fromRGBA(sfUint8 red, sfUint8 green, sfUint8 blue, sfUint8 alpha);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Construct the color from 32-bit unsigned integer
|
||||||
|
///
|
||||||
|
/// \param color Number containing the RGBA components (in that order)
|
||||||
|
///
|
||||||
|
/// \return sfColor constructed from the 32-bit unsigned integer
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfColor sfColor_fromInteger(sfUint32 color);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Convert a color to a 32-bit unsigned integer
|
||||||
|
///
|
||||||
|
/// \return Color represented as a 32-bit unsigned integer
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfUint32 sfColor_toInteger(sfColor color);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Add two colors
|
/// \brief Add two colors
|
||||||
///
|
///
|
||||||
@@ -91,6 +109,17 @@ CSFML_GRAPHICS_API sfColor sfColor_fromRGBA(sfUint8 red, sfUint8 green, sfUint8
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfColor sfColor_add(sfColor color1, sfColor color2);
|
CSFML_GRAPHICS_API sfColor sfColor_add(sfColor color1, sfColor color2);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Subtract two colors
|
||||||
|
///
|
||||||
|
/// \param color1 First color
|
||||||
|
/// \param color2 Second color
|
||||||
|
///
|
||||||
|
/// \return Component-wise saturated subtraction of the two colors
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfColor sfColor_subtract(sfColor color1, sfColor color2);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Modulate two colors
|
/// \brief Modulate two colors
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <SFML/Graphics/Transform.h>
|
#include <SFML/Graphics/Transform.h>
|
||||||
#include <SFML/Graphics/Types.h>
|
#include <SFML/Graphics/Types.h>
|
||||||
#include <SFML/System/Vector2.h>
|
#include <SFML/System/Vector2.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -57,7 +58,7 @@ CSFML_GRAPHICS_API sfConvexShape* sfConvexShape_copy(const sfConvexShape* shape)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Destroy an existing convex Shape
|
/// \brief Destroy an existing convex Shape
|
||||||
///
|
///
|
||||||
/// \param Shape Shape to delete
|
/// \param shape Shape to delete
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfConvexShape_destroy(sfConvexShape* shape);
|
CSFML_GRAPHICS_API void sfConvexShape_destroy(sfConvexShape* shape);
|
||||||
@@ -352,7 +353,7 @@ CSFML_GRAPHICS_API float sfConvexShape_getOutlineThickness(const sfConvexShape*
|
|||||||
/// \return Number of points of the shape
|
/// \return Number of points of the shape
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API unsigned int sfConvexShape_getPointCount(const sfConvexShape* shape);
|
CSFML_GRAPHICS_API size_t sfConvexShape_getPointCount(const sfConvexShape* shape);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get a point of a convex shape
|
/// \brief Get a point of a convex shape
|
||||||
@@ -365,7 +366,7 @@ CSFML_GRAPHICS_API unsigned int sfConvexShape_getPointCount(const sfConvexShape*
|
|||||||
/// \return Index-th point of the shape
|
/// \return Index-th point of the shape
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, unsigned int index);
|
CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, size_t index);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set the number of points of a convex shap
|
/// \brief Set the number of points of a convex shap
|
||||||
@@ -376,7 +377,7 @@ CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape,
|
|||||||
/// \param count New number of points of the shape
|
/// \param count New number of points of the shape
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfConvexShape_setPointCount(sfConvexShape* shape, unsigned int count);
|
CSFML_GRAPHICS_API void sfConvexShape_setPointCount(sfConvexShape* shape, size_t count);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set the position of a point in a convex shape
|
/// \brief Set the position of a point in a convex shape
|
||||||
@@ -392,7 +393,7 @@ CSFML_GRAPHICS_API void sfConvexShape_setPointCount(sfConvexShape* shape, unsign
|
|||||||
/// \param point New point
|
/// \param point New point
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfConvexShape_setPoint(sfConvexShape* shape, unsigned int index, sfVector2f point);
|
CSFML_GRAPHICS_API void sfConvexShape_setPoint(sfConvexShape* shape, size_t index, sfVector2f point);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the local bounding rectangle of a convex shape
|
/// \brief Get the local bounding rectangle of a convex shape
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -29,6 +29,7 @@
|
|||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Graphics/Export.h>
|
#include <SFML/Graphics/Export.h>
|
||||||
|
#include <SFML/Graphics/FontInfo.h>
|
||||||
#include <SFML/Graphics/Glyph.h>
|
#include <SFML/Graphics/Glyph.h>
|
||||||
#include <SFML/Graphics/Types.h>
|
#include <SFML/Graphics/Types.h>
|
||||||
#include <SFML/System/InputStream.h>
|
#include <SFML/System/InputStream.h>
|
||||||
@@ -87,15 +88,35 @@ CSFML_GRAPHICS_API void sfFont_destroy(sfFont* font);
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get a glyph in a font
|
/// \brief Get a glyph in a font
|
||||||
///
|
///
|
||||||
/// \param font Source font
|
/// \param font Source font
|
||||||
/// \param codePoint Unicode code point of the character to get
|
/// \param codePoint Unicode code point of the character to get
|
||||||
/// \param characterSize Character size, in pixels
|
/// \param characterSize Character size, in pixels
|
||||||
/// \param bold Retrieve the bold version or the regular one?
|
/// \param bold Retrieve the bold version or the regular one?
|
||||||
|
/// \param outlineThickness Thickness of outline (when != 0 the glyph will not be filled)
|
||||||
///
|
///
|
||||||
/// \return The corresponding glyph
|
/// \return The corresponding glyph
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, unsigned int characterSize, sfBool bold);
|
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
|
/// \brief Get the kerning value corresponding to a given pair of characters in a font
|
||||||
@@ -108,7 +129,20 @@ CSFML_GRAPHICS_API sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, uns
|
|||||||
/// \return Kerning offset, in pixels
|
/// \return Kerning offset, in pixels
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API int sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize);
|
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
|
/// \brief Get the line spacing value
|
||||||
@@ -119,7 +153,34 @@ CSFML_GRAPHICS_API int sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32
|
|||||||
/// \return Line spacing, in pixels
|
/// \return Line spacing, in pixels
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API int sfFont_getLineSpacing(sfFont* font, unsigned int characterSize);
|
CSFML_GRAPHICS_API float sfFont_getLineSpacing(const sfFont* font, unsigned int characterSize);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the position of the underline
|
||||||
|
///
|
||||||
|
/// Underline position is the vertical offset to apply between the
|
||||||
|
/// baseline and the underline.
|
||||||
|
///
|
||||||
|
/// \param font Source font
|
||||||
|
/// \param characterSize Reference character size
|
||||||
|
///
|
||||||
|
/// \return Underline position, in pixels
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API float sfFont_getUnderlinePosition(const sfFont* font, unsigned int characterSize);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the thickness of the underline
|
||||||
|
///
|
||||||
|
/// Underline thickness is the vertical size of the underline.
|
||||||
|
///
|
||||||
|
/// \param font Source font
|
||||||
|
/// \param characterSize Reference character size
|
||||||
|
///
|
||||||
|
/// \return Underline thickness, in pixels
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API float sfFont_getUnderlineThickness(const sfFont* font, unsigned int characterSize);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the texture containing the glyphs of a given size in a font
|
/// \brief Get the texture containing the glyphs of a given size in a font
|
||||||
@@ -132,5 +193,48 @@ CSFML_GRAPHICS_API int sfFont_getLineSpacing(sfFont* font, unsigned int characte
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API const sfTexture* sfFont_getTexture(sfFont* font, unsigned int characterSize);
|
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);
|
||||||
|
|
||||||
#endif // SFML_IMAGE_H
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \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
|
||||||
|
///
|
||||||
|
/// The returned structure will remain valid only if the font
|
||||||
|
/// is still valid. If the font is invalid an invalid structure
|
||||||
|
/// is returned.
|
||||||
|
///
|
||||||
|
/// \param font Source font
|
||||||
|
///
|
||||||
|
/// \return A structure that holds the font information
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfFontInfo sfFont_getInfo(const sfFont* font);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // SFML_FONT_H
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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_FONTINFO_H
|
||||||
|
#define SFML_FONTINFO_H
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Headers
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
#include <SFML/Graphics/Export.h>
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// sfFontInfo holds various information about a font
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
const char* family;
|
||||||
|
} sfFontInfo;
|
||||||
|
|
||||||
|
|
||||||
|
#endif // SFML_FONTINFO_H
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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_GLSL_H
|
||||||
|
#define SFML_GLSL_H
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Headers
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
#include <SFML/Graphics/Transform.h>
|
||||||
|
#include <SFML/Graphics/Color.h>
|
||||||
|
#include <SFML/System/Vector2.h>
|
||||||
|
#include <SFML/System/Vector3.h>
|
||||||
|
|
||||||
|
// 2D vectors
|
||||||
|
typedef sfVector2f sfGlslVec2;
|
||||||
|
typedef sfVector2i sfGlslIvec2;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
sfBool x;
|
||||||
|
sfBool y;
|
||||||
|
} sfGlslBvec2;
|
||||||
|
|
||||||
|
// 3D vectors
|
||||||
|
typedef sfVector3f sfGlslVec3;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int z;
|
||||||
|
} sfGlslIvec3;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
sfBool x;
|
||||||
|
sfBool y;
|
||||||
|
sfBool z;
|
||||||
|
} sfGlslBvec3;
|
||||||
|
|
||||||
|
// 4D vectors
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float z;
|
||||||
|
float w;
|
||||||
|
} sfGlslVec4;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int z;
|
||||||
|
int w;
|
||||||
|
} sfGlslIvec4;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
sfBool x;
|
||||||
|
sfBool y;
|
||||||
|
sfBool z;
|
||||||
|
sfBool w;
|
||||||
|
} sfGlslBvec4;
|
||||||
|
|
||||||
|
// matrices
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float array[3 * 3];
|
||||||
|
} sfGlslMat3;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float array[4 * 4];
|
||||||
|
} sfGlslMat4;
|
||||||
|
|
||||||
|
|
||||||
|
#endif // SFML_GLSL_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -37,9 +37,9 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int advance; ///< Offset to move horizontically to the next character
|
float advance; ///< Offset to move horizontically to the next character
|
||||||
sfIntRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline
|
sfFloatRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline
|
||||||
sfIntRect textureRect; ///< Texture coordinates of the glyph inside the font's image
|
sfIntRect textureRect; ///< Texture coordinates of the glyph inside the font's image
|
||||||
} sfGlyph;
|
} sfGlyph;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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/Color.h>
|
||||||
#include <SFML/Graphics/Rect.h>
|
#include <SFML/Graphics/Rect.h>
|
||||||
#include <SFML/Graphics/Types.h>
|
#include <SFML/Graphics/Types.h>
|
||||||
|
#include <SFML/System/Buffer.h>
|
||||||
#include <SFML/System/InputStream.h>
|
#include <SFML/System/InputStream.h>
|
||||||
#include <SFML/System/Vector2.h>
|
#include <SFML/System/Vector2.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@@ -156,9 +157,30 @@ CSFML_GRAPHICS_API void sfImage_destroy(sfImage* image);
|
|||||||
///
|
///
|
||||||
/// \return sfTrue if saving was successful
|
/// \return sfTrue if saving was successful
|
||||||
///
|
///
|
||||||
|
/// \see sfImage_saveToMemory
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfBool sfImage_saveToFile(const sfImage* image, const char* filename);
|
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
|
/// \brief Return the size of an image
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -39,15 +39,19 @@
|
|||||||
/// and view.
|
/// and view.
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
sfPoints, ///< List of individual points
|
sfPoints, ///< List of individual points
|
||||||
sfLines, ///< List of individual lines
|
sfLines, ///< List of individual lines
|
||||||
sfLinesStrip, ///< List of connected lines, a point uses the previous point to form a line
|
sfLineStrip, ///< List of connected lines, a point uses the previous point to form a line
|
||||||
sfTriangles, ///< List of individual triangles
|
sfTriangles, ///< List of individual triangles
|
||||||
sfTrianglesStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle
|
sfTriangleStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle
|
||||||
sfTrianglesFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle
|
sfTriangleFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle
|
||||||
sfQuads ///< List of individual quads
|
sfQuads, ///< List of individual quads
|
||||||
|
|
||||||
|
sfLinesStrip = sfLineStrip, ///< \deprecated Use sfLineStrip instead
|
||||||
|
sfTrianglesStrip = sfTriangleStrip, ///< \deprecated Use sfTriangleStrip instead
|
||||||
|
sfTrianglesFan = sfTriangleFan ///< \deprecated Use sfTriangleFan instead
|
||||||
} sfPrimitiveType;
|
} sfPrimitiveType;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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/Graphics/Export.h>
|
||||||
|
|
||||||
|
#include <SFML/System/Vector2.h>
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// sfFloatRect and sfIntRect are utility classes for
|
/// 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 sfFloatRect_intersects(const sfFloatRect* rect1, const sfFloatRect* rect2, sfFloatRect* intersection);
|
||||||
CSFML_GRAPHICS_API sfBool sfIntRect_intersects(const sfIntRect* rect1, const sfIntRect* rect2, sfIntRect* 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
|
#endif // SFML_RECT_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <SFML/Graphics/Transform.h>
|
#include <SFML/Graphics/Transform.h>
|
||||||
#include <SFML/Graphics/Types.h>
|
#include <SFML/Graphics/Types.h>
|
||||||
#include <SFML/System/Vector2.h>
|
#include <SFML/System/Vector2.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -57,7 +58,7 @@ CSFML_GRAPHICS_API sfRectangleShape* sfRectangleShape_copy(const sfRectangleShap
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Destroy an existing rectangle shape
|
/// \brief Destroy an existing rectangle shape
|
||||||
///
|
///
|
||||||
/// \param Shape Shape to delete
|
/// \param shape Shape to delete
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfRectangleShape_destroy(sfRectangleShape* shape);
|
CSFML_GRAPHICS_API void sfRectangleShape_destroy(sfRectangleShape* shape);
|
||||||
@@ -352,7 +353,7 @@ CSFML_GRAPHICS_API float sfRectangleShape_getOutlineThickness(const sfRectangleS
|
|||||||
/// \return Number of points of the shape
|
/// \return Number of points of the shape
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API unsigned int sfRectangleShape_getPointCount(const sfRectangleShape* shape);
|
CSFML_GRAPHICS_API size_t sfRectangleShape_getPointCount(const sfRectangleShape* shape);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get a point of a rectangle shape
|
/// \brief Get a point of a rectangle shape
|
||||||
@@ -365,7 +366,7 @@ CSFML_GRAPHICS_API unsigned int sfRectangleShape_getPointCount(const sfRectangle
|
|||||||
/// \return Index-th point of the shape
|
/// \return Index-th point of the shape
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getPoint(const sfRectangleShape* shape, unsigned int index);
|
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getPoint(const sfRectangleShape* shape, size_t index);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set the size of a rectangle shape
|
/// \brief Set the size of a rectangle shape
|
||||||
@@ -380,7 +381,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_setSize(sfRectangleShape* shape, sfVect
|
|||||||
/// \brief Get the size of a rectangle shape
|
/// \brief Get the size of a rectangle shape
|
||||||
///
|
///
|
||||||
/// \param shape Shape object
|
/// \param shape Shape object
|
||||||
//
|
///
|
||||||
/// \return height Size of the rectangle
|
/// \return height Size of the rectangle
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
const sfShader* shader; ///< Shader
|
||||||
} sfRenderStates;
|
} sfRenderStates;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Define the default values for a RenderState
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfRenderStates sfRenderStates_default(void);
|
||||||
|
|
||||||
#endif // SFML_RENDERSTATES_H
|
#endif // SFML_RENDERSTATES_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -35,7 +35,9 @@
|
|||||||
#include <SFML/Graphics/PrimitiveType.h>
|
#include <SFML/Graphics/PrimitiveType.h>
|
||||||
#include <SFML/Graphics/RenderStates.h>
|
#include <SFML/Graphics/RenderStates.h>
|
||||||
#include <SFML/Graphics/Vertex.h>
|
#include <SFML/Graphics/Vertex.h>
|
||||||
|
#include <SFML/Window/Window.h>
|
||||||
#include <SFML/System/Vector2.h>
|
#include <SFML/System/Vector2.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -47,9 +49,24 @@
|
|||||||
///
|
///
|
||||||
/// \return A new sfRenderTexture object, or NULL if it failed
|
/// \return A new sfRenderTexture object, or NULL if it failed
|
||||||
///
|
///
|
||||||
|
/// \deprecated
|
||||||
|
/// Use sfRenderTexture_createWithSettings instead.
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfRenderTexture* sfRenderTexture_create(unsigned int width, unsigned int height, sfBool depthBuffer);
|
CSFML_GRAPHICS_API sfRenderTexture* sfRenderTexture_create(unsigned int width, unsigned int height, sfBool depthBuffer);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Construct a new render texture
|
||||||
|
///
|
||||||
|
/// \param width Width of the render texture
|
||||||
|
/// \param height Height of the render texture
|
||||||
|
/// \param settings Settings of the render texture
|
||||||
|
///
|
||||||
|
/// \return A new sfRenderTexture object, or NULL if it failed
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfRenderTexture* sfRenderTexture_createWithSettings(unsigned int width, unsigned int height, const sfContextSettings* settings);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Destroy an existing render texture
|
/// \brief Destroy an existing render texture
|
||||||
///
|
///
|
||||||
@@ -68,6 +85,16 @@ CSFML_GRAPHICS_API void sfRenderTexture_destroy(sfRenderTexture* renderTexture);
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfVector2u sfRenderTexture_getSize(const 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
|
/// \brief Activate or deactivate a render texture as the current target for rendering
|
||||||
///
|
///
|
||||||
@@ -204,6 +231,21 @@ CSFML_GRAPHICS_API void sfRenderTexture_drawCircleShape(sfRenderTexture* renderT
|
|||||||
CSFML_GRAPHICS_API void sfRenderTexture_drawConvexShape(sfRenderTexture* renderTexture, const sfConvexShape* object, const sfRenderStates* states);
|
CSFML_GRAPHICS_API void sfRenderTexture_drawConvexShape(sfRenderTexture* renderTexture, const sfConvexShape* object, const sfRenderStates* states);
|
||||||
CSFML_GRAPHICS_API void sfRenderTexture_drawRectangleShape(sfRenderTexture* renderTexture, const sfRectangleShape* object, const sfRenderStates* states);
|
CSFML_GRAPHICS_API void sfRenderTexture_drawRectangleShape(sfRenderTexture* renderTexture, const sfRectangleShape* object, const sfRenderStates* states);
|
||||||
CSFML_GRAPHICS_API void sfRenderTexture_drawVertexArray(sfRenderTexture* renderTexture, const sfVertexArray* object, const sfRenderStates* states);
|
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
|
/// \brief Draw primitives defined by an array of vertices to a render texture
|
||||||
@@ -216,7 +258,7 @@ CSFML_GRAPHICS_API void sfRenderTexture_drawVertexArray(sfRenderTexture* renderT
|
|||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfRenderTexture_drawPrimitives(sfRenderTexture* renderTexture,
|
CSFML_GRAPHICS_API void sfRenderTexture_drawPrimitives(sfRenderTexture* renderTexture,
|
||||||
const sfVertex* vertices, unsigned int vertexCount,
|
const sfVertex* vertices, size_t vertexCount,
|
||||||
sfPrimitiveType type, const sfRenderStates* states);
|
sfPrimitiveType type, const sfRenderStates* states);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -277,6 +319,15 @@ CSFML_GRAPHICS_API void sfRenderTexture_resetGLStates(sfRenderTexture* renderTex
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API const sfTexture* sfRenderTexture_getTexture(const sfRenderTexture* renderTexture);
|
CSFML_GRAPHICS_API const sfTexture* sfRenderTexture_getTexture(const sfRenderTexture* renderTexture);
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the maximum anti-aliasing level supported by the system
|
||||||
|
///
|
||||||
|
/// \return The maximum anti-aliasing level supported by the system
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API unsigned int sfRenderTexture_getMaximumAntialiasingLevel(void);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Enable or disable the smooth filter on a render texture
|
/// \brief Enable or disable the smooth filter on a render texture
|
||||||
///
|
///
|
||||||
@@ -296,5 +347,40 @@ CSFML_GRAPHICS_API void sfRenderTexture_setSmooth(sfRenderTexture* renderTexture
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfBool sfRenderTexture_isSmooth(const sfRenderTexture* renderTexture);
|
CSFML_GRAPHICS_API sfBool sfRenderTexture_isSmooth(const sfRenderTexture* renderTexture);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Enable or disable texture repeating
|
||||||
|
///
|
||||||
|
/// \param renderTexture Render texture object
|
||||||
|
/// \param repeated sfTrue to enable repeating, sfFalse to disable it
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfRenderTexture_setRepeated(sfRenderTexture* renderTexture, sfBool repeated);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Tell whether the texture is repeated or not
|
||||||
|
///
|
||||||
|
/// \param renderTexture Render texture object
|
||||||
|
///
|
||||||
|
/// \return sfTrue if repeat mode is enabled, sfFalse if it is disabled
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfBool sfRenderTexture_isRepeated(const sfRenderTexture* renderTexture);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Generate a mipmap using the current texture data
|
||||||
|
///
|
||||||
|
/// This function is similar to sfTexture_generateMipmap and operates
|
||||||
|
/// on the texture used as the target for drawing.
|
||||||
|
/// Be aware that any draw operation may modify the base level image data.
|
||||||
|
/// For this reason, calling this function only makes sense after all
|
||||||
|
/// drawing is completed and display has been called. Not calling display
|
||||||
|
/// after subsequent drawing will lead to undefined behavior if a mipmap
|
||||||
|
/// had been previously generated.
|
||||||
|
///
|
||||||
|
/// \return sfTrue if mipmap generation was successful, sfFalse if unsuccessful
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfBool sfRenderTexture_generateMipmap(sfRenderTexture* renderTexture);
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_RENDERTEXTURE_H
|
#endif // SFML_RENDERTEXTURE_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
#include <SFML/Window/WindowHandle.h>
|
#include <SFML/Window/WindowHandle.h>
|
||||||
#include <SFML/Window/Window.h>
|
#include <SFML/Window/Window.h>
|
||||||
#include <SFML/System/Vector2.h>
|
#include <SFML/System/Vector2.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -160,6 +161,16 @@ CSFML_GRAPHICS_API void sfRenderWindow_setPosition(sfRenderWindow* renderWindow,
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfVector2u sfRenderWindow_getSize(const 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
|
/// \brief Change the size of the rendering region of a render window
|
||||||
///
|
///
|
||||||
@@ -207,6 +218,15 @@ CSFML_GRAPHICS_API void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, uns
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfRenderWindow_setVisible(sfRenderWindow* renderWindow, sfBool visible);
|
CSFML_GRAPHICS_API void sfRenderWindow_setVisible(sfRenderWindow* renderWindow, sfBool visible);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Enable / disable vertical synchronization on a render window
|
||||||
|
///
|
||||||
|
/// \param renderWindow Render window object
|
||||||
|
/// \param enabled sfTrue to enable v-sync, sfFalse to deactivate
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow* renderWindow, sfBool enabled);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Show or hide the mouse cursor on a render window
|
/// \brief Show or hide the mouse cursor on a render window
|
||||||
///
|
///
|
||||||
@@ -217,13 +237,38 @@ CSFML_GRAPHICS_API void sfRenderWindow_setVisible(sfRenderWindow* renderWindow,
|
|||||||
CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorVisible(sfRenderWindow* renderWindow, sfBool show);
|
CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorVisible(sfRenderWindow* renderWindow, sfBool show);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Enable / disable vertical synchronization on a render window
|
/// \brief Grab or release the mouse cursor
|
||||||
///
|
///
|
||||||
/// \param renderWindow Render window object
|
/// If set, grabs the mouse cursor inside this window's client
|
||||||
/// \param enabled sfTrue to enable v-sync, sfFalse to deactivate
|
/// area so it may no longer be moved outside its bounds.
|
||||||
|
/// Note that grabbing is only active while the window has
|
||||||
|
/// focus and calling this function for fullscreen windows
|
||||||
|
/// won't have any effect (fullscreen windows always grab the
|
||||||
|
/// cursor).
|
||||||
|
///
|
||||||
|
/// \param grabbed sfTrue to enable, sfFalse to disable
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow* renderWindow, sfBool enabled);
|
CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorGrabbed(sfRenderWindow* renderWindow, sfBool grabbed);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Set the displayed cursor to a native system cursor
|
||||||
|
///
|
||||||
|
/// Upon window creation, the arrow cursor is used by default.
|
||||||
|
///
|
||||||
|
/// \warning The cursor must not be destroyed while in use by
|
||||||
|
/// the window.
|
||||||
|
///
|
||||||
|
/// \warning Features related to Cursor are not supported on
|
||||||
|
/// iOS and Android.
|
||||||
|
///
|
||||||
|
/// \param cursor Native system cursor type to display
|
||||||
|
///
|
||||||
|
/// \see sfCursor_createFromSystem
|
||||||
|
/// \see sfCursor_createFromPixels
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursor(sfRenderWindow* window, const sfCursor* cursor);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Enable or disable automatic key-repeat for keydown events
|
/// \brief Enable or disable automatic key-repeat for keydown events
|
||||||
@@ -236,25 +281,6 @@ CSFML_GRAPHICS_API void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow* re
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfRenderWindow_setKeyRepeatEnabled(sfRenderWindow* renderWindow, sfBool enabled);
|
CSFML_GRAPHICS_API void sfRenderWindow_setKeyRepeatEnabled(sfRenderWindow* renderWindow, sfBool enabled);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Activate or deactivate a render window as the current target for rendering
|
|
||||||
///
|
|
||||||
/// \param renderWindow Render window object
|
|
||||||
/// \param active sfTrue to activate, sfFalse to deactivate
|
|
||||||
///
|
|
||||||
/// \return True if operation was successful, false otherwise
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
CSFML_GRAPHICS_API sfBool sfRenderWindow_setActive(sfRenderWindow* renderWindow, sfBool active);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Display a render window on screen
|
|
||||||
///
|
|
||||||
/// \param renderWindow Render window object
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
CSFML_GRAPHICS_API void sfRenderWindow_display(sfRenderWindow* renderWindow);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Limit the framerate to a maximum fixed frequency for a render window
|
/// \brief Limit the framerate to a maximum fixed frequency for a render window
|
||||||
///
|
///
|
||||||
@@ -273,6 +299,51 @@ CSFML_GRAPHICS_API void sfRenderWindow_setFramerateLimit(sfRenderWindow* renderW
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfRenderWindow_setJoystickThreshold(sfRenderWindow* renderWindow, float threshold);
|
CSFML_GRAPHICS_API void sfRenderWindow_setJoystickThreshold(sfRenderWindow* renderWindow, float threshold);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Activate or deactivate a render window as the current target for rendering
|
||||||
|
///
|
||||||
|
/// \param renderWindow Render window object
|
||||||
|
/// \param active sfTrue to activate, sfFalse to deactivate
|
||||||
|
///
|
||||||
|
/// \return True if operation was successful, false otherwise
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfBool sfRenderWindow_setActive(sfRenderWindow* renderWindow, sfBool active);
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
/// \brief Request the current render window to be made the active
|
||||||
|
/// foreground window
|
||||||
|
///
|
||||||
|
/// At any given time, only one window may have the input focus
|
||||||
|
/// to receive input events such as keystrokes or mouse events.
|
||||||
|
/// If a window requests focus, it only hints to the operating
|
||||||
|
/// system, that it would like to be focused. The operating system
|
||||||
|
/// is free to deny the request.
|
||||||
|
/// This is not to be confused with sfWindow_setActive().
|
||||||
|
///
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfRenderWindow_requestFocus(sfRenderWindow* renderWindow);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Check whether the render window has the input focus
|
||||||
|
///
|
||||||
|
/// At any given time, only one window may have the input focus
|
||||||
|
/// to receive input events such as keystrokes or most mouse
|
||||||
|
/// events.
|
||||||
|
///
|
||||||
|
/// \return True if window has focus, false otherwise
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfBool sfRenderWindow_hasFocus(const sfRenderWindow* renderWindow);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Display a render window on screen
|
||||||
|
///
|
||||||
|
/// \param renderWindow Render window object
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfRenderWindow_display(sfRenderWindow* renderWindow);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Retrieve the OS-specific handle of a render window
|
/// \brief Retrieve the OS-specific handle of a render window
|
||||||
///
|
///
|
||||||
@@ -403,6 +474,21 @@ CSFML_GRAPHICS_API void sfRenderWindow_drawCircleShape(sfRenderWindow* renderWin
|
|||||||
CSFML_GRAPHICS_API void sfRenderWindow_drawConvexShape(sfRenderWindow* renderWindow, const sfConvexShape* object, const sfRenderStates* states);
|
CSFML_GRAPHICS_API void sfRenderWindow_drawConvexShape(sfRenderWindow* renderWindow, const sfConvexShape* object, const sfRenderStates* states);
|
||||||
CSFML_GRAPHICS_API void sfRenderWindow_drawRectangleShape(sfRenderWindow* renderWindow, const sfRectangleShape* object, const sfRenderStates* states);
|
CSFML_GRAPHICS_API void sfRenderWindow_drawRectangleShape(sfRenderWindow* renderWindow, const sfRectangleShape* object, const sfRenderStates* states);
|
||||||
CSFML_GRAPHICS_API void sfRenderWindow_drawVertexArray(sfRenderWindow* renderWindow, const sfVertexArray* object, const sfRenderStates* states);
|
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
|
/// \brief Draw primitives defined by an array of vertices to a render window
|
||||||
@@ -415,7 +501,7 @@ CSFML_GRAPHICS_API void sfRenderWindow_drawVertexArray(sfRenderWindow* renderWin
|
|||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfRenderWindow_drawPrimitives(sfRenderWindow* renderWindow,
|
CSFML_GRAPHICS_API void sfRenderWindow_drawPrimitives(sfRenderWindow* renderWindow,
|
||||||
const sfVertex* vertices, unsigned int vertexCount,
|
const sfVertex* vertices, size_t vertexCount,
|
||||||
sfPrimitiveType type, const sfRenderStates* states);
|
sfPrimitiveType type, const sfRenderStates* states);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -467,38 +553,47 @@ CSFML_GRAPHICS_API void sfRenderWindow_popGLStates(sfRenderWindow* renderWindow)
|
|||||||
CSFML_GRAPHICS_API void sfRenderWindow_resetGLStates(sfRenderWindow* renderWindow);
|
CSFML_GRAPHICS_API void sfRenderWindow_resetGLStates(sfRenderWindow* renderWindow);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Copy the current contents of a render window to an image
|
/// \brief Copy the current contents of the window to an image
|
||||||
|
///
|
||||||
|
/// \deprecated
|
||||||
|
/// Use a sfTexture and its
|
||||||
|
/// sfTexture_updateFromRenderWindow(sfTexture*, const sfRenderWindow*, unsigned int, unsigned int)
|
||||||
|
/// function and copy its contents into an sfImage instead.
|
||||||
|
/// \code
|
||||||
|
/// sfVector2u windowSize = sfRenderWindow_getSize(window);
|
||||||
|
/// sfTexture* texture = sfTexture_create(windowSize.x, windowSize.y);
|
||||||
|
/// sfTexture_updateFromRenderWindow(texture, window, windowSize.x, windowSize.y);
|
||||||
|
/// sfImage* screenshot = sfTexture_copyToImage(texture);
|
||||||
|
/// \endcode
|
||||||
///
|
///
|
||||||
/// This is a slow operation, whose main purpose is to make
|
/// This is a slow operation, whose main purpose is to make
|
||||||
/// screenshots of the application. If you want to update an
|
/// screenshots of the application. If you want to update an
|
||||||
/// image with the contents of the window and then use it for
|
/// image with the contents of the window and then use it for
|
||||||
/// drawing, you should rather use a sfTexture and its
|
/// drawing, you should rather use a sfTexture and the
|
||||||
/// update(sfWindow*) function.
|
/// sfTexture_updateFromWindow(sfTexture*, const sfWindow*, unsigned int, unsigned int) function.
|
||||||
/// You can also draw things directly to a texture with the
|
/// You can also draw things directly to a texture with the
|
||||||
/// sfRenderWindow class.
|
/// sfRenderTexture class.
|
||||||
///
|
///
|
||||||
/// \param renderWindow Render window object
|
/// \return sfImage containing the captured contents.
|
||||||
///
|
|
||||||
/// \return New image containing the captured contents
|
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfImage* sfRenderWindow_capture(const sfRenderWindow* renderWindow);
|
CSFML_GRAPHICS_API CSFML_DEPRECATED sfImage* sfRenderWindow_capture(const sfRenderWindow* renderWindow);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the current position of the mouse relatively to a render-window
|
/// \brief Get the current position of the mouse relative to a render-window
|
||||||
///
|
///
|
||||||
/// This function returns the current position of the mouse
|
/// This function returns the current position of the mouse
|
||||||
/// cursor relative to the given render-window, or desktop if NULL is passed.
|
/// cursor relative to the given render-window, or desktop if NULL is passed.
|
||||||
///
|
///
|
||||||
/// \param relativeTo Reference window
|
/// \param relativeTo Reference window
|
||||||
///
|
///
|
||||||
/// \return Position of the mouse cursor, relative to the given render-window
|
/// \return Position of the mouse cursor, relative to the given render window
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfVector2i sfMouse_getPositionRenderWindow(const sfRenderWindow* relativeTo);
|
CSFML_GRAPHICS_API sfVector2i sfMouse_getPositionRenderWindow(const sfRenderWindow* relativeTo);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set the current position of the mouse relatively to a render-window
|
/// \brief Set the current position of the mouse relative to a render window
|
||||||
///
|
///
|
||||||
/// This function sets the current position of the mouse
|
/// This function sets the current position of the mouse
|
||||||
/// cursor relative to the given render-window, or desktop if NULL is passed.
|
/// cursor relative to the given render-window, or desktop if NULL is passed.
|
||||||
@@ -509,5 +604,32 @@ CSFML_GRAPHICS_API sfVector2i sfMouse_getPositionRenderWindow(const sfRenderWind
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfMouse_setPositionRenderWindow(sfVector2i position, const sfRenderWindow* relativeTo);
|
CSFML_GRAPHICS_API void sfMouse_setPositionRenderWindow(sfVector2i position, const sfRenderWindow* relativeTo);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the current position of a touch in window coordinates
|
||||||
|
///
|
||||||
|
/// This function returns the current touch position
|
||||||
|
/// relative to the given render window, or desktop if NULL is passed.
|
||||||
|
///
|
||||||
|
/// \param finger Finger index
|
||||||
|
/// \param relativeTo Reference window
|
||||||
|
///
|
||||||
|
/// \return Current position of \a finger, or undefined if it's not down
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
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
|
#endif // SFML_RENDERWINDOW_H
|
||||||
+354
-26
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -30,69 +30,74 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Graphics/Export.h>
|
#include <SFML/Graphics/Export.h>
|
||||||
#include <SFML/Graphics/Color.h>
|
#include <SFML/Graphics/Color.h>
|
||||||
|
#include <SFML/Graphics/Glsl.h>
|
||||||
#include <SFML/Graphics/Transform.h>
|
#include <SFML/Graphics/Transform.h>
|
||||||
#include <SFML/Graphics/Types.h>
|
#include <SFML/Graphics/Types.h>
|
||||||
#include <SFML/System/InputStream.h>
|
#include <SFML/System/InputStream.h>
|
||||||
#include <SFML/System/Vector2.h>
|
#include <SFML/System/Vector2.h>
|
||||||
#include <SFML/System/Vector3.h>
|
#include <SFML/System/Vector3.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Load both the vertex and fragment shaders from files
|
/// \brief Load the vertex, geometry and fragment shaders from files
|
||||||
///
|
///
|
||||||
/// This function can load both the vertex and the fragment
|
/// This function loads the vertex, geometry and fragment
|
||||||
/// shaders, or only one of them: pass NULL if you don't want to load
|
/// shaders. Pass NULL if you don't want to load
|
||||||
/// either the vertex shader or the fragment shader.
|
/// a specific shader.
|
||||||
/// The sources must be text files containing valid shaders
|
/// The sources must be text files containing valid shaders
|
||||||
/// in GLSL language. GLSL is a C-like language dedicated to
|
/// in GLSL language. GLSL is a C-like language dedicated to
|
||||||
/// OpenGL shaders; you'll probably need to read a good documentation
|
/// OpenGL shaders; you'll probably need to read a good documentation
|
||||||
/// for it before writing your own shaders.
|
/// for it before writing your own shaders.
|
||||||
///
|
///
|
||||||
/// \param vertexShaderFilename Path of the vertex shader file to load, or NULL to skip this shader
|
/// \param vertexShaderFilename Path of the vertex shader file to load, or NULL to skip this shader
|
||||||
|
/// \param geometryShaderFilename Path of the geometry shader file to load, or NULL to skip this shader
|
||||||
/// \param fragmentShaderFilename Path of the fragment shader file to load, or NULL to skip this shader
|
/// \param fragmentShaderFilename Path of the fragment shader file to load, or NULL to skip this shader
|
||||||
///
|
///
|
||||||
/// \return A new sfShader object, or NULL if it failed
|
/// \return A new sfShader object, or NULL if it failed
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfShader* sfShader_createFromFile(const char* vertexShaderFilename, const char* fragmentShaderFilename);
|
CSFML_GRAPHICS_API sfShader* sfShader_createFromFile(const char* vertexShaderFilename, const char* geometryShaderFilename, const char* fragmentShaderFilename);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Load both the vertex and fragment shaders from source codes in memory
|
/// \brief Load the vertex, geometry and fragment shaders from source code in memory
|
||||||
///
|
///
|
||||||
/// This function can load both the vertex and the fragment
|
/// This function loads the vertex, geometry and fragment
|
||||||
/// shaders, or only one of them: pass NULL if you don't want to load
|
/// shaders. Pass NULL if you don't want to load
|
||||||
/// either the vertex shader or the fragment shader.
|
/// a specific shader.
|
||||||
/// The sources must be valid shaders in GLSL language. GLSL is
|
/// The sources must be valid shaders in GLSL language. GLSL is
|
||||||
/// a C-like language dedicated to OpenGL shaders; you'll
|
/// a C-like language dedicated to OpenGL shaders; you'll
|
||||||
/// probably need to read a good documentation for it before
|
/// probably need to read a good documentation for it before
|
||||||
/// writing your own shaders.
|
/// writing your own shaders.
|
||||||
///
|
///
|
||||||
/// \param vertexShader String containing the source code of the vertex shader, or NULL to skip this shader
|
/// \param vertexShader String containing the source code of the vertex shader, or NULL to skip this shader
|
||||||
|
/// \param geometryShader String containing the source code of the geometry shader, or NULL to skip this shader
|
||||||
/// \param fragmentShader String containing the source code of the fragment shader, or NULL to skip this shader
|
/// \param fragmentShader String containing the source code of the fragment shader, or NULL to skip this shader
|
||||||
///
|
///
|
||||||
/// \return A new sfShader object, or NULL if it failed
|
/// \return A new sfShader object, or NULL if it failed
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfShader* sfShader_createFromMemory(const char* vertexShader, const char* fragmentShader);
|
CSFML_GRAPHICS_API sfShader* sfShader_createFromMemory(const char* vertexShader, const char* geometryShader, const char* fragmentShader);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Load both the vertex and fragment shaders from custom streams
|
/// \brief Load the vertex, geometry and fragment shaders from custom streams
|
||||||
///
|
///
|
||||||
/// This function can load both the vertex and the fragment
|
/// This function loads the vertex, geometry and fragment
|
||||||
/// shaders, or only one of them: pass NULL if you don't want to load
|
/// shaders. Pass NULL if you don't want to load
|
||||||
/// either the vertex shader or the fragment shader.
|
/// a specific shader.
|
||||||
/// The source codes must be valid shaders in GLSL language.
|
/// The source codes must be valid shaders in GLSL language.
|
||||||
/// GLSL is a C-like language dedicated to OpenGL shaders;
|
/// GLSL is a C-like language dedicated to OpenGL shaders;
|
||||||
/// you'll probably need to read a good documentation for
|
/// you'll probably need to read a good documentation for
|
||||||
/// it before writing your own shaders.
|
/// it before writing your own shaders.
|
||||||
///
|
///
|
||||||
/// \param vertexShaderStream Source stream to read the vertex shader from, or NULL to skip this shader
|
/// \param vertexShaderStream Source stream to read the vertex shader from, or NULL to skip this shader
|
||||||
|
/// \param geometryShaderStream Source stream to read the geometry shader from, or NULL to skip this shader
|
||||||
/// \param fragmentShaderStream Source stream to read the fragment shader from, or NULL to skip this shader
|
/// \param fragmentShaderStream Source stream to read the fragment shader from, or NULL to skip this shader
|
||||||
///
|
///
|
||||||
/// \return A new sfShader object, or NULL if it failed
|
/// \return A new sfShader object, or NULL if it failed
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream, sfInputStream* fragmentShaderStream);
|
CSFML_GRAPHICS_API sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream, sfInputStream* geometryShaderStream, sfInputStream* fragmentShaderStream);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Destroy an existing shader
|
/// \brief Destroy an existing shader
|
||||||
@@ -102,6 +107,297 @@ CSFML_GRAPHICS_API sfShader* sfShader_createFromStream(sfInputStream* vertexShad
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfShader_destroy(sfShader* shader);
|
CSFML_GRAPHICS_API void sfShader_destroy(sfShader* shader);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p float uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param x Value of the float scalar
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setFloatUniform(sfShader* shader, const char* name, float x);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p vec2 uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param vector Value of the vec2 vector
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setVec2Uniform(sfShader* shader, const char* name, sfGlslVec2 vector);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p vec3 uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param vector Value of the vec3 vector
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setVec3Uniform(sfShader* shader, const char* name, sfGlslVec3 vector);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p vec4 uniform
|
||||||
|
///
|
||||||
|
/// sfColor objects can be passed to this function via
|
||||||
|
/// the use of sfGlslVec4_fromsfColor(sfColor);
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param vector Value of the vec4 vector
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setVec4Uniform(sfShader* shader, const char* name, sfGlslVec4 vector);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p vec4 uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param color Value of the vec4 vector
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setColorUniform(sfShader* shader, const char* name, sfColor color);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p int uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param x Value of the integer scalar
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setIntUniform(sfShader* shader, const char* name, int x);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p ivec2 uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param vector Value of the ivec2 vector
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setIvec2Uniform(sfShader* shader, const char* name, sfGlslIvec2 vector);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p ivec3 uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param vector Value of the ivec3 vector
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setIvec3Uniform(sfShader* shader, const char* name, sfGlslIvec3 vector);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p ivec4 uniform
|
||||||
|
///
|
||||||
|
/// sfColor objects can be passed to this function via
|
||||||
|
/// the use of sfGlslIvec4_fromsfColor(sfColor);
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param vector Value of the ivec4 vector
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setIvec4Uniform(sfShader* shader, const char* name, sfGlslIvec4 vector);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p ivec4 uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param color Value of the ivec4 vector
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setIntColorUniform(sfShader* shader, const char* name, sfColor color);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p bool uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param x Value of the bool scalar
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setBoolUniform(sfShader* shader, const char* name, sfBool x);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p bvec2 uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param vector Value of the bvec2 vector
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setBvec2Uniform(sfShader* shader, const char* name, sfGlslBvec2 vector);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p Bvec3 uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param vector Value of the Bvec3 vector
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setBvec3Uniform(sfShader* shader, const char* name, sfGlslBvec3 vector);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p bvec4 uniform
|
||||||
|
///
|
||||||
|
/// sfColor objects can be passed to this function via
|
||||||
|
/// the use of sfGlslIvec4_fromsfColor(sfColor);
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param vector Value of the bvec4 vector
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setBvec4Uniform(sfShader* shader, const char* name, sfGlslBvec4 vector);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p mat3 matrix
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param matrix Value of the mat3 matrix
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setMat3Uniform(sfShader* shader, const char* name, const sfGlslMat3* matrix);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify value for \p mat4 matrix
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param matrix Value of the mat4 matrix
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setMat4Uniform(sfShader* shader, const char* name, const sfGlslMat4* matrix);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify a texture as \p sampler2D uniform
|
||||||
|
///
|
||||||
|
/// \a name is the name of the variable to change in the shader.
|
||||||
|
/// The corresponding parameter in the shader must be a 2D texture
|
||||||
|
/// (\p sampler2D GLSL type).
|
||||||
|
///
|
||||||
|
/// Example:
|
||||||
|
/// \code
|
||||||
|
/// uniform sampler2D the_texture; // this is the variable in the shader
|
||||||
|
/// \endcode
|
||||||
|
/// \code
|
||||||
|
/// sfTexture texture;
|
||||||
|
/// ...
|
||||||
|
/// sfShader_setTextureUniform(shader, "the_texture", &texture);
|
||||||
|
/// \endcode
|
||||||
|
/// It is important to note that \a texture must remain alive as long
|
||||||
|
/// as the shader uses it, no copy is made internally.
|
||||||
|
///
|
||||||
|
/// To use the texture of the object being drawn, which cannot be
|
||||||
|
/// known in advance, you can pass the special value
|
||||||
|
/// sf::Shader::CurrentTexture:
|
||||||
|
/// \code
|
||||||
|
/// shader.setUniform("the_texture", sf::Shader::CurrentTexture).
|
||||||
|
/// \endcode
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the texture in the shader
|
||||||
|
/// \param texture Texture to assign
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setTextureUniform(sfShader* shader, const char* name, const sfTexture* texture);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify current texture as \p sampler2D uniform
|
||||||
|
///
|
||||||
|
/// This overload maps a shader texture variable to the
|
||||||
|
/// texture of the object being drawn, which cannot be
|
||||||
|
/// known in advance.
|
||||||
|
/// The corresponding parameter in the shader must be a 2D texture
|
||||||
|
/// (\p sampler2D GLSL type).
|
||||||
|
///
|
||||||
|
/// Example:
|
||||||
|
/// \code
|
||||||
|
/// uniform sampler2D current; // this is the variable in the shader
|
||||||
|
/// \endcode
|
||||||
|
/// \code
|
||||||
|
/// sfShader_setCurrentTextureUniform(shader, "current");
|
||||||
|
/// \endcode
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the texture in the shader
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setCurrentTextureUniform(sfShader* shader, const char* name);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify values for \p float[] array uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param scalarArray pointer to array of \p float values
|
||||||
|
/// \param length Number of elements in the array
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setFloatUniformArray(sfShader* shader, const char* name, const float* scalarArray, size_t length);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify values for \p vec2[] array uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param vectorArray pointer to array of \p vec2 values
|
||||||
|
/// \param length Number of elements in the array
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setVec2UniformArray(sfShader* shader, const char* name, const sfGlslVec2* vectorArray, size_t length);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify values for \p vec3[] array uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param vectorArray pointer to array of \p vec3 values
|
||||||
|
/// \param length Number of elements in the array
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setVec3UniformArray(sfShader* shader, const char* name, const sfGlslVec3* vectorArray, size_t length);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify values for \p vec4[] array uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param vectorArray pointer to array of \p vec4 values
|
||||||
|
/// \param length Number of elements in the array
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setVec4UniformArray(sfShader* shader, const char* name, const sfGlslVec4* vectorArray, size_t length);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify values for \p mat3[] array uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param matrixArray pointer to array of \p mat3 values
|
||||||
|
/// \param length Number of elements in the array
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setMat3UniformArray(sfShader* shader, const char* name, const sfGlslMat3* matrixArray, size_t length);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Specify values for \p mat4[] array uniform
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
/// \param name Name of the uniform variable in GLSL
|
||||||
|
/// \param matrixArray pointer to array of \p mat4 values
|
||||||
|
/// \param length Number of elements in the array
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfShader_setMat4UniformArray(sfShader* shader, const char* name, const sfGlslMat4* matrixArray, size_t length);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Change a float parameter of a shader
|
/// \brief Change a float parameter of a shader
|
||||||
///
|
///
|
||||||
@@ -122,7 +418,7 @@ CSFML_GRAPHICS_API void sfShader_destroy(sfShader* shader);
|
|||||||
/// \param x Value to assign
|
/// \param x Value to assign
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfShader_setFloatParameter(sfShader* shader, const char* name, float x);
|
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloatParameter(sfShader* shader, const char* name, float x);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Change a 2-components vector parameter of a shader
|
/// \brief Change a 2-components vector parameter of a shader
|
||||||
@@ -145,7 +441,7 @@ CSFML_GRAPHICS_API void sfShader_setFloatParameter(sfShader* shader, const char*
|
|||||||
/// \param y Second component of the value to assign
|
/// \param y Second component of the value to assign
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfShader_setFloat2Parameter(sfShader* shader, const char* name, float x, float y);
|
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat2Parameter(sfShader* shader, const char* name, float x, float y);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Change a 3-components vector parameter of a shader
|
/// \brief Change a 3-components vector parameter of a shader
|
||||||
@@ -169,7 +465,7 @@ CSFML_GRAPHICS_API void sfShader_setFloat2Parameter(sfShader* shader, const char
|
|||||||
/// \param z Third component of the value to assign
|
/// \param z Third component of the value to assign
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfShader_setFloat3Parameter(sfShader* shader, const char* name, float x, float y, float z);
|
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat3Parameter(sfShader* shader, const char* name, float x, float y, float z);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Change a 4-components vector parameter of a shader
|
/// \brief Change a 4-components vector parameter of a shader
|
||||||
@@ -194,7 +490,7 @@ CSFML_GRAPHICS_API void sfShader_setFloat3Parameter(sfShader* shader, const char
|
|||||||
/// \param w Fourth component of the value to assign
|
/// \param w Fourth component of the value to assign
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfShader_setFloat4Parameter(sfShader* shader, const char* name, float x, float y, float z, float w);
|
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat4Parameter(sfShader* shader, const char* name, float x, float y, float z, float w);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Change a 2-components vector parameter of a shader
|
/// \brief Change a 2-components vector parameter of a shader
|
||||||
@@ -217,7 +513,7 @@ CSFML_GRAPHICS_API void sfShader_setFloat4Parameter(sfShader* shader, const char
|
|||||||
/// \param vector Vector to assign
|
/// \param vector Vector to assign
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfShader_setVector2Parameter(sfShader* shader, const char* name, sfVector2f vector);
|
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setVector2Parameter(sfShader* shader, const char* name, sfVector2f vector);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Change a 3-components vector parameter of a shader
|
/// \brief Change a 3-components vector parameter of a shader
|
||||||
@@ -240,7 +536,7 @@ CSFML_GRAPHICS_API void sfShader_setVector2Parameter(sfShader* shader, const cha
|
|||||||
/// \param vector Vector to assign
|
/// \param vector Vector to assign
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfShader_setVector3Parameter(sfShader* shader, const char* name, sfVector3f vector);
|
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setVector3Parameter(sfShader* shader, const char* name, sfVector3f vector);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Change a color parameter of a shader
|
/// \brief Change a color parameter of a shader
|
||||||
@@ -268,7 +564,7 @@ CSFML_GRAPHICS_API void sfShader_setVector3Parameter(sfShader* shader, const cha
|
|||||||
/// \param color Color to assign
|
/// \param color Color to assign
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfShader_setColorParameter(sfShader* shader, const char* name, sfColor color);
|
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setColorParameter(sfShader* shader, const char* name, sfColor color);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Change a matrix parameter of a shader
|
/// \brief Change a matrix parameter of a shader
|
||||||
@@ -291,7 +587,7 @@ CSFML_GRAPHICS_API void sfShader_setColorParameter(sfShader* shader, const char*
|
|||||||
/// \param transform Transform to assign
|
/// \param transform Transform to assign
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfShader_setTransformParameter(sfShader* shader, const char* name, sfTransform transform);
|
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setTransformParameter(sfShader* shader, const char* name, sfTransform transform);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Change a texture parameter of a shader
|
/// \brief Change a texture parameter of a shader
|
||||||
@@ -324,7 +620,7 @@ CSFML_GRAPHICS_API void sfShader_setTransformParameter(sfShader* shader, const c
|
|||||||
/// \param texture Texture to assign
|
/// \param texture Texture to assign
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfShader_setTextureParameter(sfShader* shader, const char* name, const sfTexture* texture);
|
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setTextureParameter(sfShader* shader, const char* name, const sfTexture* texture);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Change a texture parameter of a shader
|
/// \brief Change a texture parameter of a shader
|
||||||
@@ -347,7 +643,21 @@ CSFML_GRAPHICS_API void sfShader_setTextureParameter(sfShader* shader, const cha
|
|||||||
/// \param name Name of the texture in the shader
|
/// \param name Name of the texture in the shader
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name);
|
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the underlying OpenGL handle of the shader.
|
||||||
|
///
|
||||||
|
/// You shouldn't need to use this function, unless you have
|
||||||
|
/// very specific stuff to implement that SFML doesn't support,
|
||||||
|
/// or implement a temporary workaround until a bug is fixed.
|
||||||
|
///
|
||||||
|
/// \param shader Shader object
|
||||||
|
///
|
||||||
|
/// \return OpenGL handle of the shader or 0 if not yet loaded
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API unsigned int sfShader_getNativeHandle(const sfShader* shader);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Bind a shader for rendering (activate it)
|
/// \brief Bind a shader for rendering (activate it)
|
||||||
@@ -384,5 +694,23 @@ CSFML_GRAPHICS_API void sfShader_bind(const sfShader* shader);
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfBool sfShader_isAvailable(void);
|
CSFML_GRAPHICS_API sfBool sfShader_isAvailable(void);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Tell whether or not the system supports geometry shaders
|
||||||
|
///
|
||||||
|
/// This function should always be called before using
|
||||||
|
/// the geometry shader features. If it returns false, then
|
||||||
|
/// any attempt to use sfShader geometry shader features will fail.
|
||||||
|
///
|
||||||
|
/// This function can only return true if isAvailable() would also
|
||||||
|
/// return true, since shaders in general have to be supported in
|
||||||
|
/// order for geometry shaders to be supported as well.
|
||||||
|
///
|
||||||
|
/// Note: The first call to this function, whether by your
|
||||||
|
/// code or SFML will result in a context switch.
|
||||||
|
///
|
||||||
|
/// \return True if geometry shaders are supported, false otherwise
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfBool sfShader_isGeometryAvailable(void);
|
||||||
|
|
||||||
#endif // SFML_SHADER_H
|
#endif // SFML_SHADER_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -34,10 +34,11 @@
|
|||||||
#include <SFML/Graphics/Transform.h>
|
#include <SFML/Graphics/Transform.h>
|
||||||
#include <SFML/Graphics/Types.h>
|
#include <SFML/Graphics/Types.h>
|
||||||
#include <SFML/System/Vector2.h>
|
#include <SFML/System/Vector2.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
typedef unsigned int (*sfShapeGetPointCountCallback)(void*); ///< Type of the callback used to get the number of points in a shape
|
typedef size_t (*sfShapeGetPointCountCallback)(void*); ///< Type of the callback used to get the number of points in a shape
|
||||||
typedef sfVector2f (*sfShapeGetPointCallback)(unsigned int, void*); ///< Type of the callback used to get a point of a shape
|
typedef sfVector2f (*sfShapeGetPointCallback)(size_t, void*); ///< Type of the callback used to get a point of a shape
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Create a new shape
|
/// \brief Create a new shape
|
||||||
@@ -56,7 +57,7 @@ CSFML_GRAPHICS_API sfShape* sfShape_create(sfShapeGetPointCountCallback getPoint
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Destroy an existing shape
|
/// \brief Destroy an existing shape
|
||||||
///
|
///
|
||||||
/// \param Shape Shape to delete
|
/// \param shape Shape to delete
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfShape_destroy(sfShape* shape);
|
CSFML_GRAPHICS_API void sfShape_destroy(sfShape* shape);
|
||||||
@@ -351,7 +352,7 @@ CSFML_GRAPHICS_API float sfShape_getOutlineThickness(const sfShape* shape);
|
|||||||
/// \return Number of points of the shape
|
/// \return Number of points of the shape
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API unsigned int sfShape_getPointCount(const sfShape* shape);
|
CSFML_GRAPHICS_API size_t sfShape_getPointCount(const sfShape* shape);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get a point of a shape
|
/// \brief Get a point of a shape
|
||||||
@@ -364,7 +365,7 @@ CSFML_GRAPHICS_API unsigned int sfShape_getPointCount(const sfShape* shape);
|
|||||||
/// \return Index-th point of the shape
|
/// \return Index-th point of the shape
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfVector2f sfShape_getPoint(const sfShape* shape, unsigned int index);
|
CSFML_GRAPHICS_API sfVector2f sfShape_getPoint(const sfShape* shape, size_t index);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the local bounding rectangle of a shape
|
/// \brief Get the local bounding rectangle of a shape
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
|||||||
+147
-10
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -42,10 +42,11 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
sfTextRegular = 0, ///< Regular characters, no style
|
sfTextRegular = 0, ///< Regular characters, no style
|
||||||
sfTextBold = 1 << 0, ///< Characters are bold
|
sfTextBold = 1 << 0, ///< Bold characters
|
||||||
sfTextItalic = 1 << 1, ///< Characters are in italic
|
sfTextItalic = 1 << 1, ///< Italic characters
|
||||||
sfTextUnderlined = 1 << 2 ///< Characters are underlined
|
sfTextUnderlined = 1 << 2, ///< Underlined characters
|
||||||
|
sfTextStrikeThrough = 1 << 3 ///< Strike through characters
|
||||||
} sfTextStyle;
|
} sfTextStyle;
|
||||||
|
|
||||||
|
|
||||||
@@ -275,6 +276,41 @@ CSFML_GRAPHICS_API void sfText_setFont(sfText* text, const sfFont* font);
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfText_setCharacterSize(sfText* text, unsigned int size);
|
CSFML_GRAPHICS_API void sfText_setCharacterSize(sfText* text, unsigned int size);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Set the line spacing factor
|
||||||
|
///
|
||||||
|
/// The default spacing between lines is defined by the font.
|
||||||
|
/// This method enables you to set a factor for the spacing
|
||||||
|
/// between lines. By default the line spacing factor is 1.
|
||||||
|
///
|
||||||
|
/// \param text Text object
|
||||||
|
/// \param spacingFactor New line spacing factor
|
||||||
|
///
|
||||||
|
/// \see sfText_getLineSpacing
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfText_setLineSpacing(sfText* text, float spacingFactor);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Set the letter spacing factor
|
||||||
|
///
|
||||||
|
/// The default spacing between letters is defined by the font.
|
||||||
|
/// This factor doesn't directly apply to the existing
|
||||||
|
/// spacing between each character, it rather adds a fixed
|
||||||
|
/// space between them which is calculated from the font
|
||||||
|
/// metrics and the character size.
|
||||||
|
/// Note that factors below 1 (including negative numbers) bring
|
||||||
|
/// characters closer to each other.
|
||||||
|
/// By default the letter spacing factor is 1.
|
||||||
|
///
|
||||||
|
/// \param text Text object
|
||||||
|
/// \param spacingFactor New letter spacing factor
|
||||||
|
///
|
||||||
|
/// \see sfText_getLetterSpacing
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfText_setLetterSpacing(sfText* text, float spacingFactor);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set the style of a text
|
/// \brief Set the style of a text
|
||||||
///
|
///
|
||||||
@@ -289,16 +325,60 @@ CSFML_GRAPHICS_API void sfText_setCharacterSize(sfText* text, unsigned int size)
|
|||||||
CSFML_GRAPHICS_API void sfText_setStyle(sfText* text, sfUint32 style);
|
CSFML_GRAPHICS_API void sfText_setStyle(sfText* text, sfUint32 style);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set the global color of a text
|
/// \brief Set the fill color of a text
|
||||||
///
|
///
|
||||||
/// By default, the text's color is opaque white.
|
/// By default, the text's fill color is opaque white.
|
||||||
|
/// Setting the fill color to a transparent color with an outline
|
||||||
|
/// will cause the outline to be displayed in the fill area of the text.
|
||||||
///
|
///
|
||||||
/// \param text Text object
|
/// \param text Text object
|
||||||
/// \param color New color of the text
|
/// \param color New fill color of the text
|
||||||
|
///
|
||||||
|
/// \deprecated This function is deprecated and may be removed in future releases.
|
||||||
|
/// Use sfText_setFillColor instead.
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfText_setColor(sfText* text, sfColor color);
|
CSFML_GRAPHICS_API void sfText_setColor(sfText* text, sfColor color);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Set the fill color of a text
|
||||||
|
///
|
||||||
|
/// By default, the text's fill color is opaque white.
|
||||||
|
/// Setting the fill color to a transparent color with an outline
|
||||||
|
/// will cause the outline to be displayed in the fill area of the text.
|
||||||
|
///
|
||||||
|
/// \param text Text object
|
||||||
|
/// \param color New fill color of the text
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfText_setFillColor(sfText* text, sfColor color);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Set the outline color of the text
|
||||||
|
///
|
||||||
|
/// By default, the text's outline color is opaque black.
|
||||||
|
///
|
||||||
|
/// \param text Text object
|
||||||
|
/// \param color New outline color of the text
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfText_setOutlineColor(sfText* text, sfColor color);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Set the thickness of the text's outline
|
||||||
|
///
|
||||||
|
/// By default, the outline thickness is 0.
|
||||||
|
///
|
||||||
|
/// Be aware that using a negative value for the outline
|
||||||
|
/// thickness will cause distorted rendering.
|
||||||
|
///
|
||||||
|
/// \param thickness New outline thickness, in pixels
|
||||||
|
///
|
||||||
|
/// \see getOutlineThickness
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfText_setOutlineThickness(sfText* text, float thickness);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the string of a text (returns an ANSI string)
|
/// \brief Get the string of a text (returns an ANSI string)
|
||||||
///
|
///
|
||||||
@@ -343,6 +423,30 @@ CSFML_GRAPHICS_API const sfFont* sfText_getFont(const sfText* text);
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API unsigned int sfText_getCharacterSize(const sfText* text);
|
CSFML_GRAPHICS_API unsigned int sfText_getCharacterSize(const sfText* text);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the size of the letter spacing factor
|
||||||
|
///
|
||||||
|
/// \param text Text object
|
||||||
|
///
|
||||||
|
/// \return Size of the letter spacing factor
|
||||||
|
///
|
||||||
|
/// \see sfText_setLetterSpacing
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API float sfText_getLetterSpacing(const sfText* text);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the size of the line spacing factor
|
||||||
|
///
|
||||||
|
/// \param text Text object
|
||||||
|
///
|
||||||
|
/// \return Size of the line spacing factor
|
||||||
|
///
|
||||||
|
/// \see sfText_setLineSpacing
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API float sfText_getLineSpacing(const sfText* text);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the style of a text
|
/// \brief Get the style of a text
|
||||||
///
|
///
|
||||||
@@ -354,15 +458,48 @@ CSFML_GRAPHICS_API unsigned int sfText_getCharacterSize(const sfText* text);
|
|||||||
CSFML_GRAPHICS_API sfUint32 sfText_getStyle(const sfText* text);
|
CSFML_GRAPHICS_API sfUint32 sfText_getStyle(const sfText* text);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the global color of a text
|
/// \brief Get the fill color of a text
|
||||||
///
|
///
|
||||||
/// \param text Text object
|
/// \param text Text object
|
||||||
///
|
///
|
||||||
/// \return Global color of the text
|
/// \return Fill color of the text
|
||||||
|
///
|
||||||
|
/// \deprecated This function is deprecated and may be removed in future releases.
|
||||||
|
/// Use sfText_getFillColor instead.
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfColor sfText_getColor(const sfText* text);
|
CSFML_GRAPHICS_API sfColor sfText_getColor(const sfText* text);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the fill color of a text
|
||||||
|
///
|
||||||
|
/// \param text Text object
|
||||||
|
///
|
||||||
|
/// \return Fill color of the text
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfColor sfText_getFillColor(const sfText* text);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the outline color of a text
|
||||||
|
///
|
||||||
|
/// \param text Text object
|
||||||
|
///
|
||||||
|
/// \return Outline color of the text
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfColor sfText_getOutlineColor(const sfText* text);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the outline thickness of a text
|
||||||
|
///
|
||||||
|
/// \param text Text object
|
||||||
|
///
|
||||||
|
/// \return Outline thickness of a text, in pixels
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API float sfText_getOutlineThickness(const sfText* text);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Return the position of the \a index-th character in a text
|
/// \brief Return the position of the \a index-th character in a text
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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 <SFML/System/Vector2.h>
|
||||||
#include <stddef.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
|
/// \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);
|
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
|
/// \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);
|
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
|
/// \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);
|
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
|
/// \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);
|
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
|
/// \brief Copy an existing texture
|
||||||
///
|
///
|
||||||
@@ -144,6 +210,24 @@ CSFML_GRAPHICS_API sfImage* sfTexture_copyToImage(const sfTexture* texture);
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfTexture_updateFromPixels(sfTexture* texture, const sfUint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y);
|
CSFML_GRAPHICS_API void sfTexture_updateFromPixels(sfTexture* texture, const sfUint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Update a part of this texture from another texture
|
||||||
|
///
|
||||||
|
/// No additional check is performed on the size of the texture,
|
||||||
|
/// passing an invalid combination of texture size and offset
|
||||||
|
/// will lead to an undefined behavior.
|
||||||
|
///
|
||||||
|
/// This function does nothing if either texture was not
|
||||||
|
/// previously created.
|
||||||
|
///
|
||||||
|
/// \param destination Destination texture to copy source texture to
|
||||||
|
/// \param source Source texture to copy to destination texture
|
||||||
|
/// \param x X offset in this texture where to copy the source texture
|
||||||
|
/// \param y Y offset in this texture where to copy the source texture
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfTexture_updateFromTexture(sfTexture* destination, const sfTexture* source, unsigned int x, unsigned int y);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Update a texture from an image
|
/// \brief Update a texture from an image
|
||||||
///
|
///
|
||||||
@@ -196,6 +280,19 @@ CSFML_GRAPHICS_API void sfTexture_setSmooth(sfTexture* texture, sfBool smooth);
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfBool sfTexture_isSmooth(const sfTexture* texture);
|
CSFML_GRAPHICS_API sfBool sfTexture_isSmooth(const sfTexture* texture);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \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_createSrgbFromFile
|
||||||
|
/// \see sfTexture_createSrgbFromMemory
|
||||||
|
/// \see sfTexture_createSrgbFromStream
|
||||||
|
/// \see sfTexture_createSrgbFromImage
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfBool sfTexture_isSrgb(const sfTexture* texture);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Enable or disable repeating for a texture
|
/// \brief Enable or disable repeating for a texture
|
||||||
///
|
///
|
||||||
@@ -229,6 +326,54 @@ CSFML_GRAPHICS_API void sfTexture_setRepeated(sfTexture* texture, sfBool repeate
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfBool sfTexture_isRepeated(const sfTexture* texture);
|
CSFML_GRAPHICS_API sfBool sfTexture_isRepeated(const sfTexture* texture);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Generate a mipmap using the current texture data
|
||||||
|
///
|
||||||
|
/// Mipmaps are pre-computed chains of optimized textures. Each
|
||||||
|
/// level of texture in a mipmap is generated by halving each of
|
||||||
|
/// the previous level's dimensions. This is done until the final
|
||||||
|
/// level has the size of 1x1. The textures generated in this process may
|
||||||
|
/// make use of more advanced filters which might improve the visual quality
|
||||||
|
/// of textures when they are applied to objects much smaller than they are.
|
||||||
|
/// This is known as minification. Because fewer texels (texture elements)
|
||||||
|
/// have to be sampled from when heavily minified, usage of mipmaps
|
||||||
|
/// can also improve rendering performance in certain scenarios.
|
||||||
|
///
|
||||||
|
/// Mipmap generation relies on the necessary OpenGL extension being
|
||||||
|
/// available. If it is unavailable or generation fails due to another
|
||||||
|
/// reason, this function will return false. Mipmap data is only valid from
|
||||||
|
/// the time it is generated until the next time the base level image is
|
||||||
|
/// modified, at which point this function will have to be called again to
|
||||||
|
/// regenerate it.
|
||||||
|
///
|
||||||
|
/// \return sfTrue if mipmap generation was successful, sfFalse if unsuccessful
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfBool sfTexture_generateMipmap(sfTexture* texture);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Swap the contents of a texture with those of another
|
||||||
|
///
|
||||||
|
/// \param left Instance to swap from
|
||||||
|
/// \param right Instance to swap with
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfTexture_swap(sfTexture* left, sfTexture* right);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the underlying OpenGL handle of the texture.
|
||||||
|
///
|
||||||
|
/// You shouldn't need to use this function, unless you have
|
||||||
|
/// very specific stuff to implement that SFML doesn't support,
|
||||||
|
/// or implement a temporary workaround until a bug is fixed.
|
||||||
|
///
|
||||||
|
/// \param texture The texture object
|
||||||
|
///
|
||||||
|
/// \return OpenGL handle of the texture or 0 if not yet created
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API unsigned int sfTexture_getNativeHandle(const sfTexture* texture);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Bind a texture for rendering
|
/// \brief Bind a texture for rendering
|
||||||
///
|
///
|
||||||
@@ -250,7 +395,7 @@ CSFML_GRAPHICS_API sfBool sfTexture_isRepeated(const sfTexture* texture);
|
|||||||
/// \param texture Pointer to the texture to bind, can be null to use no texture
|
/// \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
|
/// \brief Get the maximum texture size allowed
|
||||||
@@ -258,7 +403,7 @@ CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture* texture);
|
|||||||
/// \return Maximum size allowed for textures, in pixels
|
/// \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
|
#endif // SFML_TEXTURE_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -139,7 +139,7 @@ CSFML_GRAPHICS_API sfFloatRect sfTransform_transformRect(const sfTransform* tran
|
|||||||
/// equivalent to a matrix multiplication.
|
/// equivalent to a matrix multiplication.
|
||||||
///
|
///
|
||||||
/// \param transform Transform object
|
/// \param transform Transform object
|
||||||
/// \param right Transform to combine to \a transform
|
/// \param other Transform to combine to \a transform
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfTransform_combine(sfTransform* transform, const sfTransform* other);
|
CSFML_GRAPHICS_API void sfTransform_combine(sfTransform* transform, const sfTransform* other);
|
||||||
@@ -206,5 +206,18 @@ CSFML_GRAPHICS_API void sfTransform_scale(sfTransform* transform, float scaleX,
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfTransform_scaleWithCenter(sfTransform* transform, float scaleX, float scaleY, float centerX, float centerY);
|
CSFML_GRAPHICS_API void sfTransform_scaleWithCenter(sfTransform* transform, float scaleX, float scaleY, float centerX, float centerY);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Compare two transforms for equality
|
||||||
|
///
|
||||||
|
/// Performs an element-wise comparison of the elements of the
|
||||||
|
/// left transform with the elements of the right transform.
|
||||||
|
///
|
||||||
|
/// \param left Left operand (the first transform)
|
||||||
|
/// \param right Right operand (the second transform)
|
||||||
|
///
|
||||||
|
/// \return true if the transforms are equal, false otherwise
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfBool sfTransform_equal(sfTransform* left, sfTransform* right);
|
||||||
|
|
||||||
#endif // SFML_TRANSFORM_H
|
#endif // SFML_TRANSFORM_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -40,6 +40,7 @@ typedef struct sfText sfText;
|
|||||||
typedef struct sfTexture sfTexture;
|
typedef struct sfTexture sfTexture;
|
||||||
typedef struct sfTransformable sfTransformable;
|
typedef struct sfTransformable sfTransformable;
|
||||||
typedef struct sfVertexArray sfVertexArray;
|
typedef struct sfVertexArray sfVertexArray;
|
||||||
|
typedef struct sfVertexBuffer sfVertexBuffer;
|
||||||
typedef struct sfView sfView;
|
typedef struct sfView sfView;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <SFML/Graphics/Rect.h>
|
#include <SFML/Graphics/Rect.h>
|
||||||
#include <SFML/Graphics/Types.h>
|
#include <SFML/Graphics/Types.h>
|
||||||
#include <SFML/Graphics/Vertex.h>
|
#include <SFML/Graphics/Vertex.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -69,7 +70,7 @@ CSFML_GRAPHICS_API void sfVertexArray_destroy(sfVertexArray* vertexArray);
|
|||||||
/// \return Number of vertices in the array
|
/// \return Number of vertices in the array
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API unsigned int sfVertexArray_getVertexCount(const sfVertexArray* vertexArray);
|
CSFML_GRAPHICS_API size_t sfVertexArray_getVertexCount(const sfVertexArray* vertexArray);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get access to a vertex by its index
|
/// \brief Get access to a vertex by its index
|
||||||
@@ -84,7 +85,7 @@ CSFML_GRAPHICS_API unsigned int sfVertexArray_getVertexCount(const sfVertexArray
|
|||||||
/// \return Pointer to the index-th vertex
|
/// \return Pointer to the index-th vertex
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfVertex* sfVertexArray_getVertex(sfVertexArray* vertexArray, unsigned int index);
|
CSFML_GRAPHICS_API sfVertex* sfVertexArray_getVertex(sfVertexArray* vertexArray, size_t index);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Clear a vertex array
|
/// \brief Clear a vertex array
|
||||||
@@ -112,7 +113,7 @@ CSFML_GRAPHICS_API void sfVertexArray_clear(sfVertexArray* vertexArray);
|
|||||||
/// \param vertexCount New size of the array (number of vertices)
|
/// \param vertexCount New size of the array (number of vertices)
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfVertexArray_resize(sfVertexArray* vertexArray, unsigned int vertexCount);
|
CSFML_GRAPHICS_API void sfVertexArray_resize(sfVertexArray* vertexArray, size_t vertexCount);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Add a vertex to a vertex array array
|
/// \brief Add a vertex to a vertex array array
|
||||||
|
|||||||
@@ -0,0 +1,254 @@
|
|||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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_VERTEXBUFFER_H
|
||||||
|
#define SFML_VERTEXBUFFER_H
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Headers
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
#include <SFML/Graphics/Export.h>
|
||||||
|
#include <SFML/Graphics/PrimitiveType.h>
|
||||||
|
#include <SFML/Graphics/Types.h>
|
||||||
|
#include <SFML/Graphics/Vertex.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Usage specifiers
|
||||||
|
///
|
||||||
|
/// If data is going to be updated once or more every frame,
|
||||||
|
/// set the usage to sfVertexBufferStream. If data is going
|
||||||
|
/// to be set once and used for a long time without being
|
||||||
|
/// modified, set the usage to sfVertexBufferUsageStatic.
|
||||||
|
/// For everything else sfVertexBufferUsageDynamic should
|
||||||
|
/// be a good compromise.
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
sfVertexBufferStream, ///< Constantly changing data
|
||||||
|
sfVertexBufferDynamic, ///< Occasionally changing data
|
||||||
|
sfVertexBufferStatic ///< Rarely changing data
|
||||||
|
} sfVertexBufferUsage;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Create a new vertex buffer with a specific
|
||||||
|
/// sfPrimitiveType and usage specifier.
|
||||||
|
///
|
||||||
|
/// Creates the vertex buffer, allocating enough graphcis
|
||||||
|
/// memory to hold \p vertexCount vertices, and sets its
|
||||||
|
/// primitive type to \p type and usage to \p usage.
|
||||||
|
///
|
||||||
|
/// \param vertexCount Amount of vertices
|
||||||
|
/// \param type Type of primitive
|
||||||
|
/// \param usage Usage specifier
|
||||||
|
///
|
||||||
|
/// \return A new sfVertexBuffer object
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfVertexBuffer* sfVertexBuffer_create(unsigned int vertexCount, sfPrimitiveType type, sfVertexBufferUsage usage);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Copy an existing vertex buffer
|
||||||
|
///
|
||||||
|
/// \param vertexBuffer Vertex buffer to copy
|
||||||
|
///
|
||||||
|
/// \return Copied object
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfVertexBuffer* sfVertexBuffer_copy(const sfVertexBuffer* vertexBuffer);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Destroy an existing vertex buffer
|
||||||
|
///
|
||||||
|
/// \param vertexBuffer Vertex buffer to delete
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfVertexBuffer_destroy(sfVertexBuffer* vertexBuffer);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Return the vertex count
|
||||||
|
///
|
||||||
|
/// \param vertexBuffer Vertex buffer object
|
||||||
|
///
|
||||||
|
/// \return Number of vertices in the vertex buffer
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API unsigned int sfVertexBuffer_getVertexCount(const sfVertexBuffer* vertexBuffer);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Update a part of the buffer from an array of vertices
|
||||||
|
///
|
||||||
|
/// \p offset is specified as the number of vertices to skip
|
||||||
|
/// from the beginning of the buffer.
|
||||||
|
///
|
||||||
|
/// If \p offset is 0 and \p vertexCount is equal to the size of
|
||||||
|
/// the currently created buffer, its whole contents are replaced.
|
||||||
|
///
|
||||||
|
/// If \p offset is 0 and \p vertexCount is greater than the
|
||||||
|
/// size of the currently created buffer, a new buffer is created
|
||||||
|
/// containing the vertex data.
|
||||||
|
///
|
||||||
|
/// If \p offset is 0 and \p vertexCount is less than the size of
|
||||||
|
/// the currently created buffer, only the corresponding region
|
||||||
|
/// is updated.
|
||||||
|
///
|
||||||
|
/// If \p offset is not 0 and \p offset + \p vertexCount is greater
|
||||||
|
/// than the size of the currently created buffer, the update fails.
|
||||||
|
///
|
||||||
|
/// No additional check is performed on the size of the vertex
|
||||||
|
/// array, passing invalid arguments will lead to undefined
|
||||||
|
/// behavior.
|
||||||
|
///
|
||||||
|
/// \param vertices Array of vertices to copy to the buffer
|
||||||
|
/// \param vertexCount Number of vertices to copy
|
||||||
|
/// \param offset Offset in the buffer to copy to
|
||||||
|
///
|
||||||
|
/// \return sfTrue if the update was successful
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfBool sfVertexBuffer_update(sfVertexBuffer* vertexBuffer, const sfVertex* vertices, unsigned int vertexCount, unsigned int offset);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Copy the contents of another buffer into this buffer
|
||||||
|
///
|
||||||
|
/// \param vertexBuffer Vertex buffer object
|
||||||
|
/// \param other Vertex buffer whose contents to copy into first vertex buffer
|
||||||
|
///
|
||||||
|
/// \return sfTrue if the copy was successful
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfBool sfVertexBuffer_updateFromVertexBuffer(sfVertexBuffer* vertexBuffer, const sfVertexBuffer* other);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Swap the contents of this vertex buffer with those of another
|
||||||
|
///
|
||||||
|
/// \param left Instance to swap
|
||||||
|
/// \param right Instance to swap with
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfVertexBuffer_swap(sfVertexBuffer* left, sfVertexBuffer* right);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the underlying OpenGL handle of the vertex buffer.
|
||||||
|
///
|
||||||
|
/// You shouldn't need to use this function, unless you have
|
||||||
|
/// very specific stuff to implement that SFML doesn't support,
|
||||||
|
/// or implement a temporary workaround until a bug is fixed.
|
||||||
|
///
|
||||||
|
/// \return OpenGL handle of the vertex buffer or 0 if not yet created
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API unsigned int sfVertexBuffer_getNativeHandle(sfVertexBuffer* vertexBuffer);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Set the type of primitives to draw
|
||||||
|
///
|
||||||
|
/// This function defines how the vertices must be interpreted
|
||||||
|
/// when it's time to draw them.
|
||||||
|
///
|
||||||
|
/// The default primitive type is sf::Points.
|
||||||
|
///
|
||||||
|
/// \param vertexBuffer Vertex buffer object
|
||||||
|
/// \param type Type of primitive
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfVertexBuffer_setPrimitiveType(sfVertexBuffer* vertexBuffer, sfPrimitiveType type);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the type of primitives drawn by the vertex buffer
|
||||||
|
///
|
||||||
|
/// \param vertexBuffer Vertex buffer object
|
||||||
|
///
|
||||||
|
/// \return Primitive type
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfPrimitiveType sfVertexBuffer_getPrimitiveType(const sfVertexBuffer* vertexBuffer);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Set the usage specifier of this vertex buffer
|
||||||
|
///
|
||||||
|
/// This function provides a hint about how this vertex buffer is
|
||||||
|
/// going to be used in terms of data update frequency.
|
||||||
|
///
|
||||||
|
/// After changing the usage specifier, the vertex buffer has
|
||||||
|
/// to be updated with new data for the usage specifier to
|
||||||
|
/// take effect.
|
||||||
|
///
|
||||||
|
/// The default primitive type is sfVertexBufferStream.
|
||||||
|
///
|
||||||
|
/// \param vertexBuffer Vertex buffer object
|
||||||
|
/// \param usage Usage specifier
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfVertexBuffer_setUsage(sfVertexBuffer* vertexBuffer, sfVertexBufferUsage usage);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the usage specifier of this vertex buffer
|
||||||
|
///
|
||||||
|
/// \param vertexBuffer Vertex buffer object
|
||||||
|
///
|
||||||
|
/// \return Usage specifier
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfVertexBufferUsage sfVertexBuffer_getUsage(const sfVertexBuffer* vertexBuffer);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Bind a vertex buffer for rendering
|
||||||
|
///
|
||||||
|
/// This function is not part of the graphics API, it mustn't be
|
||||||
|
/// used when drawing SFML entities. It must be used only if you
|
||||||
|
/// mix sfVertexBuffer with OpenGL code.
|
||||||
|
///
|
||||||
|
/// \code
|
||||||
|
/// sfVertexBuffer* vb1, vb2;
|
||||||
|
/// ...
|
||||||
|
/// sfVertexBuffer_bind(vb1);
|
||||||
|
/// // draw OpenGL stuff that use vb1...
|
||||||
|
/// sfVertexBuffer_bind(vb2);
|
||||||
|
/// // draw OpenGL stuff that use vb2...
|
||||||
|
/// sfVertexBuffer_bind(NULL);
|
||||||
|
/// // draw OpenGL stuff that use no vertex buffer...
|
||||||
|
/// \endcode
|
||||||
|
///
|
||||||
|
/// \param vertexBuffer Pointer to the vertex buffer to bind, can be null to use no vertex buffer
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API void sfVertexBuffer_bind(const sfVertexBuffer* vertexBuffer);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Tell whether or not the system supports vertex buffers
|
||||||
|
///
|
||||||
|
/// This function should always be called before using
|
||||||
|
/// the vertex buffer features. If it returns false, then
|
||||||
|
/// any attempt to use sf::VertexBuffer will fail.
|
||||||
|
///
|
||||||
|
/// \return True if vertex buffers are supported, false otherwise
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_GRAPHICS_API sfBool sfVertexBuffer_isAvailable(void);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // SFML_VERTEXBUFFER_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
#include <SFML/Network/IpAddress.h>
|
#include <SFML/Network/IpAddress.h>
|
||||||
#include <SFML/Network/Packet.h>
|
#include <SFML/Network/Packet.h>
|
||||||
#include <SFML/Network/SocketSelector.h>
|
#include <SFML/Network/SocketSelector.h>
|
||||||
|
#include <SFML/Network/SocketStatus.h>
|
||||||
#include <SFML/Network/TcpListener.h>
|
#include <SFML/Network/TcpListener.h>
|
||||||
#include <SFML/Network/TcpSocket.h>
|
#include <SFML/Network/TcpSocket.h>
|
||||||
#include <SFML/Network/UdpSocket.h>
|
#include <SFML/Network/UdpSocket.h>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -332,7 +332,7 @@ CSFML_NETWORK_API sfFtpResponse* sfFtp_loginAnonymous(sfFtp* ftp);
|
|||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API sfFtpResponse* sfFtp_login(sfFtp* ftp, const char* userName, const char* password);
|
CSFML_NETWORK_API sfFtpResponse* sfFtp_login(sfFtp* ftp, const char* name, const char* password);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Close the connection with the server
|
/// \brief Close the connection with the server
|
||||||
@@ -486,7 +486,7 @@ CSFML_NETWORK_API sfFtpResponse* sfFtp_deleteFile(sfFtp* ftp, const char* name);
|
|||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* distantFile, const char* destPath, sfFtpTransferMode mode);
|
CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* remoteFile, const char* localPath, sfFtpTransferMode mode);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Upload a file to a FTP server
|
/// \brief Upload a file to a FTP server
|
||||||
@@ -500,11 +500,32 @@ CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* distantF
|
|||||||
/// \param localFile Path of the local file to upload
|
/// \param localFile Path of the local file to upload
|
||||||
/// \param remotePath Where to put to file on the server
|
/// \param remotePath Where to put to file on the server
|
||||||
/// \param mode Transfer mode
|
/// \param mode Transfer mode
|
||||||
|
/// \param append Pass sfTrue to append to or sfFalse to overwrite the remote file if it already exists
|
||||||
///
|
///
|
||||||
/// \return Server response to the request
|
/// \return Server response to the request
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* destPath, sfFtpTransferMode mode);
|
CSFML_NETWORK_API sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* remotePath, sfFtpTransferMode mode, sfBool append);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Send a command to the FTP server
|
||||||
|
///
|
||||||
|
/// While the most often used commands are provided as
|
||||||
|
/// specific functions, this function can be used to send
|
||||||
|
/// any FTP command to the server. If the command requires
|
||||||
|
/// one or more parameters, they can be specified in
|
||||||
|
/// \a parameter. Otherwise you should pass NULL.
|
||||||
|
/// If the server returns information, you can extract it
|
||||||
|
/// from the response using sfResponse_getMessage().
|
||||||
|
///
|
||||||
|
/// \param ftp Ftp object
|
||||||
|
/// \param command Command to send
|
||||||
|
/// \param parameter Command parameter
|
||||||
|
///
|
||||||
|
/// \return Server response to the request
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_NETWORK_API sfFtpResponse* sfFtp_sendCommand(sfFtp* ftp, const char* command, const char* parameter);
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_FTP_H
|
#endif // SFML_FTP_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -39,9 +39,11 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
sfHttpGet, ///< Request in get mode, standard method to retrieve a page
|
sfHttpGet, ///< Request in get mode, standard method to retrieve a page
|
||||||
sfHttpPost, ///< Request in post mode, usually to send data to a page
|
sfHttpPost, ///< Request in post mode, usually to send data to a page
|
||||||
sfHttpHead ///< Request a page's header only
|
sfHttpHead, ///< Request a page's header only
|
||||||
|
sfHttpPut, ///< Request in put mode, useful for a REST API
|
||||||
|
sfHttpDelete ///< Request in delete mode, useful for a REST API
|
||||||
} sfHttpMethod;
|
} sfHttpMethod;
|
||||||
|
|
||||||
|
|
||||||
@@ -63,12 +65,12 @@ typedef enum
|
|||||||
sfHttpMultipleChoices = 300, ///< The requested page can be accessed from several locations
|
sfHttpMultipleChoices = 300, ///< The requested page can be accessed from several locations
|
||||||
sfHttpMovedPermanently = 301, ///< The requested page has permanently moved to a new location
|
sfHttpMovedPermanently = 301, ///< The requested page has permanently moved to a new location
|
||||||
sfHttpMovedTemporarily = 302, ///< The requested page has temporarily moved to a new location
|
sfHttpMovedTemporarily = 302, ///< The requested page has temporarily moved to a new location
|
||||||
sfHttpNotModified = 304, ///< For conditionnal requests, means the requested page hasn't changed and doesn't need to be refreshed
|
sfHttpNotModified = 304, ///< For conditional requests, means the requested page hasn't changed and doesn't need to be refreshed
|
||||||
|
|
||||||
// 4xx: client error
|
// 4xx: client error
|
||||||
sfHttpBadRequest = 400, ///< The server couldn't understand the request (syntax error)
|
sfHttpBadRequest = 400, ///< The server couldn't understand the request (syntax error)
|
||||||
sfHttpUnauthorized = 401, ///< The requested page needs an authentification to be accessed
|
sfHttpUnauthorized = 401, ///< The requested page needs an authentication to be accessed
|
||||||
sfHttpForbidden = 403, ///< The requested page cannot be accessed at all, even with authentification
|
sfHttpForbidden = 403, ///< The requested page cannot be accessed at all, even with authentication
|
||||||
sfHttpNotFound = 404, ///< The requested page doesn't exist
|
sfHttpNotFound = 404, ///< The requested page doesn't exist
|
||||||
sfHttpRangeNotSatisfiable = 407, ///< The server can't satisfy the partial GET request (with a "Range" header field)
|
sfHttpRangeNotSatisfiable = 407, ///< The server can't satisfy the partial GET request (with a "Range" header field)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -48,6 +48,12 @@ typedef struct
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API const sfIpAddress sfIpAddress_None;
|
CSFML_NETWORK_API const sfIpAddress sfIpAddress_None;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Value representing any address (0.0.0.0)
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_NETWORK_API const sfIpAddress sfIpAddress_Any;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Local host IP address (127.0.0.1, or "localhost")
|
/// \brief Local host IP address (127.0.0.1, or "localhost")
|
||||||
///
|
///
|
||||||
@@ -114,8 +120,7 @@ CSFML_NETWORK_API sfIpAddress sfIpAddress_fromInteger(sfUint32 address);
|
|||||||
/// from a host name.
|
/// from a host name.
|
||||||
///
|
///
|
||||||
/// \param address Address object
|
/// \param address Address object
|
||||||
///
|
/// \param string String where the string representation will be stored
|
||||||
/// \return String representation of the address
|
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API void sfIpAddress_toString(sfIpAddress address, char* string);
|
CSFML_NETWORK_API void sfIpAddress_toString(sfIpAddress address, char* string);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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);
|
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
|
/// \brief Clear a packet
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -34,6 +34,7 @@ typedef enum
|
|||||||
{
|
{
|
||||||
sfSocketDone, ///< The socket has sent / received the data
|
sfSocketDone, ///< The socket has sent / received the data
|
||||||
sfSocketNotReady, ///< The socket is not ready to send / receive data yet
|
sfSocketNotReady, ///< The socket is not ready to send / receive data yet
|
||||||
|
sfSocketPartial, ///< The socket sent a part of the data
|
||||||
sfSocketDisconnected, ///< The TCP socket has been disconnected
|
sfSocketDisconnected, ///< The TCP socket has been disconnected
|
||||||
sfSocketError ///< An unexpected error happened
|
sfSocketError ///< An unexpected error happened
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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/Network/Export.h>
|
#include <SFML/Network/Export.h>
|
||||||
#include <SFML/Network/SocketStatus.h>
|
#include <SFML/Network/SocketStatus.h>
|
||||||
|
#include <SFML/Network/IpAddress.h>
|
||||||
#include <SFML/Network/Types.h>
|
#include <SFML/Network/Types.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -98,13 +99,16 @@ CSFML_NETWORK_API unsigned short sfTcpListener_getLocalPort(const sfTcpListener*
|
|||||||
/// If the socket was previously listening to another port,
|
/// If the socket was previously listening to another port,
|
||||||
/// it will be stopped first and bound to the new port.
|
/// it will be stopped first and bound to the new port.
|
||||||
///
|
///
|
||||||
|
/// If there is no specific address to listen to, pass sfIpAddress_Any
|
||||||
|
///
|
||||||
/// \param listener TCP listener object
|
/// \param listener TCP listener object
|
||||||
/// \param port Port to listen for new connections
|
/// \param port Port to listen for new connections
|
||||||
|
/// \param address Address of the interface to listen on
|
||||||
///
|
///
|
||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, unsigned short port);
|
CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, unsigned short port, sfIpAddress address);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Accept a new connection
|
/// \brief Accept a new connection
|
||||||
@@ -112,6 +116,10 @@ CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, u
|
|||||||
/// If the socket is in blocking mode, this function will
|
/// If the socket is in blocking mode, this function will
|
||||||
/// not return until a connection is actually received.
|
/// not return until a connection is actually received.
|
||||||
///
|
///
|
||||||
|
/// The \a connected argument points to a valid sfTcpSocket pointer
|
||||||
|
/// in case of success (the function returns sfSocketDone), it points
|
||||||
|
/// to a NULL pointer otherwise.
|
||||||
|
///
|
||||||
/// \param listener TCP listener object
|
/// \param listener TCP listener object
|
||||||
/// \param connected Socket that will hold the new connection
|
/// \param connected Socket that will hold the new connection
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -134,7 +134,7 @@ CSFML_NETWORK_API unsigned short sfTcpSocket_getRemotePort(const sfTcpSocket* so
|
|||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_connect(sfTcpSocket* socket, sfIpAddress host, unsigned short port, sfTime timeout);
|
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_connect(sfTcpSocket* socket, sfIpAddress remoteAddress, unsigned short remotePort, sfTime timeout);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Disconnect a TCP socket from its remote peer
|
/// \brief Disconnect a TCP socket from its remote peer
|
||||||
@@ -150,6 +150,9 @@ CSFML_NETWORK_API void sfTcpSocket_disconnect(sfTcpSocket* socket);
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Send raw data to the remote peer of a TCP socket
|
/// \brief Send raw data to the remote peer of a TCP socket
|
||||||
///
|
///
|
||||||
|
/// To be able to handle partial sends over non-blocking
|
||||||
|
/// sockets, use the sfTcpSocket_sendPartial(sfTcpSocket*, const void*, std::size_t, size_t*)
|
||||||
|
/// overload instead.
|
||||||
/// This function will fail if the socket is not connected.
|
/// This function will fail if the socket is not connected.
|
||||||
///
|
///
|
||||||
/// \param socket TCP socket object
|
/// \param socket TCP socket object
|
||||||
@@ -161,6 +164,21 @@ CSFML_NETWORK_API void sfTcpSocket_disconnect(sfTcpSocket* socket);
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_send(sfTcpSocket* socket, const void* data, size_t size);
|
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_send(sfTcpSocket* socket, const void* data, size_t size);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Send raw data to the remote peer
|
||||||
|
///
|
||||||
|
/// This function will fail if the socket is not connected.
|
||||||
|
///
|
||||||
|
/// \param socket TCP socket object
|
||||||
|
/// \param data Pointer to the sequence of bytes to send
|
||||||
|
/// \param size Number of bytes to send
|
||||||
|
/// \param sent The number of bytes sent will be written here
|
||||||
|
///
|
||||||
|
/// \return Status code
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_sendPartial(sfTcpSocket* socket, const void* data, size_t size, size_t* sent);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Receive raw data from the remote peer of a TCP socket
|
/// \brief Receive raw data from the remote peer of a TCP socket
|
||||||
///
|
///
|
||||||
@@ -176,11 +194,15 @@ CSFML_NETWORK_API sfSocketStatus sfTcpSocket_send(sfTcpSocket* socket, const voi
|
|||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_receive(sfTcpSocket* socket, void* data, size_t maxSize, size_t* sizeReceived);
|
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_receive(sfTcpSocket* socket, void* data, size_t size, size_t* received);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Send a formatted packet of data to the remote peer of a TCP socket
|
/// \brief Send a formatted packet of data to the remote peer of a TCP socket
|
||||||
///
|
///
|
||||||
|
/// In non-blocking mode, if this function returns sfSocketPartial,
|
||||||
|
/// you must retry sending the same unmodified packet before sending
|
||||||
|
/// anything else in order to guarantee the packet arrives at the remote
|
||||||
|
/// peer uncorrupted.
|
||||||
/// This function will fail if the socket is not connected.
|
/// This function will fail if the socket is not connected.
|
||||||
///
|
///
|
||||||
/// \param socket TCP socket object
|
/// \param socket TCP socket object
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -101,13 +101,16 @@ CSFML_NETWORK_API unsigned short sfUdpSocket_getLocalPort(const sfUdpSocket* soc
|
|||||||
/// system to automatically pick an available port, and then
|
/// system to automatically pick an available port, and then
|
||||||
/// call sfUdpSocket_getLocalPort to retrieve the chosen port.
|
/// call sfUdpSocket_getLocalPort to retrieve the chosen port.
|
||||||
///
|
///
|
||||||
/// \param socket UDP socket object
|
/// If there is no specific address to listen to, pass sfIpAddress_Any
|
||||||
/// \param port Port to bind the socket to
|
///
|
||||||
|
/// \param socket UDP socket object
|
||||||
|
/// \param port Port to bind the socket to
|
||||||
|
/// \param address Address of the interface to bind to
|
||||||
///
|
///
|
||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_bind(sfUdpSocket* socket, unsigned short port);
|
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_bind(sfUdpSocket* socket, unsigned short port, sfIpAddress address);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Unbind a UDP socket from the local port to which it is bound
|
/// \brief Unbind a UDP socket from the local port to which it is bound
|
||||||
@@ -137,7 +140,7 @@ CSFML_NETWORK_API void sfUdpSocket_unbind(sfUdpSocket* socket);
|
|||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_send(sfUdpSocket* socket, const void* data, size_t size, sfIpAddress address, unsigned short port);
|
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_send(sfUdpSocket* socket, const void* data, size_t size, sfIpAddress remoteAddress, unsigned short remotePort);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Receive raw data from a remote peer with a UDP socket
|
/// \brief Receive raw data from a remote peer with a UDP socket
|
||||||
@@ -159,7 +162,7 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_send(sfUdpSocket* socket, const voi
|
|||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receive(sfUdpSocket* socket, void* data, size_t maxSize, size_t* sizeReceived, sfIpAddress* address, unsigned short* port);
|
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receive(sfUdpSocket* socket, void* data, size_t size, size_t* received, sfIpAddress* remoteAddress, unsigned short* remotePort);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Send a formatted packet of data to a remote peer with a UDP socket
|
/// \brief Send a formatted packet of data to a remote peer with a UDP socket
|
||||||
@@ -176,7 +179,7 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receive(sfUdpSocket* socket, void*
|
|||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_sendPacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress address, unsigned short port);
|
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_sendPacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress remoteAddress, unsigned short remotePort);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Receive a formatted packet of data from a remote peer with a UDP socket
|
/// \brief Receive a formatted packet of data from a remote peer with a UDP socket
|
||||||
@@ -191,7 +194,7 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_sendPacket(sfUdpSocket* socket, sfP
|
|||||||
/// \return Status code
|
/// \return Status code
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receivePacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress* address, unsigned short* port);
|
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receivePacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress* remoteAddress, unsigned short* remotePort);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Return the maximum number of bytes that can be
|
/// \brief Return the maximum number of bytes that can be
|
||||||
@@ -200,7 +203,7 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receivePacket(sfUdpSocket* socket,
|
|||||||
/// \return The maximum size of a UDP datagram (message)
|
/// \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
|
#endif // SFML_UDPSOCKET_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -27,14 +27,14 @@
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Config.h>
|
#include <SFML/Config.h>
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// This file just includes the OpenGL (GL and GLU) headers,
|
// This file just includes the OpenGL (GL and GLU) headers,
|
||||||
/// which have actually different paths on each system
|
// which have actually different paths on each system
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#if defined(CSFML_SYSTEM_WINDOWS)
|
#if defined(CSFML_SYSTEM_WINDOWS)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -30,11 +30,13 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <SFML/Config.h>
|
#include <SFML/Config.h>
|
||||||
|
#include <SFML/System/Buffer.h>
|
||||||
#include <SFML/System/Clock.h>
|
#include <SFML/System/Clock.h>
|
||||||
#include <SFML/System/InputStream.h>
|
#include <SFML/System/InputStream.h>
|
||||||
#include <SFML/System/Mutex.h>
|
#include <SFML/System/Mutex.h>
|
||||||
#include <SFML/System/Sleep.h>
|
#include <SFML/System/Sleep.h>
|
||||||
#include <SFML/System/Thread.h>
|
#include <SFML/System/Thread.h>
|
||||||
|
#include <SFML/System/Time.h>
|
||||||
#include <SFML/System/Vector2.h>
|
#include <SFML/System/Vector2.h>
|
||||||
#include <SFML/System/Vector3.h>
|
#include <SFML/System/Vector3.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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -41,7 +41,7 @@ typedef struct
|
|||||||
} sfTime;
|
} sfTime;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Predefined "zero" time value
|
/// \brief Predefined "zero" time value
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_SYSTEM_API sfTime sfTime_Zero;
|
CSFML_SYSTEM_API sfTime sfTime_Zero;
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)//
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
#define SFML_SYSTEM_TYPES_H
|
#define SFML_SYSTEM_TYPES_H
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct sfBuffer sfBuffer;
|
||||||
typedef struct sfClock sfClock;
|
typedef struct sfClock sfClock;
|
||||||
typedef struct sfMutex sfMutex;
|
typedef struct sfMutex sfMutex;
|
||||||
typedef struct sfThread sfThread;
|
typedef struct sfThread sfThread;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// 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
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -30,11 +30,16 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <SFML/System.h>
|
#include <SFML/System.h>
|
||||||
|
#include <SFML/Window/Clipboard.h>
|
||||||
#include <SFML/Window/Context.h>
|
#include <SFML/Window/Context.h>
|
||||||
|
#include <SFML/Window/Cursor.h>
|
||||||
#include <SFML/Window/Event.h>
|
#include <SFML/Window/Event.h>
|
||||||
#include <SFML/Window/Joystick.h>
|
#include <SFML/Window/Joystick.h>
|
||||||
|
#include <SFML/Window/JoystickIdentification.h>
|
||||||
#include <SFML/Window/Keyboard.h>
|
#include <SFML/Window/Keyboard.h>
|
||||||
#include <SFML/Window/Mouse.h>
|
#include <SFML/Window/Mouse.h>
|
||||||
|
#include <SFML/Window/Sensor.h>
|
||||||
|
#include <SFML/Window/Touch.h>
|
||||||
#include <SFML/Window/VideoMode.h>
|
#include <SFML/Window/VideoMode.h>
|
||||||
#include <SFML/Window/Window.h>
|
#include <SFML/Window/Window.h>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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_CLIPBOARD_H
|
||||||
|
#define SFML_CLIPBOARD_H
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Headers
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
#include <SFML/Window/Export.h>
|
||||||
|
#include <SFML/Window/Types.h>
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the content of the clipboard as string data (returns an ANSI string)
|
||||||
|
///
|
||||||
|
/// This function returns the content of the clipboard
|
||||||
|
/// as a string. If the clipboard does not contain string
|
||||||
|
/// it returns an empty string.
|
||||||
|
///
|
||||||
|
/// \return Clipboard contents as a locale-dependent ANSI string
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_WINDOW_API const char* sfClipboard_getString(void);
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the content of the clipboard as string data (returns a Unicode string)
|
||||||
|
///
|
||||||
|
/// This function returns the content of the clipboard
|
||||||
|
/// as a string. If the clipboard does not contain string
|
||||||
|
/// it returns an empty string.
|
||||||
|
///
|
||||||
|
/// \return Clipboard contents as UTF-32
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_WINDOW_API const sfUint32* sfClipboard_getUnicodeString(void);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Set the content of the clipboard as ANSI string data
|
||||||
|
///
|
||||||
|
/// This function sets the content of the clipboard as an
|
||||||
|
/// ANSI string.
|
||||||
|
///
|
||||||
|
/// \param text ANSI string containing the data to be sent
|
||||||
|
/// to the clipboard
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_WINDOW_API void sfClipboard_setString(const char* text);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Set the content of the clipboard as Unicode string data
|
||||||
|
///
|
||||||
|
/// This function sets the content of the clipboard as a
|
||||||
|
/// Unicode string.
|
||||||
|
///
|
||||||
|
/// \param text Unicode string containing the data to be sent
|
||||||
|
/// to the clipboard
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_WINDOW_API void sfClipboard_setUnicodeString(const sfUint32* text);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // SFML_CURSOR_H
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
@@ -30,7 +30,9 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/Export.h>
|
#include <SFML/Window/Export.h>
|
||||||
#include <SFML/Window/Types.h>
|
#include <SFML/Window/Types.h>
|
||||||
|
#include <SFML/Window/Window.h>
|
||||||
|
|
||||||
|
typedef void (*GlFunctionPointer)(void);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Create a new context
|
/// \brief Create a new context
|
||||||
@@ -50,14 +52,60 @@ CSFML_WINDOW_API sfContext* sfContext_create(void);
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_WINDOW_API void sfContext_destroy(sfContext* context);
|
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
|
/// \brief Activate or deactivate explicitely a context
|
||||||
///
|
///
|
||||||
/// \param context Context object
|
/// \param context Context object
|
||||||
/// \param active sfTrue to activate, sfFalse to deactivate
|
/// \param active sfTrue to activate, sfFalse to deactivate
|
||||||
///
|
///
|
||||||
|
/// \return sfTrue on success, sfFalse on failure
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_WINDOW_API void sfContext_setActive(sfContext* context, sfBool active);
|
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.
|
||||||
|
///
|
||||||
|
/// \return Structure containing the settings
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_WINDOW_API sfContextSettings sfContext_getSettings(const sfContext* context);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the currently active context's ID
|
||||||
|
///
|
||||||
|
/// The context ID is used to identify contexts when
|
||||||
|
/// managing unshareable OpenGL resources.
|
||||||
|
///
|
||||||
|
/// \return The active context's ID or 0 if no context is currently active
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_WINDOW_API sfUint64 sfContext_getActiveContextId(void);
|
||||||
|
|
||||||
#endif // SFML_CONTEXT_H
|
#endif // SFML_CONTEXT_H
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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_CURSOR_H
|
||||||
|
#define SFML_CURSOR_H
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Headers
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
#include <SFML/System/Vector2.h>
|
||||||
|
#include <SFML/Window/Export.h>
|
||||||
|
#include <SFML/Window/Types.h>
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Enumeration of the native system cursor types
|
||||||
|
///
|
||||||
|
/// Refer to the following table to determine which cursor
|
||||||
|
/// is available on which platform.
|
||||||
|
///
|
||||||
|
/// Type | Linux | Mac OS X | Windows
|
||||||
|
/// ------------------------------------|:-----:|:--------:|:--------:
|
||||||
|
/// sfCursorArrow | yes | yes | yes
|
||||||
|
/// sfCursorArrowWait | no | no | yes
|
||||||
|
/// sfCursorWait | yes | no | yes
|
||||||
|
/// sfCursorText | yes | yes | yes
|
||||||
|
/// sfCursorHand | yes | yes | yes
|
||||||
|
/// sfCursorSizeHorizontal | yes | yes | yes
|
||||||
|
/// 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
|
||||||
|
/// sfCursorNotAllowed | yes | yes | yes
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
sfCursorArrow, ///< Arrow cursor (default)
|
||||||
|
sfCursorArrowWait, ///< Busy arrow cursor
|
||||||
|
sfCursorWait, ///< Busy cursor
|
||||||
|
sfCursorText, ///< I-beam, cursor when hovering over a field allowing text entry
|
||||||
|
sfCursorHand, ///< Pointing hand cursor
|
||||||
|
sfCursorSizeHorizontal, ///< Horizontal double arrow cursor
|
||||||
|
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
|
||||||
|
sfCursorNotAllowed ///< Action not allowed cursor
|
||||||
|
} sfCursorType;
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Create a cursor with the provided image
|
||||||
|
///
|
||||||
|
/// \a pixels must be an array of \a width by \a height pixels
|
||||||
|
/// in 32-bit RGBA format. If not, this will cause undefined behavior.
|
||||||
|
///
|
||||||
|
/// If \a pixels is null or either \a width or \a height are 0,
|
||||||
|
/// the current cursor is left unchanged and the function will
|
||||||
|
/// return false.
|
||||||
|
///
|
||||||
|
/// In addition to specifying the pixel data, you can also
|
||||||
|
/// specify the location of the hotspot of the cursor. The
|
||||||
|
/// hotspot is the pixel coordinate within the cursor image
|
||||||
|
/// which will be located exactly where the mouse pointer
|
||||||
|
/// position is. Any mouse actions that are performed will
|
||||||
|
/// return the window/screen location of the hotspot.
|
||||||
|
///
|
||||||
|
/// \warning On Unix, the pixels are mapped into a monochrome
|
||||||
|
/// bitmap: pixels with an alpha channel to 0 are
|
||||||
|
/// transparent, black if the RGB channel are close
|
||||||
|
/// to zero, and white otherwise.
|
||||||
|
///
|
||||||
|
/// \param pixels Array of pixels of the image
|
||||||
|
/// \param size Width and height of the image
|
||||||
|
/// \param hotspot (x,y) location of the hotspot
|
||||||
|
/// \return A new sfCursor object
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_WINDOW_API sfCursor* sfCursor_createFromPixels(const sfUint8* pixels, sfVector2u size, sfVector2u hotspot);
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Create a native system cursor
|
||||||
|
///
|
||||||
|
/// Refer to the list of cursor available on each system
|
||||||
|
/// (see sfCursorType) to know whether a given cursor is
|
||||||
|
/// expected to load successfully or is not supported by
|
||||||
|
/// the operating system.
|
||||||
|
///
|
||||||
|
/// \param type Native system cursor type
|
||||||
|
/// \return A new sfCursor object
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_WINDOW_API sfCursor* sfCursor_createFromSystem(sfCursorType type);
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Destroy a cursor
|
||||||
|
///
|
||||||
|
/// \param cursor Cursor to destroy
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_WINDOW_API void sfCursor_destroy(sfCursor* cursor);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // SFML_CURSOR_H
|
||||||
+83
-33
@@ -1,7 +1,8 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)//
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
#include <SFML/Window/Joystick.h>
|
#include <SFML/Window/Joystick.h>
|
||||||
#include <SFML/Window/Keyboard.h>
|
#include <SFML/Window/Keyboard.h>
|
||||||
#include <SFML/Window/Mouse.h>
|
#include <SFML/Window/Mouse.h>
|
||||||
|
#include <SFML/Window/Sensor.h>
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -39,24 +41,31 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
sfEvtClosed,
|
sfEvtClosed, ///< The window requested to be closed (no data)
|
||||||
sfEvtResized,
|
sfEvtResized, ///< The window was resized (data in event.size)
|
||||||
sfEvtLostFocus,
|
sfEvtLostFocus, ///< The window lost the focus (no data)
|
||||||
sfEvtGainedFocus,
|
sfEvtGainedFocus, ///< The window gained the focus (no data)
|
||||||
sfEvtTextEntered,
|
sfEvtTextEntered, ///< A character was entered (data in event.text)
|
||||||
sfEvtKeyPressed,
|
sfEvtKeyPressed, ///< A key was pressed (data in event.key)
|
||||||
sfEvtKeyReleased,
|
sfEvtKeyReleased, ///< A key was released (data in event.key)
|
||||||
sfEvtMouseWheelMoved,
|
sfEvtMouseWheelMoved, ///< The mouse wheel was scrolled (data in event.mouseWheel) (deprecated)
|
||||||
sfEvtMouseButtonPressed,
|
sfEvtMouseWheelScrolled, ///< The mouse wheel was scrolled (data in event.mouseWheelScroll)
|
||||||
sfEvtMouseButtonReleased,
|
sfEvtMouseButtonPressed, ///< A mouse button was pressed (data in event.mouseButton)
|
||||||
sfEvtMouseMoved,
|
sfEvtMouseButtonReleased, ///< A mouse button was released (data in event.mouseButton)
|
||||||
sfEvtMouseEntered,
|
sfEvtMouseMoved, ///< The mouse cursor moved (data in event.mouseMove)
|
||||||
sfEvtMouseLeft,
|
sfEvtMouseEntered, ///< The mouse cursor entered the area of the window (no data)
|
||||||
sfEvtJoystickButtonPressed,
|
sfEvtMouseLeft, ///< The mouse cursor left the area of the window (no data)
|
||||||
sfEvtJoystickButtonReleased,
|
sfEvtJoystickButtonPressed, ///< A joystick button was pressed (data in event.joystickButton)
|
||||||
sfEvtJoystickMoved,
|
sfEvtJoystickButtonReleased, ///< A joystick button was released (data in event.joystickButton)
|
||||||
sfEvtJoystickConnected,
|
sfEvtJoystickMoved, ///< The joystick moved along an axis (data in event.joystickMove)
|
||||||
sfEvtJoystickDisconnected
|
sfEvtJoystickConnected, ///< A joystick was connected (data in event.joystickConnect)
|
||||||
|
sfEvtJoystickDisconnected, ///< A joystick was disconnected (data in event.joystickConnect)
|
||||||
|
sfEvtTouchBegan, ///< A touch event began (data in event.touch)
|
||||||
|
sfEvtTouchMoved, ///< A touch moved (data in event.touch)
|
||||||
|
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
|
||||||
} sfEventType;
|
} sfEventType;
|
||||||
|
|
||||||
|
|
||||||
@@ -68,6 +77,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
sfEventType type;
|
sfEventType type;
|
||||||
sfKeyCode code;
|
sfKeyCode code;
|
||||||
|
sfScancode scancode;
|
||||||
sfBool alt;
|
sfBool alt;
|
||||||
sfBool control;
|
sfBool control;
|
||||||
sfBool shift;
|
sfBool shift;
|
||||||
@@ -110,8 +120,11 @@ typedef struct
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Mouse wheel events parameters
|
/// \brief Mouse wheel events parameters
|
||||||
///
|
///
|
||||||
|
/// \deprecated
|
||||||
|
/// Use sfMouseWheelScrollEvent instead.
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef struct
|
typedef struct CSFML_DEPRECATED
|
||||||
{
|
{
|
||||||
sfEventType type;
|
sfEventType type;
|
||||||
int delta;
|
int delta;
|
||||||
@@ -119,6 +132,19 @@ typedef struct
|
|||||||
int y;
|
int y;
|
||||||
} sfMouseWheelEvent;
|
} sfMouseWheelEvent;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Mouse wheel events parameters
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
sfEventType type;
|
||||||
|
sfMouseWheel wheel;
|
||||||
|
float delta;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
} sfMouseWheelScrollEvent;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Joystick axis move event parameters
|
/// \brief Joystick axis move event parameters
|
||||||
///
|
///
|
||||||
@@ -163,6 +189,30 @@ typedef struct
|
|||||||
unsigned int height;
|
unsigned int height;
|
||||||
} sfSizeEvent;
|
} sfSizeEvent;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Touch events parameters
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
sfEventType type;
|
||||||
|
unsigned int finger;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
} sfTouchEvent;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Sensor event parameters
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
sfEventType type;
|
||||||
|
sfSensorType sensorType;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float z;
|
||||||
|
} sfSensorEvent;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief sfEvent defines a system event and its parameters
|
/// \brief sfEvent defines a system event and its parameters
|
||||||
@@ -170,19 +220,19 @@ typedef struct
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef union
|
typedef union
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
sfEventType type; ///< Type of the event
|
||||||
// Member data
|
sfSizeEvent size; ///< Size event parameters
|
||||||
////////////////////////////////////////////////////////////
|
sfKeyEvent key; ///< Key event parameters
|
||||||
sfEventType type; ///< Type of the event
|
sfTextEvent text; ///< Text event parameters
|
||||||
sfSizeEvent size;
|
sfMouseMoveEvent mouseMove; ///< Mouse move event parameters
|
||||||
sfKeyEvent key;
|
sfMouseButtonEvent mouseButton; ///< Mouse button event parameters
|
||||||
sfTextEvent text;
|
sfMouseWheelEvent mouseWheel; ///< Mouse wheel event parameters (deprecated)
|
||||||
sfMouseMoveEvent mouseMove;
|
sfMouseWheelScrollEvent mouseWheelScroll; ///< Mouse wheel event parameters
|
||||||
sfMouseButtonEvent mouseButton;
|
sfJoystickMoveEvent joystickMove; ///< Joystick move event parameters
|
||||||
sfMouseWheelEvent mouseWheel;
|
sfJoystickButtonEvent joystickButton; ///< Joystick button event parameters
|
||||||
sfJoystickMoveEvent joystickMove;
|
sfJoystickConnectEvent joystickConnect; ///< Joystick (dis)connect event parameters
|
||||||
sfJoystickButtonEvent joystickButton;
|
sfTouchEvent touch; ///< Touch events parameters
|
||||||
sfJoystickConnectEvent joystickConnect;
|
sfSensorEvent sensor; ///< Sensor event parameters
|
||||||
} sfEvent;
|
} sfEvent;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)//
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// 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.
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
//
|
//
|
||||||
@@ -28,6 +29,7 @@
|
|||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/Export.h>
|
#include <SFML/Window/Export.h>
|
||||||
|
#include <SFML/Window/JoystickIdentification.h>
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -120,6 +122,19 @@ CSFML_WINDOW_API sfBool sfJoystick_isButtonPressed(unsigned int joystick, unsign
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_WINDOW_API float sfJoystick_getAxisPosition(unsigned int joystick, sfJoystickAxis axis);
|
CSFML_WINDOW_API float sfJoystick_getAxisPosition(unsigned int joystick, sfJoystickAxis axis);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the joystick information
|
||||||
|
///
|
||||||
|
/// The result of this function will only remain valid until
|
||||||
|
/// the next time the function is called.
|
||||||
|
///
|
||||||
|
/// \param joystick Index of the joystick
|
||||||
|
///
|
||||||
|
/// \return Structure containing joystick information.
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
CSFML_WINDOW_API sfJoystickIdentification sfJoystick_getIdentification(unsigned int joystick);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Update the states of all joysticks
|
/// \brief Update the states of all joysticks
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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_JOYSTICKIDENDIFICATION_H
|
||||||
|
#define SFML_JOYSTICKIDENDIFICATION_H
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Headers
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
#include <SFML/Window/Export.h>
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// sfJoystickIdentification holds a joystick's identification
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
const char* name;
|
||||||
|
unsigned int vendorId;
|
||||||
|
unsigned int productId;
|
||||||
|
} sfJoystickIdentification;
|
||||||
|
|
||||||
|
|
||||||
|
#endif // SFML_JOYSTICKIDENDIFICATION_H
|
||||||
Loaded 100 of 252 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user