mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 13:06:13 +01:00
Improved API documentation (copied from SFML)
This commit is contained in:
1 parent
c84a787d0a
commit
d734c9df5c
50 files changed
+1606
-1478
No files matched your search
@@ -30,8 +30,6 @@
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the global volume of all the sounds
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfListener_SetGlobalVolume(float volume)
|
||||
{
|
||||
@@ -39,8 +37,6 @@ void sfListener_SetGlobalVolume(float volume)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current value of the global volume of all the sounds
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfListener_GetGlobalVolume(void)
|
||||
{
|
||||
@@ -48,8 +44,6 @@ float sfListener_GetGlobalVolume(void)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of the listener
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfListener_SetPosition(float x, float y, float z)
|
||||
{
|
||||
@@ -57,8 +51,6 @@ void sfListener_SetPosition(float x, float y, float z)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current position of the listener
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfListener_GetPosition(float* x, float* y, float* z)
|
||||
{
|
||||
@@ -72,8 +64,6 @@ void sfListener_GetPosition(float* x, float* y, float* z)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the orientation of the listener
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfListener_SetDirection(float x, float y, float z)
|
||||
{
|
||||
@@ -81,8 +71,6 @@ void sfListener_SetDirection(float x, float y, float z)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current orientation of the listener
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfListener_GetDirection(float* x, float* y, float* z)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new music and load it from a file
|
||||
////////////////////////////////////////////////////////////
|
||||
sfMusic* sfMusic_CreateFromFile(const char* filename)
|
||||
{
|
||||
@@ -46,8 +44,6 @@ sfMusic* sfMusic_CreateFromFile(const char* filename)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new music and load it from a file in memory
|
||||
////////////////////////////////////////////////////////////
|
||||
sfMusic* sfMusic_CreateFromMemory(const void* data, size_t sizeInBytes)
|
||||
{
|
||||
@@ -62,8 +58,6 @@ sfMusic* sfMusic_CreateFromMemory(const void* data, size_t sizeInBytes)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new music and load it from a custom stream
|
||||
////////////////////////////////////////////////////////////
|
||||
sfMusic* sfMusic_CreateFromStream(sfInputStream* stream)
|
||||
{
|
||||
@@ -81,8 +75,6 @@ sfMusic* sfMusic_CreateFromStream(sfInputStream* stream)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing music
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMusic_Destroy(sfMusic* music)
|
||||
{
|
||||
@@ -90,8 +82,6 @@ void sfMusic_Destroy(sfMusic* music)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a music loop state
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMusic_SetLoop(sfMusic* music, sfBool loop)
|
||||
{
|
||||
@@ -99,8 +89,6 @@ void sfMusic_SetLoop(sfMusic* music, sfBool loop)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a music is looping
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfMusic_GetLoop(const sfMusic* music)
|
||||
{
|
||||
@@ -108,8 +96,6 @@ sfBool sfMusic_GetLoop(const sfMusic* music)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a music duration
|
||||
////////////////////////////////////////////////////////////
|
||||
sfUint32 sfMusic_GetDuration(const sfMusic* music)
|
||||
{
|
||||
@@ -117,8 +103,6 @@ sfUint32 sfMusic_GetDuration(const sfMusic* music)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start playing a music
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMusic_Play(sfMusic* music)
|
||||
{
|
||||
@@ -126,8 +110,6 @@ void sfMusic_Play(sfMusic* music)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Pause a music
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMusic_Pause(sfMusic* music)
|
||||
{
|
||||
@@ -135,8 +117,6 @@ void sfMusic_Pause(sfMusic* music)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop playing a music
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMusic_Stop(sfMusic* music)
|
||||
{
|
||||
@@ -144,8 +124,6 @@ void sfMusic_Stop(sfMusic* music)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the number of channels of a music (1 = mono, 2 = stereo)
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfMusic_GetChannelsCount(const sfMusic* music)
|
||||
{
|
||||
@@ -153,8 +131,6 @@ unsigned int sfMusic_GetChannelsCount(const sfMusic* music)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the stream sample rate of a music
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfMusic_GetSampleRate(const sfMusic* music)
|
||||
{
|
||||
@@ -162,8 +138,6 @@ unsigned int sfMusic_GetSampleRate(const sfMusic* music)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the status of a music (stopped, paused, playing)
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSoundStatus sfMusic_GetStatus(const sfMusic* music)
|
||||
{
|
||||
@@ -173,8 +147,6 @@ sfSoundStatus sfMusic_GetStatus(const sfMusic* music)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current playing position of a music
|
||||
////////////////////////////////////////////////////////////
|
||||
sfUint32 sfMusic_GetPlayingOffset(const sfMusic* music)
|
||||
{
|
||||
@@ -182,8 +154,6 @@ sfUint32 sfMusic_GetPlayingOffset(const sfMusic* music)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the pitch of a music
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMusic_SetPitch(sfMusic* music, float pitch)
|
||||
{
|
||||
@@ -191,8 +161,6 @@ void sfMusic_SetPitch(sfMusic* music, float pitch)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the volume of a music
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMusic_SetVolume(sfMusic* music, float volume)
|
||||
{
|
||||
@@ -200,8 +168,6 @@ void sfMusic_SetVolume(sfMusic* music, float volume)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a music
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMusic_SetPosition(sfMusic* music, float x, float y, float z)
|
||||
{
|
||||
@@ -209,10 +175,6 @@ void sfMusic_SetPosition(sfMusic* music, float x, float y, float z)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Make the music's position relative to the listener's
|
||||
/// position, or absolute.
|
||||
/// The default value is false (absolute)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMusic_SetRelativeToListener(sfMusic* music, sfBool relative)
|
||||
{
|
||||
@@ -220,10 +182,6 @@ void sfMusic_SetRelativeToListener(sfMusic* music, sfBool relative)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the minimum distance - closer than this distance,
|
||||
/// the listener will hear the music at its maximum volume.
|
||||
/// The default minimum distance is 1.0
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMusic_SetMinDistance(sfMusic* music, float distance)
|
||||
{
|
||||
@@ -231,10 +189,6 @@ void sfMusic_SetMinDistance(sfMusic* music, float distance)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the attenuation factor - the higher the attenuation, the
|
||||
/// more the sound will be attenuated with distance from listener.
|
||||
/// The default attenuation factor 1.0
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMusic_SetAttenuation(sfMusic* music, float attenuation)
|
||||
{
|
||||
@@ -242,8 +196,6 @@ void sfMusic_SetAttenuation(sfMusic* music, float attenuation)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the current playing position of a stream
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMusic_SetPlayingOffset(sfMusic* music, sfUint32 timeOffset)
|
||||
{
|
||||
@@ -251,8 +203,6 @@ void sfMusic_SetPlayingOffset(sfMusic* music, sfUint32 timeOffset)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the pitch of a music
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfMusic_GetPitch(const sfMusic* music)
|
||||
{
|
||||
@@ -260,8 +210,6 @@ float sfMusic_GetPitch(const sfMusic* music)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the volume of a music
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfMusic_GetVolume(const sfMusic* music)
|
||||
{
|
||||
@@ -269,8 +217,6 @@ float sfMusic_GetVolume(const sfMusic* music)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the position of a music
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMusic_GetPosition(const sfMusic* music, float* x, float* y, float* z)
|
||||
{
|
||||
@@ -286,9 +232,6 @@ void sfMusic_GetPosition(const sfMusic* music, float* x, float* y, float* z)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell if the music's position is relative to the listener's
|
||||
/// position, or if it's absolute
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfMusic_IsRelativeToListener(const sfMusic* music)
|
||||
{
|
||||
@@ -296,8 +239,6 @@ CSFML_API sfBool sfMusic_IsRelativeToListener(const sfMusic* music)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the minimum distance of a music
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfMusic_GetMinDistance(const sfMusic* music)
|
||||
{
|
||||
@@ -305,8 +246,6 @@ float sfMusic_GetMinDistance(const sfMusic* music)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the attenuation factor of a music
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfMusic_GetAttenuation(const sfMusic* music)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new sound
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSound* sfSound_Create(void)
|
||||
{
|
||||
@@ -39,8 +37,6 @@ sfSound* sfSound_Create(void)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing sound
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSound* sfSound_Copy(sfSound* sound)
|
||||
{
|
||||
@@ -50,8 +46,6 @@ sfSound* sfSound_Copy(sfSound* sound)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSound_Destroy(sfSound* sound)
|
||||
{
|
||||
@@ -59,8 +53,6 @@ void sfSound_Destroy(sfSound* sound)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start playing a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSound_Play(sfSound* sound)
|
||||
{
|
||||
@@ -68,8 +60,6 @@ void sfSound_Play(sfSound* sound)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Pause a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSound_Pause(sfSound* sound)
|
||||
{
|
||||
@@ -77,8 +67,6 @@ void sfSound_Pause(sfSound* sound)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop playing a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSound_Stop(sfSound* sound)
|
||||
{
|
||||
@@ -86,8 +74,6 @@ void sfSound_Stop(sfSound* sound)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Bind a sound buffer to a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSound_SetBuffer(sfSound* sound, const sfSoundBuffer* buffer)
|
||||
{
|
||||
@@ -99,8 +85,6 @@ void sfSound_SetBuffer(sfSound* sound, const sfSoundBuffer* buffer)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sound buffer bound to a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
const sfSoundBuffer* sfSound_GetBuffer(const sfSound* sound)
|
||||
{
|
||||
@@ -110,8 +94,6 @@ const sfSoundBuffer* sfSound_GetBuffer(const sfSound* sound)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a sound loop state
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSound_SetLoop(sfSound* sound, sfBool loop)
|
||||
{
|
||||
@@ -119,8 +101,6 @@ void sfSound_SetLoop(sfSound* sound, sfBool loop)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a sound is looping
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfSound_GetLoop(const sfSound* sound)
|
||||
{
|
||||
@@ -128,8 +108,6 @@ sfBool sfSound_GetLoop(const sfSound* sound)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the status of a sound (stopped, paused, playing)
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSoundStatus sfSound_GetStatus(const sfSound* sound)
|
||||
{
|
||||
@@ -139,8 +117,6 @@ sfSoundStatus sfSound_GetStatus(const sfSound* sound)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the pitch of a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSound_SetPitch(sfSound* sound, float pitch)
|
||||
{
|
||||
@@ -148,8 +124,6 @@ void sfSound_SetPitch(sfSound* sound, float pitch)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the volume of a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSound_SetVolume(sfSound* sound, float volume)
|
||||
{
|
||||
@@ -157,8 +131,6 @@ void sfSound_SetVolume(sfSound* sound, float volume)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSound_SetPosition(sfSound* sound, float x, float y, float z)
|
||||
{
|
||||
@@ -166,10 +138,6 @@ void sfSound_SetPosition(sfSound* sound, float x, float y, float z)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Make the sound's position relative to the listener's
|
||||
/// position, or absolute.
|
||||
/// The default value is false (absolute)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSound_SetRelativeToListener(sfSound* sound, sfBool relative)
|
||||
{
|
||||
@@ -177,10 +145,6 @@ void sfSound_SetRelativeToListener(sfSound* sound, sfBool relative)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the minimum distance - closer than this distance,
|
||||
/// the listener will hear the sound at its maximum volume.
|
||||
/// The default minimum distance is 1.0
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSound_SetMinDistance(sfSound* sound, float distance)
|
||||
{
|
||||
@@ -188,10 +152,6 @@ void sfSound_SetMinDistance(sfSound* sound, float distance)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the attenuation factor - the higher the attenuation, the
|
||||
/// more the sound will be attenuated with distance from listener.
|
||||
/// The default attenuation factor is 1.0
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSound_SetAttenuation(sfSound* sound, float attenuation)
|
||||
{
|
||||
@@ -199,8 +159,6 @@ void sfSound_SetAttenuation(sfSound* sound, float attenuation)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the current playing position of a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSound_SetPlayingOffset(sfSound* sound, sfUint32 timeOffset)
|
||||
{
|
||||
@@ -208,8 +166,6 @@ void sfSound_SetPlayingOffset(sfSound* sound, sfUint32 timeOffset)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the pitch of a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfSound_GetPitch(const sfSound* sound)
|
||||
{
|
||||
@@ -217,8 +173,6 @@ float sfSound_GetPitch(const sfSound* sound)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the volume of a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfSound_GetVolume(const sfSound* sound)
|
||||
{
|
||||
@@ -226,8 +180,6 @@ float sfSound_GetVolume(const sfSound* sound)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the position of a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSound_GetPosition(const sfSound* sound, float* x, float* y, float* z)
|
||||
{
|
||||
@@ -240,9 +192,6 @@ void sfSound_GetPosition(const sfSound* sound, float* x, float* y, float* z)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell if the sound's position is relative to the listener's
|
||||
/// position, or if it's absolute
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfSound_IsRelativeToListener(const sfSound* sound)
|
||||
{
|
||||
@@ -250,8 +199,6 @@ CSFML_API sfBool sfSound_IsRelativeToListener(const sfSound* sound)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the minimum distance of a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfSound_GetMinDistance(const sfSound* sound)
|
||||
{
|
||||
@@ -259,8 +206,6 @@ float sfSound_GetMinDistance(const sfSound* sound)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the attenuation factor of a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfSound_GetAttenuation(const sfSound* sound)
|
||||
{
|
||||
@@ -268,8 +213,6 @@ float sfSound_GetAttenuation(const sfSound* sound)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current playing position of a sound
|
||||
////////////////////////////////////////////////////////////
|
||||
sfUint32 sfSound_GetPlayingOffset(const sfSound* sound)
|
||||
{
|
||||
|
||||
@@ -27,11 +27,10 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Audio/SoundBuffer.h>
|
||||
#include <SFML/Audio/SoundBufferStruct.h>
|
||||
#include <SFML/CallbackStream.h>
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new sound buffer and load it from a file
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSoundBuffer* sfSoundBuffer_CreateFromFile(const char* filename)
|
||||
{
|
||||
@@ -47,8 +46,6 @@ sfSoundBuffer* sfSoundBuffer_CreateFromFile(const char* filename)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new sound buffer and load it from a file in memory
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const void* data, size_t sizeInBytes)
|
||||
{
|
||||
@@ -64,10 +61,24 @@ sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const void* data, size_t sizeInByt
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new sound buffer and load it from an array of
|
||||
/// samples in memory - assumed format for samples is
|
||||
/// 16 bits signed integer
|
||||
CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromStream(sfInputStream* stream)
|
||||
{
|
||||
CSFML_CHECK_RETURN(stream, NULL);
|
||||
|
||||
sfSoundBuffer* buffer = new sfSoundBuffer;
|
||||
CallbackStream sfmlStream(stream);
|
||||
if (!buffer->This.LoadFromStream(sfmlStream))
|
||||
{
|
||||
delete buffer;
|
||||
buffer = NULL;
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSoundBuffer* sfSoundBuffer_CreateFromSamples(const sfInt16* samples, size_t samplesCount, unsigned int channelsCount, unsigned int sampleRate)
|
||||
{
|
||||
@@ -83,8 +94,6 @@ sfSoundBuffer* sfSoundBuffer_CreateFromSamples(const sfInt16* samples, size_t sa
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing sound buffer
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSoundBuffer* sfSoundBuffer_Copy(sfSoundBuffer* soundBuffer)
|
||||
{
|
||||
@@ -94,8 +103,6 @@ sfSoundBuffer* sfSoundBuffer_Copy(sfSoundBuffer* soundBuffer)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound buffer
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundBuffer_Destroy(sfSoundBuffer* soundBuffer)
|
||||
{
|
||||
@@ -103,8 +110,6 @@ void sfSoundBuffer_Destroy(sfSoundBuffer* soundBuffer)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Save a sound buffer to a file
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfSoundBuffer_SaveToFile(const sfSoundBuffer* soundBuffer, const char* filename)
|
||||
{
|
||||
@@ -112,8 +117,6 @@ sfBool sfSoundBuffer_SaveToFile(const sfSoundBuffer* soundBuffer, const char* fi
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the samples contained in a sound buffer
|
||||
////////////////////////////////////////////////////////////
|
||||
const sfInt16* sfSoundBuffer_GetSamples(const sfSoundBuffer* soundBuffer)
|
||||
{
|
||||
@@ -121,8 +124,6 @@ const sfInt16* sfSoundBuffer_GetSamples(const sfSoundBuffer* soundBuffer)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the number of samples contained in a sound buffer
|
||||
////////////////////////////////////////////////////////////
|
||||
size_t sfSoundBuffer_GetSamplesCount(const sfSoundBuffer* soundBuffer)
|
||||
{
|
||||
@@ -130,8 +131,6 @@ size_t sfSoundBuffer_GetSamplesCount(const sfSoundBuffer* soundBuffer)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sample rate of a sound buffer
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfSoundBuffer_GetSampleRate(const sfSoundBuffer* soundBuffer)
|
||||
{
|
||||
@@ -139,8 +138,6 @@ unsigned int sfSoundBuffer_GetSampleRate(const sfSoundBuffer* soundBuffer)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the number of channels of a sound buffer (1 = mono, 2 = stereo, ...)
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfSoundBuffer_GetChannelsCount(const sfSoundBuffer* soundBuffer)
|
||||
{
|
||||
@@ -148,8 +145,6 @@ unsigned int sfSoundBuffer_GetChannelsCount(const sfSoundBuffer* soundBuffer)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the duration of a sound buffer
|
||||
////////////////////////////////////////////////////////////
|
||||
sfUint32 sfSoundBuffer_GetDuration(const sfSoundBuffer* soundBuffer)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new sound buffer recorder
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSoundBufferRecorder* sfSoundBufferRecorder_Create(void)
|
||||
{
|
||||
@@ -39,8 +37,6 @@ sfSoundBufferRecorder* sfSoundBufferRecorder_Create(void)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound buffer recorder
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundBufferRecorder_Destroy(sfSoundBufferRecorder* soundBufferRecorder)
|
||||
{
|
||||
@@ -48,9 +44,6 @@ void sfSoundBufferRecorder_Destroy(sfSoundBufferRecorder* soundBufferRecorder)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start the capture.
|
||||
/// Warning : only one capture can happen at the same time
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundBufferRecorder_Start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate)
|
||||
{
|
||||
@@ -58,8 +51,6 @@ void sfSoundBufferRecorder_Start(sfSoundBufferRecorder* soundBufferRecorder, uns
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop the capture
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundBufferRecorder_Stop(sfSoundBufferRecorder* soundBufferRecorder)
|
||||
{
|
||||
@@ -67,8 +58,6 @@ void sfSoundBufferRecorder_Stop(sfSoundBufferRecorder* soundBufferRecorder)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sample rate of a sound buffer recorder
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfSoundBufferRecorder_GetSampleRate(const sfSoundBufferRecorder* soundBufferRecorder)
|
||||
{
|
||||
@@ -76,9 +65,6 @@ unsigned int sfSoundBufferRecorder_GetSampleRate(const sfSoundBufferRecorder* so
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sound buffer containing the captured audio data
|
||||
/// of a sound buffer recorder
|
||||
////////////////////////////////////////////////////////////
|
||||
const sfSoundBuffer* sfSoundBufferRecorder_GetBuffer(const sfSoundBufferRecorder* soundBufferRecorder)
|
||||
{
|
||||
|
||||
@@ -30,9 +30,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new sound recorder with callback functions
|
||||
/// for processing captured samples
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSoundRecorder* sfSoundRecorder_Create(sfSoundRecorderStartCallback onStart,
|
||||
sfSoundRecorderProcessCallback onProcess,
|
||||
@@ -43,8 +40,6 @@ sfSoundRecorder* sfSoundRecorder_Create(sfSoundRecorderStartCallback onStart,
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound recorder
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundRecorder_Destroy(sfSoundRecorder* soundRecorder)
|
||||
{
|
||||
@@ -52,9 +47,6 @@ void sfSoundRecorder_Destroy(sfSoundRecorder* soundRecorder)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start the capture.
|
||||
/// Warning : only one capture can happen at the same time
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundRecorder_Start(sfSoundRecorder* soundRecorder, unsigned int sampleRate)
|
||||
{
|
||||
@@ -62,8 +54,6 @@ void sfSoundRecorder_Start(sfSoundRecorder* soundRecorder, unsigned int sampleRa
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop the capture
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundRecorder_Stop(sfSoundRecorder* soundRecorder)
|
||||
{
|
||||
@@ -71,8 +61,6 @@ void sfSoundRecorder_Stop(sfSoundRecorder* soundRecorder)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sample rate of a sound recorder
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfSoundRecorder_GetSampleRate(const sfSoundRecorder* soundRecorder)
|
||||
{
|
||||
@@ -80,9 +68,6 @@ unsigned int sfSoundRecorder_GetSampleRate(const sfSoundRecorder* soundRecorder)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell if the system supports sound capture.
|
||||
/// If not, this class won't be usable
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfSoundRecorder_IsAvailable(void)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSoundStream* sfSoundStream_Create(sfSoundStreamGetDataCallback onGetData,
|
||||
sfSoundStreamSeekCallback onSeek,
|
||||
@@ -43,8 +41,6 @@ sfSoundStream* sfSoundStream_Create(sfSoundStreamGetDataCallback onGetData,
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundStream_Destroy(sfSoundStream* soundStream)
|
||||
{
|
||||
@@ -52,8 +48,6 @@ void sfSoundStream_Destroy(sfSoundStream* soundStream)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start playing a sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundStream_Play(sfSoundStream* soundStream)
|
||||
{
|
||||
@@ -61,8 +55,6 @@ void sfSoundStream_Play(sfSoundStream* soundStream)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Pause a sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundStream_Pause(sfSoundStream* soundStream)
|
||||
{
|
||||
@@ -70,8 +62,6 @@ void sfSoundStream_Pause(sfSoundStream* soundStream)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop playing a sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundStream_Stop(sfSoundStream* soundStream)
|
||||
{
|
||||
@@ -79,8 +69,6 @@ void sfSoundStream_Stop(sfSoundStream* soundStream)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the status of a sound stream (stopped, paused, playing)
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSoundStatus sfSoundStream_GetStatus(const sfSoundStream* soundStream)
|
||||
{
|
||||
@@ -90,9 +78,6 @@ sfSoundStatus sfSoundStream_GetStatus(const sfSoundStream* soundStream)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the number of channels of a sound stream
|
||||
/// (1 = mono, 2 = stereo)
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfSoundStream_GetChannelsCount(const sfSoundStream* soundStream)
|
||||
{
|
||||
@@ -100,8 +85,6 @@ unsigned int sfSoundStream_GetChannelsCount(const sfSoundStream* soundStream)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sample rate of a sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfSoundStream_GetSampleRate(const sfSoundStream* soundStream)
|
||||
{
|
||||
@@ -109,8 +92,6 @@ unsigned int sfSoundStream_GetSampleRate(const sfSoundStream* soundStream)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the pitch of a sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundStream_SetPitch(sfSoundStream* soundStream, float pitch)
|
||||
{
|
||||
@@ -118,8 +99,6 @@ void sfSoundStream_SetPitch(sfSoundStream* soundStream, float pitch)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the volume of a sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundStream_SetVolume(sfSoundStream* soundStream, float volume)
|
||||
{
|
||||
@@ -127,8 +106,6 @@ void sfSoundStream_SetVolume(sfSoundStream* soundStream, float volume)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundStream_SetPosition(sfSoundStream* soundStream, float x, float y, float z)
|
||||
{
|
||||
@@ -136,10 +113,6 @@ void sfSoundStream_SetPosition(sfSoundStream* soundStream, float x, float y, flo
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Make the sound stream's position relative to the listener's
|
||||
/// position, or absolute.
|
||||
/// The default value is false (absolute)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundStream_SetRelativeToListener(sfSoundStream* soundStream, sfBool relative)
|
||||
{
|
||||
@@ -147,10 +120,6 @@ void sfSoundStream_SetRelativeToListener(sfSoundStream* soundStream, sfBool rela
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the minimum distance - closer than this distance,
|
||||
/// the listener will hear the sound stream at its maximum volume.
|
||||
/// The default minimum distance is 1.0
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundStream_SetMinDistance(sfSoundStream* soundStream, float distance)
|
||||
{
|
||||
@@ -158,10 +127,6 @@ void sfSoundStream_SetMinDistance(sfSoundStream* soundStream, float distance)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the attenuation factor - the higher the attenuation, the
|
||||
/// more the sound stream will be attenuated with distance from listener.
|
||||
/// The default attenuation factor 1.0
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundStream_SetAttenuation(sfSoundStream* soundStream, float attenuation)
|
||||
{
|
||||
@@ -169,8 +134,6 @@ void sfSoundStream_SetAttenuation(sfSoundStream* soundStream, float attenuation)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the current playing position of a stream
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundStream_SetPlayingOffset(sfSoundStream* soundStream, sfUint32 timeOffset)
|
||||
{
|
||||
@@ -178,8 +141,6 @@ void sfSoundStream_SetPlayingOffset(sfSoundStream* soundStream, sfUint32 timeOff
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a stream loop state
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundStream_SetLoop(sfSoundStream* soundStream, sfBool loop)
|
||||
{
|
||||
@@ -187,8 +148,6 @@ void sfSoundStream_SetLoop(sfSoundStream* soundStream, sfBool loop)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the pitch of a sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfSoundStream_GetPitch(const sfSoundStream* soundStream)
|
||||
{
|
||||
@@ -196,8 +155,6 @@ float sfSoundStream_GetPitch(const sfSoundStream* soundStream)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the volume of a sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfSoundStream_GetVolume(const sfSoundStream* soundStream)
|
||||
{
|
||||
@@ -205,8 +162,6 @@ float sfSoundStream_GetVolume(const sfSoundStream* soundStream)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the position of a sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSoundStream_GetPosition(const sfSoundStream* soundStream, float* x, float* y, float* z)
|
||||
{
|
||||
@@ -219,9 +174,6 @@ void sfSoundStream_GetPosition(const sfSoundStream* soundStream, float* x, float
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell if the sound stream's position is relative to the listener's
|
||||
/// position, or if it's absolute
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfSoundStream_IsRelativeToListener(const sfSoundStream* soundStream)
|
||||
{
|
||||
@@ -229,8 +181,6 @@ CSFML_API sfBool sfSoundStream_IsRelativeToListener(const sfSoundStream* soundSt
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the minimum distance of a sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfSoundStream_GetMinDistance(const sfSoundStream* soundStream)
|
||||
{
|
||||
@@ -238,8 +188,6 @@ float sfSoundStream_GetMinDistance(const sfSoundStream* soundStream)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the attenuation factor of a sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfSoundStream_GetAttenuation(const sfSoundStream* soundStream)
|
||||
{
|
||||
@@ -247,8 +195,6 @@ float sfSoundStream_GetAttenuation(const sfSoundStream* soundStream)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a stream is looping
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfSoundStream_GetLoop(const sfSoundStream* soundStream)
|
||||
{
|
||||
@@ -256,8 +202,6 @@ sfBool sfSoundStream_GetLoop(const sfSoundStream* soundStream)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current playing position of a sound stream
|
||||
////////////////////////////////////////////////////////////
|
||||
sfUint32 sfSoundStream_GetPlayingOffset(const sfSoundStream* soundStream)
|
||||
{
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Ftp directory response
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfFtpListingResponse_Destroy(sfFtpListingResponse* ftpListingResponse)
|
||||
{
|
||||
@@ -40,9 +38,6 @@ void sfFtpListingResponse_Destroy(sfFtpListingResponse* ftpListingResponse)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Convenience function to check if the response status code
|
||||
/// means a success
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfFtpListingResponse_IsOk(const sfFtpListingResponse* ftpListingResponse)
|
||||
{
|
||||
@@ -50,8 +45,6 @@ sfBool sfFtpListingResponse_IsOk(const sfFtpListingResponse* ftpListingResponse)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the response status code
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpStatus sfFtpListingResponse_GetStatus(const sfFtpListingResponse* ftpListingResponse)
|
||||
{
|
||||
@@ -61,8 +54,6 @@ sfFtpStatus sfFtpListingResponse_GetStatus(const sfFtpListingResponse* ftpListin
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the full message contained in the response
|
||||
////////////////////////////////////////////////////////////
|
||||
const char* sfFtpListingResponse_GetMessage(const sfFtpListingResponse* ftpListingResponse)
|
||||
{
|
||||
@@ -72,8 +63,6 @@ const char* sfFtpListingResponse_GetMessage(const sfFtpListingResponse* ftpListi
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the number of filenames in the listing
|
||||
////////////////////////////////////////////////////////////
|
||||
size_t sfFtpListingResponse_GetCount(const sfFtpListingResponse* ftpListingResponse)
|
||||
{
|
||||
@@ -83,8 +72,6 @@ size_t sfFtpListingResponse_GetCount(const sfFtpListingResponse* ftpListingRespo
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Index-th filename in the directory
|
||||
////////////////////////////////////////////////////////////
|
||||
const char* sfFtpListingResponse_GetFilename(const sfFtpListingResponse* ftpListingResponse, size_t index)
|
||||
{
|
||||
@@ -94,8 +81,6 @@ const char* sfFtpListingResponse_GetFilename(const sfFtpListingResponse* ftpList
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Ftp directory response
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfFtpDirectoryResponse_Destroy(sfFtpDirectoryResponse* ftpDirectoryResponse)
|
||||
{
|
||||
@@ -103,9 +88,6 @@ void sfFtpDirectoryResponse_Destroy(sfFtpDirectoryResponse* ftpDirectoryResponse
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Convenience function to check if the response status code
|
||||
/// means a success
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfFtpDirectoryResponse_IsOk(const sfFtpDirectoryResponse* ftpDirectoryResponse)
|
||||
{
|
||||
@@ -113,8 +95,6 @@ sfBool sfFtpDirectoryResponse_IsOk(const sfFtpDirectoryResponse* ftpDirectoryRes
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the response status code
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpStatus sfFtpDirectoryResponse_GetStatus(const sfFtpDirectoryResponse* ftpDirectoryResponse)
|
||||
{
|
||||
@@ -124,8 +104,6 @@ sfFtpStatus sfFtpDirectoryResponse_GetStatus(const sfFtpDirectoryResponse* ftpDi
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the full message contained in the response
|
||||
////////////////////////////////////////////////////////////
|
||||
const char* sfFtpDirectoryResponse_GetMessage(const sfFtpDirectoryResponse* ftpDirectoryResponse)
|
||||
{
|
||||
@@ -135,8 +113,6 @@ const char* sfFtpDirectoryResponse_GetMessage(const sfFtpDirectoryResponse* ftpD
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the directory returned in the response
|
||||
////////////////////////////////////////////////////////////
|
||||
const char* sfFtpDirectoryResponse_GetDirectory(const sfFtpDirectoryResponse* ftpDirectoryResponse)
|
||||
{
|
||||
@@ -146,8 +122,6 @@ const char* sfFtpDirectoryResponse_GetDirectory(const sfFtpDirectoryResponse* ft
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Ftp response
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfFtpResponse_Destroy(sfFtpResponse* ftpResponse)
|
||||
{
|
||||
@@ -155,9 +129,6 @@ void sfFtpResponse_Destroy(sfFtpResponse* ftpResponse)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Convenience function to check if the response status code
|
||||
/// means a success
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfFtpResponse_IsOk(const sfFtpResponse* ftpResponse)
|
||||
{
|
||||
@@ -165,8 +136,6 @@ sfBool sfFtpResponse_IsOk(const sfFtpResponse* ftpResponse)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the response status code
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpStatus sfFtpResponse_GetStatus(const sfFtpResponse* ftpResponse)
|
||||
{
|
||||
@@ -176,8 +145,6 @@ sfFtpStatus sfFtpResponse_GetStatus(const sfFtpResponse* ftpResponse)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the full message contained in the response
|
||||
////////////////////////////////////////////////////////////
|
||||
const char* sfFtpResponse_GetMessage(const sfFtpResponse* ftpResponse)
|
||||
{
|
||||
@@ -187,8 +154,6 @@ const char* sfFtpResponse_GetMessage(const sfFtpResponse* ftpResponse)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new Ftp
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtp* sfFtp_Create(void)
|
||||
{
|
||||
@@ -196,8 +161,6 @@ sfFtp* sfFtp_Create(void)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Ftp
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfFtp_Destroy(sfFtp* ftp)
|
||||
{
|
||||
@@ -205,8 +168,6 @@ void sfFtp_Destroy(sfFtp* ftp)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Connect to the specified FTP server
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpResponse* sfFtp_Connect(sfFtp* ftp, sfIpAddress server, unsigned short port, sfUint32 timeout)
|
||||
{
|
||||
@@ -218,8 +179,6 @@ sfFtpResponse* sfFtp_Connect(sfFtp* ftp, sfIpAddress server, unsigned short port
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Log in using anonymous account
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpResponse* sfFtp_LoginAnonymous(sfFtp* ftp)
|
||||
{
|
||||
@@ -229,8 +188,6 @@ sfFtpResponse* sfFtp_LoginAnonymous(sfFtp* ftp)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Log in using a username and a password
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpResponse* sfFtp_Login(sfFtp* ftp, const char* userName, const char* password)
|
||||
{
|
||||
@@ -240,8 +197,6 @@ sfFtpResponse* sfFtp_Login(sfFtp* ftp, const char* userName, const char* passwor
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Close the connection with FTP server
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpResponse* sfFtp_Disconnect(sfFtp* ftp)
|
||||
{
|
||||
@@ -251,8 +206,6 @@ sfFtpResponse* sfFtp_Disconnect(sfFtp* ftp)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send a null command just to prevent from being disconnected
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpResponse* sfFtp_KeepAlive(sfFtp* ftp)
|
||||
{
|
||||
@@ -262,8 +215,6 @@ sfFtpResponse* sfFtp_KeepAlive(sfFtp* ftp)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current working directory
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpDirectoryResponse* sfFtp_GetWorkingDirectory(sfFtp* ftp)
|
||||
{
|
||||
@@ -273,9 +224,6 @@ sfFtpDirectoryResponse* sfFtp_GetWorkingDirectory(sfFtp* ftp)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the contents of the given directory
|
||||
/// (subdirectories and files)
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpListingResponse* sfFtp_GetDirectoryListing(sfFtp* ftp, const char* directory)
|
||||
{
|
||||
@@ -285,8 +233,6 @@ sfFtpListingResponse* sfFtp_GetDirectoryListing(sfFtp* ftp, const char* director
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the current working directory
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpResponse* sfFtp_ChangeDirectory(sfFtp* ftp, const char* directory)
|
||||
{
|
||||
@@ -296,8 +242,6 @@ sfFtpResponse* sfFtp_ChangeDirectory(sfFtp* ftp, const char* directory)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Go to the parent directory of the current one
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpResponse* sfFtp_ParentDirectory(sfFtp* ftp)
|
||||
{
|
||||
@@ -307,8 +251,6 @@ sfFtpResponse* sfFtp_ParentDirectory(sfFtp* ftp)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new directory
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpResponse* sfFtp_CreateDirectory(sfFtp* ftp, const char* name)
|
||||
{
|
||||
@@ -318,8 +260,6 @@ sfFtpResponse* sfFtp_CreateDirectory(sfFtp* ftp, const char* name)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove an existing directory
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpResponse* sfFtp_DeleteDirectory(sfFtp* ftp, const char* name)
|
||||
{
|
||||
@@ -329,8 +269,6 @@ sfFtpResponse* sfFtp_DeleteDirectory(sfFtp* ftp, const char* name)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Rename a file
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpResponse* sfFtp_RenameFile(sfFtp* ftp, const char* file, const char* newName)
|
||||
{
|
||||
@@ -340,8 +278,6 @@ sfFtpResponse* sfFtp_RenameFile(sfFtp* ftp, const char* file, const char* newNam
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove an existing file
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpResponse* sfFtp_DeleteFile(sfFtp* ftp, const char* name)
|
||||
{
|
||||
@@ -351,8 +287,6 @@ sfFtpResponse* sfFtp_DeleteFile(sfFtp* ftp, const char* name)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Download a file from the server
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpResponse* sfFtp_Download(sfFtp* ftp, const char* distantFile, const char* destPath, sfFtpTransferMode mode)
|
||||
{
|
||||
@@ -364,8 +298,6 @@ sfFtpResponse* sfFtp_Download(sfFtp* ftp, const char* distantFile, const char* d
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Upload a file to the server
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFtpResponse* sfFtp_Upload(sfFtp* ftp, const char* localFile, const char* destPath, sfFtpTransferMode mode)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new Http request
|
||||
////////////////////////////////////////////////////////////
|
||||
sfHttpRequest* sfHttpRequest_Create(void)
|
||||
{
|
||||
@@ -39,8 +37,6 @@ sfHttpRequest* sfHttpRequest_Create(void)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Http request
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfHttpRequest_Destroy(sfHttpRequest* httpRequest)
|
||||
{
|
||||
@@ -48,8 +44,6 @@ void sfHttpRequest_Destroy(sfHttpRequest* httpRequest)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the value of a field; the field is added if it doesn't exist
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfHttpRequest_SetField(sfHttpRequest* httpRequest, const char* field, const char* value)
|
||||
{
|
||||
@@ -59,9 +53,6 @@ void sfHttpRequest_SetField(sfHttpRequest* httpRequest, const char* field, const
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the request method.
|
||||
/// This parameter is sfHttpGet by default
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfHttpRequest_SetMethod(sfHttpRequest* httpRequest, sfHttpMethod method)
|
||||
{
|
||||
@@ -69,9 +60,6 @@ void sfHttpRequest_SetMethod(sfHttpRequest* httpRequest, sfHttpMethod method)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the target URI of the request.
|
||||
/// This parameter is "/" by default
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfHttpRequest_SetUri(sfHttpRequest* httpRequest, const char* uri)
|
||||
{
|
||||
@@ -79,9 +67,6 @@ void sfHttpRequest_SetUri(sfHttpRequest* httpRequest, const char* uri)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the HTTP version of the request.
|
||||
/// This parameter is 1.0 by default
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfHttpRequest_SetHttpVersion(sfHttpRequest* httpRequest, unsigned int major, unsigned int minor)
|
||||
{
|
||||
@@ -89,10 +74,6 @@ void sfHttpRequest_SetHttpVersion(sfHttpRequest* httpRequest, unsigned int major
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the body of the request. This parameter is optional and
|
||||
/// makes sense only for POST requests.
|
||||
/// This parameter is empty by default
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfHttpRequest_SetBody(sfHttpRequest* httpRequest, const char* body)
|
||||
{
|
||||
@@ -100,8 +81,6 @@ void sfHttpRequest_SetBody(sfHttpRequest* httpRequest, const char* body)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Http response
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfHttpResponse_Destroy(sfHttpResponse* httpResponse)
|
||||
{
|
||||
@@ -109,8 +88,6 @@ void sfHttpResponse_Destroy(sfHttpResponse* httpResponse)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the value of a field; returns NULL if the field doesn't exist
|
||||
////////////////////////////////////////////////////////////
|
||||
const char* sfHttpResponse_GetField(const sfHttpResponse* httpResponse, const char* field)
|
||||
{
|
||||
@@ -122,8 +99,6 @@ const char* sfHttpResponse_GetField(const sfHttpResponse* httpResponse, const ch
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the status of a response
|
||||
////////////////////////////////////////////////////////////
|
||||
sfHttpStatus sfHttpResponse_GetStatus(const sfHttpResponse* httpResponse)
|
||||
{
|
||||
@@ -133,8 +108,6 @@ sfHttpStatus sfHttpResponse_GetStatus(const sfHttpResponse* httpResponse)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the major HTTP version of a response
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfHttpResponse_GetMajorVersion(const sfHttpResponse* httpResponse)
|
||||
{
|
||||
@@ -142,8 +115,6 @@ unsigned int sfHttpResponse_GetMajorVersion(const sfHttpResponse* httpResponse)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the minor HTTP version of a response
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfHttpResponse_GetMinorVersion(const sfHttpResponse* httpResponse)
|
||||
{
|
||||
@@ -151,12 +122,6 @@ unsigned int sfHttpResponse_GetMinorVersion(const sfHttpResponse* httpResponse)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the body of the response. The body can contain :
|
||||
/// - the requested page (for GET requests)
|
||||
/// - a response from the server (for POST requests)
|
||||
/// - nothing (for HEAD requests)
|
||||
/// - an error message (in case of an error)
|
||||
////////////////////////////////////////////////////////////
|
||||
const char* sfHttpResponse_GetBody(const sfHttpResponse* httpResponse)
|
||||
{
|
||||
@@ -166,8 +131,6 @@ const char* sfHttpResponse_GetBody(const sfHttpResponse* httpResponse)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new Http object
|
||||
////////////////////////////////////////////////////////////
|
||||
sfHttp* sfHttp_Create(void)
|
||||
{
|
||||
@@ -175,8 +138,6 @@ sfHttp* sfHttp_Create(void)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Http object
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfHttp_Destroy(sfHttp* http)
|
||||
{
|
||||
@@ -184,8 +145,6 @@ void sfHttp_Destroy(sfHttp* http)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the target host of a Http server
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfHttp_SetHost(sfHttp* http, const char* host, unsigned short port)
|
||||
{
|
||||
@@ -193,13 +152,6 @@ void sfHttp_SetHost(sfHttp* http, const char* host, unsigned short port)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send a HTTP request and return the server's response.
|
||||
/// You must be connected to a host before sending requests.
|
||||
/// Any missing mandatory header field will be added with an appropriate value.
|
||||
/// Warning : this function waits for the server's response and may
|
||||
/// not return instantly; use a thread if you don't want to block your
|
||||
/// application.
|
||||
////////////////////////////////////////////////////////////
|
||||
sfHttpResponse* sfHttp_SendRequest(sfHttp* http, const sfHttpRequest* request, sfUint32 timeout)
|
||||
{
|
||||
|
||||
@@ -32,9 +32,7 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Helper function for converting a SFML address to a CSFML one
|
||||
////////////////////////////////////////////////////////////
|
||||
// Helper function for converting a SFML address to a CSFML one
|
||||
sfIpAddress FromSFMLAddress(sf::IpAddress address)
|
||||
{
|
||||
sfIpAddress result;
|
||||
@@ -43,9 +41,7 @@ namespace
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Helper function for converting a CSFML address to a SFML one
|
||||
////////////////////////////////////////////////////////////
|
||||
// Helper function for converting a CSFML address to a SFML one
|
||||
sf::IpAddress ToSFMLAddress(sfIpAddress address)
|
||||
{
|
||||
return sf::IpAddress(address.Address);
|
||||
@@ -54,16 +50,12 @@ namespace
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct an address from a string
|
||||
////////////////////////////////////////////////////////////
|
||||
sfIpAddress sfIpAddress_FromString(const char* string)
|
||||
sfIpAddress sfIpAddress_FromString(const char* address)
|
||||
{
|
||||
return FromSFMLAddress(sf::IpAddress(string));
|
||||
return FromSFMLAddress(sf::IpAddress(address));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct an address from 4 bytes
|
||||
////////////////////////////////////////////////////////////
|
||||
sfIpAddress sfIpAddress_FromBytes(sfUint8 byte0, sfUint8 byte1, sfUint8 byte2, sfUint8 byte3)
|
||||
{
|
||||
@@ -71,8 +63,6 @@ sfIpAddress sfIpAddress_FromBytes(sfUint8 byte0, sfUint8 byte1, sfUint8 byte2, s
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct the address from a 32-bits integer
|
||||
////////////////////////////////////////////////////////////
|
||||
sfIpAddress sfIpAddress_FromInteger(sfUint32 address)
|
||||
{
|
||||
@@ -80,8 +70,6 @@ sfIpAddress sfIpAddress_FromInteger(sfUint32 address)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a string representation of an address
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfIpAddress_ToString(sfIpAddress address, char* string)
|
||||
{
|
||||
@@ -90,8 +78,6 @@ void sfIpAddress_ToString(sfIpAddress address, char* string)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get an integer representation of the address
|
||||
////////////////////////////////////////////////////////////
|
||||
sfUint32 sfIpAddress_ToInteger(sfIpAddress address)
|
||||
{
|
||||
@@ -99,8 +85,6 @@ sfUint32 sfIpAddress_ToInteger(sfIpAddress address)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the computer's local IP address (from the LAN point of view)
|
||||
////////////////////////////////////////////////////////////
|
||||
sfIpAddress sfIpAddress_GetLocalAddress(void)
|
||||
{
|
||||
@@ -108,11 +92,6 @@ sfIpAddress sfIpAddress_GetLocalAddress(void)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the computer's public IP address (from the web point of view).
|
||||
/// The only way to get a public address is to ask it to a
|
||||
/// distant website ; as a consequence, this function may be
|
||||
/// very slow -- use it as few as possible !
|
||||
////////////////////////////////////////////////////////////
|
||||
sfIpAddress sfIpAddress_GetPublicAddress(sfUint32 timeout)
|
||||
{
|
||||
@@ -120,16 +99,12 @@ sfIpAddress sfIpAddress_GetPublicAddress(sfUint32 timeout)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the computer's loopback address
|
||||
////////////////////////////////////////////////////////////
|
||||
sfIpAddress sfIpAddress_LocalHost(void)
|
||||
{
|
||||
return FromSFMLAddress(sf::IpAddress::LocalHost);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the empty/invalid address
|
||||
////////////////////////////////////////////////////////////
|
||||
sfIpAddress sfIpAddress_None(void)
|
||||
{
|
||||
|
||||
@@ -32,9 +32,7 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Helper function to read a variable from a packet
|
||||
////////////////////////////////////////////////////////////
|
||||
// Helper function to read a variable from a packet
|
||||
template <typename T>
|
||||
T PacketRead(sfPacket* packet)
|
||||
{
|
||||
@@ -45,9 +43,7 @@ namespace
|
||||
return value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Helper function to write a variable to a packet
|
||||
////////////////////////////////////////////////////////////
|
||||
// Helper function to write a variable to a packet
|
||||
template <typename T>
|
||||
void PacketWrite(sfPacket* packet, T value)
|
||||
{
|
||||
@@ -58,8 +54,6 @@ namespace
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new empty packet
|
||||
////////////////////////////////////////////////////////////
|
||||
sfPacket* sfPacket_Create(void)
|
||||
{
|
||||
@@ -67,8 +61,6 @@ sfPacket* sfPacket_Create(void)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing packet
|
||||
////////////////////////////////////////////////////////////
|
||||
sfPacket* sfPacket_Copy(sfPacket* packet)
|
||||
{
|
||||
@@ -78,8 +70,6 @@ sfPacket* sfPacket_Copy(sfPacket* packet)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing packet
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfPacket_Destroy(sfPacket* packet)
|
||||
{
|
||||
@@ -87,8 +77,6 @@ void sfPacket_Destroy(sfPacket* packet)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Append data to the end of a packet
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfPacket_Append(sfPacket* packet, const void* data, size_t sizeInBytes)
|
||||
{
|
||||
@@ -97,18 +85,12 @@ void sfPacket_Append(sfPacket* packet, const void* data, size_t sizeInBytes)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Clear all the data of a packet
|
||||
///////////////////////////////////////////////////////////
|
||||
void sfPacket_Clear(sfPacket* packet)
|
||||
{
|
||||
CSFML_CALL(packet, Clear());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a pointer to the data contained in a packet
|
||||
/// Warning : the returned pointer may be invalid after you
|
||||
/// append data to the packet
|
||||
////////////////////////////////////////////////////////////
|
||||
const char* sfPacket_GetData(const sfPacket* packet)
|
||||
{
|
||||
@@ -116,8 +98,6 @@ const char* sfPacket_GetData(const sfPacket* packet)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the size of the data contained in a packet
|
||||
////////////////////////////////////////////////////////////
|
||||
size_t sfPacket_GetDataSize(const sfPacket* packet)
|
||||
{
|
||||
@@ -125,8 +105,6 @@ size_t sfPacket_GetDataSize(const sfPacket* packet)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell if the reading position has reached the end of the packet
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfPacket_EndOfPacket(const sfPacket* packet)
|
||||
{
|
||||
@@ -134,8 +112,6 @@ sfBool sfPacket_EndOfPacket(const sfPacket* packet)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check if a packet is in a valid reading state
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfPacket_CanRead(const sfPacket* packet)
|
||||
{
|
||||
@@ -144,11 +120,6 @@ sfBool sfPacket_CanRead(const sfPacket* packet)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Functions to extract data from a packet
|
||||
///
|
||||
/// \param Packet : Packet to read
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfPacket_ReadBool(sfPacket* packet) {return PacketRead<sfUint8>(packet);}
|
||||
sfInt8 sfPacket_ReadInt8(sfPacket* packet) {return PacketRead<sfInt8>(packet);}
|
||||
@@ -177,11 +148,6 @@ void sfPacket_ReadWideString(sfPacket* packet, wchar_t* string)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Functions to insert data into a packet
|
||||
///
|
||||
/// \param Packet : Packet to write
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfPacket_WriteBool(sfPacket* packet, sfBool value) {PacketWrite(packet, static_cast<sfUint8>(value));}
|
||||
void sfPacket_WriteInt8(sfPacket* packet, sfInt8 value) {PacketWrite(packet, value);}
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new selector
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketSelector* sfSocketSelector_Create(void)
|
||||
{
|
||||
@@ -42,8 +40,6 @@ sfSocketSelector* sfSocketSelector_Create(void)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing selector
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketSelector* sfSocketSelector_Copy(sfSocketSelector* selector)
|
||||
{
|
||||
@@ -53,8 +49,6 @@ sfSocketSelector* sfSocketSelector_Copy(sfSocketSelector* selector)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing selector
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSocketSelector_Destroy(sfSocketSelector* selector)
|
||||
{
|
||||
@@ -62,8 +56,6 @@ void sfSocketSelector_Destroy(sfSocketSelector* selector)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Add a socket to watch to a selector
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSocketSelector_AddTcpListener(sfSocketSelector* selector, sfTcpListener* socket)
|
||||
{
|
||||
@@ -82,8 +74,6 @@ void sfSocketSelector_AddUdpSocket(sfSocketSelector* selector, sfUdpSocket* sock
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove a socket from a selector
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSocketSelector_RemoveTcpListener(sfSocketSelector* selector, sfTcpListener* socket)
|
||||
{
|
||||
@@ -102,8 +92,6 @@ void sfSocketSelector_RemoveUdpSocket(sfSocketSelector* selector, sfUdpSocket* s
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove all sockets from a selector
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSocketSelector_Clear(sfSocketSelector* selector)
|
||||
{
|
||||
@@ -111,10 +99,6 @@ void sfSocketSelector_Clear(sfSocketSelector* selector)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Wait and collect sockets which are ready for reading.
|
||||
/// This functions will return either when at least one socket
|
||||
/// is ready, or when the given timeout is over
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfSocketSelector_Wait(sfSocketSelector* selector, sfUint32 timeout)
|
||||
{
|
||||
@@ -122,8 +106,6 @@ sfBool sfSocketSelector_Wait(sfSocketSelector* selector, sfUint32 timeout)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Test a socket to know if it is ready to receive data
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfSocketSelector_IsTcpListenerReady(const sfSocketSelector* selector, sfTcpListener* socket)
|
||||
{
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new TCP socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfTcpListener* sfTcpListener_Create(void)
|
||||
{
|
||||
@@ -41,54 +39,48 @@ sfTcpListener* sfTcpListener_Create(void)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing TCP socket
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfTcpListener_Destroy(sfTcpListener* socket)
|
||||
void sfTcpListener_Destroy(sfTcpListener* listener)
|
||||
{
|
||||
delete socket;
|
||||
delete listener;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the blocking state of a TCP socket.
|
||||
/// The default behaviour of a socket is blocking
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfTcpListener_SetBlocking(sfTcpListener* socket, sfBool blocking)
|
||||
void sfTcpListener_SetBlocking(sfTcpListener* listener, sfBool blocking)
|
||||
{
|
||||
CSFML_CALL(socket, SetBlocking(blocking == sfTrue));
|
||||
CSFML_CALL(listener, SetBlocking(blocking == sfTrue));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the blocking state of the socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfTcpListener_IsBlocking(const sfTcpListener* socket)
|
||||
sfBool sfTcpListener_IsBlocking(const sfTcpListener* listener)
|
||||
{
|
||||
CSFML_CALL_RETURN(socket, IsBlocking(), sfFalse);
|
||||
CSFML_CALL_RETURN(listener, IsBlocking(), sfFalse);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Listen to a specified port for incoming data or connections
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfTcpListener_Listen(sfTcpListener* socket, unsigned short port)
|
||||
unsigned short sfTcpListener_GetLocalPort(const sfTcpListener* listener)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError);
|
||||
|
||||
return static_cast<sfSocketStatus>(socket->This.Listen(port));
|
||||
CSFML_CALL_RETURN(listener, GetLocalPort(), 0);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Wait for a connection (must be listening to a port).
|
||||
/// This function is blocking, ie. it won't return before
|
||||
/// a connection has been accepted
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfTcpListener_Accept(sfTcpListener* socket, sfTcpSocket** connected)
|
||||
sfSocketStatus sfTcpListener_Listen(sfTcpListener* listener, unsigned short port)
|
||||
{
|
||||
CSFML_CHECK_RETURN(socket, sfSocketError);
|
||||
CSFML_CHECK_RETURN(listener, sfSocketError);
|
||||
|
||||
return static_cast<sfSocketStatus>(listener->This.Listen(port));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfTcpListener_Accept(sfTcpListener* listener, sfTcpSocket** connected)
|
||||
{
|
||||
CSFML_CHECK_RETURN(listener, sfSocketError);
|
||||
CSFML_CHECK_RETURN(connected, sfSocketError);
|
||||
|
||||
*connected = new sfTcpSocket;
|
||||
return static_cast<sfSocketStatus>(socket->This.Accept((*connected)->This));
|
||||
return static_cast<sfSocketStatus>(listener->This.Accept((*connected)->This));
|
||||
}
|
||||
@@ -33,8 +33,6 @@
|
||||
#include <string.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new TCP socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfTcpSocket* sfTcpSocket_Create(void)
|
||||
{
|
||||
@@ -42,8 +40,6 @@ sfTcpSocket* sfTcpSocket_Create(void)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing TCP socket
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfTcpSocket_Destroy(sfTcpSocket* socket)
|
||||
{
|
||||
@@ -51,9 +47,6 @@ void sfTcpSocket_Destroy(sfTcpSocket* socket)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the blocking state of a TCP socket.
|
||||
/// The default behaviour of a socket is blocking
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfTcpSocket_SetBlocking(sfTcpSocket* socket, sfBool blocking)
|
||||
{
|
||||
@@ -61,8 +54,6 @@ void sfTcpSocket_SetBlocking(sfTcpSocket* socket, sfBool blocking)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the blocking state of the socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfTcpSocket_IsBlocking(const sfTcpSocket* socket)
|
||||
{
|
||||
@@ -70,8 +61,6 @@ sfBool sfTcpSocket_IsBlocking(const sfTcpSocket* socket)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the port to which a socket is bound locally
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned short sfTcpSocket_GetLocalPort(const sfTcpSocket* socket)
|
||||
{
|
||||
@@ -79,8 +68,6 @@ unsigned short sfTcpSocket_GetLocalPort(const sfTcpSocket* socket)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the address of the connected peer of a socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfIpAddress sfTcpSocket_GetRemoteAddress(const sfTcpSocket* socket)
|
||||
{
|
||||
@@ -94,8 +81,6 @@ sfIpAddress sfTcpSocket_GetRemoteAddress(const sfTcpSocket* socket)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the port of the connected peer to which a socket is connected
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned short sfTcpSocket_GetRemotePort(const sfTcpSocket* socket)
|
||||
{
|
||||
@@ -103,8 +88,6 @@ unsigned short sfTcpSocket_GetRemotePort(const sfTcpSocket* socket)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Connect a TCP socket to another computer on a specified port
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfTcpSocket_Connect(sfTcpSocket* socket, sfIpAddress host, unsigned short port, sfUint32 timeout)
|
||||
{
|
||||
@@ -116,8 +99,6 @@ sfSocketStatus sfTcpSocket_Connect(sfTcpSocket* socket, sfIpAddress host, unsign
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Disconnect a connect from its remote peer
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfTcpSocket_Disconnect(sfTcpSocket* socket)
|
||||
{
|
||||
@@ -125,8 +106,6 @@ void sfTcpSocket_Disconnect(sfTcpSocket* socket)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send an array of bytes to the host (must be connected first)
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfTcpSocket_Send(sfTcpSocket* socket, const char* data, size_t size)
|
||||
{
|
||||
@@ -136,8 +115,6 @@ sfSocketStatus sfTcpSocket_Send(sfTcpSocket* socket, const char* data, size_t si
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Receive an array of bytes from the host (must be connected first)
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfTcpSocket_Receive(sfTcpSocket* socket, char* data, size_t maxSize, size_t* sizeReceived)
|
||||
{
|
||||
@@ -155,8 +132,6 @@ sfSocketStatus sfTcpSocket_Receive(sfTcpSocket* socket, char* data, size_t maxSi
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send a packet of data to the host (must be connected first)
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfTcpSocket_SendPacket(sfTcpSocket* socket, sfPacket* packet)
|
||||
{
|
||||
@@ -167,8 +142,6 @@ sfSocketStatus sfTcpSocket_SendPacket(sfTcpSocket* socket, sfPacket* packet)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Receive a packet from the host (must be connected first)
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfTcpSocket_ReceivePacket(sfTcpSocket* socket, sfPacket* packet)
|
||||
{
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
#include <string.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new UDP socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfUdpSocket* sfUdpSocket_Create(void)
|
||||
{
|
||||
@@ -42,8 +40,6 @@ sfUdpSocket* sfUdpSocket_Create(void)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing UDP socket
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfUdpSocket_Destroy(sfUdpSocket* socket)
|
||||
{
|
||||
@@ -51,17 +47,12 @@ void sfUdpSocket_Destroy(sfUdpSocket* socket)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the blocking state of a UDP socket.
|
||||
/// The default behaviour of a socket is blocking
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfUdpSocket_SetBlocking(sfUdpSocket* socket, sfBool blocking)
|
||||
{
|
||||
CSFML_CALL(socket, SetBlocking(blocking == sfTrue));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the blocking state of the socket
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfUdpSocket_IsBlocking(const sfUdpSocket* socket)
|
||||
{
|
||||
@@ -69,8 +60,6 @@ sfBool sfUdpSocket_IsBlocking(const sfUdpSocket* socket)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the port to which the socket is bound locally
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned short sfUdpSocket_GetLocalPort(const sfUdpSocket* socket)
|
||||
{
|
||||
@@ -78,8 +67,6 @@ unsigned short sfUdpSocket_GetLocalPort(const sfUdpSocket* socket)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Bind a socket to a specific port
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfUdpSocket_Bind(sfUdpSocket* socket, unsigned short port)
|
||||
{
|
||||
@@ -89,8 +76,6 @@ sfSocketStatus sfUdpSocket_Bind(sfUdpSocket* socket, unsigned short port)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Unbind a socket from its previous port, if any
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfUdpSocket_Unbind(sfUdpSocket* socket)
|
||||
{
|
||||
@@ -98,8 +83,6 @@ void sfUdpSocket_Unbind(sfUdpSocket* socket)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send an array of bytes
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfUdpSocket_Send(sfUdpSocket* socket, const char* data, size_t size, sfIpAddress address, unsigned short port)
|
||||
{
|
||||
@@ -112,10 +95,6 @@ sfSocketStatus sfUdpSocket_Send(sfUdpSocket* socket, const char* data, size_t si
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Receive an array of bytes.
|
||||
/// This function is blocking, ie. it won't return before some
|
||||
/// bytes have been received
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfUdpSocket_Receive(sfUdpSocket* socket, char* data, size_t maxSize, size_t* sizeReceived, sfIpAddress* address, unsigned short* port)
|
||||
{
|
||||
@@ -143,8 +122,6 @@ sfSocketStatus sfUdpSocket_Receive(sfUdpSocket* socket, char* data, size_t maxSi
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send a packet of data
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfUdpSocket_SendPacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress address, unsigned short port)
|
||||
{
|
||||
@@ -158,10 +135,6 @@ sfSocketStatus sfUdpSocket_SendPacket(sfUdpSocket* socket, sfPacket* packet, sfI
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Receive a packet.
|
||||
/// This function is blocking, ie. it won't return before a
|
||||
/// packet is received
|
||||
////////////////////////////////////////////////////////////
|
||||
sfSocketStatus sfUdpSocket_ReceivePacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress* address, unsigned short* port)
|
||||
{
|
||||
@@ -182,3 +155,10 @@ sfSocketStatus sfUdpSocket_ReceivePacket(sfUdpSocket* socket, sfPacket* packet,
|
||||
|
||||
return sfSocketDone;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfUdpSocket_MaxDatagramSize()
|
||||
{
|
||||
return sf::UdpSocket::MaxDatagramSize;
|
||||
}
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new clock and start it
|
||||
////////////////////////////////////////////////////////////
|
||||
sfClock* sfClock_Create(void)
|
||||
{
|
||||
@@ -39,8 +37,6 @@ sfClock* sfClock_Create(void)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing clock
|
||||
////////////////////////////////////////////////////////////
|
||||
sfClock* sfClock_Copy(sfClock* clock)
|
||||
{
|
||||
@@ -50,8 +46,6 @@ sfClock* sfClock_Copy(sfClock* clock)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing clock
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfClock_Destroy(sfClock* clock)
|
||||
{
|
||||
@@ -59,8 +53,6 @@ void sfClock_Destroy(sfClock* clock)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the time elapsed for a clock
|
||||
////////////////////////////////////////////////////////////
|
||||
sfUint32 sfClock_GetTime(const sfClock* clock)
|
||||
{
|
||||
@@ -68,8 +60,6 @@ sfUint32 sfClock_GetTime(const sfClock* clock)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Restart a clock
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfClock_Reset(sfClock* clock)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new mutex
|
||||
////////////////////////////////////////////////////////////
|
||||
sfMutex* sfMutex_Create(void)
|
||||
{
|
||||
@@ -39,8 +37,6 @@ sfMutex* sfMutex_Create(void)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing mutex
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMutex_Destroy(sfMutex* mutex)
|
||||
{
|
||||
@@ -48,8 +44,6 @@ void sfMutex_Destroy(sfMutex* mutex)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Lock a mutex
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMutex_Lock(sfMutex* mutex)
|
||||
{
|
||||
@@ -57,8 +51,6 @@ void sfMutex_Lock(sfMutex* mutex)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Unlock a mutex
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMutex_Unlock(sfMutex* mutex)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Make the current thread sleep for a given duration
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSleep(sfUint32 Duration)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new thread from a function pointer
|
||||
////////////////////////////////////////////////////////////
|
||||
sfThread* sfThread_Create(void (*function)(void*), void* userData)
|
||||
{
|
||||
@@ -39,8 +37,6 @@ sfThread* sfThread_Create(void (*function)(void*), void* userData)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing thread
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfThread_Destroy(sfThread* thread)
|
||||
{
|
||||
@@ -48,8 +44,6 @@ void sfThread_Destroy(sfThread* thread)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Run a thread
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfThread_Launch(sfThread* thread)
|
||||
{
|
||||
@@ -57,8 +51,6 @@ void sfThread_Launch(sfThread* thread)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Wait until a thread finishes
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfThread_Wait(sfThread* thread)
|
||||
{
|
||||
@@ -66,11 +58,6 @@ void sfThread_Wait(sfThread* thread)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Terminate a thread
|
||||
/// Terminating a thread with this function is not safe,
|
||||
/// you should rather try to make the thread function
|
||||
/// terminate by itself
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfThread_Terminate(sfThread* thread)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new context
|
||||
////////////////////////////////////////////////////////////
|
||||
sfContext* sfContext_Create(void)
|
||||
{
|
||||
@@ -39,8 +37,6 @@ sfContext* sfContext_Create(void)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing context
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfContext_Destroy(sfContext* context)
|
||||
{
|
||||
@@ -48,8 +44,6 @@ void sfContext_Destroy(sfContext* context)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Activate or deactivate a context
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfContext_SetActive(sfContext* context, sfBool active)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check if a joystick is connected
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfJoystick_IsConnected(unsigned int joystick)
|
||||
{
|
||||
@@ -39,8 +37,6 @@ sfBool sfJoystick_IsConnected(unsigned int joystick)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the number of buttons supported by a joystick
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfJoystick_GetButtonCount(unsigned int joystick)
|
||||
{
|
||||
@@ -48,8 +44,6 @@ unsigned int sfJoystick_GetButtonCount(unsigned int joystick)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check if a joystick supports a given axis
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfJoystick_HasAxis(unsigned int joystick, sfJoystickAxis axis)
|
||||
{
|
||||
@@ -57,8 +51,6 @@ sfBool sfJoystick_HasAxis(unsigned int joystick, sfJoystickAxis axis)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check if a joystick button is pressed
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfJoystick_IsButtonPressed(unsigned int joystick, unsigned int button)
|
||||
{
|
||||
@@ -66,8 +58,6 @@ sfBool sfJoystick_IsButtonPressed(unsigned int joystick, unsigned int button)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current position of a joystick axis
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfJoystick_GetAxisPosition(unsigned int joystick, sfJoystickAxis axis)
|
||||
{
|
||||
@@ -75,8 +65,6 @@ float sfJoystick_GetAxisPosition(unsigned int joystick, sfJoystickAxis axis)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Update the states of all joysticks
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfJoystick_Update(void)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check if a key is pressed
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfKeyboard_IsKeyPressed(sfKeyCode key)
|
||||
{
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check if a mouse button is pressed
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfMouse_IsButtonPressed(sfMouseButton button)
|
||||
{
|
||||
@@ -40,8 +38,6 @@ sfBool sfMouse_IsButtonPressed(sfMouseButton button)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current position of the mouse
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMouse_GetPosition(int* x, int* y, const sfWindow* relativeTo)
|
||||
{
|
||||
@@ -58,8 +54,6 @@ void sfMouse_GetPosition(int* x, int* y, const sfWindow* relativeTo)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current position of the mouse
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMouse_SetPosition(int x, int y, const sfWindow* relativeTo)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current desktop video mode
|
||||
////////////////////////////////////////////////////////////
|
||||
sfVideoMode sfVideoMode_GetDesktopMode(void)
|
||||
{
|
||||
@@ -46,10 +44,7 @@ sfVideoMode sfVideoMode_GetDesktopMode(void)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get all the supported video modes for fullscreen mode.
|
||||
/// Modes are sorted from best to worst.
|
||||
////////////////////////////////////////////////////////////
|
||||
const sfVideoMode* sfVideoMode_GetFullscreenModes(size_t* Count)
|
||||
const sfVideoMode* sfVideoMode_GetFullscreenModes(size_t* count)
|
||||
{
|
||||
static std::vector<sfVideoMode> modes;
|
||||
|
||||
@@ -67,15 +62,13 @@ const sfVideoMode* sfVideoMode_GetFullscreenModes(size_t* Count)
|
||||
}
|
||||
}
|
||||
|
||||
if (Count)
|
||||
*Count = modes.size();
|
||||
if (count)
|
||||
*count = modes.size();
|
||||
|
||||
return !modes.empty() ? &modes[0] : NULL;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a video mode is supported
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfVideoMode_IsValid(sfVideoMode mode)
|
||||
{
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include <SFML/ConvertEvent.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new window
|
||||
////////////////////////////////////////////////////////////
|
||||
sfWindow* sfWindow_Create(sfVideoMode mode, const char* title, unsigned long style, const sfContextSettings* settings)
|
||||
{
|
||||
@@ -58,8 +56,6 @@ sfWindow* sfWindow_Create(sfVideoMode mode, const char* title, unsigned long sty
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a window from an existing control
|
||||
////////////////////////////////////////////////////////////
|
||||
sfWindow* sfWindow_CreateFromHandle(sfWindowHandle handle, const sfContextSettings* settings)
|
||||
{
|
||||
@@ -82,16 +78,12 @@ sfWindow* sfWindow_CreateFromHandle(sfWindowHandle handle, const sfContextSettin
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing window
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_Destroy(sfWindow* window)
|
||||
{
|
||||
delete window;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Close a window (but doesn't destroy the internal data)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_Close(sfWindow* window)
|
||||
{
|
||||
@@ -99,8 +91,6 @@ void sfWindow_Close(sfWindow* window)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a window is opened
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfWindow_IsOpened(const sfWindow* window)
|
||||
{
|
||||
@@ -108,8 +98,6 @@ sfBool sfWindow_IsOpened(const sfWindow* window)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the width of the rendering region of a window
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfWindow_GetWidth(const sfWindow* window)
|
||||
{
|
||||
@@ -117,8 +105,6 @@ unsigned int sfWindow_GetWidth(const sfWindow* window)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the height of the rendering region of a window
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfWindow_GetHeight(const sfWindow* window)
|
||||
{
|
||||
@@ -126,8 +112,6 @@ unsigned int sfWindow_GetHeight(const sfWindow* window)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the creation settings of a window
|
||||
////////////////////////////////////////////////////////////
|
||||
sfContextSettings sfWindow_GetSettings(const sfWindow* window)
|
||||
{
|
||||
@@ -145,8 +129,6 @@ sfContextSettings sfWindow_GetSettings(const sfWindow* window)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the event on top of events stack of a window, if any, and pop it
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfWindow_PollEvent(sfWindow* window, sfEvent* event)
|
||||
{
|
||||
@@ -168,8 +150,6 @@ sfBool sfWindow_PollEvent(sfWindow* window, sfEvent* event)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Wait for an event and return it
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfWindow_WaitEvent(sfWindow* window, sfEvent* event)
|
||||
{
|
||||
@@ -191,8 +171,6 @@ sfBool sfWindow_WaitEvent(sfWindow* window, sfEvent* event)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable / disable vertical synchronization on a window
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_EnableVerticalSync(sfWindow* window, sfBool enabled)
|
||||
{
|
||||
@@ -200,8 +178,6 @@ void sfWindow_EnableVerticalSync(sfWindow* window, sfBool enabled)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Show or hide the mouse cursor on a window
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_ShowMouseCursor(sfWindow* window, sfBool show)
|
||||
{
|
||||
@@ -209,9 +185,6 @@ void sfWindow_ShowMouseCursor(sfWindow* window, sfBool show)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of a window on screen.
|
||||
/// Only works for top-level windows
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_SetPosition(sfWindow* window, int left, int top)
|
||||
{
|
||||
@@ -219,8 +192,6 @@ void sfWindow_SetPosition(sfWindow* window, int left, int top)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the size of the rendering region of a window
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_SetSize(sfWindow* window, unsigned int width, unsigned int height)
|
||||
{
|
||||
@@ -228,8 +199,6 @@ void sfWindow_SetSize(sfWindow* window, unsigned int width, unsigned int height)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the title of a window
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_SetTitle(sfWindow* window, const char* title)
|
||||
{
|
||||
@@ -237,8 +206,6 @@ void sfWindow_SetTitle(sfWindow* window, const char* title)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Show or hide a window
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_Show(sfWindow* window, sfBool show)
|
||||
{
|
||||
@@ -246,9 +213,6 @@ void sfWindow_Show(sfWindow* window, sfBool show)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable or disable automatic key-repeat for keydown events.
|
||||
/// Automatic key-repeat is enabled by default
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_EnableKeyRepeat(sfWindow* window, sfBool enabled)
|
||||
{
|
||||
@@ -256,8 +220,6 @@ void sfWindow_EnableKeyRepeat(sfWindow* window, sfBool enabled)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the window's icon
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_SetIcon(sfWindow* window, unsigned int width, unsigned int height, const sfUint8* pixels)
|
||||
{
|
||||
@@ -265,8 +227,6 @@ void sfWindow_SetIcon(sfWindow* window, unsigned int width, unsigned int height,
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Activate or deactivate a window as the current target for rendering
|
||||
////////////////////////////////////////////////////////////
|
||||
sfBool sfWindow_SetActive(sfWindow* window, sfBool active)
|
||||
{
|
||||
@@ -274,8 +234,6 @@ sfBool sfWindow_SetActive(sfWindow* window, sfBool active)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Display a window on screen
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_Display(sfWindow* window)
|
||||
{
|
||||
@@ -283,8 +241,6 @@ void sfWindow_Display(sfWindow* window)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Limit the framerate to a maximum fixed frequency for a window
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_SetFramerateLimit(sfWindow* window, unsigned int limit)
|
||||
{
|
||||
@@ -292,8 +248,6 @@ void sfWindow_SetFramerateLimit(sfWindow* window, unsigned int limit)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get time elapsed since last frame of a window
|
||||
////////////////////////////////////////////////////////////
|
||||
sfUint32 sfWindow_GetFrameTime(const sfWindow* window)
|
||||
{
|
||||
@@ -301,9 +255,6 @@ sfUint32 sfWindow_GetFrameTime(const sfWindow* window)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the joystick threshold, ie. the value below which
|
||||
/// no move event will be generated
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_SetJoystickThreshold(sfWindow* window, float threshold)
|
||||
{
|
||||
@@ -311,8 +262,6 @@ void sfWindow_SetJoystickThreshold(sfWindow* window, float threshold)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Retrieve the Os-specific handle of a window
|
||||
////////////////////////////////////////////////////////////
|
||||
sfWindowHandle sfWindow_GetSystemHandle(const sfWindow* window)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user