Skip to content

Commit

Permalink
Run clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisThrasher committed Sep 1, 2024
1 parent 42aec92 commit 54d2832
Show file tree
Hide file tree
Showing 156 changed files with 1,035 additions and 767 deletions.
6 changes: 3 additions & 3 deletions examples/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
int main(void)
{
// Create the main window
const sfVideoMode mode = {{800, 600}, 32};
sfRenderWindow* window = sfRenderWindow_create(mode, "SFML window", sfResize | sfClose, sfWindowed, NULL);
const sfVideoMode mode = {{800, 600}, 32};
sfRenderWindow* window = sfRenderWindow_create(mode, "SFML window", sfResize | sfClose, sfWindowed, NULL);
if (!window)
return EXIT_FAILURE;

Expand All @@ -18,7 +18,7 @@ int main(void)
sfRenderWindow_destroy(window);
return EXIT_FAILURE;
}
sfSprite* sprite = sfSprite_create(texture);
sfSprite* sprite = sfSprite_create(texture);
const sfVector2f spritePosition = {200, 200};
sfSprite_setPosition(sprite, spritePosition);

Expand Down
2 changes: 1 addition & 1 deletion include/CSFML/Audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
// Headers
////////////////////////////////////////////////////////////

#include <CSFML/System.h>
#include <CSFML/Audio/Listener.h>
#include <CSFML/Audio/Music.h>
#include <CSFML/Audio/Sound.h>
Expand All @@ -37,3 +36,4 @@
#include <CSFML/Audio/SoundRecorder.h>
#include <CSFML/Audio/SoundStatus.h>
#include <CSFML/Audio/SoundStream.h>
#include <CSFML/System.h>
4 changes: 2 additions & 2 deletions include/CSFML/Audio/Export.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
////////////////////////////////////////////////////////////
#if defined(CSFML_AUDIO_EXPORTS)

#define CSFML_AUDIO_API CSFML_API_EXPORT
#define CSFML_AUDIO_API CSFML_API_EXPORT

#else

#define CSFML_AUDIO_API CSFML_API_IMPORT
#define CSFML_AUDIO_API CSFML_API_IMPORT

#endif
1 change: 1 addition & 0 deletions include/CSFML/Audio/Listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <CSFML/Audio/Export.h>

#include <CSFML/System/Vector3.h>


Expand Down
2 changes: 2 additions & 0 deletions include/CSFML/Audio/Music.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
// Headers
////////////////////////////////////////////////////////////
#include <CSFML/Audio/Export.h>

#include <CSFML/Audio/SoundStatus.h>
#include <CSFML/Audio/Types.h>
#include <CSFML/System/InputStream.h>
#include <CSFML/System/Time.h>
#include <CSFML/System/Vector3.h>

#include <stddef.h>


Expand Down
3 changes: 2 additions & 1 deletion include/CSFML/Audio/Sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <CSFML/Audio/Export.h>

#include <CSFML/Audio/SoundStatus.h>
#include <CSFML/Audio/Types.h>
#include <CSFML/System/Time.h>
Expand All @@ -36,7 +37,7 @@

////////////////////////////////////////////////////////////
/// \brief Create a new sound
///
///
/// \param soundBuffer Sound buffer containing the audio data to play with the sound
///
/// \return A new sfSound object
Expand Down
17 changes: 10 additions & 7 deletions include/CSFML/Audio/SoundBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
// Headers
////////////////////////////////////////////////////////////
#include <CSFML/Audio/Export.h>
#include <CSFML/Audio/Types.h>

#include <CSFML/Audio/SoundChannel.h>
#include <CSFML/Audio/Types.h>
#include <CSFML/System/InputStream.h>
#include <CSFML/System/Time.h>

#include <stddef.h>


Expand Down Expand Up @@ -94,12 +96,13 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* str
/// \return A new sfSoundBuffer object (NULL if failed)
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(const int16_t* samples,
uint64_t sampleCount,
unsigned int channelCount,
unsigned int sampleRate,
sfSoundChannel* channelMapData,
size_t channelMapSize);
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(
const int16_t* samples,
uint64_t sampleCount,
unsigned int channelCount,
unsigned int sampleRate,
sfSoundChannel* channelMapData,
size_t channelMapSize);

