Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ concurrency:
cancel-in-progress: true

env:
SFML_VERSION: 3.0.2
SFML_VERSION: 3.1.0

defaults:
run:
Expand All @@ -26,8 +26,7 @@ jobs:
platform:
- { name: Windows VS2026 x86, os: windows-2025-vs2026, flags: -AWin32 }
- { name: Windows VS2026 x64, os: windows-2025-vs2026, flags: -Ax64 }
# ClangCL is disabled until we build against SFML 3.1, the FLAC version bundled with SFML 3.0 fails to compile with VS2026's ClangCL
# - { name: Windows ClangCL, os: windows-2025-vs2026, flags: -T ClangCL }
- { name: Windows ClangCL, os: windows-2025-vs2026, flags: -T ClangCL }
- { name: Windows Clang, os: windows-2025-vs2026, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
- { name: Linux GCC, os: ubuntu-24.04, flags: -GNinja }
- { name: Linux Clang, os: ubuntu-24.04, flags: -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
Expand All @@ -43,12 +42,12 @@ jobs:
- name: Get CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: ${{ runner.os == 'Windows' && '4.2' || '3.22' }} # Visual Studio 2026 generator requires CMake 4.2 or later
cmakeVersion: ${{ runner.os == 'Windows' && '4.2' || '3.28' }} # Visual Studio 2026 generator requires CMake 4.2 or later
ninjaVersion: latest

- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libxi-dev libudev-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libfreetype-dev
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libxi-dev libudev-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libfreetype-dev libharfbuzz-dev libmbedtls-dev libssh2-1-dev

- name: Checkout SFML
uses: actions/checkout@v7
Expand All @@ -63,9 +62,13 @@ jobs:
BUILD_TYPE: ${{ matrix.type.name }}
CMAKE_FLAGS: ${{ matrix.platform.flags }} ${{ matrix.config.flags }}
run: |
# Let the installed SFML libraries find each other, same as tools/nuget/build.linux.sh
RPATH_FLAGS=()
if [ "$RUNNER_OS" = "Linux" ]; then RPATH_FLAGS=('-DCMAKE_INSTALL_RPATH=$ORIGIN'); fi
cmake -S SFML -B SFML/build \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DCMAKE_INSTALL_PREFIX=SFML/install \
"${RPATH_FLAGS[@]}" \
$CMAKE_FLAGS

- name: Build SFML
Expand Down Expand Up @@ -128,7 +131,7 @@ jobs:
- name: Get CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: ${{ runner.os == 'Windows' && '4.2' || '3.22' }} # Visual Studio 2026 generator requires CMake 4.2 or later
cmakeVersion: ${{ runner.os == 'Windows' && '4.2' || '3.28' }} # Visual Studio 2026 generator requires CMake 4.2 or later
ninjaVersion: latest

- name: Install Dependencies
Expand Down Expand Up @@ -171,7 +174,7 @@ jobs:
- name: Get CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: ${{ runner.os == 'Windows' && '4.2' || '3.22' }} # Visual Studio 2026 generator requires CMake 4.2 or later
cmakeVersion: ${{ runner.os == 'Windows' && '4.2' || '3.28' }} # Visual Studio 2026 generator requires CMake 4.2 or later
ninjaVersion: latest

- name: Install Doxygen
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ concurrency:
cancel-in-progress: true

env:
SFML_VERSION: 3.0.2
SFML_VERSION: 3.1.0

defaults:
run:
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.28)

# define a macro that helps defining an option
macro(csfml_set_option var default type docstring)
Expand All @@ -13,7 +13,7 @@ endmacro()
csfml_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debug or Release)")

# project name
project(CSFML VERSION 3.0.0)
project(CSFML VERSION 3.1.0)

# we use the paths from the cmake GNUInstallDirs module as defaults
# you can override these if you like
Expand Down Expand Up @@ -66,7 +66,7 @@ endif()
if(CSFML_BUILD_NETWORK)
list(PREPEND SFML_MODULES "Network")
endif()
find_package(SFML 3.0 COMPONENTS ${SFML_MODULES} REQUIRED)
find_package(SFML 3.1 COMPONENTS ${SFML_MODULES} REQUIRED)

