Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ jobs:

- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-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

- name: Checkout SFML
uses: actions/checkout@v4
with:
repository: SFML/SFML
ref: b583eaf1606e54e5f443b094b3b2a6e3af72a5a4
ref: 8096ba24fccb6b76a7d9e8cc71a3afb7b02e517c
path: SFML

- name: Configure SFML CMake
Expand Down
6 changes: 3 additions & 3 deletions include/SFML/Audio/Music.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ CSFML_AUDIO_API void sfMusic_destroy(sfMusic* music);
///
/// If set, the music will restart from beginning after
/// reaching the end and so on, until it is stopped or
/// sfMusic_setLoop(music, false) is called.
/// sfMusic_setLooping(music, false) is called.
/// The default looping state for musics is false.
///
/// \param music Music object
/// \param loop true to play in loop, false to play once
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfMusic_setLoop(sfMusic* music, bool loop);
CSFML_AUDIO_API void sfMusic_setLooping(sfMusic* music, bool loop);

////////////////////////////////////////////////////////////
/// \brief Tell whether or not a music is in loop mode
Expand All @@ -127,7 +127,7 @@ CSFML_AUDIO_API void sfMusic_setLoop(sfMusic* music, bool loop);
/// \return true if the music is looping, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API bool sfMusic_getLoop(const sfMusic* music);
CSFML_AUDIO_API bool sfMusic_isLooping(const sfMusic* music);

////////////////////////////////////////////////////////////
/// \brief Get the total duration of a music
Expand Down
6 changes: 3 additions & 3 deletions include/SFML/Audio/Sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ CSFML_AUDIO_API const sfSoundBuffer* sfSound_getBuffer(const sfSound* sound);
///
/// If set, the sound will restart from beginning after
/// reaching the end and so on, until it is stopped or
/// sfSound_setLoop(sound, false) is called.
/// sfSound_setLooping(sound, false) is called.
/// The default looping state for sounds is false.
///
/// \param sound Sound object
/// \param loop true to play in loop, false to play once
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSound_setLoop(sfSound* sound, bool loop);
CSFML_AUDIO_API void sfSound_setLooping(sfSound* sound, bool loop);

////////////////////////////////////////////////////////////
/// \brief Tell whether or not a sound is in loop mode
Expand All @@ -145,7 +145,7 @@ CSFML_AUDIO_API void sfSound_setLoop(sfSound* sound, bool loop);
/// \return true if the sound is looping, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API bool sfSound_getLoop(const sfSound* sound);
CSFML_AUDIO_API bool sfSound_isLooping(const sfSound* sound);