////////////////////////////////////////////////////////////
/// \brief Create a new sound buffer by copying an existing one
Expand Down
1 change: 1 addition & 0 deletions include/CSFML/Audio/SoundBufferRecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <CSFML/Audio/Export.h>

#include <CSFML/Audio/Types.h>


Expand Down
6 changes: 4 additions & 2 deletions include/CSFML/Audio/SoundRecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@
// Headers
////////////////////////////////////////////////////////////
#include <CSFML/Audio/Export.h>

#include <CSFML/Audio/Types.h>
#include <CSFML/System/Time.h>

#include <stddef.h>


typedef bool (*sfSoundRecorderStartCallback)(void*); ///< Type of the callback used when starting a capture
typedef bool (*sfSoundRecorderStartCallback)(void*); ///< Type of the callback used when starting a capture
typedef bool (*sfSoundRecorderProcessCallback)(const int16_t*, size_t, void*); ///< Type of the callback used to process audio data
typedef void (*sfSoundRecorderStopCallback)(void*); ///< Type of the callback used when stopping a capture
typedef void (*sfSoundRecorderStopCallback)(void*); ///< Type of the callback used when stopping a capture


////////////////////////////////////////////////////////////
Expand Down
21 changes: 12 additions & 9 deletions include/CSFML/Audio/SoundStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
// Headers
////////////////////////////////////////////////////////////
#include <CSFML/Audio/Export.h>

#include <CSFML/Audio/SoundChannel.h>
#include <CSFML/Audio/SoundStatus.h>
#include <CSFML/Audio/Types.h>
#include <CSFML/Audio/SoundChannel.h>
#include <CSFML/System/Time.h>
#include <CSFML/System/Vector3.h>

#include <stddef.h>


Expand All @@ -47,7 +49,7 @@ typedef struct
} sfSoundStreamChunk;

typedef bool (*sfSoundStreamGetDataCallback)(sfSoundStreamChunk*, void*); ///< Type of the callback used to get a sound stream data
typedef void (*sfSoundStreamSeekCallback)(sfTime, void*); ///< Type of the callback used to seek in a sound stream
typedef void (*sfSoundStreamSeekCallback)(sfTime, void*); ///< Type of the callback used to seek in a sound stream


////////////////////////////////////////////////////////////
Expand All @@ -64,13 +66,14 @@ typedef void (*sfSoundStreamSeekCallback)(sfTime, void*); ///< T
/// \return A new sfSoundStream object
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfSoundStream* sfSoundStream_create(sfSoundStreamGetDataCallback onGetData,
sfSoundStreamSeekCallback onSeek,
unsigned int channelCount,
unsigned int sampleRate,
sfSoundChannel* channelMapData,
size_t channelMapSize,
void* userData);
CSFML_AUDIO_API sfSoundStream* sfSoundStream_create(
sfSoundStreamGetDataCallback onGetData,
sfSoundStreamSeekCallback onSeek,
unsigned int channelCount,
unsigned int sampleRate,
sfSoundChannel* channelMapData,
size_t channelMapSize,
void* userData);

////////////////////////////////////////////////////////////
/// \brief Destroy a sound stream
Expand Down
10 changes: 5 additions & 5 deletions include/CSFML/Audio/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

#pragma once

typedef struct sfMusic sfMusic;
typedef struct sfSound sfSound;
typedef struct sfSoundBuffer sfSoundBuffer;
typedef struct sfMusic sfMusic;
typedef struct sfSound sfSound;
typedef struct sfSoundBuffer sfSoundBuffer;
typedef struct sfSoundBufferRecorder sfSoundBufferRecorder;
typedef struct sfSoundRecorder sfSoundRecorder;
typedef struct sfSoundStream sfSoundStream;
typedef struct sfSoundRecorder sfSoundRecorder;
typedef struct sfSoundStream sfSoundStream;
68 changes: 34 additions & 34 deletions include/CSFML/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
// Headers
////////////////////////////////////////////////////////////

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