# add the subdirectories
add_subdirectory(src/CSFML)
Expand Down
3 changes: 1 addition & 2 deletions doc/mainpage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@
/// font = sfFont_createFromFile("arial.ttf");
/// if (!font)
/// return EXIT_FAILURE;
/// text = sfText_create();
/// text = sfText_create(font);
/// sfText_setString(text, "Hello SFML");
/// sfText_setFont(text, font);
/// sfText_setCharacterSize(text, 50);
///
/// /* Load a music to play */
Expand Down
1 change: 1 addition & 0 deletions include/CSFML/Audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include <CSFML/Audio/Listener.h>
#include <CSFML/Audio/Music.h>
#include <CSFML/Audio/PlaybackDevice.h>
#include <CSFML/Audio/Sound.h>
#include <CSFML/Audio/SoundBuffer.h>
#include <CSFML/Audio/SoundBufferRecorder.h>
Expand Down
205 changes: 205 additions & 0 deletions include/CSFML/Audio/PlaybackDevice.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////

#pragma once

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <CSFML/Audio/Export.h>

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>


////////////////////////////////////////////////////////////
/// \brief Enumeration of the playback device notifications
///
////////////////////////////////////////////////////////////
typedef enum
{
sfPlaybackDeviceStarted, ///< Playback device has been started
sfPlaybackDeviceStopped, ///< Playback device has been stopped
sfPlaybackDeviceRerouted, ///< Playback device has been rerouted (Generated on platforms that support automatic stream routing)
sfPlaybackDeviceInterruptionBegan, ///< Playback device interruption has begun (Generated on Apple mobile platforms)
sfPlaybackDeviceInterruptionEnded, ///< Playback device interruption has ended (Generated on Apple mobile platforms)
sfPlaybackDeviceUnlocked ///< Playback device has been unlocked (Generated by Emscripten/WebAudio)
} sfPlaybackDeviceNotification;

////////////////////////////////////////////////////////////
/// \brief Callback that is called to notify of changes to the playback device state
///
/// \param notification The notification
/// \param userData User data passed to sfPlaybackDevice_setNotificationCallback
///
////////////////////////////////////////////////////////////
typedef void (*sfPlaybackDeviceNotificationCallback)(sfPlaybackDeviceNotification notification, void* userData);


////////////////////////////////////////////////////////////
/// \brief Get a list of the names of all available audio playback devices
///
/// If the operating system reports multiple devices with
/// the same name, a number will be appended to the name
/// of all subsequent devices to distinguish them from each
/// other. This guarantees that every entry returned by this
/// function will represent a unique device.
///
/// The default device, if one is marked as such, will be
/// placed at the beginning of the list.
///
/// The returned array and strings stay valid until the next
/// call to this function.
///
/// \param count Pointer to a variable that will be filled with the number of devices
///
/// \return An array of strings containing the device names or NULL if no devices are available
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API const char* const* sfPlaybackDevice_getAvailableDevices(size_t* count);

////////////////////////////////////////////////////////////
/// \brief Get the name of the default audio playback device
///
/// Note that depending on when this function is called, the
/// default device reported by the operating system might
/// change e.g. when a USB audio device is plugged into or
/// unplugged from the system.
///
/// The returned string stays valid until the next call to
/// this function.
///
/// \return The name of the default audio playback device or NULL if there is none
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API const char* sfPlaybackDevice_getDefaultDevice(void);

////////////////////////////////////////////////////////////
/// \brief Set the audio playback device
///
/// This function sets the audio playback device to the device
/// with the given name. It can be called on the fly (i.e:
/// while sounds are playing).
///
/// If there are sounds playing when the audio playback
/// device is switched, the sounds will continue playing
/// uninterrupted on the new audio playback device.
///
/// \param name The name of the audio playback device
///
/// \return True, if it was able to set the requested device
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API bool sfPlaybackDevice_setDevice(const char* name);

////////////////////////////////////////////////////////////
/// \brief Set the audio playback device to the default
///
/// This function sets the audio playback device to the
/// default device. It can be called on the fly (i.e:
/// while sounds are playing).
///
/// When certain backends are used, using the default device
/// will enable automatic stream routing. When automatic
/// stream routing is enabled, audio data is automatically
/// sent to whichever physical audio device is currently
/// marked as the default on the system.
///
/// Automatic stream routing is currently supported when using
/// the WASAPI or DirectSound backend on Windows or the
/// Core Audio backend on macOS and iOS.
///
/// \return True, if it was able to set the audio playback device to the default device
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API bool sfPlaybackDevice_setDeviceToDefault(void);