////////////////////////////////////////////////////////////
/// \brief Get the current status of a sound (stopped, paused, playing)
Expand Down
6 changes: 3 additions & 3 deletions include/SFML/Audio/SoundStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,14 @@ CSFML_AUDIO_API void sfSoundStream_setPlayingOffset(sfSoundStream* soundStream,
///
/// If set, the stream will restart from beginning after
/// reaching the end and so on, until it is stopped or
/// sfSoundStream_setLoop(stream, false) is called.
/// sfSoundStream_setLooping(stream, false) is called.
/// The default looping state for sound streams is false.
///
/// \param soundStream Sound stream object
/// \param loop true to play in loop, false to play once
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_setLoop(sfSoundStream* soundStream, bool loop);
CSFML_AUDIO_API void sfSoundStream_setLooping(sfSoundStream* soundStream, bool loop);

////////////////////////////////////////////////////////////
/// \brief Get the pitch of a sound stream
Expand Down Expand Up @@ -337,7 +337,7 @@ CSFML_AUDIO_API float sfSoundStream_getAttenuation(const sfSoundStream* soundStr
/// \return true if the music is looping, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API bool sfSoundStream_getLoop(const sfSoundStream* soundStream);
CSFML_AUDIO_API bool sfSoundStream_isLooping(const sfSoundStream* soundStream);

////////////////////////////////////////////////////////////
/// \brief Get the current playing position of a sound stream
Expand Down
34 changes: 4 additions & 30 deletions include/SFML/Graphics/Rect.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,14 @@
////////////////////////////////////////////////////////////
typedef struct
{
float left;
float top;
float width;
float height;
sfVector2f position;
sfVector2f size;
} sfFloatRect;

typedef struct
{
int left;
int top;
int width;
int height;
sfVector2i position;
sfVector2i size;
} sfIntRect;

////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -79,27 +75,5 @@ CSFML_GRAPHICS_API bool sfIntRect_contains(const sfIntRect* rect, int x, int y);
CSFML_GRAPHICS_API bool sfFloatRect_intersects(const sfFloatRect* rect1, const sfFloatRect* rect2, sfFloatRect* intersection);
CSFML_GRAPHICS_API bool 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
11 changes: 0 additions & 11 deletions include/SFML/Graphics/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,6 @@ CSFML_GRAPHICS_API void sfView_setRotation(sfView* view, float angle);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfView_setViewport(sfView* view, sfFloatRect viewport);

////////////////////////////////////////////////////////////
/// \brief Reset a view to the given rectangle
///
/// Note that this function resets the rotation angle to 0.
///
/// \param view View object
/// \param rectangle Rectangle defining the zone to display
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfView_reset(sfView* view, sfFloatRect rectangle);

////////////////////////////////////////////////////////////
/// \brief Get the center of a view
///
Expand Down
5 changes: 3 additions & 2 deletions include/SFML/System/InputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/Export.h>
#include <stdlib.h>


typedef int64_t (*sfInputStreamReadFunc)(void* data, int64_t size, void* userData);
typedef int64_t (*sfInputStreamSeekFunc)(int64_t position, void* userData);
typedef int64_t (*sfInputStreamReadFunc)(void* data, size_t size, void* userData);
typedef int64_t (*sfInputStreamSeekFunc)(size_t position, void* userData);
typedef int64_t (*sfInputStreamTellFunc)(void* userData);
typedef int64_t (*sfInputStreamGetSizeFunc)(void* userData);

Expand Down
8 changes: 4 additions & 4 deletions src/SFML/Audio/Music.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@ void sfMusic_destroy(sfMusic* music)


////////////////////////////////////////////////////////////
void sfMusic_setLoop(sfMusic* music, bool loop)
void sfMusic_setLooping(sfMusic* music, bool loop)
{
CSFML_CALL(music, setLoop(loop != 0));
CSFML_CALL(music, setLooping(loop != 0));
}


////////////////////////////////////////////////////////////
bool sfMusic_getLoop(const sfMusic* music)
bool sfMusic_isLooping(const sfMusic* music)
{
CSFML_CALL_RETURN(music, getLoop(), false);
CSFML_CALL_RETURN(music, isLooping(), false);
}


Expand Down
8 changes: 4 additions & 4 deletions src/SFML/Audio/Sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ const sfSoundBuffer* sfSound_getBuffer(const sfSound* sound)


////////////////////////////////////////////////////////////
void sfSound_setLoop(sfSound* sound, bool loop)
void sfSound_setLooping(sfSound* sound, bool loop)
{
CSFML_CALL(sound, setLoop(loop));
CSFML_CALL(sound, setLooping(loop));
}


////////////////////////////////////////////////////////////
bool sfSound_getLoop(const sfSound* sound)
bool sfSound_isLooping(const sfSound* sound)
{
CSFML_CALL_RETURN(sound, getLoop(), false);
CSFML_CALL_RETURN(sound, isLooping(), false);
}


Expand Down
24 changes: 12 additions & 12 deletions src/SFML/Audio/SoundBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@
////////////////////////////////////////////////////////////
sfSoundBuffer* sfSoundBuffer_createFromFile(const char* filename)
{
auto soundBuffer = sf::SoundBuffer::loadFromFile(filename);
if (!soundBuffer)
sf::SoundBuffer soundBuffer;
if (!soundBuffer.loadFromFile(filename))
return nullptr;

return new sfSoundBuffer{std::move(*soundBuffer)};
return new sfSoundBuffer{std::move(soundBuffer)};
}


////////////////////////////////////////////////////////////
sfSoundBuffer* sfSoundBuffer_createFromMemory(const void* data, size_t sizeInBytes)
{
auto soundBuffer = sf::SoundBuffer::loadFromMemory(data, sizeInBytes);
if (!soundBuffer)
sf::SoundBuffer soundBuffer;
if (!soundBuffer.loadFromMemory(data, sizeInBytes))
return nullptr;

return new sfSoundBuffer{std::move(*soundBuffer)};
return new sfSoundBuffer{std::move(soundBuffer)};
}


Expand All @@ -60,11 +60,11 @@ sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* stream)
CSFML_CHECK_RETURN(stream, nullptr);

CallbackStream sfmlStream(stream);
auto soundBuffer = sf::SoundBuffer::loadFromStream(sfmlStream);
if (!soundBuffer)
sf::SoundBuffer soundBuffer;
if (!soundBuffer.loadFromStream(sfmlStream))
return nullptr;

return new sfSoundBuffer{std::move(*soundBuffer)};
return new sfSoundBuffer{std::move(soundBuffer)};
}