////////////////////////////////////////////////////////////
Expand All @@ -44,9 +44,9 @@
// Check if we need to mark functions as extern "C"
////////////////////////////////////////////////////////////
#ifdef __cplusplus
#define CSFML_EXTERN_C extern "C"
#define CSFML_EXTERN_C extern "C"
#else
#define CSFML_EXTERN_C extern
#define CSFML_EXTERN_C extern
#endif


Expand All @@ -55,28 +55,28 @@
////////////////////////////////////////////////////////////
#if defined(_WIN32) || defined(__WIN32__)

// Windows
#define CSFML_SYSTEM_WINDOWS
// Windows
#define CSFML_SYSTEM_WINDOWS

#elif defined(linux) || defined(__linux)

// Linux
#define CSFML_SYSTEM_LINUX
// Linux
#define CSFML_SYSTEM_LINUX

#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)

// MacOS
#define CSFML_SYSTEM_MACOS
// MacOS
#define CSFML_SYSTEM_MACOS

#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)

// FreeBSD
#define CSFML_SYSTEM_FREEBSD
// FreeBSD
#define CSFML_SYSTEM_FREEBSD

#else

// Unsupported system
#error This operating system is not supported by SFML library
// Unsupported system
#error This operating system is not supported by SFML library

#endif

Expand All @@ -86,21 +86,21 @@
////////////////////////////////////////////////////////////
#if defined(CSFML_SYSTEM_WINDOWS)

// Windows compilers need specific (and different) keywords for export and import
#define CSFML_API_EXPORT extern "C" __declspec(dllexport)
#define CSFML_API_IMPORT CSFML_EXTERN_C __declspec(dllimport)
// Windows compilers need specific (and different) keywords for export and import
#define CSFML_API_EXPORT extern "C" __declspec(dllexport)
#define CSFML_API_IMPORT CSFML_EXTERN_C __declspec(dllimport)

// For Visual C++ compilers, we also need to turn off this annoying C4251 warning
#ifdef _MSC_VER
// For Visual C++ compilers, we also need to turn off this annoying C4251 warning
#ifdef _MSC_VER

#pragma warning(disable : 4251)
#pragma warning(disable : 4251)

#endif
#endif

#else // Linux, FreeBSD, Mac OS X

#define CSFML_API_EXPORT extern "C" __attribute__ ((__visibility__ ("default")))
#define CSFML_API_IMPORT CSFML_EXTERN_C __attribute__ ((__visibility__ ("default")))
#define CSFML_API_EXPORT extern "C" __attribute__((__visibility__("default")))
#define CSFML_API_IMPORT CSFML_EXTERN_C __attribute__((__visibility__("default")))

#endif

Expand All @@ -117,27 +117,27 @@
////////////////////////////////////////////////////////////
#if defined(CSFML_NO_DEPRECATED_WARNINGS)

// User explicitly requests to disable deprecation warnings
#define CSFML_DEPRECATED
// 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)
// 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))
// 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
// 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

Expand Down
8 changes: 4 additions & 4 deletions include/CSFML/GPUPreference.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
////////////////////////////////////////////////////////////
#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;
#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
#define SFML_DEFINE_DISCRETE_GPU_PREFERENCE

#endif
2 changes: 1 addition & 1 deletion include/CSFML/Graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
// Headers
////////////////////////////////////////////////////////////

#include <CSFML/Window.h>
#include <CSFML/Graphics/BlendMode.h>
#include <CSFML/Graphics/CircleShape.h>
#include <CSFML/Graphics/Color.h>
Expand All @@ -54,3 +53,4 @@
#include <CSFML/Graphics/VertexArray.h>
#include <CSFML/Graphics/VertexBuffer.h>
#include <CSFML/Graphics/View.h>
#include <CSFML/Window.h>
12 changes: 6 additions & 6 deletions include/CSFML/Graphics/BlendMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ typedef enum
////////////////////////////////////////////////////////////
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
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;


Expand Down
Loading

0 comments on commit 54d2832

Please sign in to comment.