////////////////////////////////////////////////////////////
/// \brief Set the audio playback device to the null device
///
/// This function sets the audio playback device to the
/// null device. It can be called on the fly (i.e:
/// while sounds are playing).
///
/// Audio data routed to the null device will be discarded
/// by the backend. This can be used to keep sounds playing
/// without having them actually output on a physical
/// audio playback device.
///
/// \return True, if it was able to set the audio playback device to the null device
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API bool sfPlaybackDevice_setDeviceToNull(void);

////////////////////////////////////////////////////////////
/// \brief Get the name of the current audio playback device
///
/// The returned string stays valid until the next call to
/// this function.
///
/// \return The name of the current audio playback device or NULL if there is none
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API const char* sfPlaybackDevice_getDevice(void);

////////////////////////////////////////////////////////////
/// \brief Get the sample rate of the current audio playback device
///
/// \return The sample rate of the current audio playback device or 0 if there is none
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API uint32_t sfPlaybackDevice_getDeviceSampleRate(void);

////////////////////////////////////////////////////////////
/// \brief Check if the current playback device is the default device
///
/// This function will return false if there is no
/// current playback device.
///
/// \return True, if the current playback device is the default device
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API bool sfPlaybackDevice_isDefaultDevice(void);

////////////////////////////////////////////////////////////
/// \brief Set a callback that should be called to notify of changes to the playback device state
///
/// Warning: Do not attempt to alter the device state from
/// within this callback. This includes changing the device
/// and even creating/destroying sound objects since that
/// could indirectly cause the playback device to be
/// created/destroyed. Also do not attempt to set the
/// notification callback from within this callback. Doing
/// so will result in a deadlock.
///
/// When receiving a notification via this callback, store
/// the information somewhere and react on it from another
/// thread e.g. the main thread within the application.
///
/// \param callback The callback to be called, pass NULL to remove the current callback
/// \param userData User data that will be passed to the callback
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfPlaybackDevice_setNotificationCallback(sfPlaybackDeviceNotificationCallback callback, void* userData);
2 changes: 1 addition & 1 deletion include/CSFML/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
// Define the CSFML version
////////////////////////////////////////////////////////////
#define CSFML_VERSION_MAJOR 3
#define CSFML_VERSION_MINOR 0
#define CSFML_VERSION_MINOR 1
#define CSFML_VERSION_PATCH 0


Expand Down
40 changes: 40 additions & 0 deletions include/CSFML/Graphics/CircleShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,36 @@ CSFML_GRAPHICS_API void sfCircleShape_setOutlineColor(sfCircleShape* shape, sfCo
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfCircleShape_setOutlineThickness(sfCircleShape* shape, float thickness);

////////////////////////////////////////////////////////////
/// \brief Set the limit on the ratio between miter length and outline thickness of a circle shape
///
/// Outline segments around each corner are joined either
/// with a miter or a bevel join.
/// - A miter join is formed by extending outline segments until
/// they intersect. The distance between the point of
/// intersection and the shape's corner is the miter length.
/// - A bevel join is formed by connecting outline segments with
/// a straight line perpendicular to the corner's bisector.
///
/// The miter limit is used to determine whether outline segments
/// around a corner are joined with a bevel or a miter.
/// When the ratio between the miter length and outline thickness
/// exceeds the miter limit, a bevel is used instead of a miter.
///
/// The miter limit is linked to the maximum inner angle of a
/// corner below which a bevel is used by the following formula:
///
/// miterLimit = 1 / sin(angle / 2)
///
/// The miter limit must be greater than or equal to 1.
/// By default, the miter limit is 10.
///
/// \param shape Shape object
/// \param miterLimit New miter limit
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfCircleShape_setMiterLimit(sfCircleShape* shape, float miterLimit);

////////////////////////////////////////////////////////////
/// \brief Get the source texture of a circle shape
///
Expand Down Expand Up @@ -346,6 +376,16 @@ CSFML_GRAPHICS_API sfColor sfCircleShape_getOutlineColor(const sfCircleShape* sh
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfCircleShape_getOutlineThickness(const sfCircleShape* shape);

////////////////////////////////////////////////////////////
/// \brief Get the limit on the ratio between miter length and outline thickness of a circle shape
///
/// \param shape Shape object
///
/// \return Limit on the ratio between miter length and outline thickness
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfCircleShape_getMiterLimit(const sfCircleShape* shape);

////////////////////////////////////////////////////////////
/// \brief Get the total number of points of a circle shape
///
Expand Down
Loading
Loading