Expand All @@ -80,11 +80,11 @@ sfSoundBuffer* sfSoundBuffer_createFromSamples(const int16_t* samples,
for (std::size_t i = 0; i < channelMap.size(); ++i)
channelMap[i] = static_cast<sf::SoundChannel>(channelMapData[i]);

auto soundBuffer = sf::SoundBuffer::loadFromSamples(samples, sampleCount, channelCount, sampleRate, channelMap);
if (!soundBuffer)
sf::SoundBuffer soundBuffer;
if (!soundBuffer.loadFromSamples(samples, sampleCount, channelCount, sampleRate, channelMap))
return nullptr;

return new sfSoundBuffer{std::move(*soundBuffer)};
return new sfSoundBuffer{std::move(soundBuffer)};
}


Expand Down
4 changes: 2 additions & 2 deletions src/SFML/Audio/SoundBufferRecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ const sfSoundBuffer* sfSoundBufferRecorder_getBuffer(const sfSoundBufferRecorder
{
CSFML_CHECK_RETURN(soundBufferRecorder, nullptr);

soundBufferRecorder->SoundBuffer = sfSoundBuffer{soundBufferRecorder->This.getBuffer()};
soundBufferRecorder->SoundBuffer.This = soundBufferRecorder->This.getBuffer();

return &*soundBufferRecorder->SoundBuffer;
return &soundBufferRecorder->SoundBuffer;
}

////////////////////////////////////////////////////////////
Expand Down
8 changes: 3 additions & 5 deletions src/SFML/Audio/SoundBufferRecorderStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,15 @@
#include <SFML/Audio/SoundBufferRecorder.hpp>
#include <SFML/Audio/SoundBufferStruct.h>

#include <optional>


////////////////////////////////////////////////////////////
// Internal structure of sfSoundBufferRecorder
////////////////////////////////////////////////////////////
struct sfSoundBufferRecorder
{
sf::SoundBufferRecorder This;
mutable std::optional<sfSoundBuffer> SoundBuffer;
std::string DeviceName;
sf::SoundBufferRecorder This;
mutable sfSoundBuffer SoundBuffer;
std::string DeviceName;
};


Expand Down
8 changes: 4 additions & 4 deletions src/SFML/Audio/SoundStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ void sfSoundStream_setPlayingOffset(sfSoundStream* soundStream, sfTime timeOffse


////////////////////////////////////////////////////////////
void sfSoundStream_setLoop(sfSoundStream* soundStream, bool loop)
void sfSoundStream_setLooping(sfSoundStream* soundStream, bool loop)
{
CSFML_CALL(soundStream, setLoop(loop));
CSFML_CALL(soundStream, setLooping(loop));
}


Expand Down Expand Up @@ -201,9 +201,9 @@ float sfSoundStream_getAttenuation(const sfSoundStream* soundStream)


////////////////////////////////////////////////////////////
bool sfSoundStream_getLoop(const sfSoundStream* soundStream)
bool sfSoundStream_isLooping(const sfSoundStream* soundStream)
{
CSFML_CALL_RETURN(soundStream, getLoop(), false);
CSFML_CALL_RETURN(soundStream, isLooping(), false);
}


Expand Down
Loading