diff --git a/CSFML/build/VC2008/csfml-audio.vcproj b/CSFML/build/VC2008/csfml-audio.vcproj index 1c1881430..fbf5f0c87 100644 --- a/CSFML/build/VC2008/csfml-audio.vcproj +++ b/CSFML/build/VC2008/csfml-audio.vcproj @@ -215,6 +215,10 @@ RelativePath="..\..\include\SFML\Audio\Music.h" > + + diff --git a/CSFML/build/VC2008/csfml-graphics.vcproj b/CSFML/build/VC2008/csfml-graphics.vcproj index 22bcb1991..7b2ebfab0 100644 --- a/CSFML/build/VC2008/csfml-graphics.vcproj +++ b/CSFML/build/VC2008/csfml-graphics.vcproj @@ -268,6 +268,10 @@ RelativePath="..\..\src\SFML\Graphics\RenderImage.cpp" > + + diff --git a/CSFML/build/VC2008/csfml-main.vcproj b/CSFML/build/VC2008/csfml-main.vcproj index 10e00d701..b996284fe 100644 --- a/CSFML/build/VC2008/csfml-main.vcproj +++ b/CSFML/build/VC2008/csfml-main.vcproj @@ -147,16 +147,10 @@ - - - - + diff --git a/CSFML/include/SFML/Audio/Listener.h b/CSFML/include/SFML/Audio/Listener.h index 601ae5c1a..ffc4cbd1a 100644 --- a/CSFML/include/SFML/Audio/Listener.h +++ b/CSFML/include/SFML/Audio/Listener.h @@ -34,10 +34,10 @@ //////////////////////////////////////////////////////////// /// Change the global volume of all the sounds /// -/// \param Volume : New global volume, in the range [0, 100] +/// \param volume : New global volume, in the range [0, 100] /// //////////////////////////////////////////////////////////// -CSFML_API void sfListener_SetGlobalVolume(float Volume); +CSFML_API void sfListener_SetGlobalVolume(float volume); //////////////////////////////////////////////////////////// /// Get the current value of the global volume of all the sounds @@ -50,44 +50,44 @@ CSFML_API float sfListener_GetGlobalVolume(); //////////////////////////////////////////////////////////// /// Change the position of the listener /// -/// \param PosX : X position of the listener in the world -/// \param PosY : Y position of the listener in the world -/// \param PosZ : Z position of the listener in the world +/// \param x : X position of the listener in the world +/// \param y : Y position of the listener in the world +/// \param z : Z position of the listener in the world /// //////////////////////////////////////////////////////////// -CSFML_API void sfListener_SetPosition(float PosX, float PosY, float PosZ); +CSFML_API void sfListener_SetPosition(float x, float y, float z); //////////////////////////////////////////////////////////// /// Get the current position of the listener /// -/// \param PosX : X position of the listener in the world -/// \param PosY : Y position of the listener in the world -/// \param PosZ : Z position of the listener in the world +/// \param x : X position of the listener in the world +/// \param y : Y position of the listener in the world +/// \param z : Z position of the listener in the world /// //////////////////////////////////////////////////////////// -CSFML_API void sfListener_GetPosition(float* PosX, float* PosY, float* PosZ); +CSFML_API void sfListener_GetPosition(float* x, float* y, float* z); //////////////////////////////////////////////////////////// /// Change the orientation of the listener (the point /// he must look at) /// -/// \param TargetX : X position of the point the listener must look at -/// \param TargetY : X position of the point the listener must look at -/// \param TargetZ : X position of the point the listener must look at +/// \param x : X position of the point the listener must look at +/// \param y : X position of the point the listener must look at +/// \param z : X position of the point the listener must look at /// //////////////////////////////////////////////////////////// -CSFML_API void sfListener_SetTarget(float TargetX, float TargetY, float TargetZ); +CSFML_API void sfListener_SetTarget(float x, float y, float z); //////////////////////////////////////////////////////////// /// Get the current orientation of the listener (the point /// he's looking at) /// -/// \param TargetX : X position of the point the listener is looking at -/// \param TargetY : X position of the point the listener is looking at -/// \param TargetZ : X position of the point the listener is looking at +/// \param x : X position of the point the listener is looking at +/// \param y : X position of the point the listener is looking at +/// \param z : X position of the point the listener is looking at /// //////////////////////////////////////////////////////////// -CSFML_API void sfListener_GetTarget(float* TargetX, float* TargetY, float* TargetZ); +CSFML_API void sfListener_GetTarget(float* x, float* y, float* z); #endif // SFML_LISTENER_H diff --git a/CSFML/include/SFML/Audio/Music.h b/CSFML/include/SFML/Audio/Music.h index cbf72749e..3c8b89cc2 100644 --- a/CSFML/include/SFML/Audio/Music.h +++ b/CSFML/include/SFML/Audio/Music.h @@ -36,257 +36,257 @@ //////////////////////////////////////////////////////////// /// Create a new music and load it from a file /// -/// \param Filename : Path of the music file to open +/// \param filename : Path of the music file to open /// /// \return A new sfMusic object (NULL if failed) /// //////////////////////////////////////////////////////////// -CSFML_API sfMusic* sfMusic_CreateFromFile(const char* Filename); +CSFML_API sfMusic* sfMusic_CreateFromFile(const char* filename); //////////////////////////////////////////////////////////// /// Create a new music and load it from a file in memory /// -/// \param Data : Pointer to the file data in memory -/// \param SizeInBytes : Size of the data to load, in bytes +/// \param data : Pointer to the file data in memory +/// \param sizeInBytes : Size of the data to load, in bytes /// /// \return A new sfMusic object (NULL if failed) /// //////////////////////////////////////////////////////////// -CSFML_API sfMusic* sfMusic_CreateFromMemory(const char* Data, size_t SizeInBytes); +CSFML_API sfMusic* sfMusic_CreateFromMemory(const char* data, size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Destroy an existing music /// -/// \param Music : Music to delete +/// \param music : Music to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfMusic_Destroy(sfMusic* Music); +CSFML_API void sfMusic_Destroy(sfMusic* music); //////////////////////////////////////////////////////////// /// Set a music loop state /// -/// \param Music : Music to set the loop state -/// \param Loop : sfTrue to play in loop, sfFalse to play once +/// \param music : Music to set the loop state +/// \param loop : sfTrue to play in loop, sfFalse to play once /// //////////////////////////////////////////////////////////// -CSFML_API void sfMusic_SetLoop(sfMusic* Music, sfBool Loop); +CSFML_API void sfMusic_SetLoop(sfMusic* music, sfBool loop); //////////////////////////////////////////////////////////// /// Tell whether or not a music is looping /// -/// \param Music : Music to get the loop state from +/// \param music : Music to get the loop state from /// /// \return sfTrue if the music is looping, sfFalse otherwise /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfMusic_GetLoop(sfMusic* Music); +CSFML_API sfBool sfMusic_GetLoop(sfMusic* music); //////////////////////////////////////////////////////////// /// Get a music duration /// -/// \param Music : Music to get the duration from +/// \param music : Music to get the duration from /// /// \return Music duration, in seconds /// //////////////////////////////////////////////////////////// -CSFML_API float sfMusic_GetDuration(sfMusic* Music); +CSFML_API float sfMusic_GetDuration(sfMusic* music); //////////////////////////////////////////////////////////// /// Start playing a music /// -/// \param Music : Music to play +/// \param music : Music to play /// //////////////////////////////////////////////////////////// -CSFML_API void sfMusic_Play(sfMusic* Music); +CSFML_API void sfMusic_Play(sfMusic* music); //////////////////////////////////////////////////////////// /// Pause a music /// -/// \param Music : Music to pause +/// \param music : Music to pause /// //////////////////////////////////////////////////////////// -CSFML_API void sfMusic_Pause(sfMusic* Music); +CSFML_API void sfMusic_Pause(sfMusic* music); //////////////////////////////////////////////////////////// /// Stop playing a music /// -/// \param Music : Music to stop +/// \param music : Music to stop /// //////////////////////////////////////////////////////////// -CSFML_API void sfMusic_Stop(sfMusic* Music); +CSFML_API void sfMusic_Stop(sfMusic* music); //////////////////////////////////////////////////////////// /// Return the number of channels of a music (1 = mono, 2 = stereo) /// -/// \param Music : Music to get the channels count from +/// \param music : Music to get the channels count from /// /// \return Number of channels /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfMusic_GetChannelsCount(sfMusic* Music); +CSFML_API unsigned int sfMusic_GetChannelsCount(sfMusic* music); //////////////////////////////////////////////////////////// /// Get the stream sample rate of a music /// -/// \param Music : Music to get the sample rate from +/// \param music : Music to get the sample rate from /// /// \return Stream frequency (number of samples per second) /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfMusic_GetSampleRate(sfMusic* Music); +CSFML_API unsigned int sfMusic_GetSampleRate(sfMusic* music); //////////////////////////////////////////////////////////// /// Get the status of a music (stopped, paused, playing) /// -/// \param Music : Music to get the status from +/// \param music : Music to get the status from /// /// \return Current status of the sound /// //////////////////////////////////////////////////////////// -CSFML_API sfSoundStatus sfMusic_GetStatus(sfMusic* Music); +CSFML_API sfSoundStatus sfMusic_GetStatus(sfMusic* music); //////////////////////////////////////////////////////////// /// Get the current playing position of a music /// -/// \param Music : Music to get the position from +/// \param music : Music to get the position from /// /// \return Current playing position, expressed in seconds /// //////////////////////////////////////////////////////////// -CSFML_API float sfMusic_GetPlayingOffset(sfMusic* Music); +CSFML_API float sfMusic_GetPlayingOffset(sfMusic* music); //////////////////////////////////////////////////////////// /// Set the pitch of a music /// -/// \param Music : Music to modify -/// \param Pitch : New pitch +/// \param music : Music to modify +/// \param pitch : New pitch /// //////////////////////////////////////////////////////////// -CSFML_API void sfMusic_SetPitch(sfMusic* Music, float Pitch); +CSFML_API void sfMusic_SetPitch(sfMusic* music, float pitch); //////////////////////////////////////////////////////////// /// Set the volume of a music /// -/// \param Music : Music to modify -/// \param Volume : Volume (in range [0, 100]) +/// \param music : Music to modify +/// \param volume : Volume (in range [0, 100]) /// //////////////////////////////////////////////////////////// -CSFML_API void sfMusic_SetVolume(sfMusic* Music, float Volume); +CSFML_API void sfMusic_SetVolume(sfMusic* music, float volume); //////////////////////////////////////////////////////////// /// Set the position of a music /// -/// \param Music : Music to modify -/// \param X : X position of the sound in the world -/// \param Y : Y position of the sound in the world -/// \param Z : Z position of the sound in the world +/// \param music : Music to modify +/// \param x : X position of the sound in the world +/// \param y : Y position of the sound in the world +/// \param z : Z position of the sound in the world /// //////////////////////////////////////////////////////////// -CSFML_API void sfMusic_SetPosition(sfMusic* Music, float X, float Y, float Z); +CSFML_API 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) /// -/// \param Music : Music to modify -/// \param Relative : True to set the position relative, false to set it absolute +/// \param music : Music to modify +/// \param relative : True to set the position relative, false to set it absolute /// //////////////////////////////////////////////////////////// -CSFML_API void sfMusic_SetRelativeToListener(sfMusic* Music, sfBool Relative); +CSFML_API 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 /// -/// \param Music : Music to modify -/// \param MinDistance : New minimum distance for the music +/// \param music : Music to modify +/// \param distance : New minimum distance for the music /// //////////////////////////////////////////////////////////// -CSFML_API void sfMusic_SetMinDistance(sfMusic* Music, float MinDistance); +CSFML_API 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 /// -/// \param Music : Music to modify -/// \param Attenuation : New attenuation factor for the sound +/// \param music : Music to modify +/// \param attenuation : New attenuation factor for the sound /// //////////////////////////////////////////////////////////// -CSFML_API void sfMusic_SetAttenuation(sfMusic* Music, float Attenuation); +CSFML_API void sfMusic_SetAttenuation(sfMusic* music, float attenuation); //////////////////////////////////////////////////////////// /// Set the current playing position of a music /// -/// \param Music : Music to modify -/// \param TimeOffset : New playing position, expressed in seconds +/// \param music : Music to modify +/// \param timeOffset : New playing position, expressed in seconds /// //////////////////////////////////////////////////////////// -CSFML_API void sfMusic_SetPlayingOffset(sfMusic* Music, float TimeOffset); +CSFML_API void sfMusic_SetPlayingOffset(sfMusic* music, float timeOffset); //////////////////////////////////////////////////////////// /// Get the pitch of a music /// -/// \param Music : Music to get the pitch from +/// \param music : Music to get the pitch from /// /// \return Pitch value /// //////////////////////////////////////////////////////////// -CSFML_API float sfMusic_GetPitch(sfMusic* Music); +CSFML_API float sfMusic_GetPitch(sfMusic* music); //////////////////////////////////////////////////////////// /// Get the volume of a music /// -/// \param Music : Music to get the volume from +/// \param music : Music to get the volume from /// /// \return Volume value (in range [1, 100]) /// //////////////////////////////////////////////////////////// -CSFML_API float sfMusic_GetVolume(sfMusic* Music); +CSFML_API float sfMusic_GetVolume(sfMusic* music); //////////////////////////////////////////////////////////// /// Get the position of a music /// -/// \param Music : Music to get the position from -/// \param X : X position of the sound in the world -/// \param Y : Y position of the sound in the world -/// \param Z : Z position of the sound in the world +/// \param music : Music to get the position from +/// \param x : X position of the sound in the world +/// \param y : Y position of the sound in the world +/// \param z : Z position of the sound in the world /// //////////////////////////////////////////////////////////// -CSFML_API void sfMusic_GetPosition(sfMusic* Music, float* X, float* Y, float* Z); +CSFML_API void sfMusic_GetPosition(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 /// -/// \param Music : Music to check +/// \param music : Music to check /// /// \return sfTrue if the position is relative, sfFalse if it's absolute /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfMusic_IsRelativeToListener(sfMusic* Music); +CSFML_API sfBool sfMusic_IsRelativeToListener(sfMusic* music); //////////////////////////////////////////////////////////// /// Get the minimum distance of a music /// -/// \param Music : Music to get the minimum distance from +/// \param music : Music to get the minimum distance from /// /// \return Minimum distance for the music /// //////////////////////////////////////////////////////////// -CSFML_API float sfMusic_GetMinDistance(sfMusic* Music); +CSFML_API float sfMusic_GetMinDistance(sfMusic* music); //////////////////////////////////////////////////////////// /// Get the attenuation factor of a music /// -/// \param Music : Music to get the attenuation factor from +/// \param music : Music to get the attenuation factor from /// /// \return Attenuation factor for the a music /// //////////////////////////////////////////////////////////// -CSFML_API float sfMusic_GetAttenuation(sfMusic* Music); +CSFML_API float sfMusic_GetAttenuation(sfMusic* music); #endif // SFML_MUSIC_H diff --git a/CSFML/include/SFML/Audio/Sound.h b/CSFML/include/SFML/Audio/Sound.h index 9afe95061..9e987c942 100644 --- a/CSFML/include/SFML/Audio/Sound.h +++ b/CSFML/include/SFML/Audio/Sound.h @@ -44,225 +44,225 @@ CSFML_API sfSound* sfSound_Create(); //////////////////////////////////////////////////////////// /// Destroy an existing sound /// -/// \param Sound : Sound to delete +/// \param sound : Sound to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfSound_Destroy(sfSound* Sound); +CSFML_API void sfSound_Destroy(sfSound* sound); //////////////////////////////////////////////////////////// /// Start playing a sound /// -/// \param Sound : Sound to play +/// \param sound : Sound to play /// //////////////////////////////////////////////////////////// -CSFML_API void sfSound_Play(sfSound* Sound); +CSFML_API void sfSound_Play(sfSound* sound); //////////////////////////////////////////////////////////// /// Pause a sound /// -/// \param Sound : Sound to pause +/// \param sound : Sound to pause /// //////////////////////////////////////////////////////////// -CSFML_API void sfSound_Pause(sfSound* Sound); +CSFML_API void sfSound_Pause(sfSound* sound); //////////////////////////////////////////////////////////// /// Stop playing a sound /// -/// \param Sound : Sound to stop +/// \param sound : Sound to stop /// //////////////////////////////////////////////////////////// -CSFML_API void sfSound_Stop(sfSound* Sound); +CSFML_API void sfSound_Stop(sfSound* sound); //////////////////////////////////////////////////////////// /// Bind a sound buffer to a sound /// -/// \param Sound : Sound to set the loop state -/// \param Buffer : Buffer to bind +/// \param sound : Sound to set the loop state +/// \param buffer : Buffer to bind /// //////////////////////////////////////////////////////////// -CSFML_API void sfSound_SetBuffer(sfSound* Sound, sfSoundBuffer* Buffer); +CSFML_API void sfSound_SetBuffer(sfSound* sound, sfSoundBuffer* buffer); //////////////////////////////////////////////////////////// /// Get the sound buffer bound to a sound /// -/// \param Sound : Sound to get the buffer from +/// \param sound : Sound to get the buffer from /// /// \return Pointer to the sound's buffer /// //////////////////////////////////////////////////////////// -CSFML_API sfSoundBuffer* sfSound_GetBuffer(sfSound* Sound); +CSFML_API sfSoundBuffer* sfSound_GetBuffer(sfSound* sound); //////////////////////////////////////////////////////////// /// Set a sound loop state /// -/// \param Sound : Sound to set the loop state -/// \param Loop : sfTrue to play in loop, sfFalse to play once +/// \param sound : Sound to set the loop state +/// \param loop : sfTrue to play in loop, sfFalse to play once /// //////////////////////////////////////////////////////////// -CSFML_API void sfSound_SetLoop(sfSound* Sound, sfBool Loop); +CSFML_API void sfSound_SetLoop(sfSound* sound, sfBool loop); //////////////////////////////////////////////////////////// /// Tell whether or not a sound is looping /// -/// \param Sound : Sound to get the loop state from +/// \param sound : Sound to get the loop state from /// /// \return sfTrue if the sound is looping, sfFalse otherwise /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfSound_GetLoop(sfSound* Sound); +CSFML_API sfBool sfSound_GetLoop(sfSound* sound); //////////////////////////////////////////////////////////// /// Get the status of a sound (stopped, paused, playing) /// -/// \param Sound : Sound to get the status from +/// \param sound : Sound to get the status from /// /// \return Current status of the sound /// //////////////////////////////////////////////////////////// -CSFML_API sfSoundStatus sfSound_GetStatus(sfSound* Sound); +CSFML_API sfSoundStatus sfSound_GetStatus(sfSound* sound); //////////////////////////////////////////////////////////// /// Set the pitch of a sound /// -/// \param Sound : Sound to modify -/// \param Pitch : New pitch +/// \param sound : Sound to modify +/// \param pitch : New pitch /// //////////////////////////////////////////////////////////// -CSFML_API void sfSound_SetPitch(sfSound* Sound, float Pitch); +CSFML_API void sfSound_SetPitch(sfSound* sound, float pitch); //////////////////////////////////////////////////////////// /// Set the volume of a sound /// -/// \param Sound : Sound to modify -/// \param Volume : Volume (in range [0, 100]) +/// \param sound : Sound to modify +/// \param volume : Volume (in range [0, 100]) /// //////////////////////////////////////////////////////////// -CSFML_API void sfSound_SetVolume(sfSound* Sound, float Volume); +CSFML_API void sfSound_SetVolume(sfSound* sound, float volume); //////////////////////////////////////////////////////////// /// Set the position of a sound /// -/// \param Sound : Sound to modify -/// \param X : X position of the sound in the world -/// \param Y : Y position of the sound in the world -/// \param Z : Z position of the sound in the world +/// \param sound : Sound to modify +/// \param x : X position of the sound in the world +/// \param y : Y position of the sound in the world +/// \param z : Z position of the sound in the world /// //////////////////////////////////////////////////////////// -CSFML_API void sfSound_SetPosition(sfSound* Sound, float X, float Y, float Z); +CSFML_API 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) /// -/// \param Sound : Sound to modify -/// \param Relative : True to set the position relative, false to set it absolute +/// \param sound : Sound to modify +/// \param relative : True to set the position relative, false to set it absolute /// //////////////////////////////////////////////////////////// -CSFML_API void sfSound_SetRelativeToListener(sfSound* Sound, sfBool Relative); +CSFML_API 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 /// -/// \param Sound : Sound to modify -/// \param MinDistance : New minimum distance for the sound +/// \param sound : Sound to modify +/// \param distance : New minimum distance for the sound /// //////////////////////////////////////////////////////////// -CSFML_API void sfSound_SetMinDistance(sfSound* Sound, float MinDistance); +CSFML_API 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 /// -/// \param Sound : Sound to modify -/// \param Attenuation : New attenuation factor for the sound +/// \param sound : Sound to modify +/// \param attenuation : New attenuation factor for the sound /// //////////////////////////////////////////////////////////// -CSFML_API void sfSound_SetAttenuation(sfSound* Sound, float Attenuation); +CSFML_API void sfSound_SetAttenuation(sfSound* sound, float attenuation); //////////////////////////////////////////////////////////// /// Set the current playing position of a sound /// -/// \param Sound : Sound to modify -/// \param TimeOffset : New playing position, expressed in seconds +/// \param sound : Sound to modify +/// \param timeOffset : New playing position, expressed in seconds /// //////////////////////////////////////////////////////////// -CSFML_API void sfSound_SetPlayingOffset(sfSound* Sound, float TimeOffset); +CSFML_API void sfSound_SetPlayingOffset(sfSound* sound, float timeOffset); //////////////////////////////////////////////////////////// /// Get the pitch of a sound /// -/// \param Sound : Sound to get the pitch from +/// \param sound : Sound to get the pitch from /// /// \return Pitch value /// //////////////////////////////////////////////////////////// -CSFML_API float sfSound_GetPitch(sfSound* Sound); +CSFML_API float sfSound_GetPitch(sfSound* sound); //////////////////////////////////////////////////////////// /// Get the volume of a sound /// -/// \param Sound : Sound to get the volume from +/// \param sound : Sound to get the volume from /// /// \return Volume value (in range [1, 100]) /// //////////////////////////////////////////////////////////// -CSFML_API float sfSound_GetVolume(sfSound* Sound); +CSFML_API float sfSound_GetVolume(sfSound* sound); //////////////////////////////////////////////////////////// /// Get the position of a sound /// -/// \param Sound : Sound to get the position from -/// \param X : X position of the sound in the world -/// \param Y : Y position of the sound in the world -/// \param Z : Z position of the sound in the world +/// \param sound : Sound to get the position from +/// \param x : X position of the sound in the world +/// \param y : Y position of the sound in the world +/// \param z : Z position of the sound in the world /// //////////////////////////////////////////////////////////// -CSFML_API void sfSound_GetPosition(sfSound* Sound, float* X, float* Y, float* Z); +CSFML_API void sfSound_GetPosition(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 /// -/// \param Sound : Sound to check +/// \param sound : Sound to check /// /// \return sfTrue if the position is relative, sfFalse if it's absolute /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfSound_IsRelativeToListener(sfSound* Sound); +CSFML_API sfBool sfSound_IsRelativeToListener(sfSound* sound); //////////////////////////////////////////////////////////// /// Get the minimum distance of a sound /// -/// \param Sound : Sound to get the minimum distance from +/// \param sound : Sound to get the minimum distance from /// /// \return Minimum distance for the sound /// //////////////////////////////////////////////////////////// -CSFML_API float sfSound_GetMinDistance(sfSound* Sound); +CSFML_API float sfSound_GetMinDistance(sfSound* sound); //////////////////////////////////////////////////////////// /// Get the attenuation factor of a sound /// -/// \param Sound : Sound to get the attenuation factor from +/// \param sound : Sound to get the attenuation factor from /// /// \return Attenuation factor for the sound /// //////////////////////////////////////////////////////////// -CSFML_API float sfSound_GetAttenuation(sfSound* Sound); +CSFML_API float sfSound_GetAttenuation(sfSound* sound); //////////////////////////////////////////////////////////// /// Get the current playing position of a sound /// -/// \param Sound : Sound to get the position from +/// \param sound : Sound to get the position from /// /// \return Current playing position, expressed in seconds /// //////////////////////////////////////////////////////////// -CSFML_API float sfSound_GetPlayingOffset(sfSound* Sound); +CSFML_API float sfSound_GetPlayingOffset(sfSound* sound); #endif // SFML_SOUND_H diff --git a/CSFML/include/SFML/Audio/SoundBuffer.h b/CSFML/include/SFML/Audio/SoundBuffer.h index 2112b3072..a0ff4ad12 100644 --- a/CSFML/include/SFML/Audio/SoundBuffer.h +++ b/CSFML/include/SFML/Audio/SoundBuffer.h @@ -35,107 +35,107 @@ //////////////////////////////////////////////////////////// /// Create a new sound buffer and load it from a file /// -/// \param Filename : Path of the music file to open +/// \param filename : Path of the music file to open /// /// \return A new sfSoundBuffer object (NULL if failed) /// //////////////////////////////////////////////////////////// -CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromFile(const char* Filename); +CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromFile(const char* filename); //////////////////////////////////////////////////////////// /// Create a new sound buffer and load it from a file in memory /// -/// \param Data : Pointer to the file data in memory -/// \param SizeInBytes : Size of the data to load, in bytes +/// \param data : Pointer to the file data in memory +/// \param sizeInBytes : Size of the data to load, in bytes /// /// \return A new sfSoundBuffer object (NULL if failed) /// //////////////////////////////////////////////////////////// -CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const char* Data, size_t SizeInBytes); +CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const char* data, size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Create a new sound buffer and load it from an array of /// samples in memory - assumed format for samples is /// 16 bits signed integer /// -/// \param Samples : Pointer to the samples in memory -/// \param SamplesCount : Number of samples pointed by Samples -/// \param ChannelsCount : Number of channels (1 = mono, 2 = stereo, ...) -/// \param SampleRate : Frequency (number of samples to play per second) +/// \param samples : Pointer to the samples in memory +/// \param samplesCount : Number of samples pointed by Samples +/// \param channelsCount : Number of channels (1 = mono, 2 = stereo, ...) +/// \param sampleRate : Frequency (number of samples to play per second) /// /// \return A new sfSoundBuffer object (NULL if failed) /// //////////////////////////////////////////////////////////// -CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromSamples(const sfInt16* Samples, size_t SamplesCount, unsigned int ChannelsCount, unsigned int SampleRate); +CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromSamples(const sfInt16* samples, size_t samplesCount, unsigned int channelsCount, unsigned int sampleRate); //////////////////////////////////////////////////////////// /// Destroy an existing sound buffer /// -/// \param SoundBuffer : Sound buffer to delete +/// \param soundBuffer : Sound buffer to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundBuffer_Destroy(sfSoundBuffer* SoundBuffer); +CSFML_API void sfSoundBuffer_Destroy(sfSoundBuffer* soundBuffer); //////////////////////////////////////////////////////////// /// Save a sound buffer to a file /// -/// \param SoundBuffer : Sound buffer to save -/// \param Filename : Path of the sound file to write +/// \param soundBuffer : Sound buffer to save +/// \param filename : Path of the sound file to write /// /// \return sfTrue if saving has been successful /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfSoundBuffer_SaveToFile(sfSoundBuffer* SoundBuffer, const char* Filename); +CSFML_API sfBool sfSoundBuffer_SaveToFile(sfSoundBuffer* soundBuffer, const char* filename); //////////////////////////////////////////////////////////// /// Return the samples contained in a sound buffer /// -/// \param SoundBuffer : Sound buffer to get samples from +/// \param soundBuffer : Sound buffer to get samples from /// /// \return Pointer to the array of sound samples, in 16 bits signed integer format /// //////////////////////////////////////////////////////////// -CSFML_API const sfInt16* sfSoundBuffer_GetSamples(sfSoundBuffer* SoundBuffer); +CSFML_API const sfInt16* sfSoundBuffer_GetSamples(sfSoundBuffer* soundBuffer); //////////////////////////////////////////////////////////// /// Return the number of samples contained in a sound buffer /// -/// \param SoundBuffer : Sound buffer to get samples count from +/// \param soundBuffer : Sound buffer to get samples count from /// /// \return Number of samples /// //////////////////////////////////////////////////////////// -CSFML_API size_t sfSoundBuffer_GetSamplesCount(sfSoundBuffer* SoundBuffer); +CSFML_API size_t sfSoundBuffer_GetSamplesCount(sfSoundBuffer* soundBuffer); //////////////////////////////////////////////////////////// /// Get the sample rate of a sound buffer /// -/// \param SoundBuffer : Sound buffer to get sample rate from +/// \param soundBuffer : Sound buffer to get sample rate from /// /// \return Sound frequency (number of samples per second) /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfSoundBuffer_GetSampleRate(sfSoundBuffer* SoundBuffer); +CSFML_API unsigned int sfSoundBuffer_GetSampleRate(sfSoundBuffer* soundBuffer); //////////////////////////////////////////////////////////// /// Return the number of channels of a sound buffer (1 = mono, 2 = stereo, ...) /// -/// \param SoundBuffer : Sound buffer to get channels count from +/// \param soundBuffer : Sound buffer to get channels count from /// /// \return Number of channels /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfSoundBuffer_GetChannelsCount(sfSoundBuffer* SoundBuffer); +CSFML_API unsigned int sfSoundBuffer_GetChannelsCount(sfSoundBuffer* soundBuffer); //////////////////////////////////////////////////////////// /// Get the duration of a sound buffer /// -/// \param SoundBuffer : Sound buffer to get duration from +/// \param soundBuffer : Sound buffer to get duration from /// /// \return Sound duration, in seconds /// //////////////////////////////////////////////////////////// -CSFML_API float sfSoundBuffer_GetDuration(sfSoundBuffer* SoundBuffer); +CSFML_API float sfSoundBuffer_GetDuration(sfSoundBuffer* soundBuffer); #endif // SFML_SOUNDBUFFER_H diff --git a/CSFML/include/SFML/Audio/SoundBufferRecorder.h b/CSFML/include/SFML/Audio/SoundBufferRecorder.h index 3741e01e4..7caf3de28 100644 --- a/CSFML/include/SFML/Audio/SoundBufferRecorder.h +++ b/CSFML/include/SFML/Audio/SoundBufferRecorder.h @@ -43,49 +43,49 @@ CSFML_API sfSoundBufferRecorder* sfSoundBufferRecorder_Create(); //////////////////////////////////////////////////////////// /// Destroy an existing sound buffer recorder /// -/// \param SoundBufferRecorder : Sound buffer recorder to delete +/// \param soundBufferRecorder : Sound buffer recorder to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundBufferRecorder_Destroy(sfSoundBufferRecorder* SoundBufferRecorder); +CSFML_API void sfSoundBufferRecorder_Destroy(sfSoundBufferRecorder* soundBufferRecorder); //////////////////////////////////////////////////////////// /// Start the capture. /// Warning : only one capture can happen at the same time /// -/// \param SoundBufferRecorder : Sound bufferrecorder to start -/// \param SampleRate : Sound frequency (the more samples, the higher the quality) +/// \param soundBufferRecorder : Sound buffer recorder to start +/// \param sampleRate : Sound frequency (the more samples, the higher the quality) /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundBufferRecorder_Start(sfSoundBufferRecorder* SoundBufferRecorder, unsigned int SampleRate); +CSFML_API void sfSoundBufferRecorder_Start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate); //////////////////////////////////////////////////////////// /// Stop the capture /// -/// \param SoundBufferRecorder : Sound buffer recorder to stop +/// \param soundBufferRecorder : Sound buffer recorder to stop /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundBufferRecorder_Stop(sfSoundBufferRecorder* SoundBufferRecorder); +CSFML_API void sfSoundBufferRecorder_Stop(sfSoundBufferRecorder* soundBufferRecorder); //////////////////////////////////////////////////////////// /// Get the sample rate of a sound buffer recorder /// -/// \param SoundBufferRecorder : Sound buffer recorder to get sample rate from +/// \param soundBufferRecorder : Sound buffer recorder to get sample rate from /// /// \return Frequency, in samples per second /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfSoundBufferRecorder_GetSampleRate(sfSoundBufferRecorder* SoundBufferRecorder); +CSFML_API unsigned int sfSoundBufferRecorder_GetSampleRate(sfSoundBufferRecorder* soundBufferRecorder); //////////////////////////////////////////////////////////// /// Get the sound buffer containing the captured audio data /// of a sound buffer recorder /// -/// \param SoundBufferRecorder : Sound buffer recorder to get the sound buffer from +/// \param soundBufferRecorder : Sound buffer recorder to get the sound buffer from /// /// \return Pointer to the sound buffer (you don't need to destroy it after use) /// //////////////////////////////////////////////////////////// -CSFML_API sfSoundBuffer* sfSoundBufferRecorder_GetBuffer(sfSoundBufferRecorder* SoundBufferRecorder); +CSFML_API sfSoundBuffer* sfSoundBufferRecorder_GetBuffer(sfSoundBufferRecorder* soundBufferRecorder); #endif // SFML_SOUNDBUFFERRECORDER_H diff --git a/CSFML/include/SFML/Audio/SoundRecorder.h b/CSFML/include/SFML/Audio/SoundRecorder.h index f93630d80..0872037db 100644 --- a/CSFML/include/SFML/Audio/SoundRecorder.h +++ b/CSFML/include/SFML/Audio/SoundRecorder.h @@ -41,54 +41,54 @@ typedef void (*sfSoundRecorderStopCallback)(void*); /// Construct a new sound recorder with callback functions /// for processing captured samples /// -/// \param OnStart : Callback function which will be called when a new capture starts (can be NULL) -/// \param OnProcess : Callback function which will be called each time there's audio data to process -/// \param OnStop : Callback function which will be called when the current capture stops (can be NULL) -/// \param UserData : Data to pass to the callback function (can be NULL) +/// \param onStart : Callback function which will be called when a new capture starts (can be NULL) +/// \param onProcess : Callback function which will be called each time there's audio data to process +/// \param onStop : Callback function which will be called when the current capture stops (can be NULL) +/// \param userData : Data to pass to the callback function (can be NULL) /// /// \return A new sfSoundRecorder object (NULL if failed) /// //////////////////////////////////////////////////////////// -CSFML_API sfSoundRecorder* sfSoundRecorder_Create(sfSoundRecorderStartCallback OnStart, - sfSoundRecorderProcessCallback OnProcess, - sfSoundRecorderStopCallback OnStop, - void* UserData); +CSFML_API sfSoundRecorder* sfSoundRecorder_Create(sfSoundRecorderStartCallback onStart, + sfSoundRecorderProcessCallback onProcess, + sfSoundRecorderStopCallback onStop, + void* userData); //////////////////////////////////////////////////////////// /// Destroy an existing sound recorder /// -/// \param SoundRecorder : Sound recorder to delete +/// \param soundRecorder : Sound recorder to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundRecorder_Destroy(sfSoundRecorder* SoundRecorder); +CSFML_API void sfSoundRecorder_Destroy(sfSoundRecorder* soundRecorder); //////////////////////////////////////////////////////////// /// Start the capture. /// Warning : only one capture can happen at the same time /// -/// \param SoundRecorder : Sound recorder to start -/// \param SampleRate : Sound frequency (the more samples, the higher the quality) +/// \param soundRecorder : Sound recorder to start +/// \param sampleRate : Sound frequency (the more samples, the higher the quality) /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundRecorder_Start(sfSoundRecorder* SoundRecorder, unsigned int SampleRate); +CSFML_API void sfSoundRecorder_Start(sfSoundRecorder* soundRecorder, unsigned int sampleRate); //////////////////////////////////////////////////////////// /// Stop the capture /// -/// \param SoundRecorder : Sound recorder to stop +/// \param soundRecorder : Sound recorder to stop /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundRecorder_Stop(sfSoundRecorder* SoundRecorder); +CSFML_API void sfSoundRecorder_Stop(sfSoundRecorder* soundRecorder); //////////////////////////////////////////////////////////// /// Get the sample rate of a sound recorder /// -/// \param SoundRecorder : Sound recorder to get sample rate from +/// \param soundRecorder : Sound recorder to get sample rate from /// /// \return Frequency, in samples per second /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfSoundRecorder_GetSampleRate(sfSoundRecorder* SoundRecorder); +CSFML_API unsigned int sfSoundRecorder_GetSampleRate(sfSoundRecorder* soundRecorder); //////////////////////////////////////////////////////////// /// Tell if the system supports sound capture. diff --git a/CSFML/include/SFML/Audio/SoundStream.h b/CSFML/include/SFML/Audio/SoundStream.h index cd0ac2a2f..6326d2eec 100644 --- a/CSFML/include/SFML/Audio/SoundStream.h +++ b/CSFML/include/SFML/Audio/SoundStream.h @@ -50,245 +50,245 @@ typedef void (*sfSoundStreamSeekCallback)(float, void*); ///< //////////////////////////////////////////////////////////// /// Construct a new sound stream /// -/// \param OnGetData : Function called when the stream needs more data (can't be NULL) -/// \param OnSeek : Function called when the stream seeks (can't be NULL) -/// \param ChannelsCount : Number of channels to use (1 = mono, 2 = stereo) -/// \param SampleRate : Sample rate of the sound (44100 = CD quality) -/// \param UserData : Data to pass to the callback functions +/// \param onGetData : Function called when the stream needs more data (can't be NULL) +/// \param onSeek : Function called when the stream seeks (can't be NULL) +/// \param channelsCount : Number of channels to use (1 = mono, 2 = stereo) +/// \param sampleRate : Sample rate of the sound (44100 = CD quality) +/// \param userData : Data to pass to the callback functions /// /// \return A new sfSoundStream object (NULL if failed) /// //////////////////////////////////////////////////////////// -CSFML_API sfSoundStream* sfSoundStream_Create(sfSoundStreamGetDataCallback OnGetData, - sfSoundStreamSeekCallback OnSeek, - unsigned int ChannelsCount, - unsigned int SampleRate, - void* UserData); +CSFML_API sfSoundStream* sfSoundStream_Create(sfSoundStreamGetDataCallback onGetData, + sfSoundStreamSeekCallback onSeek, + unsigned int channelsCount, + unsigned int sampleRate, + void* userData); //////////////////////////////////////////////////////////// /// Destroy an existing sound stream /// -/// \param SoundStream : Sound stream to delete +/// \param soundStream : Sound stream to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundStream_Destroy(sfSoundStream* SoundStreamStream); +CSFML_API void sfSoundStream_Destroy(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// Start playing a sound stream /// -/// \param SoundStream : Sound stream to play +/// \param soundStream : Sound stream to play /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundStream_Play(sfSoundStream* SoundStream); +CSFML_API void sfSoundStream_Play(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// Pause a sound stream /// -/// \param SoundStream : Sound stream to pause +/// \param soundStream : Sound stream to pause /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundStream_Pause(sfSoundStream* SoundStream); +CSFML_API void sfSoundStream_Pause(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// Stop playing a sound stream /// -/// \param SoundStream : Sound stream to stop +/// \param soundStream : Sound stream to stop /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundStream_Stop(sfSoundStream* SoundStream); +CSFML_API void sfSoundStream_Stop(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// Get the status of a sound stream (stopped, paused, playing) /// -/// \param SoundStream : Sound stream to get the status from +/// \param soundStream : Sound stream to get the status from /// /// \return Current status of the sound stream /// //////////////////////////////////////////////////////////// -CSFML_API sfSoundStatus sfSoundStream_GetStatus(sfSoundStream* SoundStream); +CSFML_API sfSoundStatus sfSoundStream_GetStatus(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// Return the number of channels of a sound stream /// (1 = mono, 2 = stereo) /// -/// \param SoundStream : Sound stream to get the channels count from +/// \param soundStream : Sound stream to get the channels count from /// /// \return Number of channels /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfSoundStream_GetChannelsCount(sfSoundStream* SoundStream); +CSFML_API unsigned int sfSoundStream_GetChannelsCount(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// Get the sample rate of a sound stream /// -/// \param SoundStream : Sound stream to get the sample rate from +/// \param soundStream : Sound stream to get the sample rate from /// /// \return Stream frequency (number of samples per second) /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfSoundStream_GetSampleRate(sfSoundStream* SoundStream); +CSFML_API unsigned int sfSoundStream_GetSampleRate(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// Set the pitch of a sound stream /// -/// \param SoundStream : Sound stream to modify -/// \param Pitch : New pitch +/// \param soundStream : Sound stream to modify +/// \param pitch : New pitch /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundStream_SetPitch(sfSoundStream* SoundStream, float Pitch); +CSFML_API void sfSoundStream_SetPitch(sfSoundStream* soundStream, float pitch); //////////////////////////////////////////////////////////// /// Set the volume of a sound stream /// -/// \param SoundStream : Sound stream to modify -/// \param Volume : Volume (in range [0, 100]) +/// \param soundStream : Sound stream to modify +/// \param volume : Volume (in range [0, 100]) /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundStream_SetVolume(sfSoundStream* SoundStream, float Volume); +CSFML_API void sfSoundStream_SetVolume(sfSoundStream* soundStream, float volume); //////////////////////////////////////////////////////////// /// Set the position of a sound stream /// -/// \param SoundStream : Sound stream to modify -/// \param X : X position of the sound stream in the world -/// \param Y : Y position of the sound stream in the world -/// \param Z : Z position of the sound stream in the world +/// \param soundStream : Sound stream to modify +/// \param x : X position of the sound stream in the world +/// \param y : Y position of the sound stream in the world +/// \param z : Z position of the sound stream in the world /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundStream_SetPosition(sfSoundStream* SoundStream, float X, float Y, float Z); +CSFML_API void sfSoundStream_SetPosition(sfSoundStream* soundStream, float x, float y, float z); //////////////////////////////////////////////////////////// /// Make the sound stream's position relative to the listener's /// position, or absolute. /// The default value is false (absolute) /// -/// \param SoundStream : Sound stream to modify -/// \param Relative : True to set the position relative, false to set it absolute +/// \param soundStream : Sound stream to modify +/// \param relative : True to set the position relative, false to set it absolute /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundStream_SetRelativeToListener(sfSoundStream* SoundStream, sfBool Relative); +CSFML_API void sfSoundStream_SetRelativeToListener(sfSoundStream* soundStream, sfBool relative); //////////////////////////////////////////////////////////// /// 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 /// -/// \param SoundStream : Sound stream to modify -/// \param MinDistance : New minimum distance for the sound stream +/// \param soundStream : Sound stream to modify +/// \param distance : New minimum distance for the sound stream /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundStream_SetMinDistance(sfSoundStream* SoundStream, float MinDistance); +CSFML_API 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 /// -/// \param SoundStream : Sound stream to modify -/// \param Attenuation : New attenuation factor for the sound stream +/// \param soundStream : Sound stream to modify +/// \param attenuation : New attenuation factor for the sound stream /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundStream_SetAttenuation(sfSoundStream* SoundStream, float Attenuation); +CSFML_API void sfSoundStream_SetAttenuation(sfSoundStream* soundStream, float attenuation); //////////////////////////////////////////////////////////// /// Set the current playing position of a stream /// -/// \param SoundStream : Sound stream to modify -/// \param TimeOffset : New playing position, expressed in seconds +/// \param soundStream : Sound stream to modify +/// \param timeOffset : New playing position, expressed in seconds /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundStream_SetPlayingOffset(sfSoundStream* SoundStream, float TimeOffset); +CSFML_API void sfSoundStream_SetPlayingOffset(sfSoundStream* soundStream, float timeOffset); //////////////////////////////////////////////////////////// /// Set a stream loop state /// -/// \param SoundStream : Stream to set the loop state -/// \param Loop : sfTrue to play in loop, sfFalse to play once +/// \param soundStream : Stream to set the loop state +/// \param loop : sfTrue to play in loop, sfFalse to play once /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundStream_SetLoop(sfSoundStream* SoundStream, sfBool Loop); +CSFML_API void sfSoundStream_SetLoop(sfSoundStream* soundStream, sfBool loop); //////////////////////////////////////////////////////////// /// Get the pitch of a sound stream /// -/// \param SoundStream : Sound stream to get the pitch from +/// \param soundStream : Sound stream to get the pitch from /// /// \return Pitch value /// //////////////////////////////////////////////////////////// -CSFML_API float sfSoundStream_GetPitch(sfSoundStream* SoundStream); +CSFML_API float sfSoundStream_GetPitch(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// Get the volume of a sound stream /// -/// \param SoundStream : Sound stream to get the volume from +/// \param soundStream : Sound stream to get the volume from /// /// \return Volume value (in range [1, 100]) /// //////////////////////////////////////////////////////////// -CSFML_API float sfSoundStream_GetVolume(sfSoundStream* SoundStream); +CSFML_API float sfSoundStream_GetVolume(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// Get the position of a sound stream /// -/// \param SoundStream : Sound stream to get the position from -/// \param X : X position of the sound stream in the world -/// \param Y : Y position of the sound stream in the world -/// \param Z : Z position of the sound stream in the world +/// \param soundStream : Sound stream to get the position from +/// \param x : X position of the sound stream in the world +/// \param y : Y position of the sound stream in the world +/// \param z : Z position of the sound stream in the world /// //////////////////////////////////////////////////////////// -CSFML_API void sfSoundStream_GetPosition(sfSoundStream* SoundStream, float* X, float* Y, float* Z); +CSFML_API void sfSoundStream_GetPosition(sfSoundStream* soundStream, float* x, float* y, float* z); //////////////////////////////////////////////////////////// /// Tell if the sound stream's position is relative to the listener's /// position, or if it's absolute /// -/// \param SoundStream : Sound stream to check +/// \param soundStream : Sound stream to check /// /// \return sfTrue if the position is relative, sfFalse if it's absolute /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfSoundStream_IsRelativeToListener(sfSoundStream* SoundStream); +CSFML_API sfBool sfSoundStream_IsRelativeToListener(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// Get the minimum distance of a sound stream /// -/// \param SoundStream : Sound stream to get the minimum distance from +/// \param soundStream : Sound stream to get the minimum distance from /// /// \return Minimum distance for the sound stream /// //////////////////////////////////////////////////////////// -CSFML_API float sfSoundStream_GetMinDistance(sfSoundStream* SoundStream); +CSFML_API float sfSoundStream_GetMinDistance(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// Get the attenuation factor of a sound stream /// -/// \param SoundStream : Sound stream to get the attenuation factor from +/// \param soundStream : Sound stream to get the attenuation factor from /// /// \return Attenuation factor for the sound stream /// //////////////////////////////////////////////////////////// -CSFML_API float sfSoundStream_GetAttenuation(sfSoundStream* SoundStream); +CSFML_API float sfSoundStream_GetAttenuation(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// Tell whether or not a stream is looping /// -/// \param SoundStream : Soundstream to get the loop state from +/// \param soundStream : Soundstream to get the loop state from /// /// \return sfTrue if the stream is looping, sfFalse otherwise /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfSoundStream_GetLoop(sfSoundStream* SoundStream); +CSFML_API sfBool sfSoundStream_GetLoop(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// Get the current playing position of a sound stream /// -/// \param SoundStream : Sound stream to get the position from +/// \param soundStream : Sound stream to get the position from /// /// \return Current playing position, expressed in seconds /// //////////////////////////////////////////////////////////// -CSFML_API float sfSoundStream_GetPlayingOffset(sfSoundStream* SoundStream); +CSFML_API float sfSoundStream_GetPlayingOffset(sfSoundStream* soundStream); #endif // SFML_SOUNDSTREAM_H diff --git a/CSFML/include/SFML/Graphics/Color.h b/CSFML/include/SFML/Graphics/Color.h index 795e93f42..767fa8447 100644 --- a/CSFML/include/SFML/Graphics/Color.h +++ b/CSFML/include/SFML/Graphics/Color.h @@ -59,49 +59,49 @@ CSFML_API sfColor sfCyan; //////////////////////////////////////////////////////////// /// Construct a color from its 3 RGB components /// -/// \param R : Red component (0 .. 255) -/// \param G : Green component (0 .. 255) -/// \param B : Blue component (0 .. 255) +/// \param red : Red component (0 .. 255) +/// \param green : Green component (0 .. 255) +/// \param blue : Blue component (0 .. 255) /// /// \return sfColor constructed from the components /// //////////////////////////////////////////////////////////// -CSFML_API sfColor sfColor_FromRGB(sfUint8 R, sfUint8 G, sfUint8 B); +CSFML_API sfColor sfColor_FromRGB(sfUint8 red, sfUint8 green, sfUint8 blue); //////////////////////////////////////////////////////////// /// Construct a color from its 4 RGBA components /// -/// \param R : Red component (0 .. 255) -/// \param G : Green component (0 .. 255) -/// \param B : Blue component (0 .. 255) -/// \param A : Alpha component (0 .. 255) +/// \param red : Red component (0 .. 255) +/// \param green : Green component (0 .. 255) +/// \param blue : Blue component (0 .. 255) +/// \param alpha : Alpha component (0 .. 255) /// /// \return sfColor constructed from the components /// //////////////////////////////////////////////////////////// -CSFML_API sfColor sfColor_FromRGBA(sfUint8 R, sfUint8 G, sfUint8 B, sfUint8 A); +CSFML_API sfColor sfColor_FromRGBA(sfUint8 red, sfUint8 green, sfUint8 blue, sfUint8 alpha); //////////////////////////////////////////////////////////// /// Add two colors /// -/// \param Color1 : First color -/// \param Color2 : Second color +/// \param color1 : First color +/// \param color2 : Second color /// /// \return Component-wise saturated addition of the two colors /// //////////////////////////////////////////////////////////// -CSFML_API sfColor sfColor_Add(sfColor Color1, sfColor Color2); +CSFML_API sfColor sfColor_Add(sfColor color1, sfColor color2); //////////////////////////////////////////////////////////// /// Modulate two colors /// -/// \param Color1 : First color -/// \param Color2 : Second color +/// \param color1 : First color +/// \param color2 : Second color /// /// \return Component-wise multiplication of the two colors /// //////////////////////////////////////////////////////////// -CSFML_API sfColor sfColor_Modulate(sfColor Color1, sfColor Color2); +CSFML_API sfColor sfColor_Modulate(sfColor color1, sfColor color2); #endif // SFML_COLOR_H diff --git a/CSFML/include/SFML/Graphics/Font.h b/CSFML/include/SFML/Graphics/Font.h index 2598a916c..5e9b38d06 100644 --- a/CSFML/include/SFML/Graphics/Font.h +++ b/CSFML/include/SFML/Graphics/Font.h @@ -43,46 +43,46 @@ CSFML_API sfFont* sfFont_Create(); //////////////////////////////////////////////////////////// /// Create a new font from a file /// -/// \param Filename : Path of the font file to load -/// \param CharSize : Size of characters in bitmap - the bigger, the higher quality -/// \param Charset : Characters set to generate (just pass NULL to get the default charset) +/// \param filename : Path of the font file to load +/// \param charSize : Size of characters in bitmap - the bigger, the higher quality +/// \param charset : Characters set to generate (just pass NULL to get the default charset) /// /// \return A new sfFont object, or NULL if it failed /// //////////////////////////////////////////////////////////// -CSFML_API sfFont* sfFont_CreateFromFile(const char* Filename, unsigned int CharSize, const sfUint32* Charset); +CSFML_API sfFont* sfFont_CreateFromFile(const char* filename, unsigned int charSize, const sfUint32* charset); //////////////////////////////////////////////////////////// /// Create a new image font a file in memory /// -/// \param Data : Pointer to the file data in memory -/// \param SizeInBytes : Size of the data to load, in bytes -/// \param CharSize : Size of characters in bitmap - the bigger, the higher quality -/// \param Charset : Characters set to generate (just pass NULL to get the default charset) +/// \param data : Pointer to the file data in memory +/// \param sizeInBytes : Size of the data to load, in bytes +/// \param charSize : Size of characters in bitmap - the bigger, the higher quality +/// \param charset : Characters set to generate (just pass NULL to get the default charset) /// /// \return A new sfFont object, or NULL if it failed /// //////////////////////////////////////////////////////////// -CSFML_API sfFont* sfFont_CreateFromMemory(const char* Data, size_t SizeInBytes, unsigned int CharSize, const sfUint32* Charset); +CSFML_API sfFont* sfFont_CreateFromMemory(const char* data, size_t sizeInBytes, unsigned int charSize, const sfUint32* charset); //////////////////////////////////////////////////////////// /// Destroy an existing font /// -/// \param Font : Font to delete +/// \param font : Font to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfFont_Destroy(sfFont* Font); +CSFML_API void sfFont_Destroy(sfFont* font); //////////////////////////////////////////////////////////// /// Get the base size of characters in a font; /// All glyphs dimensions are based on this value /// -/// \param Font : Font object +/// \param font : Font object /// /// \return Base size of characters /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfFont_GetCharacterSize(sfFont* Font); +CSFML_API unsigned int sfFont_GetCharacterSize(sfFont* font); //////////////////////////////////////////////////////////// /// Get the built-in default font (Arial) diff --git a/CSFML/include/SFML/Graphics/Image.h b/CSFML/include/SFML/Graphics/Image.h index bf0cb93d4..5bbb549f0 100644 --- a/CSFML/include/SFML/Graphics/Image.h +++ b/CSFML/include/SFML/Graphics/Image.h @@ -45,186 +45,186 @@ CSFML_API sfImage* sfImage_Create(); //////////////////////////////////////////////////////////// /// Create a new image filled with a color /// -/// \param Width : Image width -/// \param Height : Image height -/// \param Col : Image color +/// \param width : Image width +/// \param height : Image height +/// \param color : Image color /// /// \return A new sfImage object, or NULL if it failed /// //////////////////////////////////////////////////////////// -CSFML_API sfImage* sfImage_CreateFromColor(unsigned int Width, unsigned int Height, sfColor Color); +CSFML_API sfImage* sfImage_CreateFromColor(unsigned int width, unsigned int height, sfColor color); //////////////////////////////////////////////////////////// /// Create a new image from an array of pixels in memory /// -/// \param Width : Image width -/// \param Height : Image height -/// \param Data : Pointer to the pixels in memory (assumed format is RGBA) +/// \param width : Image width +/// \param height : Image height +/// \param data : Pointer to the pixels in memory (assumed format is RGBA) /// /// \return A new sfImage object, or NULL if it failed /// //////////////////////////////////////////////////////////// -CSFML_API sfImage* sfImage_CreateFromPixels(unsigned int Width, unsigned int Height, const sfUint8* Data); +CSFML_API sfImage* sfImage_CreateFromPixels(unsigned int width, unsigned int height, const sfUint8* data); //////////////////////////////////////////////////////////// /// Create a new image from a file /// -/// \param Filename : Path of the image file to load +/// \param filename : Path of the image file to load /// /// \return A new sfImage object, or NULL if it failed /// //////////////////////////////////////////////////////////// -CSFML_API sfImage* sfImage_CreateFromFile(const char* Filename); +CSFML_API sfImage* sfImage_CreateFromFile(const char* filename); //////////////////////////////////////////////////////////// /// Create a new image from a file in memory /// -/// \param Data : Pointer to the file data in memory -/// \param SizeInBytes : Size of the data to load, in bytes +/// \param data : Pointer to the file data in memory +/// \param sizeInBytes : Size of the data to load, in bytes /// /// \return A new sfImage object, or NULL if it failed /// //////////////////////////////////////////////////////////// -CSFML_API sfImage* sfImage_CreateFromMemory(const char* Data, size_t SizeInBytes); +CSFML_API sfImage* sfImage_CreateFromMemory(const char* data, size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Destroy an existing image /// -/// \param Image : Image to delete +/// \param image : Image to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfImage_Destroy(sfImage* Image); +CSFML_API void sfImage_Destroy(sfImage* image); //////////////////////////////////////////////////////////// /// Save the content of an image to a file /// -/// \param Image : Image to save -/// \param Filename : Path of the file to save (overwritten if already exist) +/// \param image : Image to save +/// \param filename : Path of the file to save (overwritten if already exist) /// /// \return sfTrue if saving was successful /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfImage_SaveToFile(sfImage* Image, const char* Filename); +CSFML_API sfBool sfImage_SaveToFile(sfImage* image, const char* filename); //////////////////////////////////////////////////////////// /// Create a transparency mask for an image from a specified colorkey /// -/// \param Image : Image to modify -/// \param ColorKey : Color to become transparent -/// \param Alpha : Alpha value to use for transparent pixels +/// \param image : Image to modify +/// \param colorKey : Color to become transparent +/// \param alpha : Alpha value to use for transparent pixels /// //////////////////////////////////////////////////////////// -CSFML_API void sfImage_CreateMaskFromColor(sfImage* Image, sfColor ColorKey, sfUint8 Alpha); +CSFML_API void sfImage_CreateMaskFromColor(sfImage* image, sfColor colorKey, sfUint8 alpha); //////////////////////////////////////////////////////////// /// Copy pixels from another image onto this one. /// This function does a slow pixel copy and should only /// be used at initialization time /// -/// \param Image : Destination image -/// \param Source : Source image to copy -/// \param DestX : X coordinate of the destination position -/// \param DestY : Y coordinate of the destination position -/// \param SourceRect : Sub-rectangle of the source image to copy +/// \param image : Destination image +/// \param source : Source image to copy +/// \param destX : X coordinate of the destination position +/// \param destY : Y coordinate of the destination position +/// \param sourceRect : Sub-rectangle of the source image to copy /// //////////////////////////////////////////////////////////// -CSFML_API void sfImage_Copy(sfImage* Image, sfImage* Source, unsigned int DestX, unsigned int DestY, sfIntRect SourceRect); +CSFML_API void sfImage_Copy(sfImage* image, sfImage* source, unsigned int destX, unsigned int destY, sfIntRect sourceRect); //////////////////////////////////////////////////////////// /// Create the image from the current contents of the /// given window /// -/// \param Image : Destination image -/// \param Window : Window to capture -/// \param SourceRect : Sub-rectangle of the screen to copy (empty by default - entire image) +/// \param image : Destination image +/// \param window : Window to capture +/// \param sourceRect : Sub-rectangle of the screen to copy (empty by default - entire image) /// /// \return True if creation was successful /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfImage_CopyScreen(sfImage* Image, sfRenderWindow* Window, sfIntRect SourceRect); +CSFML_API sfBool sfImage_CopyScreen(sfImage* image, sfRenderWindow* window, sfIntRect sourceRect); //////////////////////////////////////////////////////////// /// Change the color of a pixel of an image /// Don't forget to call Update when you end modifying pixels /// -/// \param Image : Image to modify -/// \param X : X coordinate of pixel in the image -/// \param Y : Y coordinate of pixel in the image -/// \param Col : New color for pixel (X, Y) +/// \param image : Image to modify +/// \param x : X coordinate of pixel in the image +/// \param y : Y coordinate of pixel in the image +/// \param color : New color for pixel (X, Y) /// //////////////////////////////////////////////////////////// -CSFML_API void sfImage_SetPixel(sfImage* Image, unsigned int X, unsigned int Y, sfColor Color); +CSFML_API void sfImage_SetPixel(sfImage* image, unsigned int x, unsigned int y, sfColor color); //////////////////////////////////////////////////////////// /// Get a pixel from an image /// -/// \param Image : Image to read -/// \param X : X coordinate of pixel in the image -/// \param Y : Y coordinate of pixel in the image +/// \param image : Image to read +/// \param x : X coordinate of pixel in the image +/// \param y : Y coordinate of pixel in the image /// /// \return Color of pixel (x, y) /// //////////////////////////////////////////////////////////// -CSFML_API sfColor sfImage_GetPixel(sfImage* Image, unsigned int X, unsigned int Y); +CSFML_API sfColor sfImage_GetPixel(sfImage* image, unsigned int x, unsigned int y); //////////////////////////////////////////////////////////// /// Get a read-only pointer to the array of pixels of an image (8 bits integers RGBA) /// Array size is sfImage_GetWidth() x sfImage_GetHeight() x 4 /// This pointer becomes invalid if you reload or resize the image /// -/// \param Image : Image to read +/// \param image : Image to read /// /// \return Pointer to the array of pixels /// //////////////////////////////////////////////////////////// -CSFML_API const sfUint8* sfImage_GetPixelsPtr(sfImage* Image); +CSFML_API const sfUint8* sfImage_GetPixelsPtr(sfImage* image); //////////////////////////////////////////////////////////// /// Bind the image for rendering /// -/// \param Image : Image to bind +/// \param image : Image to bind /// //////////////////////////////////////////////////////////// -CSFML_API void sfImage_Bind(sfImage* Image); +CSFML_API void sfImage_Bind(sfImage* image); //////////////////////////////////////////////////////////// /// Enable or disable image smooth filter /// -/// \param Image : Image to modify -/// \param Smooth : sfTrue to enable smoothing filter, false to disable it +/// \param image : Image to modify +/// \param smooth : sfTrue to enable smoothing filter, false to disable it /// //////////////////////////////////////////////////////////// -CSFML_API void sfImage_SetSmooth(sfImage* Image, sfBool Smooth); +CSFML_API void sfImage_SetSmooth(sfImage* image, sfBool smooth); //////////////////////////////////////////////////////////// /// Return the width of the image /// -/// \param Image : Image to read +/// \param image : Image to read /// /// \return Width in pixels /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfImage_GetWidth(sfImage* Image); +CSFML_API unsigned int sfImage_GetWidth(sfImage* image); //////////////////////////////////////////////////////////// /// Return the height of the image /// -/// \param Image : Image to read +/// \param image : Image to read /// /// \return Height in pixels /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfImage_GetHeight(sfImage* Image); +CSFML_API unsigned int sfImage_GetHeight(sfImage* image); //////////////////////////////////////////////////////////// /// Tells whether the smoothing filter is enabled or not on an image /// -/// \param Image : Image to read +/// \param image : Image to read /// /// \return sfTrue if the smoothing filter is enabled /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfImage_IsSmooth(sfImage* Image); +CSFML_API sfBool sfImage_IsSmooth(sfImage* image); #endif // SFML_IMAGE_H diff --git a/CSFML/include/SFML/Graphics/PostFX.h b/CSFML/include/SFML/Graphics/PostFX.h index 719d985ea..d7db0c227 100644 --- a/CSFML/include/SFML/Graphics/PostFX.h +++ b/CSFML/include/SFML/Graphics/PostFX.h @@ -35,7 +35,7 @@ //////////////////////////////////////////////////////////// /// Create a new post-fx from a file /// -/// \param Filename : File to load +/// \param filename : File to load /// /// \return A new sfPostFX object, or NULL if it failed /// @@ -45,70 +45,70 @@ CSFML_API sfPostFX* sfPostFX_CreateFromFile(const char* Filename); //////////////////////////////////////////////////////////// /// Create a new post-fx from an effect source code /// -/// \param Effect : Source code of the effect +/// \param effect : Source code of the effect /// /// \return A new sfPostFX object, or NULL if it failed /// //////////////////////////////////////////////////////////// -CSFML_API sfPostFX* sfPostFX_CreateFromMemory(const char* Effect); +CSFML_API sfPostFX* sfPostFX_CreateFromMemory(const char* effect); //////////////////////////////////////////////////////////// /// Destroy an existing post-fx /// -/// \param PostFX : PostFX to delete +/// \param postFX : PostFX to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfPostFX_Destroy(sfPostFX* PostFX); +CSFML_API void sfPostFX_Destroy(sfPostFX* postFX); //////////////////////////////////////////////////////////// /// Change a parameter of a post-fx (1 float) /// -/// \param PostFX : Post-effect to modify -/// \param Name : Parameter name in the effect -/// \param X : Value to assign +/// \param postFX : Post-effect to modify +/// \param name : Parameter name in the effect +/// \param x : Value to assign /// //////////////////////////////////////////////////////////// -CSFML_API void sfPostFX_SetParameter1(sfPostFX* PostFX, const char* Name, float X); +CSFML_API void sfPostFX_SetParameter1(sfPostFX* postFX, const char* name, float x); //////////////////////////////////////////////////////////// /// Change a parameter of a post-fx (2 floats) /// -/// \param PostFX : Post-effect to modify -/// \param Name : Parameter name in the effect -/// \param X, Y : Values to assign +/// \param postFX : Post-effect to modify +/// \param name : Parameter name in the effect +/// \param x, y : Values to assign /// //////////////////////////////////////////////////////////// -CSFML_API void sfPostFX_SetParameter2(sfPostFX* PostFX, const char* Name, float X, float Y); +CSFML_API void sfPostFX_SetParameter2(sfPostFX* postFX, const char* name, float x, float y); //////////////////////////////////////////////////////////// /// Change a parameter of a post-fx (3 floats) /// -/// \param PostFX : Post-effect to modify -/// \param Name : Parameter name in the effect -/// \param X, Y, Z : Values to assign +/// \param postFX : Post-effect to modify +/// \param name : Parameter name in the effect +/// \param x, y, z : Values to assign /// //////////////////////////////////////////////////////////// -CSFML_API void sfPostFX_SetParameter3(sfPostFX* PostFX, const char* Name, float X, float Y, float Z); +CSFML_API void sfPostFX_SetParameter3(sfPostFX* postFX, const char* name, float x, float y, float z); //////////////////////////////////////////////////////////// /// Change a parameter of a post-fx (4 floats) /// -/// \param PostFX : Post-effect to modify -/// \param Name : Parameter name in the effect -/// \param X, Y, Z, W : Values to assign +/// \param postFX : Post-effect to modify +/// \param name : Parameter name in the effect +/// \param x, y, z, w : Values to assign /// //////////////////////////////////////////////////////////// -CSFML_API void sfPostFX_SetParameter4(sfPostFX* PostFX, const char* Name, float X, float Y, float Z, float W); +CSFML_API void sfPostFX_SetParameter4(sfPostFX* postFX, const char* name, float x, float y, float z, float w); //////////////////////////////////////////////////////////// /// Set a texture parameter in a post-fx /// -/// \param PostFX : Post-effect to modify -/// \param Name : Texture name in the effect -/// \param Texture : Image to set (pass NULL to use content of current framebuffer) +/// \param postFX : Post-effect to modify +/// \param name : Texture name in the effect +/// \param texture : Image to set (pass NULL to use content of current framebuffer) /// //////////////////////////////////////////////////////////// -CSFML_API void sfPostFX_SetTexture(sfPostFX* PostFX, const char* Name, sfImage* Texture); +CSFML_API void sfPostFX_SetTexture(sfPostFX* postFX, const char* name, sfImage* texture); //////////////////////////////////////////////////////////// /// Tell whether or not the system supports post-effects diff --git a/CSFML/include/SFML/Graphics/Rect.h b/CSFML/include/SFML/Graphics/Rect.h index 7f978085a..eecb31c6b 100644 --- a/CSFML/include/SFML/Graphics/Rect.h +++ b/CSFML/include/SFML/Graphics/Rect.h @@ -55,39 +55,39 @@ typedef struct //////////////////////////////////////////////////////////// /// Move a rectangle by the given offset /// -/// \param Rect : Rectangle to move -/// \param OffsetX : Horizontal offset -/// \param OffsetY : Vertical offset +/// \param rect : Rectangle to move +/// \param offsetX : Horizontal offset +/// \param offsetY : Vertical offset /// //////////////////////////////////////////////////////////// -CSFML_API void sfFloatRect_Offset(sfFloatRect* Rect, float OffsetX, float OffsetY); -CSFML_API void sfIntRect_Offset(sfIntRect* Rect, int OffsetX, int OffsetY); +CSFML_API void sfFloatRect_Offset(sfFloatRect* rect, float offsetX, float offsetY); +CSFML_API void sfIntRect_Offset(sfIntRect* rect, int offsetX, int offsetY); //////////////////////////////////////////////////////////// /// Check if a point is inside a rectangle's area /// -/// \param Rect : Rectangle to test -/// \param X : X coordinate of the point to test -/// \param Y : Y coordinate of the point to test +/// \param rect : Rectangle to test +/// \param x : X coordinate of the point to test +/// \param y : Y coordinate of the point to test /// /// \return sfTrue if the point is inside /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfFloatRect_Contains(sfFloatRect* Rect, float X, float Y); -CSFML_API sfBool sfIntRect_Contains(sfIntRect* Rect, int X, int Y); +CSFML_API sfBool sfFloatRect_Contains(sfFloatRect* rect, float x, float y); +CSFML_API sfBool sfIntRect_Contains(sfIntRect* rect, int x, int y); //////////////////////////////////////////////////////////// /// Check intersection between two rectangles /// -/// \param Rect1 : First rectangle to test -/// \param Rect2 : Second rectangle to test -/// \param OverlappingRect : Rectangle to be filled with overlapping rect (can be NULL) +/// \param rect1 : First rectangle to test +/// \param rect2 : Second rectangle to test +/// \param intersection : Rectangle to be filled with overlapping rect (can be NULL) /// /// \return sfTrue if rectangles overlap /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfFloatRect_Intersects(sfFloatRect* Rect1, sfFloatRect* Rect2, sfFloatRect* OverlappingRect); -CSFML_API sfBool sfIntRect_Intersects(sfIntRect* Rect1, sfIntRect* Rect2, sfIntRect* OverlappingRect); +CSFML_API sfBool sfFloatRect_Intersects(sfFloatRect* rect1, sfFloatRect* rect2, sfFloatRect* intersection); +CSFML_API sfBool sfIntRect_Intersects(sfIntRect* rect1, sfIntRect* rect2, sfIntRect* intersection); #endif // SFML_RECT_H diff --git a/CSFML/include/SFML/Graphics/RenderImage.h b/CSFML/include/SFML/Graphics/RenderImage.h index 3e6c38f9f..ced58a7bc 100644 --- a/CSFML/include/SFML/Graphics/RenderImage.h +++ b/CSFML/include/SFML/Graphics/RenderImage.h @@ -37,101 +37,101 @@ //////////////////////////////////////////////////////////// /// Construct a new renderimage /// -/// \param Width : Width of the renderimage -/// \param Height : Height of the renderimage -/// \param DepthBuffer : Do you want a depth-buffer attached? (useful only if you're doing 3D OpenGL on the renderimage) +/// \param width : Width of the renderimage +/// \param height : Height of the renderimage +/// \param depthBuffer : Do you want a depth-buffer attached? (useful only if you're doing 3D OpenGL on the renderimage) /// //////////////////////////////////////////////////////////// -CSFML_API sfRenderImage* sfRenderImage_Create(unsigned int Width, unsigned int Height, sfBool DepthBuffer); +CSFML_API sfRenderImage* sfRenderImage_Create(unsigned int width, unsigned int height, sfBool depthBuffer); //////////////////////////////////////////////////////////// /// Destroy an existing renderimage /// -/// \param RenderImage : renderimage to destroy +/// \param renderImage : renderimage to destroy /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderImage_Destroy(sfRenderImage* RenderImage); +CSFML_API void sfRenderImage_Destroy(sfRenderImage* renderImage); //////////////////////////////////////////////////////////// /// Get the width of the rendering region of a renderimage /// -/// \param RenderImage : Renderimage object +/// \param renderImage : Renderimage object /// /// \return Width in pixels /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfRenderImage_GetWidth(sfRenderImage* RenderImage); +CSFML_API unsigned int sfRenderImage_GetWidth(sfRenderImage* renderImage); //////////////////////////////////////////////////////////// /// Get the height of the rendering region of a renderimage /// -/// \param RenderImage : Renderimage object +/// \param renderImage : Renderimage object /// /// \return Height in pixels /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfRenderImage_GetHeight(sfRenderImage* RenderImage); +CSFML_API unsigned int sfRenderImage_GetHeight(sfRenderImage* renderImage); //////////////////////////////////////////////////////////// /// Activate or deactivate a renderimage as the current target for rendering /// -/// \param RenderImage : Renderimage object -/// \param Active : sfTrue to activate, sfFalse to deactivate +/// \param renderImage : Renderimage object +/// \param active : sfTrue to activate, sfFalse to deactivate /// /// \return True if operation was successful, false otherwise /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfRenderImage_SetActive(sfRenderImage* RenderImage, sfBool Active); +CSFML_API sfBool sfRenderImage_SetActive(sfRenderImage* renderImage, sfBool active); //////////////////////////////////////////////////////////// /// Draw something on a renderimage /// -/// \param RenderImage : Renderimage to draw in -/// \param PostFX / Sprite / String / shape : Object to draw +/// \param renderImage : Renderimage to draw in +/// \param postFX / sprite / string / shape : Object to draw /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderImage_DrawPostFX(sfRenderImage* RenderImage, sfPostFX* PostFX); -CSFML_API void sfRenderImage_DrawSprite(sfRenderImage* RenderImage, sfSprite* Sprite); -CSFML_API void sfRenderImage_DrawShape (sfRenderImage* RenderImage, sfShape* Shape); -CSFML_API void sfRenderImage_DrawString(sfRenderImage* RenderImage, sfString* String); +CSFML_API void sfRenderImage_DrawPostFX(sfRenderImage* renderImage, sfPostFX* postFX); +CSFML_API void sfRenderImage_DrawSprite(sfRenderImage* renderImage, sfSprite* sprite); +CSFML_API void sfRenderImage_DrawShape (sfRenderImage* renderImage, sfShape* shape); +CSFML_API void sfRenderImage_DrawString(sfRenderImage* renderImage, sfString* string); //////////////////////////////////////////////////////////// /// Clear the renderimage with the given color /// -/// \param RenderImage : Renderimage to modify -/// \param Color : Fill color +/// \param renderImage : Renderimage to modify +/// \param color : Fill color /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderImage_Clear(sfRenderImage* RenderImage, sfColor Color); +CSFML_API void sfRenderImage_Clear(sfRenderImage* renderImage, sfColor color); //////////////////////////////////////////////////////////// /// Change the current active view of a renderimage /// -/// \param RenderImage : Renderimage to modify -/// \param NewView : Pointer to the new view +/// \param renderImage : Renderimage to modify +/// \param view : Pointer to the new view /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderImage_SetView(sfRenderImage* RenderImage, sfView* View); +CSFML_API void sfRenderImage_SetView(sfRenderImage* renderImage, sfView* view); //////////////////////////////////////////////////////////// /// Get the current active view of a renderimage /// -/// \param RenderImage : Renderimage +/// \param renderImage : Renderimage /// /// \return Current active view /// //////////////////////////////////////////////////////////// -CSFML_API const sfView* sfRenderImage_GetView(sfRenderImage* RenderImage); +CSFML_API const sfView* sfRenderImage_GetView(sfRenderImage* renderImage); //////////////////////////////////////////////////////////// /// Get the default view of a renderimage /// -/// \param RenderImage : Renderimage +/// \param renderImage : Renderimage /// /// \return Default view of the renderimage /// //////////////////////////////////////////////////////////// -CSFML_API sfView* sfRenderImage_GetDefaultView(sfRenderImage* RenderImage); +CSFML_API sfView* sfRenderImage_GetDefaultView(sfRenderImage* renderImage); //////////////////////////////////////////////////////////// /// Tell SFML to preserve external OpenGL states, at the expense of @@ -141,21 +141,21 @@ CSFML_API sfView* sfRenderImage_GetDefaultView(sfRenderImage* RenderImage); /// SFML to do internal optimizations and improve performances. /// This parameter is false by default /// -/// \param RenderImage : Target renderimage -/// \param Preserve : True to preserve OpenGL states, false to let SFML optimize +/// \param renderImage : Target renderimage +/// \param preserve : True to preserve OpenGL states, false to let SFML optimize /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderImage_PreserveOpenGLStates(sfRenderImage* RenderImage, sfBool Preserve); +CSFML_API void sfRenderImage_PreserveOpenGLStates(sfRenderImage* renderImage, sfBool preserve); //////////////////////////////////////////////////////////// /// Get the target image /// -/// \param RenderImage : Renderimage object +/// \param renderImage : Renderimage object /// /// \return Pointer to the target image /// //////////////////////////////////////////////////////////// -CSFML_API sfImage* sfRenderImage_GetImage(sfRenderImage* RenderImage); +CSFML_API sfImage* sfRenderImage_GetImage(sfRenderImage* renderImage); //////////////////////////////////////////////////////////// /// Check whether the system supports render images or not diff --git a/CSFML/include/SFML/Graphics/RenderWindow.h b/CSFML/include/SFML/Graphics/RenderWindow.h index ea93edb6c..328e1b3db 100644 --- a/CSFML/include/SFML/Graphics/RenderWindow.h +++ b/CSFML/include/SFML/Graphics/RenderWindow.h @@ -41,298 +41,297 @@ //////////////////////////////////////////////////////////// /// Construct a new renderwindow /// -/// \param Mode : Video mode to use -/// \param Title : Title of the window -/// \param Style : Window style -/// \param Params : Creation settings +/// \param mode : Video mode to use +/// \param title : Title of the window +/// \param style : Window style +/// \param settings : Creation settings /// //////////////////////////////////////////////////////////// -CSFML_API sfRenderWindow* sfRenderWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfContextSettings Params); +CSFML_API sfRenderWindow* sfRenderWindow_Create(sfVideoMode mode, const char* title, unsigned long style, sfContextSettings settings); //////////////////////////////////////////////////////////// /// Construct a renderwindow from an existing control /// -/// \param Handle : Platform-specific handle of the control -/// \param Params : Creation settings +/// \param handle : Platform-specific handle of the control +/// \param settings : Creation settings /// //////////////////////////////////////////////////////////// -CSFML_API sfRenderWindow* sfRenderWindow_CreateFromHandle(sfWindowHandle Handle, sfContextSettings Params); +CSFML_API sfRenderWindow* sfRenderWindow_CreateFromHandle(sfWindowHandle handle, sfContextSettings settings); //////////////////////////////////////////////////////////// /// Destroy an existing renderwindow /// -/// \param RenderWindow : Renderwindow to destroy +/// \param renderWindow : Renderwindow to destroy /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_Destroy(sfRenderWindow* RenderWindow); +CSFML_API void sfRenderWindow_Destroy(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// Close a renderwindow (but doesn't destroy the internal data) /// -/// \param RenderWindow : Renderwindow to close +/// \param renderWindow : Renderwindow to close /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_Close(sfRenderWindow* RenderWindow); +CSFML_API void sfRenderWindow_Close(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// Tell whether or not a renderwindow is opened /// -/// \param RenderWindow : Renderwindow object +/// \param renderWindow : Renderwindow object /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfRenderWindow_IsOpened(sfRenderWindow* RenderWindow); +CSFML_API sfBool sfRenderWindow_IsOpened(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// Get the width of the rendering region of a window /// -/// \param RenderWindow : Renderwindow object +/// \param renderWindow : Renderwindow object /// /// \return Width in pixels /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfRenderWindow_GetWidth(sfRenderWindow* RenderWindow); +CSFML_API unsigned int sfRenderWindow_GetWidth(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// Get the height of the rendering region of a window /// -/// \param RenderWindow : Renderwindow object +/// \param renderWindow : Renderwindow object /// /// \return Height in pixels /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfRenderWindow_GetHeight(sfRenderWindow* RenderWindow); +CSFML_API unsigned int sfRenderWindow_GetHeight(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// Get the creation settings of a window /// -/// \param RenderWindow : Renderwindow object +/// \param renderWindow : Renderwindow object /// /// \return Settings used to create the window /// //////////////////////////////////////////////////////////// -CSFML_API sfContextSettings sfRenderWindow_GetSettings(sfRenderWindow* RenderWindow); +CSFML_API sfContextSettings sfRenderWindow_GetSettings(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// Get the event on top of events stack of a window, if any, and pop it /// -/// \param RenderWindow : Renderwindow object -/// \param Event : Event to fill, if any +/// \param renderWindow : Renderwindow object +/// \param event : Event to fill, if any /// /// \return sfTrue if an event was returned, sfFalse if events stack was empty /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfRenderWindow_GetEvent(sfRenderWindow* RenderWindow, sfEvent* Event); +CSFML_API sfBool sfRenderWindow_GetEvent(sfRenderWindow* renderWindow, sfEvent* event); //////////////////////////////////////////////////////////// /// Enable / disable vertical synchronization on a window /// -/// \param RenderWindow : Renderwindow object -/// \param Enabled : sfTrue to enable v-sync, sfFalse to deactivate +/// \param renderWindow : Renderwindow object +/// \param enabled : sfTrue to enable v-sync, sfFalse to deactivate /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_UseVerticalSync(sfRenderWindow* RenderWindow, sfBool Enabled); +CSFML_API void sfRenderWindow_UseVerticalSync(sfRenderWindow* renderWindow, sfBool enabled); //////////////////////////////////////////////////////////// /// Show or hide the mouse cursor on a window /// -/// \param RenderWindow : RenderWindow object -/// \param Show : sfTrue to show, sfFalse to hide +/// \param renderWindow : RenderWindow object +/// \param show : sfTrue to show, sfFalse to hide /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_ShowMouseCursor(sfRenderWindow* RenderWindow, sfBool Show); +CSFML_API void sfRenderWindow_ShowMouseCursor(sfRenderWindow* renderWindow, sfBool show); //////////////////////////////////////////////////////////// /// Change the position of the mouse cursor on a window /// -/// \param RenderWindow : Renderwindow object -/// \param Left : Left coordinate of the cursor, relative to the window -/// \param Top : Top coordinate of the cursor, relative to the window +/// \param renderWindow : Renderwindow object +/// \param left : Left coordinate of the cursor, relative to the window +/// \param top : Top coordinate of the cursor, relative to the window /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_SetCursorPosition(sfRenderWindow* RenderWindow, unsigned int Left, unsigned int Top); +CSFML_API void sfRenderWindow_SetCursorPosition(sfRenderWindow* renderWindow, unsigned int left, unsigned int top); //////////////////////////////////////////////////////////// /// Change the position of a window on screen. /// Only works for top-level windows /// -/// \param RenderWindow : Renderwindow object -/// \param Left : Left position -/// \param Top : Top position +/// \param renderWindow : Renderwindow object +/// \param left : Left position +/// \param top : Top position /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_SetPosition(sfRenderWindow* RenderWindow, int Left, int Top); +CSFML_API void sfRenderWindow_SetPosition(sfRenderWindow* renderWindow, int left, int top); //////////////////////////////////////////////////////////// /// Change the size of the rendering region of a window /// -/// \param RenderWindow : Renderwindow object -/// \param Width : New Width -/// \param Height : New Height +/// \param renderWindow : Renderwindow object +/// \param width : New Width +/// \param height : New Height /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_SetSize(sfRenderWindow* RenderWindow, unsigned int Width, unsigned int Height); +CSFML_API void sfRenderWindow_SetSize(sfRenderWindow* renderWindow, unsigned int width, unsigned int height); //////////////////////////////////////////////////////////// /// Show or hide a window /// -/// \param RenderWindow : Renderwindow object -/// \param State : sfTrue to show, sfFalse to hide +/// \param renderWindow : Renderwindow object +/// \param show : sfTrue to show, sfFalse to hide /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_Show(sfRenderWindow* RenderWindow, sfBool State); +CSFML_API void sfRenderWindow_Show(sfRenderWindow* renderWindow, sfBool show); //////////////////////////////////////////////////////////// /// Enable or disable automatic key-repeat for keydown events. /// Automatic key-repeat is enabled by default /// -/// \param RenderWindow : Renderwindow object -/// \param Enabled : sfTrue to enable, sfFalse to disable +/// \param renderWindow : Renderwindow object +/// \param enabled : sfTrue to enable, sfFalse to disable /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_EnableKeyRepeat(sfRenderWindow* RenderWindow, sfBool Enabled); +CSFML_API void sfRenderWindow_EnableKeyRepeat(sfRenderWindow* renderWindow, sfBool enabled); //////////////////////////////////////////////////////////// /// Change the window's icon /// -/// \param RenderWindow : Renderwindow object -/// \param Width : Icon's width, in pixels -/// \param Height : Icon's height, in pixels -/// \param Pixels : Pointer to the pixels in memory, format must be RGBA 32 bits +/// \param renderWindow : Renderwindow object +/// \param width : Icon's width, in pixels +/// \param height : Icon's height, in pixels +/// \param pixels : Pointer to the pixels in memory, format must be RGBA 32 bits /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_SetIcon(sfRenderWindow* RenderWindow, unsigned int Width, unsigned int Height, sfUint8* Pixels); +CSFML_API void sfRenderWindow_SetIcon(sfRenderWindow* renderWindow, unsigned int width, unsigned int height, sfUint8* pixels); //////////////////////////////////////////////////////////// /// Activate or deactivate a window as the current target for rendering /// -/// \param RenderWindow : Renderwindow object -/// \param Active : sfTrue to activate, sfFalse to deactivate +/// \param renderWindow : Renderwindow object +/// \param active : sfTrue to activate, sfFalse to deactivate /// /// \return True if operation was successful, false otherwise /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfRenderWindow_SetActive(sfRenderWindow* RenderWindow, sfBool Active); +CSFML_API sfBool sfRenderWindow_SetActive(sfRenderWindow* renderWindow, sfBool active); //////////////////////////////////////////////////////////// /// Display a window on screen /// -/// \param RenderWindow : Renderwindow object +/// \param renderWindow : Renderwindow object /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_Display(sfRenderWindow* RenderWindow); +CSFML_API void sfRenderWindow_Display(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// Get the input manager of a window /// -/// \param RenderWindow : Renderwindow object +/// \param renderWindow : Renderwindow object /// /// \return Reference to the input /// //////////////////////////////////////////////////////////// -CSFML_API sfInput* sfRenderWindow_GetInput(sfRenderWindow* RenderWindow); +CSFML_API sfInput* sfRenderWindow_GetInput(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// Limit the framerate to a maximum fixed frequency for a window /// -/// \param RenderWindow : Renderwindow object -/// -/// \param Limit : Framerate limit, in frames per seconds (use 0 to disable limit) +/// \param renderWindow : Renderwindow object +/// \param limit : Framerate limit, in frames per seconds (use 0 to disable limit) /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_SetFramerateLimit(sfRenderWindow* RenderWindow, unsigned int Limit); +CSFML_API void sfRenderWindow_SetFramerateLimit(sfRenderWindow* renderWindow, unsigned int limit); //////////////////////////////////////////////////////////// /// Get time elapsed since last frame of a window /// -/// \param RenderWindow : Renderwindow object +/// \param renderWindow : Renderwindow object /// /// \return Time elapsed, in seconds /// //////////////////////////////////////////////////////////// -CSFML_API float sfRenderWindow_GetFrameTime(sfRenderWindow* RenderWindow); +CSFML_API float sfRenderWindow_GetFrameTime(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// Change the joystick threshold, ie. the value below which /// no move event will be generated /// -/// \param RenderWindow : Renderwindow object -/// \param Threshold : New threshold, in range [0, 100] +/// \param renderWindow : Renderwindow object +/// \param threshold : New threshold, in range [0, 100] /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_SetJoystickThreshold(sfRenderWindow* RenderWindow, float Threshold); +CSFML_API void sfRenderWindow_SetJoystickThreshold(sfRenderWindow* renderWindow, float threshold); //////////////////////////////////////////////////////////// /// Draw something on a renderwindow /// -/// \param RenderWindow : Renderwindow to draw in -/// \param PostFX / Sprite / String / shape : Object to draw +/// \param renderWindow : Renderwindow to draw in +/// \param postFX / sprite / string / shape : Object to draw /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_DrawPostFX(sfRenderWindow* RenderWindow, sfPostFX* PostFX); -CSFML_API void sfRenderWindow_DrawSprite(sfRenderWindow* RenderWindow, sfSprite* Sprite); -CSFML_API void sfRenderWindow_DrawShape (sfRenderWindow* RenderWindow, sfShape* Shape); -CSFML_API void sfRenderWindow_DrawString(sfRenderWindow* RenderWindow, sfString* String); +CSFML_API void sfRenderWindow_DrawPostFX(sfRenderWindow* renderWindow, sfPostFX* postFX); +CSFML_API void sfRenderWindow_DrawSprite(sfRenderWindow* renderWindow, sfSprite* sprite); +CSFML_API void sfRenderWindow_DrawShape (sfRenderWindow* renderWindow, sfShape* shape); +CSFML_API void sfRenderWindow_DrawString(sfRenderWindow* renderWindow, sfString* string); //////////////////////////////////////////////////////////// /// Save the content of a renderwindow to an image /// -/// \param RenderWindow : Renderwindow to capture +/// \param renderWindow : Renderwindow to capture /// /// \return Image instance containing the contents of the screen /// //////////////////////////////////////////////////////////// -CSFML_API sfImage* sfRenderWindow_Capture(sfRenderWindow* RenderWindow); +CSFML_API sfImage* sfRenderWindow_Capture(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// Clear the screen with the given color /// -/// \param RenderWindow : Renderwindow to modify -/// \param Color : Fill color +/// \param renderWindow : Renderwindow to modify +/// \param color : Fill color /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_Clear(sfRenderWindow* RenderWindow, sfColor Color); +CSFML_API void sfRenderWindow_Clear(sfRenderWindow* renderWindow, sfColor color); //////////////////////////////////////////////////////////// /// Change the current active view of a renderwindow /// -/// \param RenderWindow : Renderwindow to modify -/// \param NewView : Pointer to the new view +/// \param renderWindow : Renderwindow to modify +/// \param view : Pointer to the new view /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_SetView(sfRenderWindow* RenderWindow, sfView* View); +CSFML_API void sfRenderWindow_SetView(sfRenderWindow* renderWindow, sfView* view); //////////////////////////////////////////////////////////// /// Get the current active view of a renderwindow /// -/// \param RenderWindow : Renderwindow +/// \param renderWindow : Renderwindow /// /// \return Current active view /// //////////////////////////////////////////////////////////// -CSFML_API const sfView* sfRenderWindow_GetView(sfRenderWindow* RenderWindow); +CSFML_API const sfView* sfRenderWindow_GetView(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// Get the default view of a renderwindow /// -/// \param RenderWindow : Renderwindow +/// \param renderWindow : Renderwindow /// /// \return Default view of the render window /// //////////////////////////////////////////////////////////// -CSFML_API sfView* sfRenderWindow_GetDefaultView(sfRenderWindow* RenderWindow); +CSFML_API sfView* sfRenderWindow_GetDefaultView(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// Convert a point in window coordinates into view coordinates /// -/// \param RenderWindow : Target Renderwindow -/// \param WindowX : X coordinate of the point to convert, relative to the window -/// \param WindowY : Y coordinate of the point to convert, relative to the window -/// \param ViewX : Pointer to fill with the X coordinate of the converted point -/// \param ViewY : Pointer to fill with the Y coordinate of the converted point -/// \param TargetView : Target view to convert the point to (pass NULL to use the current view) +/// \param renderWindow : Target Renderwindow +/// \param windowX : X coordinate of the point to convert, relative to the window +/// \param windowY : Y coordinate of the point to convert, relative to the window +/// \param viewX : Pointer to fill with the X coordinate of the converted point +/// \param viewY : Pointer to fill with the Y coordinate of the converted point +/// \param targetView : Target view to convert the point to (pass NULL to use the current view) /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_ConvertCoords(sfRenderWindow* RenderWindow, unsigned int WindowX, unsigned int WindowY, float* ViewX, float* ViewY, sfView* TargetView); +CSFML_API void sfRenderWindow_ConvertCoords(sfRenderWindow* renderWindow, unsigned int windowX, unsigned int windowY, float* viewX, float* viewY, sfView* targetView); //////////////////////////////////////////////////////////// /// Tell SFML to preserve external OpenGL states, at the expense of @@ -342,11 +341,11 @@ CSFML_API void sfRenderWindow_ConvertCoords(sfRenderWindow* RenderWindow, unsign /// SFML to do internal optimizations and improve performances. /// This parameter is false by default /// -/// \param RenderWindow : Target Renderwindow -/// \param Preserve : True to preserve OpenGL states, false to let SFML optimize +/// \param renderWindow : Target Renderwindow +/// \param preserve : True to preserve OpenGL states, false to let SFML optimize /// //////////////////////////////////////////////////////////// -CSFML_API void sfRenderWindow_PreserveOpenGLStates(sfRenderWindow* RenderWindow, sfBool Preserve); +CSFML_API void sfRenderWindow_PreserveOpenGLStates(sfRenderWindow* renderWindow, sfBool preserve); #endif // SFML_RENDERWINDOW_H diff --git a/CSFML/include/SFML/Graphics/Shape.h b/CSFML/include/SFML/Graphics/Shape.h index 072ef0b59..719c26848 100644 --- a/CSFML/include/SFML/Graphics/Shape.h +++ b/CSFML/include/SFML/Graphics/Shape.h @@ -45,39 +45,39 @@ CSFML_API sfShape* sfShape_Create(); //////////////////////////////////////////////////////////// /// Create a new shape made of a single line /// -/// \param P1X, P1Y : Position of the first point -/// \param P2X, P2Y : Position second point -/// \param Thickness : Line thickness -/// \param Col : Color used to draw the line -/// \param Outline : Outline width -/// \param OutlineCol : Color used to draw the outline +/// \param p1x, p1y : Position of the first point +/// \param p2x, p2y : Position second point +/// \param thickness : Line thickness +/// \param color : Color used to draw the line +/// \param outline : Outline width +/// \param outlineColor : Color used to draw the outline /// //////////////////////////////////////////////////////////// -CSFML_API sfShape* sfShape_CreateLine(float P1X, float P1Y, float P2X, float P2Y, float Thickness, sfColor Col, float Outline, sfColor OutlineCol); +CSFML_API sfShape* sfShape_CreateLine(float p1x, float p1y, float p2x, float p2y, float thickness, sfColor color, float outline, sfColor outlineColor); //////////////////////////////////////////////////////////// /// Create a new shape made of a single rectangle /// -/// \param P1X, P1Y : Position of the first point -/// \param P2X, P2Y : Position second point -/// \param Col : Color used to fill the rectangle -/// \param Outline : Outline width -/// \param OutlineCol : Color used to draw the outline +/// \param p1x, p1y : Position of the first point +/// \param p2x, p2y : Position second point +/// \param color : Color used to fill the rectangle +/// \param outline : Outline width +/// \param outlineColor : Color used to draw the outline /// //////////////////////////////////////////////////////////// -CSFML_API sfShape* sfShape_CreateRectangle(float P1X, float P1Y, float P2X, float P2Y, sfColor Col, float Outline, sfColor OutlineCol); +CSFML_API sfShape* sfShape_CreateRectangle(float p1x, float p1y, float p2x, float p2y, sfColor color, float outline, sfColor outlineColor); //////////////////////////////////////////////////////////// /// Create a new shape made of a single circle /// -/// \param X, Y : Position of the center -/// \param Radius : Radius -/// \param Col : Color used to fill the circle -/// \param Outline : Outline width -/// \param OutlineCol : Color used to draw the outline +/// \param x, y : Position of the center +/// \param radius : Radius +/// \param color : Color used to fill the circle +/// \param outline : Outline width +/// \param outlineColor : Color used to draw the outline /// //////////////////////////////////////////////////////////// -CSFML_API sfShape* sfShape_CreateCircle(float X, float Y, float Radius, sfColor Col, float Outline, sfColor OutlineCol); +CSFML_API sfShape* sfShape_CreateCircle(float x, float y, float radius, sfColor color, float outline, sfColor outlineColor); //////////////////////////////////////////////////////////// /// Destroy an existing Shape @@ -85,369 +85,370 @@ CSFML_API sfShape* sfShape_CreateCircle(float X, float Y, float Radius, sfColor /// \param Shape : Shape to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_Destroy(sfShape* Shape); +CSFML_API void sfShape_Destroy(sfShape* shape); //////////////////////////////////////////////////////////// /// Set the X position of a shape /// -/// \param Shape : Shape to modify -/// \param X : New X coordinate +/// \param shape : Shape to modify +/// \param x : New X coordinate /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_SetX(sfShape* Shape, float X); +CSFML_API void sfShape_SetX(sfShape* shape, float x); //////////////////////////////////////////////////////////// /// Set the Y position of a shape /// -/// \param Shape : Shape to modify -/// \param Y : New Y coordinate +/// \param shape : Shape to modify +/// \param y : New Y coordinate /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_SetY(sfShape* Shape, float Y); +CSFML_API void sfShape_SetY(sfShape* shape, float y); //////////////////////////////////////////////////////////// /// Set the position of a shape /// -/// \param Shape : Shape to modify -/// \param X : New X coordinate -/// \param Y : New Y coordinate +/// \param shape : Shape to modify +/// \param x : New X coordinate +/// \param y : New Y coordinate /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_SetPosition(sfShape* Shape, float X, float Y); +CSFML_API void sfShape_SetPosition(sfShape* shape, float x, float y); //////////////////////////////////////////////////////////// /// Set the horizontal scale of a shape /// -/// \param Shape : Shape to modify -/// \param Scale : New scale (must be strictly positive) +/// \param shape : Shape to modify +/// \param scale : New scale (must be strictly positive) /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_SetScaleX(sfShape* Shape, float Scale); +CSFML_API void sfShape_SetScaleX(sfShape* shape, float scale); //////////////////////////////////////////////////////////// /// Set the vertical scale of a shape /// -/// \param Shape : Shape to modify -/// \param Scale : New scale (must be strictly positive) +/// \param shape : Shape to modify +/// \param scale : New scale (must be strictly positive) /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_SetScaleY(sfShape* Shape, float Scale); +CSFML_API void sfShape_SetScaleY(sfShape* shape, float scale); //////////////////////////////////////////////////////////// /// Set the scale of a shape /// -/// \param Shape : Shape to modify -/// \param ScaleX : New horizontal scale (must be strictly positive) -/// \param ScaleY : New vertical scale (must be strictly positive) +/// \param shape : Shape to modify +/// \param scaleX : New horizontal scale (must be strictly positive) +/// \param scaleY : New vertical scale (must be strictly positive) /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_SetScale(sfShape* Shape, float ScaleX, float ScaleY); +CSFML_API void sfShape_SetScale(sfShape* shape, float scaleX, float scaleY); //////////////////////////////////////////////////////////// /// Set the orientation of a shape /// -/// \param Shape : Shape to modify -/// \param Rotation : Angle of rotation, in degrees +/// \param shape : Shape to modify +/// \param rotation : Angle of rotation, in degrees /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_SetRotation(sfShape* Shape, float Rotation); +CSFML_API void sfShape_SetRotation(sfShape* shape, float rotation); //////////////////////////////////////////////////////////// /// Set the local origin of a shape, in coordinates relative to /// its left-top corner /// -/// \param Shape : Shape to modify -/// \param X : X coordinate of the origin -/// \param Y : Y coordinate of the origin +/// \param shape : Shape to modify +/// \param x : X coordinate of the origin +/// \param y : Y coordinate of the origin /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_SetOrigin(sfShape* Shape, float X, float Y); +CSFML_API void sfShape_SetOrigin(sfShape* shape, float x, float y); //////////////////////////////////////////////////////////// /// Set the color of a shape /// -/// \param Shape : Shape to modify -/// \param Color : New color +/// \param shape : Shape to modify +/// \param color : New color /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_SetColor(sfShape* Shape, sfColor Color); +CSFML_API void sfShape_SetColor(sfShape* shape, sfColor color); //////////////////////////////////////////////////////////// /// Set the blending mode for a shape /// -/// \param Shape : Shape to modify -/// \param Mode : New blending mode +/// \param shape : Shape to modify +/// \param mode : New blending mode /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_SetBlendMode(sfShape* Shape, sfBlendMode Mode); +CSFML_API void sfShape_SetBlendMode(sfShape* shape, sfBlendMode mode); //////////////////////////////////////////////////////////// /// Get the X position of a shape /// -/// \param Shape : Shape to read +/// \param shape : Shape to read /// /// \return Current X position /// //////////////////////////////////////////////////////////// -CSFML_API float sfShape_GetX(sfShape* Shape); +CSFML_API float sfShape_GetX(sfShape* shape); //////////////////////////////////////////////////////////// /// Get the Y position of a shape /// -/// \param Shape : Shape to read +/// \param shape : Shape to read /// /// \return Current Y position /// //////////////////////////////////////////////////////////// -CSFML_API float sfShape_GetY(sfShape* Shape); +CSFML_API float sfShape_GetY(sfShape* shape); //////////////////////////////////////////////////////////// /// Get the horizontal scale of a shape /// -/// \param Shape : Shape to read +/// \param shape : Shape to read /// /// \return Current X scale factor (always positive) /// //////////////////////////////////////////////////////////// -CSFML_API float sfShape_GetScaleX(sfShape* Shape); +CSFML_API float sfShape_GetScaleX(sfShape* shape); //////////////////////////////////////////////////////////// /// Get the vertical scale of a shape /// -/// \param Shape : Shape to read +/// \param shape : Shape to read /// /// \return Current Y scale factor (always positive) /// //////////////////////////////////////////////////////////// -CSFML_API float sfShape_GetScaleY(sfShape* Shape); +CSFML_API float sfShape_GetScaleY(sfShape* shape); //////////////////////////////////////////////////////////// /// Get the orientation of a shape /// -/// \param Shape : Shape to read +/// \param shape : Shape to read /// /// \return Current rotation, in degrees /// //////////////////////////////////////////////////////////// -CSFML_API float sfShape_GetRotation(sfShape* Shape); +CSFML_API float sfShape_GetRotation(sfShape* shape); //////////////////////////////////////////////////////////// /// Get the X position of the origin a shape /// -/// \param Shape : Shape to read +/// \param shape : Shape to read /// /// \return Current X origin /// //////////////////////////////////////////////////////////// -CSFML_API float sfShape_GetOriginX(sfShape* Shape); +CSFML_API float sfShape_GetOriginX(sfShape* shape); //////////////////////////////////////////////////////////// /// Get the Y position of the origin a shape /// -/// \param Shape : Shape to read +/// \param shape : Shape to read /// /// \return Current Y origin /// //////////////////////////////////////////////////////////// -CSFML_API float sfShape_GetOriginY(sfShape* Shape); +CSFML_API float sfShape_GetOriginY(sfShape* shape); //////////////////////////////////////////////////////////// /// Get the color of a shape /// -/// \param Shape : Shape to read +/// \param shape : Shape to read /// /// \return Current color /// //////////////////////////////////////////////////////////// -CSFML_API sfColor sfShape_GetColor(sfShape* Shape); +CSFML_API sfColor sfShape_GetColor(sfShape* shape); //////////////////////////////////////////////////////////// /// Get the current blending mode of a shape /// -/// \param Shape : Shape to read +/// \param shape : Shape to read /// /// \return Current blending mode /// //////////////////////////////////////////////////////////// -CSFML_API sfBlendMode sfShape_GetBlendMode(sfShape* Shape); +CSFML_API sfBlendMode sfShape_GetBlendMode(sfShape* shape); //////////////////////////////////////////////////////////// /// Move a shape /// -/// \param Shape : Shape to modify -/// \param OffsetX : Offset on the X axis -/// \param OffsetY : Offset on the Y axis +/// \param shape : Shape to modify +/// \param offsetX : Offset on the X axis +/// \param offsetY : Offset on the Y axis /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_Move(sfShape* Shape, float OffsetX, float OffsetY); +CSFML_API void sfShape_Move(sfShape* shape, float offsetX, float offsetY); //////////////////////////////////////////////////////////// /// Scale a shape /// -/// \param Shape : Shape to modify -/// \param FactorX : Horizontal scaling factor (must be strictly positive) -/// \param FactorY : Vertical scaling factor (must be strictly positive) +/// \param shape : Shape to modify +/// \param factorX : Horizontal scaling factor (must be strictly positive) +/// \param factorY : Vertical scaling factor (must be strictly positive) /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_Scale(sfShape* Shape, float FactorX, float FactorY); +CSFML_API void sfShape_Scale(sfShape* shape, float factorX, float factorY); //////////////////////////////////////////////////////////// /// Rotate a shape /// -/// \param Shape : Shape to modify -/// \param Angle : Angle of rotation, in degrees +/// \param shape : Shape to modify +/// \param angle : Angle of rotation, in degrees /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_Rotate(sfShape* Shape, float Angle); +CSFML_API void sfShape_Rotate(sfShape* shape, float angle); //////////////////////////////////////////////////////////// /// Transform a point from global coordinates into the shape's local coordinates /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) /// -/// \param Shape : Shape object -/// \param PointX : X coordinate of the point to transform -/// \param PointY : Y coordinate of the point to transform -/// \param X : Value to fill with the X coordinate of the converted point -/// \param Y : Value to fill with the y coordinate of the converted point +/// \param shape : Shape object +/// \param pointX : X coordinate of the point to transform +/// \param pointY : Y coordinate of the point to transform +/// \param x : Value to fill with the X coordinate of the converted point +/// \param y : Value to fill with the y coordinate of the converted point /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_TransformToLocal(sfShape* Shape, float PointX, float PointY, float* X, float* Y); +CSFML_API void sfShape_TransformToLocal(sfShape* shape, float pointX, float pointY, float* x, float* y); //////////////////////////////////////////////////////////// /// Transform a point from the shape's local coordinates into global coordinates /// (ie it applies the object's origin, translation, rotation and scale to the point) /// -/// \param Shape : Shape object -/// \param PointX : X coordinate of the point to transform -/// \param PointY : Y coordinate of the point to transform -/// \param X : Value to fill with the X coordinate of the converted point -/// \param Y : Value to fill with the y coordinate of the converted point +/// \param shape : Shape object +/// \param pointX : X coordinate of the point to transform +/// \param pointY : Y coordinate of the point to transform +/// \param x : Value to fill with the X coordinate of the converted point +/// \param y : Value to fill with the y coordinate of the converted point /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_TransformToGlobal(sfShape* Shape, float PointX, float PointY, float* X, float* Y); +CSFML_API void sfShape_TransformToGlobal(sfShape* shape, float pointX, float pointY, float* x, float* y); //////////////////////////////////////////////////////////// /// Add a point to a shape /// -/// \param Shape : Shape to modify -/// \param X, Y : Position of the point -/// \param Col : Color of the point -/// \param OutlineCol : Outline color of the point +/// \param shape : Shape to modify +/// \param x, y : Position of the point +/// \param color : Color of the point +/// \param outlineColor : Outline color of the point /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_AddPoint(sfShape* Shape, float X, float Y, sfColor Col, sfColor OutlineCol); +CSFML_API void sfShape_AddPoint(sfShape* shape, float x, float y, sfColor color, sfColor outlineColor); //////////////////////////////////////////////////////////// /// Enable or disable filling a shape. /// Fill is enabled by default /// -/// \param Enable : True to enable, false to disable +/// \param shape : Shape to modify +/// \param enable : True to enable, false to disable /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_EnableFill(sfShape* Shape, sfBool Enable); +CSFML_API void sfShape_EnableFill(sfShape* shape, sfBool enable); //////////////////////////////////////////////////////////// /// Enable or disable drawing a shape outline. /// Outline is enabled by default /// -/// \param Shape : Shape to modify -/// \param Enable : True to enable, false to disable +/// \param shape : Shape to modify +/// \param enable : True to enable, false to disable /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_EnableOutline(sfShape* Shape, sfBool Enable); +CSFML_API void sfShape_EnableOutline(sfShape* shape, sfBool enable); //////////////////////////////////////////////////////////// /// Change the width of a shape outline /// -/// \param Shape : Shape to modify -/// \param Width : New width +/// \param shape : Shape to modify +/// \param width : New width /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_SetOutlineWidth(sfShape* Shape, float Width); +CSFML_API void sfShape_SetOutlineWidth(sfShape* shape, float width); //////////////////////////////////////////////////////////// /// Get the width of a shape outline /// -/// \param Shape : Shape to read +/// \param shape : Shape to read /// /// \param return Current outline width /// //////////////////////////////////////////////////////////// -CSFML_API float sfShape_GetOutlineWidth(sfShape* Shape); +CSFML_API float sfShape_GetOutlineWidth(sfShape* shape); //////////////////////////////////////////////////////////// /// Get the number of points composing a shape /// -/// \param Shape : Shape to read +/// \param shape : Shape to read /// /// \return Total number of points /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfShape_GetNbPoints(sfShape* Shape); +CSFML_API unsigned int sfShape_GetNbPoints(sfShape* shape); //////////////////////////////////////////////////////////// /// Get a the position of a shape's point /// -/// \param Shape : Shape to read -/// \param Index : Index of the point to get -/// \param X : Variable to fill with the X coordinate of the point -/// \param Y : Variable to fill with the Y coordinate of the point +/// \param shape : Shape to read +/// \param index : Index of the point to get +/// \param x : Variable to fill with the X coordinate of the point +/// \param y : Variable to fill with the Y coordinate of the point /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_GetPointPosition(sfShape* Shape, unsigned int Index, float* X, float* Y); +CSFML_API void sfShape_GetPointPosition(sfShape* shape, unsigned int index, float* x, float* y); //////////////////////////////////////////////////////////// /// Get a the color of a shape's point /// -/// \param Shape : Shape to read -/// \param Index : Index of the point to get +/// \param shape : Shape to read +/// \param index : Index of the point to get /// /// \return Color of the point /// //////////////////////////////////////////////////////////// -CSFML_API sfColor sfShape_GetPointColor(sfShape* Shape, unsigned int Index); +CSFML_API sfColor sfShape_GetPointColor(sfShape* shape, unsigned int index); //////////////////////////////////////////////////////////// /// Get a the outline color of a shape's point /// -/// \param Shape : Shape to read -/// \param Index : Index of the point to get +/// \param shape : Shape to read +/// \param index : Index of the point to get /// /// \return Outline color of the point /// //////////////////////////////////////////////////////////// -CSFML_API sfColor sfShape_GetPointOutlineColor(sfShape* Shape, unsigned int Index); +CSFML_API sfColor sfShape_GetPointOutlineColor(sfShape* shape, unsigned int index); //////////////////////////////////////////////////////////// /// Set a the position of a shape's point /// -/// \param Shape : Shape to read -/// \param Index : Index of the point to get -/// \param X : X coordinate of the point -/// \param Y : Y coordinate of the point +/// \param shape : Shape to read +/// \param index : Index of the point to get +/// \param x : X coordinate of the point +/// \param y : Y coordinate of the point /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_SetPointPosition(sfShape* Shape, unsigned int Index, float X, float Y); +CSFML_API void sfShape_SetPointPosition(sfShape* shape, unsigned int index, float x, float y); //////////////////////////////////////////////////////////// /// Set a the color of a shape's point /// -/// \param Shape : Shape to read -/// \param Index : Index of the point to get -/// \param Color : Color of the point +/// \param shape : Shape to read +/// \param index : Index of the point to get +/// \param color : Color of the point /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_SetPointColor(sfShape* Shape, unsigned int Index, sfColor Color); +CSFML_API void sfShape_SetPointColor(sfShape* shape, unsigned int index, sfColor color); //////////////////////////////////////////////////////////// /// Set a the outline color of a shape's point /// -/// \param Shape : Shape to read -/// \param Index : Index of the point to get -/// \param Color : Outline color of the point +/// \param shape : Shape to read +/// \param index : Index of the point to get +/// \param color : Outline color of the point /// //////////////////////////////////////////////////////////// -CSFML_API void sfShape_SetPointOutlineColor(sfShape* Shape, unsigned int Index, sfColor Color); +CSFML_API void sfShape_SetPointOutlineColor(sfShape* shape, unsigned int index, sfColor color); #endif // SFML_Shape_H diff --git a/CSFML/include/SFML/Graphics/Sprite.h b/CSFML/include/SFML/Graphics/Sprite.h index 5ec023b0b..15477e8ed 100644 --- a/CSFML/include/SFML/Graphics/Sprite.h +++ b/CSFML/include/SFML/Graphics/Sprite.h @@ -46,347 +46,347 @@ CSFML_API sfSprite* sfSprite_Create(); //////////////////////////////////////////////////////////// /// Destroy an existing sprite /// -/// \param Sprite : Sprite to delete +/// \param sprite : Sprite to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_Destroy(sfSprite* Sprite); +CSFML_API void sfSprite_Destroy(sfSprite* sprite); //////////////////////////////////////////////////////////// /// Set the X position of a sprite /// -/// \param Sprite : Sprite to modify -/// \param X : New X coordinate +/// \param sprite : Sprite to modify +/// \param x : New X coordinate /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_SetX(sfSprite* Sprite, float X); +CSFML_API void sfSprite_SetX(sfSprite* sprite, float x); //////////////////////////////////////////////////////////// /// Set the T position of a sprite /// -/// \param Sprite : Sprite to modify -/// \param Y : New Y coordinate +/// \param sprite : Sprite to modify +/// \param y : New Y coordinate /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_SetY(sfSprite* Sprite, float Y); +CSFML_API void sfSprite_SetY(sfSprite* sprite, float y); //////////////////////////////////////////////////////////// /// Set the position of a sprite /// -/// \param Sprite : Sprite to modify -/// \param X : New X coordinate -/// \param Y : New Y coordinate +/// \param sprite : Sprite to modify +/// \param x : New X coordinate +/// \param y : New Y coordinate /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_SetPosition(sfSprite* Sprite, float X, float Y); +CSFML_API void sfSprite_SetPosition(sfSprite* sprite, float x, float y); //////////////////////////////////////////////////////////// /// Set the horizontal scale of a sprite /// -/// \param Sprite : Sprite to modify -/// \param Scale : New scale (must be strictly positive) +/// \param sprite : Sprite to modify +/// \param scale : New scale (must be strictly positive) /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_SetScaleX(sfSprite* Sprite, float Scale); +CSFML_API void sfSprite_SetScaleX(sfSprite* sprite, float scale); //////////////////////////////////////////////////////////// /// Set the vertical scale of a sprite /// -/// \param Sprite : Sprite to modify -/// \param Scale : New scale (must be strictly positive) +/// \param sprite : Sprite to modify +/// \param scale : New scale (must be strictly positive) /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_SetScaleY(sfSprite* Sprite, float Scale); +CSFML_API void sfSprite_SetScaleY(sfSprite* sprite, float scale); //////////////////////////////////////////////////////////// /// Set the scale of a sprite /// -/// \param Sprite : Sprite to modify -/// \param ScaleX : New horizontal scale (must be strictly positive) -/// \param ScaleY : New vertical scale (must be strictly positive) +/// \param sprite : Sprite to modify +/// \param scaleX : New horizontal scale (must be strictly positive) +/// \param scaleY : New vertical scale (must be strictly positive) /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_SetScale(sfSprite* Sprite, float ScaleX, float ScaleY); +CSFML_API void sfSprite_SetScale(sfSprite* sprite, float scaleX, float scaleY); //////////////////////////////////////////////////////////// /// Set the orientation of a sprite /// -/// \param Sprite : Sprite to modify -/// \param Rotation : Angle of rotation, in degrees +/// \param sprite : Sprite to modify +/// \param rotation : Angle of rotation, in degrees /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_SetRotation(sfSprite* Sprite, float Rotation); +CSFML_API void sfSprite_SetRotation(sfSprite* sprite, float rotation); //////////////////////////////////////////////////////////// /// Set the local origin of a sprite, in coordinates relative to /// its left-top corner /// -/// \param Sprite : Sprite to modify -/// \param X : X coordinate of the origin -/// \param Y : Y coordinate of the origin +/// \param sprite : Sprite to modify +/// \param x : X coordinate of the origin +/// \param y : Y coordinate of the origin /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_SetOrigin(sfSprite* Sprite, float X, float Y); +CSFML_API void sfSprite_SetOrigin(sfSprite* sprite, float x, float y); //////////////////////////////////////////////////////////// /// Set the color of a sprite /// -/// \param Sprite : Sprite to modify -/// \param Color : New color +/// \param sprite : Sprite to modify +/// \param color : New color /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_SetColor(sfSprite* Sprite, sfColor Color); +CSFML_API void sfSprite_SetColor(sfSprite* sprite, sfColor color); //////////////////////////////////////////////////////////// /// Set the blending mode for a sprite /// -/// \param Sprite : Sprite to modify -/// \param Mode : New blending mode +/// \param sprite : Sprite to modify +/// \param mode : New blending mode /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_SetBlendMode(sfSprite* Sprite, sfBlendMode Mode); +CSFML_API void sfSprite_SetBlendMode(sfSprite* sprite, sfBlendMode mode); //////////////////////////////////////////////////////////// /// Get the X position of a sprite /// -/// \param Sprite : Sprite to read +/// \param sprite : Sprite to read /// /// \return Current X position /// //////////////////////////////////////////////////////////// -CSFML_API float sfSprite_GetX(sfSprite* Sprite); +CSFML_API float sfSprite_GetX(sfSprite* sprite); //////////////////////////////////////////////////////////// /// Get the Y position of a sprite /// -/// \param Sprite : Sprite to read +/// \param sprite : Sprite to read /// /// \return Current Y position /// //////////////////////////////////////////////////////////// -CSFML_API float sfSprite_GetY(sfSprite* Sprite); +CSFML_API float sfSprite_GetY(sfSprite* sprite); //////////////////////////////////////////////////////////// /// Get the horizontal scale of a sprite /// -/// \param Sprite : Sprite to read +/// \param sprite : Sprite to read /// /// \return Current X scale factor (always positive) /// //////////////////////////////////////////////////////////// -CSFML_API float sfSprite_GetScaleX(sfSprite* Sprite); +CSFML_API float sfSprite_GetScaleX(sfSprite* sprite); //////////////////////////////////////////////////////////// /// Get the vertical scale of a sprite /// -/// \param Sprite : Sprite to read +/// \param sprite : Sprite to read /// /// \return Current Y scale factor (always positive) /// //////////////////////////////////////////////////////////// -CSFML_API float sfSprite_GetScaleY(sfSprite* Sprite); +CSFML_API float sfSprite_GetScaleY(sfSprite* sprite); //////////////////////////////////////////////////////////// /// Get the orientation of a sprite /// -/// \param Sprite : Sprite to read +/// \param sprite : Sprite to read /// /// \return Current rotation, in degrees /// //////////////////////////////////////////////////////////// -CSFML_API float sfSprite_GetRotation(sfSprite* Sprite); +CSFML_API float sfSprite_GetRotation(sfSprite* sprite); //////////////////////////////////////////////////////////// /// Get the X position of the origin a sprite /// -/// \param Sprite : Sprite to read +/// \param sprite : Sprite to read /// /// \return Current X origin /// //////////////////////////////////////////////////////////// -CSFML_API float sfSprite_GetOriginX(sfSprite* Sprite); +CSFML_API float sfSprite_GetOriginX(sfSprite* sprite); //////////////////////////////////////////////////////////// /// Get the Y position of the origin a sprite /// -/// \param Sprite : Sprite to read +/// \param sprite : Sprite to read /// /// \return Current Y origin /// //////////////////////////////////////////////////////////// -CSFML_API float sfSprite_GetOriginY(sfSprite* Sprite); +CSFML_API float sfSprite_GetOriginY(sfSprite* sprite); //////////////////////////////////////////////////////////// /// Get the color of a sprite /// -/// \param Sprite : Sprite to read +/// \param sprite : Sprite to read /// /// \return Current color /// //////////////////////////////////////////////////////////// -CSFML_API sfColor sfSprite_GetColor(sfSprite* Sprite); +CSFML_API sfColor sfSprite_GetColor(sfSprite* sprite); //////////////////////////////////////////////////////////// /// Get the current blending mode of a sprite /// -/// \param Sprite : Sprite to read +/// \param sprite : Sprite to read /// /// \return Current blending mode /// //////////////////////////////////////////////////////////// -CSFML_API sfBlendMode sfSprite_GetBlendMode(sfSprite* Sprite); +CSFML_API sfBlendMode sfSprite_GetBlendMode(sfSprite* sprite); //////////////////////////////////////////////////////////// /// Move a sprite /// -/// \param Sprite : Sprite to modify -/// \param OffsetX : Offset on the X axis -/// \param OffsetY : Offset on the Y axis +/// \param sprite : Sprite to modify +/// \param offsetX : Offset on the X axis +/// \param offsetY : Offset on the Y axis /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_Move(sfSprite* Sprite, float OffsetX, float OffsetY); +CSFML_API void sfSprite_Move(sfSprite* sprite, float offsetX, float offsetY); //////////////////////////////////////////////////////////// /// Scale a sprite /// -/// \param Sprite : Sprite to modify -/// \param FactorX : Horizontal scaling factor (must be strictly positive) -/// \param FactorY : Vertical scaling factor (must be strictly positive) +/// \param sprite : Sprite to modify +/// \param factorX : Horizontal scaling factor (must be strictly positive) +/// \param factorY : Vertical scaling factor (must be strictly positive) /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_Scale(sfSprite* Sprite, float FactorX, float FactorY); +CSFML_API void sfSprite_Scale(sfSprite* sprite, float factorX, float factorY); //////////////////////////////////////////////////////////// /// Rotate a sprite /// -/// \param Sprite : Sprite to modify -/// \param Angle : Angle of rotation, in degrees +/// \param sprite : Sprite to modify +/// \param angle : Angle of rotation, in degrees /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_Rotate(sfSprite* Sprite, float Angle); +CSFML_API void sfSprite_Rotate(sfSprite* sprite, float angle); //////////////////////////////////////////////////////////// /// Transform a point from global coordinates into the sprite's local coordinates /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) /// -/// \param Sprite : Sprite object -/// \param PointX : X coordinate of the point to transform -/// \param PointY : Y coordinate of the point to transform -/// \param X : Value to fill with the X coordinate of the converted point -/// \param Y : Value to fill with the y coordinate of the converted point +/// \param sprite : Sprite object +/// \param pointX : X coordinate of the point to transform +/// \param pointY : Y coordinate of the point to transform +/// \param x : Value to fill with the X coordinate of the converted point +/// \param y : Value to fill with the y coordinate of the converted point /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_TransformToLocal(sfSprite* Sprite, float PointX, float PointY, float* X, float* Y); +CSFML_API void sfSprite_TransformToLocal(sfSprite* sprite, float pointX, float pointY, float* x, float* y); //////////////////////////////////////////////////////////// /// Transform a point from the sprite's local coordinates into global coordinates /// (ie it applies the object's origin, translation, rotation and scale to the point) /// -/// \param Sprite : Sprite object -/// \param PointX : X coordinate of the point to transform -/// \param PointY : Y coordinate of the point to transform -/// \param X : Value to fill with the X coordinate of the converted point -/// \param Y : Value to fill with the y coordinate of the converted point +/// \param sprite : Sprite object +/// \param pointX : X coordinate of the point to transform +/// \param pointY : Y coordinate of the point to transform +/// \param x : Value to fill with the X coordinate of the converted point +/// \param y : Value to fill with the y coordinate of the converted point /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_TransformToGlobal(sfSprite* Sprite, float PointX, float PointY, float* X, float* Y); +CSFML_API void sfSprite_TransformToGlobal(sfSprite* sprite, float pointX, float pointY, float* x, float* y); //////////////////////////////////////////////////////////// /// Change the image of a sprite /// /// \param Sprite : Sprite to modify -/// \param Image : New image +/// \param image : New image /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_SetImage(sfSprite* Sprite, sfImage* Image); +CSFML_API void sfSprite_SetImage(sfSprite* sprite, sfImage* image); //////////////////////////////////////////////////////////// /// Set the sub-rectangle of a sprite inside the source image /// -/// \param Sprite : Sprite to modify -/// \param SubRect : New sub-rectangle +/// \param sprite : Sprite to modify +/// \param rectangle : New sub-rectangle /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_SetSubRect(sfSprite* Sprite, sfIntRect SubRect); +CSFML_API void sfSprite_SetSubRect(sfSprite* sprite, sfIntRect rectangle); //////////////////////////////////////////////////////////// /// Resize a sprite (by changing its scale factors) /// -/// \param Sprite : Sprite to modify -/// \param Width : New width (must be strictly positive) -/// \param Height : New height (must be strictly positive) +/// \param sprite : Sprite to modify +/// \param width : New width (must be strictly positive) +/// \param height : New height (must be strictly positive) /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_Resize(sfSprite* Sprite, float Width, float Height); +CSFML_API void sfSprite_Resize(sfSprite* sprite, float width, float height); //////////////////////////////////////////////////////////// /// Flip a sprite horizontally /// -/// \param Sprite : Sprite to modify -/// \param Flipped : sfTrue to flip the sprite +/// \param sprite : Sprite to modify +/// \param flipped : sfTrue to flip the sprite /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_FlipX(sfSprite* Sprite, sfBool Flipped); +CSFML_API void sfSprite_FlipX(sfSprite* sprite, sfBool flipped); //////////////////////////////////////////////////////////// /// Flip a sprite vertically /// -/// \param Sprite : Sprite to modify -/// \param Flipped : sfTrue to flip the sprite +/// \param sprite : Sprite to modify +/// \param flipped : sfTrue to flip the sprite /// //////////////////////////////////////////////////////////// -CSFML_API void sfSprite_FlipY(sfSprite* Sprite, sfBool Flipped); +CSFML_API void sfSprite_FlipY(sfSprite* sprite, sfBool flipped); //////////////////////////////////////////////////////////// /// Get the source image of a sprite /// -/// \param Sprite : Sprite to read +/// \param sprite : Sprite to read /// /// \return Pointer to the image (can be NULL) /// //////////////////////////////////////////////////////////// -CSFML_API sfImage* sfSprite_GetImage(sfSprite* Sprite); +CSFML_API sfImage* sfSprite_GetImage(sfSprite* sprite); //////////////////////////////////////////////////////////// /// Get the sub-rectangle of a sprite inside the source image /// -/// \param Sprite : Sprite to read +/// \param sprite : Sprite to read /// /// \return Sub-rectangle /// //////////////////////////////////////////////////////////// -CSFML_API sfIntRect sfSprite_GetSubRect(sfSprite* Sprite); +CSFML_API sfIntRect sfSprite_GetSubRect(sfSprite* sprite); //////////////////////////////////////////////////////////// /// Get a sprite width /// -/// \param Sprite : Sprite to read +/// \param sprite : Sprite to read /// /// \return Width of the sprite /// //////////////////////////////////////////////////////////// -CSFML_API float sfSprite_GetWidth(sfSprite* Sprite); +CSFML_API float sfSprite_GetWidth(sfSprite* sprite); //////////////////////////////////////////////////////////// /// Get a sprite height /// -/// \param Sprite : Sprite to read +/// \param sprite : Sprite to read /// /// \return Height of the sprite /// //////////////////////////////////////////////////////////// -CSFML_API float sfSprite_GetHeight(sfSprite* Sprite); +CSFML_API float sfSprite_GetHeight(sfSprite* sprite); //////////////////////////////////////////////////////////// /// Get the color of a given pixel in a sprite /// -/// \param Sprite : Sprite to read -/// \param X : X coordinate of the pixel to get -/// \param Y : Y coordinate of the pixel to get +/// \param sprite : Sprite to read +/// \param x : X coordinate of the pixel to get +/// \param y : Y coordinate of the pixel to get /// /// \return Color of pixel (X, Y) /// //////////////////////////////////////////////////////////// -CSFML_API sfColor sfSprite_GetPixel(sfSprite* Sprite, unsigned int X, unsigned int Y); +CSFML_API sfColor sfSprite_GetPixel(sfSprite* sprite, unsigned int x, unsigned int y); #endif // SFML_SPRITE_H diff --git a/CSFML/include/SFML/Graphics/String.h b/CSFML/include/SFML/Graphics/String.h index 4887d2020..3909aa760 100644 --- a/CSFML/include/SFML/Graphics/String.h +++ b/CSFML/include/SFML/Graphics/String.h @@ -58,367 +58,367 @@ CSFML_API sfString* sfString_Create(); //////////////////////////////////////////////////////////// /// Destroy an existing string /// -/// \param String : String to delete +/// \param string : String to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_Destroy(sfString* String); +CSFML_API void sfString_Destroy(sfString* string); //////////////////////////////////////////////////////////// /// Set the X position of a string /// -/// \param String : String to modify -/// \param X : New X coordinate +/// \param string : String to modify +/// \param x : New X coordinate /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetX(sfString* String, float X); +CSFML_API void sfString_SetX(sfString* string, float x); //////////////////////////////////////////////////////////// /// Set the Y position of a string /// -/// \param String : String to modify -/// \param Y : New Y coordinate +/// \param string : String to modify +/// \param y : New Y coordinate /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetY(sfString* String, float Y); +CSFML_API void sfString_SetY(sfString* string, float y); //////////////////////////////////////////////////////////// /// Set the position of a string /// -/// \param String : String to modify -/// \param Left : New left coordinate -/// \param Top : New top coordinate +/// \param string : String to modify +/// \param x : New X coordinate +/// \param y : New Y coordinate /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetPosition(sfString* String, float Left, float Top); +CSFML_API void sfString_SetPosition(sfString* string, float x, float y); //////////////////////////////////////////////////////////// /// Set the horizontal scale of a string /// -/// \param String : String to modify -/// \param Scale : New scale (must be strictly positive) +/// \param string : String to modify +/// \param scale : New scale (must be strictly positive) /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetScaleX(sfString* String, float Scale); +CSFML_API void sfString_SetScaleX(sfString* string, float scale); //////////////////////////////////////////////////////////// /// Set the vertical scale of a string /// -/// \param String : String to modify -/// \param Scale : New scale (must be strictly positive) +/// \param string : String to modify +/// \param scale : New scale (must be strictly positive) /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetScaleY(sfString* String, float Scale); +CSFML_API void sfString_SetScaleY(sfString* string, float scale); //////////////////////////////////////////////////////////// /// Set the scale of a string /// -/// \param String : String to modify -/// \param ScaleX : New horizontal scale (must be strictly positive) -/// \param ScaleY : New vertical scale (must be strictly positive) +/// \param string : String to modify +/// \param scaleX : New horizontal scale (must be strictly positive) +/// \param scaleY : New vertical scale (must be strictly positive) /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetScale(sfString* String, float ScaleX, float ScaleY); +CSFML_API void sfString_SetScale(sfString* string, float scaleX, float scaleY); //////////////////////////////////////////////////////////// /// Set the orientation of a string /// -/// \param String : String to modify -/// \param Rotation : Angle of rotation, in degrees +/// \param string : String to modify +/// \param rotation : Angle of rotation, in degrees /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetRotation(sfString* String, float Rotation); +CSFML_API void sfString_SetRotation(sfString* string, float rotation); //////////////////////////////////////////////////////////// /// Set the local origin of a string, in coordinates /// relative to its left-top corner /// -/// \param String : String to modify -/// \param X : X coordinate of the origin -/// \param Y : Y coordinate of the origin +/// \param string : String to modify +/// \param x : X coordinate of the origin +/// \param y : Y coordinate of the origin /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetOrigin(sfString* String, float X, float Y); +CSFML_API void sfString_SetOrigin(sfString* string, float x, float y); //////////////////////////////////////////////////////////// /// Set the color of a string /// -/// \param String : String to modify -/// \param Color : New color +/// \param string : String to modify +/// \param color : New color /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetColor(sfString* String, sfColor Color); +CSFML_API void sfString_SetColor(sfString* string, sfColor color); //////////////////////////////////////////////////////////// /// Set the blending mode for a string /// -/// \param String : String to modify -/// \param Mode : New blending mode +/// \param string : String to modify +/// \param mode : New blending mode /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetBlendMode(sfString* String, sfBlendMode Mode); +CSFML_API void sfString_SetBlendMode(sfString* string, sfBlendMode mode); //////////////////////////////////////////////////////////// /// Get the X position of a string /// -/// \param String : String to read +/// \param string : String to read /// /// \return Current X position /// //////////////////////////////////////////////////////////// -CSFML_API float sfString_GetX(sfString* String); +CSFML_API float sfString_GetX(sfString* string); //////////////////////////////////////////////////////////// /// Get the top Y of a string /// -/// \param String : String to read +/// \param string : String to read /// /// \return Current Y position /// //////////////////////////////////////////////////////////// -CSFML_API float sfString_GetY(sfString* String); +CSFML_API float sfString_GetY(sfString* string); //////////////////////////////////////////////////////////// /// Get the horizontal scale of a string /// -/// \param String : String to read +/// \param string : String to read /// /// \return Current X scale factor (always positive) /// //////////////////////////////////////////////////////////// -CSFML_API float sfString_GetScaleX(sfString* String); +CSFML_API float sfString_GetScaleX(sfString* string); //////////////////////////////////////////////////////////// /// Get the vertical scale of a string /// -/// \param String : String to read +/// \param string : String to read /// /// \return Current Y scale factor (always positive) /// //////////////////////////////////////////////////////////// -CSFML_API float sfString_GetScaleY(sfString* String); +CSFML_API float sfString_GetScaleY(sfString* string); //////////////////////////////////////////////////////////// /// Get the orientation of a string /// -/// \param String : String to read +/// \param string : String to read /// /// \return Current rotation, in degrees /// //////////////////////////////////////////////////////////// -CSFML_API float sfString_GetRotation(sfString* String); +CSFML_API float sfString_GetRotation(sfString* string); //////////////////////////////////////////////////////////// /// Get the X position of the origin a string /// -/// \param String : String to read +/// \param string : String to read /// /// \return Current X origin position /// //////////////////////////////////////////////////////////// -CSFML_API float sfString_GetOriginX(sfString* String); +CSFML_API float sfString_GetOriginX(sfString* string); //////////////////////////////////////////////////////////// /// Get the top Y of the origin of a string /// -/// \param String : String to read +/// \param string : String to read /// /// \return Current Y origin position /// //////////////////////////////////////////////////////////// -CSFML_API float sfString_GetOriginY(sfString* String); +CSFML_API float sfString_GetOriginY(sfString* string); //////////////////////////////////////////////////////////// /// Get the color of a string /// -/// \param String : String to read +/// \param string : String to read /// /// \return Current color /// //////////////////////////////////////////////////////////// -CSFML_API sfColor sfString_GetColor(sfString* String); +CSFML_API sfColor sfString_GetColor(sfString* string); //////////////////////////////////////////////////////////// /// Get the current blending mode of a string /// -/// \param String : String to read +/// \param string : String to read /// /// \return Current blending mode /// //////////////////////////////////////////////////////////// -CSFML_API sfBlendMode sfString_GetBlendMode(sfString* String); +CSFML_API sfBlendMode sfString_GetBlendMode(sfString* string); //////////////////////////////////////////////////////////// /// Move a string /// -/// \param String : String to modify -/// \param OffsetX : Offset on the X axis -/// \param OffsetY : Offset on the Y axis +/// \param string : String to modify +/// \param offsetX : Offset on the X axis +/// \param offsetY : Offset on the Y axis /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_Move(sfString* String, float OffsetX, float OffsetY); +CSFML_API void sfString_Move(sfString* string, float offsetX, float offsetY); //////////////////////////////////////////////////////////// /// Scale a string /// -/// \param String : String to modify -/// \param FactorX : Horizontal scaling factor (must be strictly positive) -/// \param FactorY : Vertical scaling factor (must be strictly positive) +/// \param string : String to modify +/// \param factorX : Horizontal scaling factor (must be strictly positive) +/// \param factorY : Vertical scaling factor (must be strictly positive) /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_Scale(sfString* String, float FactorX, float FactorY); +CSFML_API void sfString_Scale(sfString* string, float factorX, float factorY); //////////////////////////////////////////////////////////// /// Rotate a string /// -/// \param String : String to modify -/// \param Angle : Angle of rotation, in degrees +/// \param string : String to modify +/// \param angle : Angle of rotation, in degrees /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_Rotate(sfString* String, float Angle); +CSFML_API void sfString_Rotate(sfString* string, float angle); //////////////////////////////////////////////////////////// /// Transform a point from global coordinates into the string's local coordinates /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) /// -/// \param String : String object -/// \param PointX : X coordinate of the point to transform -/// \param PointY : Y coordinate of the point to transform -/// \param X : Value to fill with the X coordinate of the converted point -/// \param Y : Value to fill with the y coordinate of the converted point +/// \param string : String object +/// \param pointX : X coordinate of the point to transform +/// \param pointY : Y coordinate of the point to transform +/// \param x : Value to fill with the X coordinate of the converted point +/// \param y : Value to fill with the y coordinate of the converted point /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_TransformToLocal(sfString* String, float PointX, float PointY, float* X, float* Y); +CSFML_API void sfString_TransformToLocal(sfString* string, float pointX, float pointY, float* x, float* y); //////////////////////////////////////////////////////////// /// Transform a point from the string's local coordinates into global coordinates /// (ie it applies the object's origin, translation, rotation and scale to the point) /// -/// \param String : String object -/// \param PointX : X coordinate of the point to transform -/// \param PointY : Y coordinate of the point to transform -/// \param X : Value to fill with the X coordinate of the converted point -/// \param Y : Value to fill with the y coordinate of the converted point +/// \param string : String object +/// \param pointX : X coordinate of the point to transform +/// \param pointY : Y coordinate of the point to transform +/// \param x : Value to fill with the X coordinate of the converted point +/// \param y : Value to fill with the y coordinate of the converted point /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_TransformToGlobal(sfString* String, float PointX, float PointY, float* X, float* Y); +CSFML_API void sfString_TransformToGlobal(sfString* string, float pointX, float pointY, float* X, float* y); //////////////////////////////////////////////////////////// /// Set the text of a string (from a multibyte string) /// -/// \param String : String to modify -/// \param Text : New text +/// \param string : String to modify +/// \param text : New text /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetText(sfString* String, const char* Text); +CSFML_API void sfString_SetText(sfString* string, const char* text); //////////////////////////////////////////////////////////// /// Set the text of a string (from a unicode string) /// -/// \param String : String to modify -/// \param Text : New text +/// \param string : String to modify +/// \param text : New text /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetUnicodeText(sfString* String, const sfUint32* Text); +CSFML_API void sfString_SetUnicodeText(sfString* string, const sfUint32* text); //////////////////////////////////////////////////////////// /// Set the font of a string /// -/// \param String : String to modify -/// \param Font : Font to use +/// \param string : String to modify +/// \param font : Font to use /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetFont(sfString* String, sfFont* Font); +CSFML_API void sfString_SetFont(sfString* string, sfFont* font); //////////////////////////////////////////////////////////// /// Set the size of a string /// -/// \param String : String to modify -/// \param Size : New size, in pixels +/// \param string : String to modify +/// \param size : New size, in pixels /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetSize(sfString* String, float Size); +CSFML_API void sfString_SetSize(sfString* string, float size); //////////////////////////////////////////////////////////// /// Set the style of a string /// -/// \param String : String to modify -/// \param Size : New style (see sfStringStyle enum) +/// \param string : String to modify +/// \param style : New style (see sfStringStyle enum) /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_SetStyle(sfString* String, unsigned long Style); +CSFML_API void sfString_SetStyle(sfString* string, unsigned long style); //////////////////////////////////////////////////////////// /// Get the text of a string (returns a unicode string) /// -/// \param String : String to read +/// \param string : String to read /// /// \return Text as UTF-32 /// //////////////////////////////////////////////////////////// -CSFML_API const sfUint32* sfString_GetUnicodeText(sfString* String); +CSFML_API const sfUint32* sfString_GetUnicodeText(sfString* string); //////////////////////////////////////////////////////////// /// Get the text of a string (returns an ANSI string) /// -/// \param String : String to read +/// \param string : String to read /// /// \return Text an a locale-dependant ANSI string /// //////////////////////////////////////////////////////////// -CSFML_API const char* sfString_GetText(sfString* String); +CSFML_API const char* sfString_GetText(sfString* string); //////////////////////////////////////////////////////////// /// Get the font used by a string /// -/// \param String : String to read +/// \param string : String to read /// /// \return Pointer to the font /// //////////////////////////////////////////////////////////// -CSFML_API sfFont* sfString_GetFont(sfString* String); +CSFML_API sfFont* sfString_GetFont(sfString* string); //////////////////////////////////////////////////////////// /// Get the size of the characters of a string /// -/// \param String : String to read +/// \param string : String to read /// /// \return Size of the characters /// //////////////////////////////////////////////////////////// -CSFML_API float sfString_GetSize(sfString* String); +CSFML_API float sfString_GetSize(sfString* string); //////////////////////////////////////////////////////////// /// Get the style of a string /// -/// \param String : String to read +/// \param string : String to read /// /// \return Current string style (see sfStringStyle enum) /// //////////////////////////////////////////////////////////// -CSFML_API unsigned long sfString_GetStyle(sfString* String); +CSFML_API unsigned long sfString_GetStyle(sfString* string); //////////////////////////////////////////////////////////// /// Return the visual position of the Index-th character of the string, /// in coordinates relative to the string /// (note : translation, origin, rotation and scale are not applied) /// -/// \param String : String to read -/// \param Index : Index of the character -/// \param X : Value to fill with the X coordinate of the position -/// \param Y : Value to fill with the y coordinate of the position +/// \param string : String to read +/// \param index : Index of the character +/// \param x : Value to fill with the X coordinate of the position +/// \param y : Value to fill with the y coordinate of the position /// //////////////////////////////////////////////////////////// -CSFML_API void sfString_GetCharacterPos(sfString* String, size_t Index, float* X, float* Y); +CSFML_API void sfString_GetCharacterPos(sfString* string, size_t index, float* x, float* y); //////////////////////////////////////////////////////////// /// Get the bounding rectangle of a string on screen /// -/// \param String : String to read +/// \param string : String to read /// /// \return Rectangle contaning the string in screen coordinates /// //////////////////////////////////////////////////////////// -CSFML_API sfFloatRect sfString_GetRect(sfString* String); +CSFML_API sfFloatRect sfString_GetRect(sfString* string); #endif // SFML_STRING_H diff --git a/CSFML/include/SFML/Graphics/View.h b/CSFML/include/SFML/Graphics/View.h index c45045b11..c13217315 100644 --- a/CSFML/include/SFML/Graphics/View.h +++ b/CSFML/include/SFML/Graphics/View.h @@ -42,47 +42,47 @@ CSFML_API sfView* sfView_Create(); //////////////////////////////////////////////////////////// /// Construct a view from a rectangle /// -/// \param Rect : Rectangle defining the bounds of the view +/// \param rectangle : Rectangle defining the bounds of the view /// //////////////////////////////////////////////////////////// -CSFML_API sfView* sfView_CreateFromRect(sfFloatRect Rect); +CSFML_API sfView* sfView_CreateFromRect(sfFloatRect rectangle); //////////////////////////////////////////////////////////// /// Destroy an existing view /// -/// \param View : View to destroy +/// \param view : View to destroy /// //////////////////////////////////////////////////////////// -CSFML_API void sfView_Destroy(sfView* View); +CSFML_API void sfView_Destroy(sfView* view); //////////////////////////////////////////////////////////// /// Change the center of a view /// -/// \param View : View to modify -/// \param X : X coordinate of the new center -/// \param Y : Y coordinate of the new center +/// \param view : View to modify +/// \param x : X coordinate of the new center +/// \param y : Y coordinate of the new center /// //////////////////////////////////////////////////////////// -CSFML_API void sfView_SetCenter(sfView* View, float X, float Y); +CSFML_API void sfView_SetCenter(sfView* view, float x, float y); //////////////////////////////////////////////////////////// /// Change the size of a view /// -/// \param View : View to modify -/// \param Width : New width -/// \param Height : New height +/// \param view : View to modify +/// \param width : New width +/// \param height : New height /// //////////////////////////////////////////////////////////// -CSFML_API void sfView_SetSize(sfView* View, float Width, float Height); +CSFML_API void sfView_SetSize(sfView* view, float width, float height); //////////////////////////////////////////////////////////// /// Set the angle of rotation of a view /// -/// \param View : View to modify -/// \param Angle : New angle, in degrees +/// \param view : View to modify +/// \param angle : New angle, in degrees /// //////////////////////////////////////////////////////////// -CSFML_API void sfView_SetRotation(sfView* View, float Angle); +CSFML_API void sfView_SetRotation(sfView* view, float angle); //////////////////////////////////////////////////////////// /// Set the target viewport of a view @@ -91,109 +91,109 @@ CSFML_API void sfView_SetRotation(sfView* View, float Angle); /// view are displayed, expressed as a factor (between 0 and 1) /// of the size of the RenderTarget to which the view is applied. /// -/// \param View : View to modify -/// \param Viewport : New viewport +/// \param view : View to modify +/// \param viewport : New viewport /// //////////////////////////////////////////////////////////// -CSFML_API void sfView_SetViewport(sfView* View, sfFloatRect Viewport); +CSFML_API void sfView_SetViewport(sfView* view, sfFloatRect viewport); //////////////////////////////////////////////////////////// /// Reset a view to the given rectangle. /// Note: this function resets the rotation angle to 0. /// -/// \param View : View to modify -/// \param Rectangle : Rectangle defining the position and size of the view +/// \param view : View to modify +/// \param rectangle : Rectangle defining the position and size of the view /// //////////////////////////////////////////////////////////// -CSFML_API void sfView_Reset(sfView* View, sfFloatRect Rectangle); +CSFML_API void sfView_Reset(sfView* view, sfFloatRect rectangle); //////////////////////////////////////////////////////////// /// Get the X coordinate of the center of a view /// -/// \param View : View to read +/// \param view : View to read /// /// \return X coordinate of the center of the view /// //////////////////////////////////////////////////////////// -CSFML_API float sfView_GetCenterX(sfView* View); +CSFML_API float sfView_GetCenterX(sfView* view); //////////////////////////////////////////////////////////// /// Get the Y coordinate of the center of a view /// -/// \param View : View to read +/// \param view : View to read /// /// \return Y coordinate of the center of the view /// //////////////////////////////////////////////////////////// -CSFML_API float sfView_GetCenterY(sfView* View); +CSFML_API float sfView_GetCenterY(sfView* view); //////////////////////////////////////////////////////////// /// Get the width of the view /// -/// \param View : View to read +/// \param view : View to read /// /// \return Width of the view /// //////////////////////////////////////////////////////////// -CSFML_API float sfView_GetWidth(sfView* View); +CSFML_API float sfView_GetWidth(sfView* view); //////////////////////////////////////////////////////////// /// Get the height of the view /// -/// \param View : View to read +/// \param view : View to read /// /// \return Height of the view /// //////////////////////////////////////////////////////////// -CSFML_API float sfView_GetHeight(sfView* View); +CSFML_API float sfView_GetHeight(sfView* view); //////////////////////////////////////////////////////////// /// Get the current rotation of a view /// -/// \param View : View to read +/// \param view : View to read /// /// \return Rotation of the view, in degrees /// //////////////////////////////////////////////////////////// -CSFML_API float sfView_GetRotation(sfView* View); +CSFML_API float sfView_GetRotation(sfView* view); //////////////////////////////////////////////////////////// /// Get the target viewport of a view /// -/// \param View : View to read +/// \param view : View to read /// /// \return Viewport rectangle, expressed as a factor of the target size /// //////////////////////////////////////////////////////////// -CSFML_API sfFloatRect sfView_GetViewport(sfView* View); +CSFML_API sfFloatRect sfView_GetViewport(sfView* view); //////////////////////////////////////////////////////////// /// Move a view /// -/// \param View : View to move -/// \param OffsetX : Offset to move the view, on X axis -/// \param OffsetY : Offset to move the view, on Y axis +/// \param view : View to move +/// \param offsetX : Offset to move the view, on X axis +/// \param offsetY : Offset to move the view, on Y axis /// //////////////////////////////////////////////////////////// -CSFML_API void sfView_Move(sfView* View, float OffsetX, float OffsetY); +CSFML_API void sfView_Move(sfView* view, float offsetX, float offsetY); //////////////////////////////////////////////////////////// /// Rotate a view /// -/// \param View : View to rotate -/// \param Angle : Angle in degrees +/// \param view : View to rotate +/// \param angle : Angle in degrees /// //////////////////////////////////////////////////////////// -CSFML_API void sfView_Rotate(sfView* View, float Angle); +CSFML_API void sfView_Rotate(sfView* view, float angle); //////////////////////////////////////////////////////////// /// Resize a view rectangle to simulate a zoom / unzoom effect /// -/// \param View : View to zoom -/// \param Factor : Zoom factor to apply, relative to the current zoom +/// \param view : View to zoom +/// \param factor : Zoom factor to apply, relative to the current zoom /// //////////////////////////////////////////////////////////// -CSFML_API void sfView_Zoom(sfView* View, float Factor); +CSFML_API void sfView_Zoom(sfView* view, float factor); #endif // SFML_VIEW_H diff --git a/CSFML/include/SFML/Network/Ftp.h b/CSFML/include/SFML/Network/Ftp.h index bc8ac6265..8904d1215 100644 --- a/CSFML/include/SFML/Network/Ftp.h +++ b/CSFML/include/SFML/Network/Ftp.h @@ -114,151 +114,151 @@ enum sfFtpStatus //////////////////////////////////////////////////////////// /// Destroy an existing Ftp listing response /// -/// \param FtpResponse : Ftp listing response to destroy +/// \param ftpListingResponse : Ftp listing response to destroy /// //////////////////////////////////////////////////////////// -CSFML_API void sfFtpListingResponse_Destroy(sfFtpListingResponse* FtpListingResponse); +CSFML_API void sfFtpListingResponse_Destroy(sfFtpListingResponse* ftpListingResponse); //////////////////////////////////////////////////////////// /// Convenience function to check if the response status code /// means a success /// -/// \param FtpListingResponse : Ftp listing response +/// \param ftpListingResponse : Ftp listing response /// /// \return sfTrue if status is success (code < 400) /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfFtpListingResponse_IsOk(sfFtpListingResponse* FtpListingResponse); +CSFML_API sfBool sfFtpListingResponse_IsOk(sfFtpListingResponse* ftpListingResponse); //////////////////////////////////////////////////////////// /// Get the response status code /// -/// \param FtpListingResponse : Ftp listing response +/// \param ftpListingResponse : Ftp listing response /// /// \return Status code /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpStatus sfFtpListingResponse_GetStatus(sfFtpListingResponse* FtpListingResponse); +CSFML_API sfFtpStatus sfFtpListingResponse_GetStatus(sfFtpListingResponse* ftpListingResponse); //////////////////////////////////////////////////////////// /// Get the full message contained in the response /// -/// \param FtpListingResponse : Ftp listing response +/// \param ftpListingResponse : Ftp listing response /// /// \return The response message /// //////////////////////////////////////////////////////////// -CSFML_API const char* sfFtpListingResponse_GetMessage(sfFtpListingResponse* FtpListingResponse); +CSFML_API const char* sfFtpListingResponse_GetMessage(sfFtpListingResponse* ftpListingResponse); //////////////////////////////////////////////////////////// /// Get the number of filenames in the listing /// -/// \param FtpListingResponse : Ftp listing response +/// \param ftpListingResponse : Ftp listing response /// /// \return Total number of filenames /// //////////////////////////////////////////////////////////// -CSFML_API size_t sfFtpListingResponse_GetCount(sfFtpListingResponse* FtpListingResponse); +CSFML_API size_t sfFtpListingResponse_GetCount(sfFtpListingResponse* ftpListingResponse); //////////////////////////////////////////////////////////// /// Get the Index-th filename in the directory /// -/// \param FtpListingResponse : Ftp listing response -/// \param Index : Index of the filename to get +/// \param ftpListingResponse : Ftp listing response +/// \param index : Index of the filename to get /// /// \return Index-th filename /// //////////////////////////////////////////////////////////// -CSFML_API const char* sfFtpListingResponse_GetFilename(sfFtpListingResponse* FtpListingResponse, size_t Index); +CSFML_API const char* sfFtpListingResponse_GetFilename(sfFtpListingResponse* ftpListingResponse, size_t index); //////////////////////////////////////////////////////////// /// Destroy an existing Ftp directory response /// -/// \param FtpDirectoryResponse : Ftp directory response to destroy +/// \param ftpDirectoryResponse : Ftp directory response to destroy /// //////////////////////////////////////////////////////////// -CSFML_API void sfFtpDirectoryResponse_Destroy(sfFtpDirectoryResponse* FtpDirectoryResponse); +CSFML_API void sfFtpDirectoryResponse_Destroy(sfFtpDirectoryResponse* ftpDirectoryResponse); //////////////////////////////////////////////////////////// /// Convenience function to check if the response status code /// means a success /// -/// \param FtpDirectoryResponse : Ftp directory response +/// \param ftpDirectoryResponse : Ftp directory response /// /// \return sfTrue if status is success (code < 400) /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfFtpDirectoryResponse_IsOk(sfFtpDirectoryResponse* FtpDirectoryResponse); +CSFML_API sfBool sfFtpDirectoryResponse_IsOk(sfFtpDirectoryResponse* ftpDirectoryResponse); //////////////////////////////////////////////////////////// /// Get the response status code /// -/// \param FtpDirectoryResponse : Ftp directory response +/// \param ftpDirectoryResponse : Ftp directory response /// /// \return Status code /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpStatus sfFtpDirectoryResponse_GetStatus(sfFtpDirectoryResponse* FtpDirectoryResponse); +CSFML_API sfFtpStatus sfFtpDirectoryResponse_GetStatus(sfFtpDirectoryResponse* ftpDirectoryResponse); //////////////////////////////////////////////////////////// /// Get the full message contained in the response /// -/// \param FtpDirectoryResponse : Ftp directory response +/// \param ftpDirectoryResponse : Ftp directory response /// /// \return The response message /// //////////////////////////////////////////////////////////// -CSFML_API const char* sfFtpDirectoryResponse_GetMessage(sfFtpDirectoryResponse* FtpDirectoryResponse); +CSFML_API const char* sfFtpDirectoryResponse_GetMessage(sfFtpDirectoryResponse* ftpDirectoryResponse); //////////////////////////////////////////////////////////// /// Get the directory returned in the response /// -/// \param FtpDirectoryResponse : Ftp directory response +/// \param ftpDirectoryResponse : Ftp directory response /// /// \return Directory name /// //////////////////////////////////////////////////////////// -CSFML_API const char* sfFtpDirectoryResponse_GetDirectory(sfFtpDirectoryResponse* FtpDirectoryResponse); +CSFML_API const char* sfFtpDirectoryResponse_GetDirectory(sfFtpDirectoryResponse* ftpDirectoryResponse); //////////////////////////////////////////////////////////// /// Destroy an existing Ftp response /// -/// \param FtpResponse : Ftp response to destroy +/// \param ftpResponse : Ftp response to destroy /// //////////////////////////////////////////////////////////// -CSFML_API void sfFtpResponse_Destroy(sfFtpResponse* FtpResponse); +CSFML_API void sfFtpResponse_Destroy(sfFtpResponse* ftpResponse); //////////////////////////////////////////////////////////// /// Convenience function to check if the response status code /// means a success /// -/// \param FtpResponse : Ftp response +/// \param ftpResponse : Ftp response /// /// \return sfTrue if status is success (code < 400) /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfFtpResponse_IsOk(sfFtpResponse* FtpResponse); +CSFML_API sfBool sfFtpResponse_IsOk(sfFtpResponse* ftpResponse); //////////////////////////////////////////////////////////// /// Get the response status code /// -/// \param FtpResponse : Ftp response +/// \param ftpResponse : Ftp response /// /// \return Status code /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpStatus sfFtpResponse_GetStatus(sfFtpResponse* FtpResponse); +CSFML_API sfFtpStatus sfFtpResponse_GetStatus(sfFtpResponse* ftpResponse); //////////////////////////////////////////////////////////// /// Get the full message contained in the response /// -/// \param FtpResponse : Ftp response +/// \param ftpResponse : Ftp response /// /// \return The response message /// //////////////////////////////////////////////////////////// -CSFML_API const char* sfFtpResponse_GetMessage(sfFtpResponse* FtpResponse); +CSFML_API const char* sfFtpResponse_GetMessage(sfFtpResponse* ftpResponse); //////////////////////////////////////////////////////////// /// Construct a new Ftp @@ -271,179 +271,179 @@ CSFML_API sfFtp* sfFtp_Create(); //////////////////////////////////////////////////////////// /// Destroy an existing Ftp /// -/// \param Ftp : Ftp to destroy +/// \param ftp : Ftp to destroy /// //////////////////////////////////////////////////////////// -CSFML_API void sfFtp_Destroy(sfFtp* Ftp); +CSFML_API void sfFtp_Destroy(sfFtp* ftp); //////////////////////////////////////////////////////////// /// Connect to the specified FTP server /// -/// \param Ftp : Ftp instance -/// \param Server : FTP server to connect to -/// \param Port : Port used for connection (21 by default, standard FTP port) -/// \param Timeout : Maximum time to wait (0 to use no timeout) +/// \param ftp : Ftp instance +/// \param server : FTP server to connect to +/// \param port : Port used for connection (21 by default, standard FTP port) +/// \param timeout : Maximum time to wait (0 to use no timeout) /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpResponse* sfFtp_Connect(sfFtp* Ftp, sfIPAddress Server, unsigned short Port, float Timeout); +CSFML_API sfFtpResponse* sfFtp_Connect(sfFtp* ftp, sfIPAddress server, unsigned short port, float timeout); //////////////////////////////////////////////////////////// /// Log in using anonymous account /// -/// \param Ftp : Ftp instance +/// \param ftp : Ftp instance /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpResponse* sfFtp_LoginAnonymous(sfFtp* Ftp); +CSFML_API sfFtpResponse* sfFtp_LoginAnonymous(sfFtp* ftp); //////////////////////////////////////////////////////////// /// Log in using a username and a password /// -/// \param Ftp : Ftp instance -/// \param UserName : User name -/// \param Password : Password +/// \param ftp : Ftp instance +/// \param userName : User name +/// \param password : Password /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpResponse* sfFtp_Login(sfFtp* Ftp, const char* UserName, const char* Password); +CSFML_API sfFtpResponse* sfFtp_Login(sfFtp* ftp, const char* userName, const char* password); //////////////////////////////////////////////////////////// /// Close the connection with FTP server /// -/// \param Ftp : Ftp instance +/// \param ftp : Ftp instance /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpResponse* sfFtp_Disconnect(sfFtp* Ftp); +CSFML_API sfFtpResponse* sfFtp_Disconnect(sfFtp* ftp); //////////////////////////////////////////////////////////// /// Send a null command just to prevent from being disconnected /// -/// \param Ftp : Ftp instance +/// \param ftp : Ftp instance /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpResponse* sfFtp_KeepAlive(sfFtp* Ftp); +CSFML_API sfFtpResponse* sfFtp_KeepAlive(sfFtp* ftp); //////////////////////////////////////////////////////////// /// Get the current working directory /// -/// \param Ftp : Ftp instance +/// \param ftp : Ftp instance /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpDirectoryResponse* sfFtp_GetWorkingDirectory(sfFtp* Ftp); +CSFML_API sfFtpDirectoryResponse* sfFtp_GetWorkingDirectory(sfFtp* ftp); //////////////////////////////////////////////////////////// /// Get the contents of the given directory /// (subdirectories and files) /// -/// \param Ftp : Ftp instance -/// \param Directory : Directory to list ("" by default, the current one) +/// \param ftp : Ftp instance +/// \param directory : Directory to list ("" by default, the current one) /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpListingResponse* sfFtp_GetDirectoryListing(sfFtp* Ftp, const char* Directory); +CSFML_API sfFtpListingResponse* sfFtp_GetDirectoryListing(sfFtp* ftp, const char* directory); //////////////////////////////////////////////////////////// /// Change the current working directory /// -/// \param Ftp : Ftp instance -/// \param Directory : New directory, relative to the current one +/// \param ftp : Ftp instance +/// \param directory : New directory, relative to the current one /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpResponse* sfFtp_ChangeDirectory(sfFtp* Ftp, const char* Directory); +CSFML_API sfFtpResponse* sfFtp_ChangeDirectory(sfFtp* ftp, const char* directory); //////////////////////////////////////////////////////////// /// Go to the parent directory of the current one /// -/// \param Ftp : Ftp instance +/// \param ftp : Ftp instance /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpResponse* sfFtp_ParentDirectory(sfFtp* Ftp); +CSFML_API sfFtpResponse* sfFtp_ParentDirectory(sfFtp* ftp); //////////////////////////////////////////////////////////// /// Create a new directory /// -/// \param Ftp : Ftp instance -/// \param Name : Name of the directory to create +/// \param ftp : Ftp instance +/// \param name : Name of the directory to create /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpResponse* sfFtp_MakeDirectory(sfFtp* Ftp, const char* Name); +CSFML_API sfFtpResponse* sfFtp_MakeDirectory(sfFtp* ftp, const char* name); //////////////////////////////////////////////////////////// /// Remove an existing directory /// -/// \param Ftp : Ftp instance -/// \param Name : Name of the directory to remove +/// \param ftp : Ftp instance +/// \param name : Name of the directory to remove /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpResponse* sfFtp_DeleteDirectory(sfFtp* Ftp, const char* Name); +CSFML_API sfFtpResponse* sfFtp_DeleteDirectory(sfFtp* ftp, const char* name); //////////////////////////////////////////////////////////// /// Rename a file /// -/// \param Ftp : Ftp instance -/// \param File : File to rename -/// \param NewName : New name +/// \param ftp : Ftp instance +/// \param file : File to rename +/// \param newName : New name /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpResponse* sfFtp_RenameFile(sfFtp* Ftp, const char* File, const char* NewName); +CSFML_API sfFtpResponse* sfFtp_RenameFile(sfFtp* ftp, const char* file, const char* newName); //////////////////////////////////////////////////////////// /// Remove an existing file /// -/// \param Ftp : Ftp instance -/// \param Name : File to remove +/// \param ftp : Ftp instance +/// \param name : File to remove /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpResponse* sfFtp_DeleteFile(sfFtp* Ftp, const char* Name); +CSFML_API sfFtpResponse* sfFtp_DeleteFile(sfFtp* ftp, const char* name); //////////////////////////////////////////////////////////// /// Download a file from the server /// -/// \param Ftp : Ftp instance -/// \param DistantFile : Path of the distant file to download -/// \param DestPath : Where to put to file on the local computer -/// \param Mode : Transfer mode (binary by default) +/// \param ftp : Ftp instance +/// \param distantFile : Path of the distant file to download +/// \param destPath : Where to put to file on the local computer +/// \param mode : Transfer mode (binary by default) /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpResponse* sfFtp_Download(sfFtp* Ftp, const char* DistantFile, const char* DestPath, sfFtpTransferMode Mode); +CSFML_API sfFtpResponse* sfFtp_Download(sfFtp* ftp, const char* distantFile, const char* destPath, sfFtpTransferMode mode); //////////////////////////////////////////////////////////// /// Upload a file to the server /// -/// \param Ftp : Ftp instance -/// \param LocalFile : Path of the local file to upload -/// \param DestPath : Where to put to file on the server -/// \param Mode : Transfer mode (binary by default) +/// \param ftp : Ftp instance +/// \param localFile : Path of the local file to upload +/// \param destPath : Where to put to file on the server +/// \param mode : Transfer mode (binary by default) /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// -CSFML_API sfFtpResponse* sfFtp_Upload(sfFtp* Ftp, const char* LocalFile, const char* DestPath, sfFtpTransferMode Mode); +CSFML_API sfFtpResponse* sfFtp_Upload(sfFtp* ftp, const char* localFile, const char* destPath, sfFtpTransferMode mode); #endif // SFML_FTP_H diff --git a/CSFML/include/SFML/Network/Http.h b/CSFML/include/SFML/Network/Http.h index 107265f7d..642f1cbc0 100644 --- a/CSFML/include/SFML/Network/Http.h +++ b/CSFML/include/SFML/Network/Http.h @@ -90,111 +90,111 @@ CSFML_API sfHttpRequest* sfHttpRequest_Create(); //////////////////////////////////////////////////////////// /// Destroy an existing Http request /// -/// \param HttpRequest : Http request to destroy +/// \param httpRequest : Http request to destroy /// //////////////////////////////////////////////////////////// -CSFML_API void sfHttpRequest_Destroy(sfHttpRequest* HttpRequest); +CSFML_API void sfHttpRequest_Destroy(sfHttpRequest* httpRequest); //////////////////////////////////////////////////////////// /// Set the value of a field; the field is added if it doesn't exist /// -/// \param HttpRequest : Http request to modify -/// \param Field : Name of the field to set (case-insensitive) -/// \param Value : Value of the field +/// \param httpRequest : Http request to modify +/// \param field : Name of the field to set (case-insensitive) +/// \param value : Value of the field /// //////////////////////////////////////////////////////////// -CSFML_API void sfHttpRequest_SetField(sfHttpRequest* HttpRequest, const char* Field, const char* Value); +CSFML_API void sfHttpRequest_SetField(sfHttpRequest* httpRequest, const char* field, const char* value); //////////////////////////////////////////////////////////// /// Set the request method. /// This parameter is sfHttpGet by default /// -/// \param HttpRequest : Http request to modify -/// \param RequestMethod : Method to use for the request +/// \param httpRequest : Http request to modify +/// \param method : Method to use for the request /// //////////////////////////////////////////////////////////// -CSFML_API void sfHttpRequest_SetMethod(sfHttpRequest* HttpRequest, sfHttpMethod Method); +CSFML_API void sfHttpRequest_SetMethod(sfHttpRequest* httpRequest, sfHttpMethod method); //////////////////////////////////////////////////////////// /// Set the target URI of the request. /// This parameter is "/" by default /// -/// \param HttpRequest : Http request to modify +/// \param httpRequest : Http request to modify /// \param URI : URI to request, local to the host /// //////////////////////////////////////////////////////////// -CSFML_API void sfHttpRequest_SetURI(sfHttpRequest* HttpRequest, const char* URI); +CSFML_API void sfHttpRequest_SetURI(sfHttpRequest* httpRequest, const char* URI); //////////////////////////////////////////////////////////// /// Set the HTTP version of the request. /// This parameter is 1.0 by default /// -/// \param HttpRequest : Http request to modify -/// \param Major : Major version number -/// \param Minor : Minor version number +/// \param httpRequest : Http request to modify +/// \param major : Major version number +/// \param minor : Minor version number /// //////////////////////////////////////////////////////////// -CSFML_API void sfHttpRequest_SetHttpVersion(sfHttpRequest* HttpRequest, unsigned int Major, unsigned int Minor); +CSFML_API void sfHttpRequest_SetHttpVersion(sfHttpRequest* httpRequest, unsigned int major, unsigned int minor); //////////////////////////////////////////////////////////// /// Set the body of the request. This parameter is optional and /// makes sense only for POST requests. /// This parameter is empty by default /// -/// \param HttpRequest : Http request to modify -/// \param Body : Content of the request body +/// \param httpRequest : Http request to modify +/// \param body : Content of the request body /// //////////////////////////////////////////////////////////// -CSFML_API void sfHttpRequest_SetBody(sfHttpRequest* HttpRequest, const char* Body); +CSFML_API void sfHttpRequest_SetBody(sfHttpRequest* httpRequest, const char* body); //////////////////////////////////////////////////////////// /// Destroy an existing Http response /// -/// \param HttpResponse : Http response to destroy +/// \param httpResponse : Http response to destroy /// //////////////////////////////////////////////////////////// -CSFML_API void sfHttpResponse_Destroy(sfHttpResponse* HttpResponse); +CSFML_API void sfHttpResponse_Destroy(sfHttpResponse* httpResponse); //////////////////////////////////////////////////////////// /// Get the value of a field; returns NULL if the field doesn't exist /// -/// \param HttpResponse : Http response -/// \param Field : Field to get +/// \param httpResponse : Http response +/// \param field : Field to get /// /// \return Value of the field (NULL if it doesn't exist) /// //////////////////////////////////////////////////////////// -CSFML_API const char* sfHttpResponse_GetField(sfHttpResponse* HttpResponse, const char* Field); +CSFML_API const char* sfHttpResponse_GetField(sfHttpResponse* httpResponse, const char* field); //////////////////////////////////////////////////////////// /// Get the status of a response /// -/// \param HttpResponse : Http response +/// \param httpResponse : Http response /// /// \return Status of the response /// //////////////////////////////////////////////////////////// -CSFML_API sfHttpStatus sfHttpResponse_GetStatus(sfHttpResponse* HttpResponse); +CSFML_API sfHttpStatus sfHttpResponse_GetStatus(sfHttpResponse* httpResponse); //////////////////////////////////////////////////////////// /// Get the major HTTP version of a response /// -/// \param HttpResponse : Http response +/// \param httpResponse : Http response /// /// \return HTTP major version of the response /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfHttpResponse_GetMajorVersion(sfHttpResponse* HttpResponse); +CSFML_API unsigned int sfHttpResponse_GetMajorVersion(sfHttpResponse* httpResponse); //////////////////////////////////////////////////////////// /// Get the minor HTTP version of a response /// -/// \param HttpResponse : Http response +/// \param httpResponse : Http response /// /// \return HTTP minor version of the response /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfHttpResponse_GetMinorVersion(sfHttpResponse* HttpResponse); +CSFML_API unsigned int sfHttpResponse_GetMinorVersion(sfHttpResponse* httpResponse); //////////////////////////////////////////////////////////// /// Get the body of the response. The body can contain : @@ -203,12 +203,12 @@ CSFML_API unsigned int sfHttpResponse_GetMinorVersion(sfHttpResponse* HttpRespon /// - nothing (for HEAD requests) /// - an error message (in case of an error) /// -/// \param HttpResponse : Http response +/// \param httpResponse : Http response /// /// \return Body of the response (empty string if no body) /// //////////////////////////////////////////////////////////// -CSFML_API const char* sfHttpResponse_GetBody(sfHttpResponse* HttpResponse); +CSFML_API const char* sfHttpResponse_GetBody(sfHttpResponse* httpResponse); //////////////////////////////////////////////////////////// /// Construct a new Http object @@ -224,17 +224,17 @@ CSFML_API sfHttp* sfHttp_Create(); /// \param Http : Http to destroy /// //////////////////////////////////////////////////////////// -CSFML_API void sfHttp_Destroy(sfHttp* Http); +CSFML_API void sfHttp_Destroy(sfHttp* http); //////////////////////////////////////////////////////////// /// Set the target host of a Http server /// -/// \param Http : Http object -/// \param Host : Web server to connect to -/// \param Port : Port to use for connection (0 to use the standard port of the protocol used) +/// \param http : Http object +/// \param host : Web server to connect to +/// \param port : Port to use for connection (0 to use the standard port of the protocol used) /// //////////////////////////////////////////////////////////// -CSFML_API void sfHttp_SetHost(sfHttp* Http, const char* Host, unsigned short Port); +CSFML_API void sfHttp_SetHost(sfHttp* http, const char* host, unsigned short port); //////////////////////////////////////////////////////////// /// Send a HTTP request and return the server's response. @@ -244,14 +244,14 @@ CSFML_API void sfHttp_SetHost(sfHttp* Http, const char* Host, unsigned short Por /// not return instantly; use a thread if you don't want to block your /// application. /// -/// \param Http : Http object -/// \param Request : Request to send -/// \param Timeout : Maximum time to wait (0 to use no timeout) +/// \param http : Http object +/// \param request : Request to send +/// \param timeout : Maximum time to wait (0 to use no timeout) /// /// \return Server's response, or NULL if request is invalid /// //////////////////////////////////////////////////////////// -CSFML_API sfHttpResponse* sfHttp_SendRequest(sfHttp* Http, sfHttpRequest* Request, float Timeout); +CSFML_API sfHttpResponse* sfHttp_SendRequest(sfHttp* http, sfHttpRequest* request, float timeout); #endif // SFML_HTTP_H diff --git a/CSFML/include/SFML/Network/IPAddress.h b/CSFML/include/SFML/Network/IPAddress.h index ad675bbde..6558c47de 100644 --- a/CSFML/include/SFML/Network/IPAddress.h +++ b/CSFML/include/SFML/Network/IPAddress.h @@ -43,62 +43,62 @@ typedef struct //////////////////////////////////////////////////////////// /// Construct an address from a string /// -/// \param String : IP address ("xxx.xxx.xxx.xxx") or network name +/// \param string : IP address ("xxx.xxx.xxx.xxx") or network name /// /// \return Resulting address /// //////////////////////////////////////////////////////////// -CSFML_API sfIPAddress sfIPAddress_FromString(const char* String); +CSFML_API sfIPAddress sfIPAddress_FromString(const char* string); //////////////////////////////////////////////////////////// /// Construct an address from 4 bytes /// -/// \param Byte0 : First byte of the address -/// \param Byte1 : Second byte of the address -/// \param Byte2 : Third byte of the address -/// \param Byte3 : Fourth byte of the address +/// \param byte0 : First byte of the address +/// \param byte1 : Second byte of the address +/// \param byte2 : Third byte of the address +/// \param byte3 : Fourth byte of the address /// /// \return Resulting address /// //////////////////////////////////////////////////////////// -CSFML_API sfIPAddress sfIPAddress_FromBytes(sfUint8 Byte0, sfUint8 Byte1, sfUint8 Byte2, sfUint8 Byte3); +CSFML_API sfIPAddress sfIPAddress_FromBytes(sfUint8 byte0, sfUint8 byte1, sfUint8 byte2, sfUint8 byte3); //////////////////////////////////////////////////////////// /// Construct the address from a 32-bits integer /// -/// \param Address : 4 bytes of the address packed into a 32-bits integer +/// \param address : 4 bytes of the address packed into a 32-bits integer /// //////////////////////////////////////////////////////////// -CSFML_API sfIPAddress sfIPAddress_FromInteger(sfUint32 Address); +CSFML_API sfIPAddress sfIPAddress_FromInteger(sfUint32 address); //////////////////////////////////////////////////////////// /// Tell if an address is a valid one /// -/// \param Address : Address to check +/// \param address : Address to check /// /// \return sfTrue if address has a valid syntax /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfIPAddress_IsValid(sfIPAddress Address); +CSFML_API sfBool sfIPAddress_IsValid(sfIPAddress address); //////////////////////////////////////////////////////////// /// Get a string representation of an address /// -/// \param Address : Address to convert -/// \param String : Char array to fill (size must be >= 16) +/// \param address : Address to convert +/// \param string : Char array to fill (size must be >= 16) /// //////////////////////////////////////////////////////////// -CSFML_API void sfIPAddress_ToString(sfIPAddress Address, char* String); +CSFML_API void sfIPAddress_ToString(sfIPAddress address, char* string); //////////////////////////////////////////////////////////// /// Get an integer representation of the address /// -/// \param Address : Address to convert +/// \param address : Address to convert /// /// \return 32-bits integer containing the 4 bytes of the address, in system endianness /// //////////////////////////////////////////////////////////// -CSFML_API sfUint32 sfIPAddress_ToInteger(sfIPAddress Address); +CSFML_API sfUint32 sfIPAddress_ToInteger(sfIPAddress address); //////////////////////////////////////////////////////////// /// Get the computer's local IP address (from the LAN point of view) @@ -114,12 +114,12 @@ CSFML_API sfIPAddress sfIPAddress_GetLocalAddress(); /// distant website ; as a consequence, this function may be /// very slow -- use it as few as possible ! /// -/// \param Timeout : Maximum time to wait, in seconds (use 0 for no timeout) +/// \param timeout : Maximum time to wait, in seconds (use 0 for no timeout) /// /// \return Public IP address /// //////////////////////////////////////////////////////////// -CSFML_API sfIPAddress sfIPAddress_GetPublicAddress(float Timeout); +CSFML_API sfIPAddress sfIPAddress_GetPublicAddress(float timeout); //////////////////////////////////////////////////////////// /// Get the computer's loopback address diff --git a/CSFML/include/SFML/Network/Packet.h b/CSFML/include/SFML/Network/Packet.h index 8331ff086..ddea64d6d 100644 --- a/CSFML/include/SFML/Network/Packet.h +++ b/CSFML/include/SFML/Network/Packet.h @@ -43,106 +43,106 @@ CSFML_API sfPacket* sfPacket_Create(); //////////////////////////////////////////////////////////// /// Destroy an existing packet /// -/// \param Packet : Packet to delete +/// \param packet : Packet to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfPacket_Destroy(sfPacket* Packet); +CSFML_API void sfPacket_Destroy(sfPacket* packet); //////////////////////////////////////////////////////////// /// Append data to the end of a packet /// -/// \param Packet : Packet to fill -/// \param Data : Pointer to the bytes to append -/// \param SizeInBytes : Number of bytes to append +/// \param packet : Packet to fill +/// \param data : Pointer to the bytes to append +/// \param sizeInBytes : Number of bytes to append /// //////////////////////////////////////////////////////////// -CSFML_API void sfPacket_Append(sfPacket* Packet, void* Data, size_t SizeInBytes); +CSFML_API void sfPacket_Append(sfPacket* packet, void* data, size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Clear all the data of a packet /// -/// \param Packet : Packet to clear +/// \param packet : Packet to clear /// /////////////////////////////////////////////////////////// -CSFML_API void sfPacket_Clear(sfPacket* Packet); +CSFML_API void sfPacket_Clear(sfPacket* packet); //////////////////////////////////////////////////////////// /// Get a pointer to the data contained in a packet /// Warning : the returned pointer may be invalid after you /// append data to the packet /// -/// \param Packet : Packet to get data from +/// \param packet : Packet to get data from /// /// \return Pointer to the data /// //////////////////////////////////////////////////////////// -CSFML_API const char* sfPacket_GetData(sfPacket* Packet); +CSFML_API const char* sfPacket_GetData(sfPacket* packet); //////////////////////////////////////////////////////////// /// Get the size of the data contained in a packet /// -/// \param Packet : Packet to get data size from +/// \param packet : Packet to get data size from /// /// \return Data size, in bytes /// //////////////////////////////////////////////////////////// -CSFML_API size_t sfPacket_GetDataSize(sfPacket* Packet); +CSFML_API size_t sfPacket_GetDataSize(sfPacket* packet); //////////////////////////////////////////////////////////// /// Tell if the reading position has reached the end of the packet /// -/// \param Packet : Packet to check +/// \param packet : Packet to check /// /// \return sfTrue if all data have been read into the packet /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfPacket_EndOfPacket(sfPacket* Packet); +CSFML_API sfBool sfPacket_EndOfPacket(sfPacket* packet); //////////////////////////////////////////////////////////// /// Return the validity of packet /// -/// \param Packet : Packet to check +/// \param packet : Packet to check /// /// \return sfTrue if last data extraction from packet was successful /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfPacket_CanRead(sfPacket* Packet); +CSFML_API sfBool sfPacket_CanRead(sfPacket* packet); //////////////////////////////////////////////////////////// /// Functions to extract data from a packet /// -/// \param Packet : Packet to read +/// \param packet : Packet to read /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfPacket_ReadBool(sfPacket* Packet); -CSFML_API sfInt8 sfPacket_ReadInt8(sfPacket* Packet); -CSFML_API sfUint8 sfPacket_ReadUint8(sfPacket* Packet); -CSFML_API sfInt16 sfPacket_ReadInt16(sfPacket* Packet); -CSFML_API sfUint16 sfPacket_ReadUint16(sfPacket* Packet); -CSFML_API sfInt32 sfPacket_ReadInt32(sfPacket* Packet); -CSFML_API sfUint32 sfPacket_ReadUint32(sfPacket* Packet); -CSFML_API float sfPacket_ReadFloat(sfPacket* Packet); -CSFML_API double sfPacket_ReadDouble(sfPacket* Packet); -CSFML_API void sfPacket_ReadString(sfPacket* Packet, char* String); -CSFML_API void sfPacket_ReadWideString(sfPacket* Packet, wchar_t* String); +CSFML_API sfBool sfPacket_ReadBool(sfPacket* packet); +CSFML_API sfInt8 sfPacket_ReadInt8(sfPacket* packet); +CSFML_API sfUint8 sfPacket_ReadUint8(sfPacket* packet); +CSFML_API sfInt16 sfPacket_ReadInt16(sfPacket* packet); +CSFML_API sfUint16 sfPacket_ReadUint16(sfPacket* packet); +CSFML_API sfInt32 sfPacket_ReadInt32(sfPacket* packet); +CSFML_API sfUint32 sfPacket_ReadUint32(sfPacket* packet); +CSFML_API float sfPacket_ReadFloat(sfPacket* packet); +CSFML_API double sfPacket_ReadDouble(sfPacket* packet); +CSFML_API void sfPacket_ReadString(sfPacket* packet, char* string); +CSFML_API void sfPacket_ReadWideString(sfPacket* packet, wchar_t* string); //////////////////////////////////////////////////////////// /// Functions to insert data into a packet /// -/// \param Packet : Packet to write +/// \param packet : Packet to write /// //////////////////////////////////////////////////////////// -CSFML_API void sfPacket_WriteBool(sfPacket* Packet, sfBool); -CSFML_API void sfPacket_WriteInt8(sfPacket* Packet, sfInt8); -CSFML_API void sfPacket_WriteUint8(sfPacket* Packet, sfUint8); -CSFML_API void sfPacket_WriteInt16(sfPacket* Packet, sfInt16); -CSFML_API void sfPacket_WriteUint16(sfPacket* Packet, sfUint16); -CSFML_API void sfPacket_WriteInt32(sfPacket* Packet, sfInt32); -CSFML_API void sfPacket_WriteUint32(sfPacket* Packet, sfUint32); -CSFML_API void sfPacket_WriteFloat(sfPacket* Packet, float); -CSFML_API void sfPacket_WriteDouble(sfPacket* Packet, double); -CSFML_API void sfPacket_WriteString(sfPacket* Packet, const char* String); -CSFML_API void sfPacket_WriteWideString(sfPacket* Packet, const wchar_t* String); +CSFML_API void sfPacket_WriteBool(sfPacket* packet, sfBool); +CSFML_API void sfPacket_WriteInt8(sfPacket* packet, sfInt8); +CSFML_API void sfPacket_WriteUint8(sfPacket* packet, sfUint8); +CSFML_API void sfPacket_WriteInt16(sfPacket* packet, sfInt16); +CSFML_API void sfPacket_WriteUint16(sfPacket* packet, sfUint16); +CSFML_API void sfPacket_WriteInt32(sfPacket* packet, sfInt32); +CSFML_API void sfPacket_WriteUint32(sfPacket* packet, sfUint32); +CSFML_API void sfPacket_WriteFloat(sfPacket* packet, float); +CSFML_API void sfPacket_WriteDouble(sfPacket* packet, double); +CSFML_API void sfPacket_WriteString(sfPacket* packet, const char* string); +CSFML_API void sfPacket_WriteWideString(sfPacket* packet, const wchar_t* string); #endif // SFML_PACKET_H diff --git a/CSFML/include/SFML/Network/Selector.h b/CSFML/include/SFML/Network/Selector.h index 982e059ff..bf6fc3dab 100644 --- a/CSFML/include/SFML/Network/Selector.h +++ b/CSFML/include/SFML/Network/Selector.h @@ -44,68 +44,68 @@ CSFML_API sfSelectorUDP* sfSelectorUDP_Create(); //////////////////////////////////////////////////////////// /// Destroy an existing selector /// -/// \param Selector : Selector to delete +/// \param selector : Selector to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfSelectorTCP_Destroy(sfSelectorTCP* Selector); -CSFML_API void sfSelectorUDP_Destroy(sfSelectorUDP* Selector); +CSFML_API void sfSelectorTCP_Destroy(sfSelectorTCP* selector); +CSFML_API void sfSelectorUDP_Destroy(sfSelectorUDP* selector); //////////////////////////////////////////////////////////// /// Add a socket to watch to a selector /// -/// \param Selector : Selector to add the socket to -/// \param Socket : Socket to add +/// \param selector : Selector to add the socket to +/// \param socket : Socket to add /// //////////////////////////////////////////////////////////// -CSFML_API void sfSelectorTCP_Add(sfSelectorTCP* Selector, sfSocketTCP* Socket); -CSFML_API void sfSelectorUDP_Add(sfSelectorUDP* Selector, sfSocketUDP* Socket); +CSFML_API void sfSelectorTCP_Add(sfSelectorTCP* selector, sfSocketTCP* socket); +CSFML_API void sfSelectorUDP_Add(sfSelectorUDP* selector, sfSocketUDP* socket); //////////////////////////////////////////////////////////// /// Remove a socket from a selector /// -/// \param Selector : Selector to remove the socket from -/// \param Socket : Socket to remove +/// \param selector : Selector to remove the socket from +/// \param socket : Socket to remove /// //////////////////////////////////////////////////////////// -CSFML_API void sfSelectorTCP_Remove(sfSelectorTCP* Selector, sfSocketTCP* Socket); -CSFML_API void sfSelectorUDP_Remove(sfSelectorUDP* Selector, sfSocketUDP* Socket); +CSFML_API void sfSelectorTCP_Remove(sfSelectorTCP* selector, sfSocketTCP* socket); +CSFML_API void sfSelectorUDP_Remove(sfSelectorUDP* selector, sfSocketUDP* socket); //////////////////////////////////////////////////////////// /// Remove all sockets from a selector /// -/// \param Selector : Selector to remove the socket from +/// \param selector : Selector to remove the socket from /// //////////////////////////////////////////////////////////// -CSFML_API void sfSelectorTCP_Clear(sfSelectorTCP* Selector); -CSFML_API void sfSelectorUDP_Clear(sfSelectorUDP* Selector); +CSFML_API void sfSelectorTCP_Clear(sfSelectorTCP* selector); +CSFML_API void sfSelectorUDP_Clear(sfSelectorUDP* 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 time is out /// -/// \param Selector : Selector to check -/// \param Timeout : Maximum time to wait, in seconds (0 to disable timeout) +/// \param selector : Selector to check +/// \param timeout : Maximum time to wait, in seconds (0 to disable timeout) /// /// \return Number of sockets ready /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfSelectorTCP_Wait(sfSelectorTCP* Selector, float Timeout); -CSFML_API unsigned int sfSelectorUDP_Wait(sfSelectorUDP* Selector, float Timeout); +CSFML_API unsigned int sfSelectorTCP_Wait(sfSelectorTCP* selector, float timeout); +CSFML_API unsigned int sfSelectorUDP_Wait(sfSelectorUDP* selector, float timeout); //////////////////////////////////////////////////////////// /// After a call to Wait(), get the Index-th socket which is /// ready for reading. The total number of sockets ready /// is the integer returned by the previous call to Wait() /// -/// \param Selector : Selector to check -/// \param Index : Index of the socket to get +/// \param selector : Selector to check +/// \param index : Index of the socket to get /// /// \return The Index-th socket /// //////////////////////////////////////////////////////////// -CSFML_API sfSocketTCP* sfSelectorTCP_GetSocketReady(sfSelectorTCP* Selector, unsigned int Index); -CSFML_API sfSocketUDP* sfSelectorUDP_GetSocketReady(sfSelectorUDP* Selector, unsigned int Index); +CSFML_API sfSocketTCP* sfSelectorTCP_GetSocketReady(sfSelectorTCP* selector, unsigned int index); +CSFML_API sfSocketUDP* sfSelectorUDP_GetSocketReady(sfSelectorUDP* selector, unsigned int index); #endif // SFML_SELECTOR_H diff --git a/CSFML/include/SFML/Network/SocketTCP.h b/CSFML/include/SFML/Network/SocketTCP.h index 86471c3e6..4aed9a450 100644 --- a/CSFML/include/SFML/Network/SocketTCP.h +++ b/CSFML/include/SFML/Network/SocketTCP.h @@ -45,116 +45,116 @@ CSFML_API sfSocketTCP* sfSocketTCP_Create(); //////////////////////////////////////////////////////////// /// Destroy an existing TCP socket /// -/// \param Socket : Socket to destroy +/// \param socket : Socket to destroy /// //////////////////////////////////////////////////////////// -CSFML_API void sfSocketTCP_Destroy(sfSocketTCP* Socket); +CSFML_API void sfSocketTCP_Destroy(sfSocketTCP* socket); //////////////////////////////////////////////////////////// /// Change the blocking state of a TCP socket. /// The default behaviour of a socket is blocking /// -/// \param Socket : Socket to modify -/// \param Blocking : Pass sfTrue to set the socket as blocking, or false for non-blocking +/// \param socket : Socket to modify +/// \param blocking : Pass sfTrue to set the socket as blocking, or false for non-blocking /// //////////////////////////////////////////////////////////// -CSFML_API void sfSocketTCP_SetBlocking(sfSocketTCP* Socket, sfBool Blocking); +CSFML_API void sfSocketTCP_SetBlocking(sfSocketTCP* socket, sfBool blocking); //////////////////////////////////////////////////////////// /// Connect a TCP socket to another computer on a specified port /// -/// \param Socket : Socket to use for connecting -/// \param Port : Port to use for transfers (warning : ports < 1024 are reserved) -/// \param HostAddress : IP Address of the host to connect to -/// \param Timeout : Maximum time to wait (0 to use no timeout) +/// \param socket : Socket to use for connecting +/// \param port : Port to use for transfers (warning : ports < 1024 are reserved) +/// \param host : IP Address of the host to connect to +/// \param timeout : Maximum time to wait (0 to use no timeout) /// /// \return sfTrue if operation has been successful /// //////////////////////////////////////////////////////////// -CSFML_API sfSocketStatus sfSocketTCP_Connect(sfSocketTCP* Socket, unsigned short Port, sfIPAddress HostAddress, float Timeout); +CSFML_API sfSocketStatus sfSocketTCP_Connect(sfSocketTCP* socket, unsigned short port, sfIPAddress host, float timeout); //////////////////////////////////////////////////////////// /// Listen to a specified port for incoming data or connections /// -/// \param Socket : Socket to use for listening -/// \param Port : Port to listen to +/// \param socket : Socket to use for listening +/// \param port : Port to listen to /// /// \return sfTrue if operation has been successful /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfSocketTCP_Listen(sfSocketTCP* Socket, unsigned short Port); +CSFML_API sfBool sfSocketTCP_Listen(sfSocketTCP* socket, unsigned short port); //////////////////////////////////////////////////////////// /// 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 /// -/// \param Socket : Socket to use for accepting -/// \param Connected : Pointer to a socket pointer that will be filled with the connected client -/// \param Address : Pointer to an address to fill with client infos +/// \param socket : Socket to use for accepting +/// \param connected : Pointer to a socket pointer that will be filled with the connected client +/// \param address : Pointer to an address to fill with client infos /// /// \return Socket status /// //////////////////////////////////////////////////////////// -CSFML_API sfSocketStatus sfSocketTCP_Accept(sfSocketTCP* Socket, sfSocketTCP** Connected, sfIPAddress* Address); +CSFML_API sfSocketStatus sfSocketTCP_Accept(sfSocketTCP* socket, sfSocketTCP** connected, sfIPAddress* address); //////////////////////////////////////////////////////////// /// Send an array of bytes to the host (must be connected first) /// -/// \param Socket : Socket to use for sending -/// \param Data : Pointer to the bytes to send -/// \param Size : Number of bytes to send +/// \param socket : Socket to use for sending +/// \param data : Pointer to the bytes to send +/// \param size : Number of bytes to send /// /// \return Socket status /// //////////////////////////////////////////////////////////// -CSFML_API sfSocketStatus sfSocketTCP_Send(sfSocketTCP* Socket, const char* Data, size_t Size); +CSFML_API sfSocketStatus sfSocketTCP_Send(sfSocketTCP* socket, const char* data, size_t size); //////////////////////////////////////////////////////////// /// Receive an array of bytes from the host (must be connected first) /// -/// \param Socket : Socket to use for receiving -/// \param Data : Pointer to a byte array to fill (make sure it is big enough) -/// \param MaxSize : Maximum number of bytes to read -/// \param SizeReceived : Number of bytes received +/// \param socket : Socket to use for receiving +/// \param data : Pointer to a byte array to fill (make sure it is big enough) +/// \param maxSize : Maximum number of bytes to read +/// \param sizeReceived : Number of bytes received /// /// \return Socket status /// //////////////////////////////////////////////////////////// -CSFML_API sfSocketStatus sfSocketTCP_Receive(sfSocketTCP* Socket, char* Data, size_t MaxSize, size_t* SizeReceived); +CSFML_API sfSocketStatus sfSocketTCP_Receive(sfSocketTCP* socket, char* data, size_t maxSize, size_t* sizeReceived); //////////////////////////////////////////////////////////// /// Send a packet of data to the host (must be connected first) /// -/// \param Socket : Socket to use for sending -/// \param Packet : Packet to send +/// \param socket : Socket to use for sending +/// \param packet : Packet to send /// /// \return Socket status /// //////////////////////////////////////////////////////////// -CSFML_API sfSocketStatus sfSocketTCP_SendPacket(sfSocketTCP* Socket, sfPacket* Packet); +CSFML_API sfSocketStatus sfSocketTCP_SendPacket(sfSocketTCP* socket, sfPacket* packet); //////////////////////////////////////////////////////////// /// Receive a packet from the host (must be connected first) /// -/// \param Socket : Socket to use for receiving -/// \param Packet : Packet to fill with received data +/// \param socket : Socket to use for receiving +/// \param packet : Packet to fill with received data /// /// \return Socket status /// //////////////////////////////////////////////////////////// -CSFML_API sfSocketStatus sfSocketTCP_ReceivePacket(sfSocketTCP* Socket, sfPacket* Packet); +CSFML_API sfSocketStatus sfSocketTCP_ReceivePacket(sfSocketTCP* socket, sfPacket* packet); //////////////////////////////////////////////////////////// /// Check if a socket is in a valid state ; this function /// can be called any time to check if the socket is OK /// -/// \param Socket : Socket to check +/// \param socket : Socket to check /// /// \return True if the socket is valid /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfSocketTCP_IsValid(sfSocketTCP* Socket); +CSFML_API sfBool sfSocketTCP_IsValid(sfSocketTCP* socket); #endif // SFML_SOCKETTCP_H diff --git a/CSFML/include/SFML/Network/SocketUDP.h b/CSFML/include/SFML/Network/SocketUDP.h index 97fa9d402..3c00ae509 100644 --- a/CSFML/include/SFML/Network/SocketUDP.h +++ b/CSFML/include/SFML/Network/SocketUDP.h @@ -45,111 +45,111 @@ CSFML_API sfSocketUDP* sfSocketUDP_Create(); //////////////////////////////////////////////////////////// /// Destroy an existing UDP socket /// -/// \param Socket : Socket to destroy +/// \param socket : Socket to destroy /// //////////////////////////////////////////////////////////// -CSFML_API void sfSocketUDP_Destroy(sfSocketUDP* Socket); +CSFML_API void sfSocketUDP_Destroy(sfSocketUDP* socket); //////////////////////////////////////////////////////////// /// Change the blocking state of a UDP socket. /// The default behaviour of a socket is blocking /// -/// \param Socket : Socket to modify -/// \param Blocking : Pass sfTrue to set the socket as blocking, or false for non-blocking +/// \param socket : Socket to modify +/// \param blocking : Pass sfTrue to set the socket as blocking, or false for non-blocking /// //////////////////////////////////////////////////////////// -CSFML_API void sfSocketUDP_SetBlocking(sfSocketUDP* Socket, sfBool Blocking); +CSFML_API void sfSocketUDP_SetBlocking(sfSocketUDP* socket, sfBool blocking); //////////////////////////////////////////////////////////// /// Bind a socket to a specific port /// -/// \param Socket : Socket to bind -/// \param Port : Port to bind the socket to +/// \param socket : Socket to bind +/// \param port : Port to bind the socket to /// /// \return True if operation has been successful /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfSocketUDP_Bind(sfSocketUDP* Socket, unsigned short Port); +CSFML_API sfBool sfSocketUDP_Bind(sfSocketUDP* socket, unsigned short port); //////////////////////////////////////////////////////////// /// Unbind a socket from its previous port, if any /// -/// \param Socket : Socket to unbind +/// \param socket : Socket to unbind /// /// \return sfTrue if operation has been successful /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfSocketUDP_Unbind(sfSocketUDP* Socket); +CSFML_API sfBool sfSocketUDP_Unbind(sfSocketUDP* socket); //////////////////////////////////////////////////////////// /// Send an array of bytes /// -/// \param Socket : Socket to use for sending -/// \param Data : Pointer to the bytes to send -/// \param Size : Number of bytes to send -/// \param Address : Address of the computer to send the packet to -/// \param Port : Port to use for communication +/// \param socket : Socket to use for sending +/// \param data : Pointer to the bytes to send +/// \param size : Number of bytes to send +/// \param address : Address of the computer to send the packet to +/// \param port : Port to use for communication /// /// \return Socket status /// //////////////////////////////////////////////////////////// -CSFML_API sfSocketStatus sfSocketUDP_Send(sfSocketUDP* Socket, const char* Data, size_t Size, sfIPAddress Address, unsigned short Port); +CSFML_API sfSocketStatus sfSocketUDP_Send(sfSocketUDP* socket, const char* data, size_t size, sfIPAddress address, unsigned short port); //////////////////////////////////////////////////////////// /// Receive an array of bytes. /// This function is blocking, ie. it won't return before some /// bytes have been received /// -/// \param Socket : Socket to use for receiving -/// \param Data : Pointer to a byte array to fill (make sure it is big enough) -/// \param MaxSize : Maximum number of bytes to read -/// \param SizeReceived : Number of bytes received -/// \param Address : Address of the computer which sent the data -/// \param Port : Port on which the remote computer sent the data +/// \param socket : Socket to use for receiving +/// \param data : Pointer to a byte array to fill (make sure it is big enough) +/// \param maxSize : Maximum number of bytes to read +/// \param sizeReceived : Number of bytes received +/// \param address : Address of the computer which sent the data +/// \param port : Port on which the remote computer sent the data /// /// \return Socket status /// //////////////////////////////////////////////////////////// -CSFML_API sfSocketStatus sfSocketUDP_Receive(sfSocketUDP* Socket, char* Data, size_t MaxSize, size_t* SizeReceived, sfIPAddress* Address, unsigned short* Port); +CSFML_API sfSocketStatus sfSocketUDP_Receive(sfSocketUDP* socket, char* data, size_t maxSize, size_t* sizeReceived, sfIPAddress* address, unsigned short* port); //////////////////////////////////////////////////////////// /// Send a packet of data /// -/// \param Socket : Socket to use for sending -/// \param Packet : Packet to send -/// \param Address : Address of the computer to send the packet to -/// \param Port : Port to use for communication +/// \param socket : Socket to use for sending +/// \param packet : Packet to send +/// \param address : Address of the computer to send the packet to +/// \param port : Port to use for communication /// /// \return Socket status /// //////////////////////////////////////////////////////////// -CSFML_API sfSocketStatus sfSocketUDP_SendPacket(sfSocketUDP* Socket, sfPacket* Packet, sfIPAddress Address, unsigned short Port); +CSFML_API sfSocketStatus sfSocketUDP_SendPacket(sfSocketUDP* socket, sfPacket* packet, sfIPAddress address, unsigned short port); //////////////////////////////////////////////////////////// /// Receive a packet. /// This function is blocking, ie. it won't return before a /// packet is received /// -/// \param Socket : Socket to use for receiving -/// \param Packet : Packet to fill with received data -/// \param Address : Address of the computer which sent the packet -/// \param Port : Port on which the remote computer sent the data +/// \param socket : Socket to use for receiving +/// \param packet : Packet to fill with received data +/// \param address : Address of the computer which sent the packet +/// \param port : Port on which the remote computer sent the data /// /// \return Socket status /// //////////////////////////////////////////////////////////// -CSFML_API sfSocketStatus sfSocketUDP_ReceivePacket(sfSocketUDP* Socket, sfPacket* Packet, sfIPAddress* Address, unsigned short* Port); +CSFML_API sfSocketStatus sfSocketUDP_ReceivePacket(sfSocketUDP* socket, sfPacket* packet, sfIPAddress* address, unsigned short* port); //////////////////////////////////////////////////////////// /// Check if a socket is in a valid state ; this function /// can be called any time to check if the socket is OK /// -/// \param Socket : Socket to check +/// \param socket : Socket to check /// /// \return sfTrue if the socket is valid /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfSocketUDP_IsValid(sfSocketUDP* Socket); +CSFML_API sfBool sfSocketUDP_IsValid(sfSocketUDP* socket); #endif // SFML_SOCKETUDP_H diff --git a/CSFML/include/SFML/System/Clock.h b/CSFML/include/SFML/System/Clock.h index 363ce4a51..eca52ed85 100644 --- a/CSFML/include/SFML/System/Clock.h +++ b/CSFML/include/SFML/System/Clock.h @@ -43,26 +43,26 @@ CSFML_API sfClock* sfClock_Create(); //////////////////////////////////////////////////////////// /// Destroy an existing clock /// -/// \param Clock : Clock to delete +/// \param clock : Clock to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfClock_Destroy(sfClock* Clock); +CSFML_API void sfClock_Destroy(sfClock* clock); //////////////////////////////////////////////////////////// /// Get the time elapsed for a clock /// -/// \param Clock : Clock to get time from +/// \param clock : Clock to get time from /// //////////////////////////////////////////////////////////// -CSFML_API float sfClock_GetTime(sfClock* Clock); +CSFML_API float sfClock_GetTime(sfClock* clock); //////////////////////////////////////////////////////////// /// Restart a clock /// -/// \param Clock : Clock to restart +/// \param clock : Clock to restart /// //////////////////////////////////////////////////////////// -CSFML_API void sfClock_Reset(sfClock* Clock); +CSFML_API void sfClock_Reset(sfClock* clock); #endif // SFML_CLOCK_H diff --git a/CSFML/include/SFML/System/Mutex.h b/CSFML/include/SFML/System/Mutex.h index f0c8095b7..f60f89750 100644 --- a/CSFML/include/SFML/System/Mutex.h +++ b/CSFML/include/SFML/System/Mutex.h @@ -43,26 +43,26 @@ CSFML_API sfMutex* sfMutex_Create(); //////////////////////////////////////////////////////////// /// Destroy an existing mutex /// -/// \param Mutex : Mutex to delete +/// \param mutex : Mutex to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfMutex_Destroy(sfMutex* Mutex); +CSFML_API void sfMutex_Destroy(sfMutex* mutex); //////////////////////////////////////////////////////////// /// Lock a mutex /// -/// \param Mutex : Mutex to lock +/// \param mutex : Mutex to lock /// //////////////////////////////////////////////////////////// -CSFML_API void sfMutex_Lock(sfMutex* Mutex); +CSFML_API void sfMutex_Lock(sfMutex* mutex); //////////////////////////////////////////////////////////// /// Unlock a mutex /// -/// \param Mutex : Mutex to unlock +/// \param mutex : Mutex to unlock /// //////////////////////////////////////////////////////////// -CSFML_API void sfMutex_Unlock(sfMutex* Mutex); +CSFML_API void sfMutex_Unlock(sfMutex* mutex); #endif // SFML_MUTEX_H diff --git a/CSFML/include/SFML/System/Randomizer.h b/CSFML/include/SFML/System/Randomizer.h index ff8570cd1..52bd09216 100644 --- a/CSFML/include/SFML/System/Randomizer.h +++ b/CSFML/include/SFML/System/Randomizer.h @@ -35,10 +35,10 @@ /// Set the seed for the random numbers generator. Using a known seed /// allows you to reproduce the same sequence of random numbers /// -/// \param Seed : Number to use as the seed +/// \param seed : Number to use as the seed /// //////////////////////////////////////////////////////////// -CSFML_API void sfRandom_SetSeed(unsigned int Seed); +CSFML_API void sfRandom_SetSeed(unsigned int seed); //////////////////////////////////////////////////////////// /// Get the seed used to generate random numbers the generator @@ -51,24 +51,24 @@ CSFML_API unsigned int sfRandom_GetSeed(); //////////////////////////////////////////////////////////// /// Get a random float number in a given range /// -/// \return Start : Start of the range -/// \return End : End of the range +/// \return begin : Start of the range +/// \return end : End of the range /// -/// \return Random number in [Begin, End] +/// \return Random number in [begin, end] /// //////////////////////////////////////////////////////////// -CSFML_API float sfRandom_Float(float Begin, float End); +CSFML_API float sfRandom_Float(float begin, float end); //////////////////////////////////////////////////////////// /// Get a random integer number in a given range /// -/// \return Start : Start of the range -/// \return End : End of the range +/// \return begin : Start of the range +/// \return end : End of the range /// -/// \return Random number in [Begin, End] +/// \return Random number in [begin, end] /// //////////////////////////////////////////////////////////// -CSFML_API int sfRandom_Int(int Begin, int End); +CSFML_API int sfRandom_Int(int begin, int end); #endif // SFML_RANDOMIZER_H diff --git a/CSFML/include/SFML/System/Sleep.h b/CSFML/include/SFML/System/Sleep.h index 8461c4566..6177a6c9e 100644 --- a/CSFML/include/SFML/System/Sleep.h +++ b/CSFML/include/SFML/System/Sleep.h @@ -34,10 +34,10 @@ //////////////////////////////////////////////////////////// /// Make the current thread sleep for a given time /// -/// \param Duration : Time to sleep, in seconds +/// \param duration : Time to sleep, in seconds /// //////////////////////////////////////////////////////////// -CSFML_API void sfSleep(float Duration); +CSFML_API void sfSleep(float duration); #endif // SFML_SLEEP_H diff --git a/CSFML/include/SFML/System/Thread.h b/CSFML/include/SFML/System/Thread.h index 20972d824..05e485dce 100644 --- a/CSFML/include/SFML/System/Thread.h +++ b/CSFML/include/SFML/System/Thread.h @@ -35,35 +35,35 @@ //////////////////////////////////////////////////////////// /// Construct a new thread from a function pointer /// -/// \param Function : Entry point of the thread -/// \param UserData : Data to pass to the thread function +/// \param function : Entry point of the thread +/// \param userData : Data to pass to the thread function /// //////////////////////////////////////////////////////////// -CSFML_API sfThread* sfThread_Create(void (*Function)(void*), void* UserData); +CSFML_API sfThread* sfThread_Create(void (*function)(void*), void* userData); //////////////////////////////////////////////////////////// /// Destroy an existing thread /// -/// \param Thread : Thread to delete +/// \param thread : Thread to delete /// //////////////////////////////////////////////////////////// -CSFML_API void sfThread_Destroy(sfThread* Thread); +CSFML_API void sfThread_Destroy(sfThread* thread); //////////////////////////////////////////////////////////// /// Run a thread /// -/// \param Thread : Thread to launch +/// \param thread : Thread to launch /// //////////////////////////////////////////////////////////// -CSFML_API void sfThread_Launch(sfThread* Thread); +CSFML_API void sfThread_Launch(sfThread* thread); //////////////////////////////////////////////////////////// /// Wait until a thread finishes /// -/// \param Thread : Thread to wait for +/// \param thread : Thread to wait for /// //////////////////////////////////////////////////////////// -CSFML_API void sfThread_Wait(sfThread* Thread); +CSFML_API void sfThread_Wait(sfThread* thread); //////////////////////////////////////////////////////////// /// Terminate a thread @@ -71,10 +71,10 @@ CSFML_API void sfThread_Wait(sfThread* Thread); /// you should rather try to make the thread function /// terminate by itself /// -/// \param Thread : Thread to terminate +/// \param thread : Thread to terminate /// //////////////////////////////////////////////////////////// -CSFML_API void sfThread_Terminate(sfThread* Thread); +CSFML_API void sfThread_Terminate(sfThread* thread); #endif // SFML_THREAD_H diff --git a/CSFML/include/SFML/Window/Context.h b/CSFML/include/SFML/Window/Context.h index ca86157f0..81506894b 100644 --- a/CSFML/include/SFML/Window/Context.h +++ b/CSFML/include/SFML/Window/Context.h @@ -43,19 +43,19 @@ CSFML_API sfContext* sfContext_Create(); //////////////////////////////////////////////////////////// /// Destroy an existing context /// -/// \param Context : Context to destroy +/// \param context : Context to destroy /// //////////////////////////////////////////////////////////// -CSFML_API void sfContext_Destroy(sfContext* Context); +CSFML_API void sfContext_Destroy(sfContext* context); //////////////////////////////////////////////////////////// /// Activate or deactivate a context /// -/// \param Context : Context to activate or deactivate -/// \param Active : sfTrue to activate, sfFalse to deactivate +/// \param context : Context to activate or deactivate +/// \param active : sfTrue to activate, sfFalse to deactivate /// //////////////////////////////////////////////////////////// -CSFML_API void sfContext_SetActive(sfContext* Context, sfBool Active); +CSFML_API void sfContext_SetActive(sfContext* context, sfBool active); #endif // SFML_CONTEXT_H diff --git a/CSFML/include/SFML/Window/Input.h b/CSFML/include/SFML/Window/Input.h index d8aacaf1a..fa1ff0607 100644 --- a/CSFML/include/SFML/Window/Input.h +++ b/CSFML/include/SFML/Window/Input.h @@ -35,68 +35,68 @@ //////////////////////////////////////////////////////////// /// Get the state of a key /// -/// \param Input : Input object -/// \param KeyCode : Key to check +/// \param input : Input object +/// \param code : Key to check /// /// \return sfTrue if key is down, sfFalse if key is up /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfInput_IsKeyDown(sfInput* Input, sfKeyCode KeyCode); +CSFML_API sfBool sfInput_IsKeyDown(sfInput* input, sfKeyCode code); //////////////////////////////////////////////////////////// /// Get the state of a mouse button /// -/// \param Input : Input object -/// \param Button : Button to check +/// \param input : Input object +/// \param button : Button to check /// /// \return sfTrue if button is down, sfFalse if button is up /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfInput_IsMouseButtonDown(sfInput* Input, sfMouseButton Button); +CSFML_API sfBool sfInput_IsMouseButtonDown(sfInput* input, sfMouseButton button); //////////////////////////////////////////////////////////// /// Get the state of a joystick button /// -/// \param Input : Input object -/// \param JoyId : Identifier of the joystick to check (0 or 1) -/// \param Button : Button to check +/// \param input : Input object +/// \param joyId : Identifier of the joystick to check (0 or 1) +/// \param button : Button to check /// /// \return sfTrue if button is down, sfFalse if button is up /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfInput_IsJoystickButtonDown(sfInput* Input, unsigned int JoyId, unsigned int Button); +CSFML_API sfBool sfInput_IsJoystickButtonDown(sfInput* input, unsigned int joyId, unsigned int button); //////////////////////////////////////////////////////////// /// Get the mouse X position /// -/// \param Input : Input object +/// \param input : Input object /// /// \return Current mouse left position, relative to owner window /// //////////////////////////////////////////////////////////// -CSFML_API int sfInput_GetMouseX(sfInput* Input); +CSFML_API int sfInput_GetMouseX(sfInput* input); //////////////////////////////////////////////////////////// /// Get the mouse Y position /// -/// \param Input : Input object +/// \param input : Input object /// /// \return Current mouse top position, relative to owner window /// //////////////////////////////////////////////////////////// -CSFML_API int sfInput_GetMouseY(sfInput* Input); +CSFML_API int sfInput_GetMouseY(sfInput* input); //////////////////////////////////////////////////////////// /// Get the joystick position on a given axis /// -/// \param Input : Input object -/// \param JoyId : Identifier of the joystick to check (0 or 1) -/// \param Axis : Identifier of the axis to read +/// \param input : Input object +/// \param joyId : Identifier of the joystick to check (0 or 1) +/// \param axis : Identifier of the axis to read /// /// \return Current joystick position, in the range [-100, 100] /// //////////////////////////////////////////////////////////// -CSFML_API float sfInput_GetJoystickAxis(sfInput* Input, unsigned int JoyId, sfJoyAxis Axis); +CSFML_API float sfInput_GetJoystickAxis(sfInput* input, unsigned int joyId, sfJoyAxis axis); #endif // SFML_INPUT_H diff --git a/CSFML/include/SFML/Window/VideoMode.h b/CSFML/include/SFML/Window/VideoMode.h index ea3bfda03..ebbd0dda5 100644 --- a/CSFML/include/SFML/Window/VideoMode.h +++ b/CSFML/include/SFML/Window/VideoMode.h @@ -56,12 +56,12 @@ CSFML_API sfVideoMode sfVideoMode_GetDesktopMode(); /// Index must be in range [0, GetModesCount()[ /// Modes are sorted from best to worst /// -/// \param Index : Index of video mode to get +/// \param index : Index of video mode to get /// /// \return Corresponding video mode (invalid mode if index is out of range) /// //////////////////////////////////////////////////////////// -CSFML_API sfVideoMode sfVideoMode_GetMode(size_t Index); +CSFML_API sfVideoMode sfVideoMode_GetMode(size_t index); //////////////////////////////////////////////////////////// /// Get valid video modes count @@ -74,13 +74,13 @@ CSFML_API size_t sfVideoMode_GetModesCount(); //////////////////////////////////////////////////////////// /// Tell whether or not a video mode is supported /// -/// \param Mode : Video mode to check +/// \param mode : Video mode to check /// /// /// \return True if video mode is supported, false otherwise /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfVideoMode_IsValid(sfVideoMode Mode); +CSFML_API sfBool sfVideoMode_IsValid(sfVideoMode mode); #endif // SFML_VIDEOMODE_H diff --git a/CSFML/include/SFML/Window/Window.h b/CSFML/include/SFML/Window/Window.h index cb2bfb34a..d39ecf41c 100644 --- a/CSFML/include/SFML/Window/Window.h +++ b/CSFML/include/SFML/Window/Window.h @@ -63,225 +63,224 @@ typedef struct //////////////////////////////////////////////////////////// /// Construct a new window /// -/// \param Mode : Video mode to use -/// \param Title : Title of the window -/// \param Style : Window style -/// \param Params : Creation settings +/// \param mode : Video mode to use +/// \param title : Title of the window +/// \param style : Window style +/// \param settings : Creation settings /// //////////////////////////////////////////////////////////// -CSFML_API sfWindow* sfWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfContextSettings Params); +CSFML_API sfWindow* sfWindow_Create(sfVideoMode mode, const char* title, unsigned long style, sfContextSettings settings); //////////////////////////////////////////////////////////// /// Construct a window from an existing control /// -/// \param Handle : Platform-specific handle of the control -/// \param Params : Creation settings +/// \param handle : Platform-specific handle of the control +/// \param settings : Creation settings /// //////////////////////////////////////////////////////////// -CSFML_API sfWindow* sfWindow_CreateFromHandle(sfWindowHandle Handle, sfContextSettings Params); +CSFML_API sfWindow* sfWindow_CreateFromHandle(sfWindowHandle handle, sfContextSettings settings); //////////////////////////////////////////////////////////// /// Destroy an existing window /// -/// \param Window : Window to destroy +/// \param window : Window to destroy /// //////////////////////////////////////////////////////////// -CSFML_API void sfWindow_Destroy(sfWindow* Window); +CSFML_API void sfWindow_Destroy(sfWindow* window); //////////////////////////////////////////////////////////// /// Close a window (but doesn't destroy the internal data) /// -/// \param Window : Window to close +/// \param window : Window to close /// //////////////////////////////////////////////////////////// -CSFML_API void sfWindow_Close(sfWindow* Window); +CSFML_API void sfWindow_Close(sfWindow* window); //////////////////////////////////////////////////////////// /// Tell whether or not a window is opened /// -/// \param Window : Window object +/// \param window : Window object /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfWindow_IsOpened(sfWindow* Window); +CSFML_API sfBool sfWindow_IsOpened(sfWindow* window); //////////////////////////////////////////////////////////// /// Get the width of the rendering region of a window /// -/// \param Window : Window object +/// \param window : Window object /// /// \return Width in pixels /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfWindow_GetWidth(sfWindow* Window); +CSFML_API unsigned int sfWindow_GetWidth(sfWindow* window); //////////////////////////////////////////////////////////// /// Get the height of the rendering region of a window /// -/// \param Window : Window object +/// \param window : Window object /// /// \return Height in pixels /// //////////////////////////////////////////////////////////// -CSFML_API unsigned int sfWindow_GetHeight(sfWindow* Window); +CSFML_API unsigned int sfWindow_GetHeight(sfWindow* window); //////////////////////////////////////////////////////////// /// Get the creation settings of a window /// -/// \param Window : Window object +/// \param window : Window object /// /// \return Settings used to create the window /// //////////////////////////////////////////////////////////// -CSFML_API sfContextSettings sfWindow_GetSettings(sfWindow* Window); +CSFML_API sfContextSettings sfWindow_GetSettings(sfWindow* window); //////////////////////////////////////////////////////////// /// Get the event on top of events stack of a window, if any, and pop it /// -/// \param Window : Window object -/// \param Event : Event to fill, if any +/// \param window : Window object +/// \param event : Event to fill, if any /// /// \return sfTrue if an event was returned, sfFalse if events stack was empty /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfWindow_GetEvent(sfWindow* Window, sfEvent* Event); +CSFML_API sfBool sfWindow_GetEvent(sfWindow* window, sfEvent* event); //////////////////////////////////////////////////////////// /// Enable / disable vertical synchronization on a window /// -/// \param Window : Window object -/// \param Enabled : sfTrue to enable v-sync, sfFalse to deactivate +/// \param window : Window object +/// \param enabled : sfTrue to enable v-sync, sfFalse to deactivate /// //////////////////////////////////////////////////////////// -CSFML_API void sfWindow_UseVerticalSync(sfWindow* Window, sfBool Enabled); +CSFML_API void sfWindow_UseVerticalSync(sfWindow* window, sfBool enabled); //////////////////////////////////////////////////////////// /// Show or hide the mouse cursor on a window /// -/// \param Window : Window object -/// \param Show : sfTrue to show, sfFalse to hide +/// \param window : Window object +/// \param show : sfTrue to show, sfFalse to hide /// //////////////////////////////////////////////////////////// -CSFML_API void sfWindow_ShowMouseCursor(sfWindow* Window, sfBool Show); +CSFML_API void sfWindow_ShowMouseCursor(sfWindow* window, sfBool show); //////////////////////////////////////////////////////////// /// Change the position of the mouse cursor on a window /// -/// \param Window : Window object -/// \param Left : Left coordinate of the cursor, relative to the window -/// \param Top : Top coordinate of the cursor, relative to the window +/// \param window : Window object +/// \param left : Left coordinate of the cursor, relative to the window +/// \param top : Top coordinate of the cursor, relative to the window /// //////////////////////////////////////////////////////////// -CSFML_API void sfWindow_SetCursorPosition(sfWindow* Window, unsigned int Left, unsigned int Top); +CSFML_API void sfWindow_SetCursorPosition(sfWindow* window, unsigned int left, unsigned int Top); //////////////////////////////////////////////////////////// /// Change the position of a window on screen. /// Only works for top-level windows /// -/// \param Window : Window object -/// \param Left : Left position -/// \param Top : Top position +/// \param window : Window object +/// \param left : Left position +/// \param top : Top position /// //////////////////////////////////////////////////////////// -CSFML_API void sfWindow_SetPosition(sfWindow* Window, int Left, int Top); +CSFML_API void sfWindow_SetPosition(sfWindow* window, int left, int top); //////////////////////////////////////////////////////////// /// Change the size of the rendering region of a window /// -/// \param Window : Window object -/// \param Width : New Width -/// \param Height : New Height +/// \param window : Window object +/// \param width : New Width +/// \param height : New Height /// //////////////////////////////////////////////////////////// -CSFML_API void sfWindow_SetSize(sfWindow* Window, unsigned int Width, unsigned int Height); +CSFML_API void sfWindow_SetSize(sfWindow* window, unsigned int width, unsigned int height); //////////////////////////////////////////////////////////// /// Show or hide a window /// -/// \param Window : Window object -/// \param State : sfTrue to show, sfFalse to hide +/// \param window : Window object +/// \param show : sfTrue to show, sfFalse to hide /// //////////////////////////////////////////////////////////// -CSFML_API void sfWindow_Show(sfWindow* Window, sfBool State); +CSFML_API void sfWindow_Show(sfWindow* window, sfBool show); //////////////////////////////////////////////////////////// /// Enable or disable automatic key-repeat for keydown events. /// Automatic key-repeat is enabled by default /// -/// \param Window : Window object -/// \param Enabled : sfTrue to enable, sfFalse to disable +/// \param window : Window object +/// \param enabled : sfTrue to enable, sfFalse to disable /// //////////////////////////////////////////////////////////// -CSFML_API void sfWindow_EnableKeyRepeat(sfWindow* Window, sfBool Enabled); +CSFML_API void sfWindow_EnableKeyRepeat(sfWindow* window, sfBool enabled); //////////////////////////////////////////////////////////// /// Change the window's icon /// -/// \param Window : Window object -/// \param Width : Icon's width, in pixels -/// \param Height : Icon's height, in pixels -/// \param Pixels : Pointer to the pixels in memory, format must be RGBA 32 bits +/// \param window : Window object +/// \param width : Icon's width, in pixels +/// \param height : Icon's height, in pixels +/// \param pixels : Pointer to the pixels in memory, format must be RGBA 32 bits /// //////////////////////////////////////////////////////////// -CSFML_API void sfWindow_SetIcon(sfWindow* Window, unsigned int Width, unsigned int Height, sfUint8* Pixels); +CSFML_API void sfWindow_SetIcon(sfWindow* window, unsigned int width, unsigned int height, sfUint8* pixels); //////////////////////////////////////////////////////////// /// Activate or deactivate a window as the current target for rendering /// -/// \param Window : Window object -/// \param Active : sfTrue to activate, sfFalse to deactivate +/// \param window : Window object +/// \param active : sfTrue to activate, sfFalse to deactivate /// /// \return True if operation was successful, false otherwise /// //////////////////////////////////////////////////////////// -CSFML_API sfBool sfWindow_SetActive(sfWindow* Window, sfBool Active); +CSFML_API sfBool sfWindow_SetActive(sfWindow* window, sfBool active); //////////////////////////////////////////////////////////// /// Display a window on screen /// -/// \param Window : Window object +/// \param window : Window object /// //////////////////////////////////////////////////////////// -CSFML_API void sfWindow_Display(sfWindow* Window); +CSFML_API void sfWindow_Display(sfWindow* window); //////////////////////////////////////////////////////////// /// Get the input manager of a window /// -/// \param Window : Window object +/// \param window : Window object /// /// \return Reference to the input /// //////////////////////////////////////////////////////////// -CSFML_API sfInput* sfWindow_GetInput(sfWindow* Window); +CSFML_API sfInput* sfWindow_GetInput(sfWindow* window); //////////////////////////////////////////////////////////// /// Limit the framerate to a maximum fixed frequency for a window /// -/// \param Window : Window object -/// -/// \param Limit : Framerate limit, in frames per seconds (use 0 to disable limit) +/// \param window : Window object +/// \param limit : Framerate limit, in frames per seconds (use 0 to disable limit) /// //////////////////////////////////////////////////////////// -CSFML_API void sfWindow_SetFramerateLimit(sfWindow* Window, unsigned int Limit); +CSFML_API void sfWindow_SetFramerateLimit(sfWindow* window, unsigned int limit); //////////////////////////////////////////////////////////// /// Get time elapsed since last frame of a window /// -/// \param Window : Window object +/// \param window : Window object /// /// \return Time elapsed, in seconds /// //////////////////////////////////////////////////////////// -CSFML_API float sfWindow_GetFrameTime(sfWindow* Window); +CSFML_API float sfWindow_GetFrameTime(sfWindow* window); //////////////////////////////////////////////////////////// /// Change the joystick threshold, ie. the value below which /// no move event will be generated /// -/// \param Window : Window object -/// \param Threshold : New threshold, in range [0, 100] +/// \param window : Window object +/// \param threshold : New threshold, in range [0, 100] /// //////////////////////////////////////////////////////////// -CSFML_API void sfWindow_SetJoystickThreshold(sfWindow* Window, float Threshold); +CSFML_API void sfWindow_SetJoystickThreshold(sfWindow* window, float threshold); #endif // SFML_WINDOW_H diff --git a/CSFML/src/SFML/Audio/Listener.cpp b/CSFML/src/SFML/Audio/Listener.cpp index c80cc5e6b..0eb57ef6e 100644 --- a/CSFML/src/SFML/Audio/Listener.cpp +++ b/CSFML/src/SFML/Audio/Listener.cpp @@ -33,9 +33,9 @@ //////////////////////////////////////////////////////////// /// Change the global volume of all the sounds //////////////////////////////////////////////////////////// -void sfListener_SetGlobalVolume(float Volume) +void sfListener_SetGlobalVolume(float volume) { - sf::Listener::SetGlobalVolume(Volume); + sf::Listener::SetGlobalVolume(volume); } @@ -51,23 +51,23 @@ float sfListener_GetGlobalVolume() //////////////////////////////////////////////////////////// /// Change the position of the listener //////////////////////////////////////////////////////////// -void sfListener_SetPosition(float PosX, float PosY, float PosZ) +void sfListener_SetPosition(float x, float y, float PosZ) { - sf::Listener::SetPosition(sf::Vector3f(PosX, PosY, PosZ)); + sf::Listener::SetPosition(sf::Vector3f(x, y, PosZ)); } //////////////////////////////////////////////////////////// /// Get the current position of the listener //////////////////////////////////////////////////////////// -void sfListener_GetPosition(float* PosX, float* PosY, float* PosZ) +void sfListener_GetPosition(float* x, float* y, float* z) { - if (PosX && PosY && PosZ) + if (x && y && z) { - sf::Vector3f Position = sf::Listener::GetPosition(); - *PosX = Position.x; - *PosY = Position.y; - *PosZ = Position.z; + sf::Vector3f position = sf::Listener::GetPosition(); + *x = position.x; + *y = position.y; + *z = position.z; } } @@ -76,9 +76,9 @@ void sfListener_GetPosition(float* PosX, float* PosY, float* PosZ) /// Change the orientation of the listener (the point /// he must look at) //////////////////////////////////////////////////////////// -void sfListener_SetTarget(float TargetX, float TargetY, float TargetZ) +void sfListener_SetTarget(float x, float y, float z) { - sf::Listener::SetTarget(sf::Vector3f(TargetX, TargetY, TargetZ)); + sf::Listener::SetTarget(sf::Vector3f(x, y, z)); } @@ -86,13 +86,13 @@ void sfListener_SetTarget(float TargetX, float TargetY, float TargetZ) /// Get the current orientation of the listener (the point /// he's looking at) //////////////////////////////////////////////////////////// -void sfListener_GetTarget(float* TargetX, float* TargetY, float* TargetZ) +void sfListener_GetTarget(float* x, float* y, float* z) { - if (TargetX && TargetY && TargetZ) + if (x && y && z) { - sf::Vector3f Target = sf::Listener::GetTarget(); - *TargetX = Target.x; - *TargetY = Target.y; - *TargetZ = Target.z; + sf::Vector3f target = sf::Listener::GetTarget(); + *x = target.x; + *y = target.y; + *z = target.z; } } diff --git a/CSFML/src/SFML/Audio/Music.cpp b/CSFML/src/SFML/Audio/Music.cpp index e3e8ebbbf..5f364bba6 100644 --- a/CSFML/src/SFML/Audio/Music.cpp +++ b/CSFML/src/SFML/Audio/Music.cpp @@ -33,162 +33,162 @@ //////////////////////////////////////////////////////////// /// Create a new music and load it from a file //////////////////////////////////////////////////////////// -sfMusic* sfMusic_CreateFromFile(const char* Filename) +sfMusic* sfMusic_CreateFromFile(const char* filename) { - sfMusic* Music = new sfMusic; + sfMusic* music = new sfMusic; - if (!Music->This.OpenFromFile(Filename)) + if (!music->This.OpenFromFile(filename)) { - delete Music; - Music = NULL; + delete music; + music = NULL; } - return Music; + return music; } //////////////////////////////////////////////////////////// /// Create a new music and load it from a file in memory //////////////////////////////////////////////////////////// -sfMusic* sfMusic_CreateFromMemory(const char* Data, size_t SizeInBytes) +sfMusic* sfMusic_CreateFromMemory(const char* data, size_t sizeInBytes) { - sfMusic* Music = new sfMusic; + sfMusic* music = new sfMusic; - if (!Music->This.OpenFromMemory(Data, SizeInBytes)) + if (!music->This.OpenFromMemory(data, sizeInBytes)) { - delete Music; - Music = NULL; + delete music; + music = NULL; } - return Music; + return music; } //////////////////////////////////////////////////////////// /// Destroy an existing music //////////////////////////////////////////////////////////// -void sfMusic_Destroy(sfMusic* Music) +void sfMusic_Destroy(sfMusic* music) { - delete Music; + delete music; } //////////////////////////////////////////////////////////// /// Set a music loop state //////////////////////////////////////////////////////////// -void sfMusic_SetLoop(sfMusic* Music, sfBool Loop) +void sfMusic_SetLoop(sfMusic* music, sfBool loop) { - CSFML_CALL(Music, SetLoop(Loop != 0)); + CSFML_CALL(music, SetLoop(loop != 0)); } //////////////////////////////////////////////////////////// /// Tell whether or not a music is looping //////////////////////////////////////////////////////////// -sfBool sfMusic_GetLoop(sfMusic* Music) +sfBool sfMusic_GetLoop(sfMusic* music) { - CSFML_CALL_RETURN(Music, GetLoop(), sfFalse); + CSFML_CALL_RETURN(music, GetLoop(), sfFalse); } //////////////////////////////////////////////////////////// /// Get a music duration //////////////////////////////////////////////////////////// -float sfMusic_GetDuration(sfMusic* Music) +float sfMusic_GetDuration(sfMusic* music) { - CSFML_CALL_RETURN(Music, GetDuration(), 0.f); + CSFML_CALL_RETURN(music, GetDuration(), 0.f); } //////////////////////////////////////////////////////////// /// Start playing a music //////////////////////////////////////////////////////////// -void sfMusic_Play(sfMusic* Music) +void sfMusic_Play(sfMusic* music) { - CSFML_CALL(Music, Play()); + CSFML_CALL(music, Play()); } //////////////////////////////////////////////////////////// /// Pause a music //////////////////////////////////////////////////////////// -void sfMusic_Pause(sfMusic* Music) +void sfMusic_Pause(sfMusic* music) { - CSFML_CALL(Music, Pause()); + CSFML_CALL(music, Pause()); } //////////////////////////////////////////////////////////// /// Stop playing a music //////////////////////////////////////////////////////////// -void sfMusic_Stop(sfMusic* Music) +void sfMusic_Stop(sfMusic* music) { - CSFML_CALL(Music, Stop()); + CSFML_CALL(music, Stop()); } //////////////////////////////////////////////////////////// /// Return the number of channels of a music (1 = mono, 2 = stereo) //////////////////////////////////////////////////////////// -unsigned int sfMusic_GetChannelsCount(sfMusic* Music) +unsigned int sfMusic_GetChannelsCount(sfMusic* music) { - CSFML_CALL_RETURN(Music, GetChannelsCount(), 0); + CSFML_CALL_RETURN(music, GetChannelsCount(), 0); } //////////////////////////////////////////////////////////// /// Get the stream sample rate of a music //////////////////////////////////////////////////////////// -unsigned int sfMusic_GetSampleRate(sfMusic* Music) +unsigned int sfMusic_GetSampleRate(sfMusic* music) { - CSFML_CALL_RETURN(Music, GetSampleRate(), 0); + CSFML_CALL_RETURN(music, GetSampleRate(), 0); } //////////////////////////////////////////////////////////// /// Get the status of a music (stopped, paused, playing) //////////////////////////////////////////////////////////// -sfSoundStatus sfMusic_GetStatus(sfMusic* Music) +sfSoundStatus sfMusic_GetStatus(sfMusic* music) { - CSFML_CHECK_RETURN(Music, sfStopped); + CSFML_CHECK_RETURN(music, sfStopped); - return static_cast(Music->This.GetStatus()); + return static_cast(music->This.GetStatus()); } //////////////////////////////////////////////////////////// /// Get the current playing position of a music //////////////////////////////////////////////////////////// -float sfMusic_GetPlayingOffset(sfMusic* Music) +float sfMusic_GetPlayingOffset(sfMusic* music) { - CSFML_CALL_RETURN(Music, GetPlayingOffset(), 0.f); + CSFML_CALL_RETURN(music, GetPlayingOffset(), 0.f); } //////////////////////////////////////////////////////////// /// Set the pitch of a music //////////////////////////////////////////////////////////// -void sfMusic_SetPitch(sfMusic* Music, float Pitch) +void sfMusic_SetPitch(sfMusic* music, float pitch) { - CSFML_CALL(Music, SetPitch(Pitch)); + CSFML_CALL(music, SetPitch(pitch)); } //////////////////////////////////////////////////////////// /// Set the volume of a music //////////////////////////////////////////////////////////// -void sfMusic_SetVolume(sfMusic* Music, float Volume) +void sfMusic_SetVolume(sfMusic* music, float volume) { - CSFML_CALL(Music, SetVolume(Volume)); + CSFML_CALL(music, SetVolume(volume)); } //////////////////////////////////////////////////////////// /// Set the position of a music //////////////////////////////////////////////////////////// -void sfMusic_SetPosition(sfMusic* Music, float X, float Y, float Z) +void sfMusic_SetPosition(sfMusic* music, float x, float y, float z) { - CSFML_CALL(Music, SetPosition(sf::Vector3f(X, Y, Z))); + CSFML_CALL(music, SetPosition(sf::Vector3f(x, y, z))); } @@ -197,9 +197,9 @@ void sfMusic_SetPosition(sfMusic* Music, float X, float Y, float Z) /// position, or absolute. /// The default value is false (absolute) //////////////////////////////////////////////////////////// -void sfMusic_SetRelativeToListener(sfMusic* music, sfBool Relative) +void sfMusic_SetRelativeToListener(sfMusic* music, sfBool relative) { - CSFML_CALL(music, SetRelativeToListener(Relative == sfTrue)); + CSFML_CALL(music, SetRelativeToListener(relative == sfTrue)); } @@ -208,9 +208,9 @@ void sfMusic_SetRelativeToListener(sfMusic* music, sfBool Relative) /// the listener will hear the music at its maximum volume. /// The default minimum distance is 1.0 //////////////////////////////////////////////////////////// -void sfMusic_SetMinDistance(sfMusic* Music, float MinDistance) +void sfMusic_SetMinDistance(sfMusic* music, float distance) { - CSFML_CALL(Music, SetMinDistance(MinDistance)); + CSFML_CALL(music, SetMinDistance(distance)); } @@ -219,52 +219,52 @@ void sfMusic_SetMinDistance(sfMusic* Music, float MinDistance) /// more the sound will be attenuated with distance from listener. /// The default attenuation factor 1.0 //////////////////////////////////////////////////////////// -void sfMusic_SetAttenuation(sfMusic* Music, float Attenuation) +void sfMusic_SetAttenuation(sfMusic* music, float attenuation) { - CSFML_CALL(Music, SetAttenuation(Attenuation)); + CSFML_CALL(music, SetAttenuation(attenuation)); } //////////////////////////////////////////////////////////// /// Set the current playing position of a stream //////////////////////////////////////////////////////////// -void sfMusic_SetPlayingOffset(sfMusic* Music, float TimeOffset) +void sfMusic_SetPlayingOffset(sfMusic* music, float timeOffset) { - CSFML_CALL(Music, SetPlayingOffset(TimeOffset)); + CSFML_CALL(music, SetPlayingOffset(timeOffset)); } //////////////////////////////////////////////////////////// /// Get the pitch of a music //////////////////////////////////////////////////////////// -float sfMusic_GetPitch(sfMusic* Music) +float sfMusic_GetPitch(sfMusic* music) { - CSFML_CALL_RETURN(Music, GetPitch(), 0.f); + CSFML_CALL_RETURN(music, GetPitch(), 0.f); } //////////////////////////////////////////////////////////// /// Get the volume of a music //////////////////////////////////////////////////////////// -float sfMusic_GetVolume(sfMusic* Music) +float sfMusic_GetVolume(sfMusic* music) { - CSFML_CALL_RETURN(Music, GetVolume(), 0.f); + CSFML_CALL_RETURN(music, GetVolume(), 0.f); } //////////////////////////////////////////////////////////// /// Get the position of a music //////////////////////////////////////////////////////////// -void sfMusic_GetPosition(sfMusic* Music, float* X, float* Y, float* Z) +void sfMusic_GetPosition(sfMusic* music, float* x, float* y, float* z) { - CSFML_CHECK(Music); + CSFML_CHECK(music); - if (X && Y && Z) + if (x && y && z) { - sf::Vector3f Position = Music->This.GetPosition(); - *X = Position.x; - *Y = Position.y; - *Z = Position.z; + sf::Vector3f position = music->This.GetPosition(); + *x = position.x; + *y = position.y; + *z = position.z; } } @@ -273,25 +273,25 @@ void sfMusic_GetPosition(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(sfMusic* Music) +CSFML_API sfBool sfMusic_IsRelativeToListener(sfMusic* music) { - CSFML_CALL_RETURN(Music, IsRelativeToListener(), sfFalse); + CSFML_CALL_RETURN(music, IsRelativeToListener(), sfFalse); } //////////////////////////////////////////////////////////// /// Get the minimum distance of a music //////////////////////////////////////////////////////////// -float sfMusic_GetMinDistance(sfMusic* Music) +float sfMusic_GetMinDistance(sfMusic* music) { - CSFML_CALL_RETURN(Music, GetMinDistance(), 0.f); + CSFML_CALL_RETURN(music, GetMinDistance(), 0.f); } //////////////////////////////////////////////////////////// /// Get the attenuation factor of a a //////////////////////////////////////////////////////////// -float sfMusic_GetAttenuation(sfMusic* Music) +float sfMusic_GetAttenuation(sfMusic* music) { - CSFML_CALL_RETURN(Music, GetAttenuation(), 0.f); + CSFML_CALL_RETURN(music, GetAttenuation(), 0.f); } diff --git a/CSFML/src/SFML/Audio/Sound.cpp b/CSFML/src/SFML/Audio/Sound.cpp index ae82d8a5b..bf4622795 100644 --- a/CSFML/src/SFML/Audio/Sound.cpp +++ b/CSFML/src/SFML/Audio/Sound.cpp @@ -42,48 +42,48 @@ sfSound* sfSound_Create() //////////////////////////////////////////////////////////// /// Destroy an existing sound //////////////////////////////////////////////////////////// -void sfSound_Destroy(sfSound* Sound) +void sfSound_Destroy(sfSound* sound) { - delete Sound; + delete sound; } //////////////////////////////////////////////////////////// /// Start playing a sound //////////////////////////////////////////////////////////// -void sfSound_Play(sfSound* Sound) +void sfSound_Play(sfSound* sound) { - CSFML_CALL(Sound, Play()) + CSFML_CALL(sound, Play()) } //////////////////////////////////////////////////////////// /// Pause a sound //////////////////////////////////////////////////////////// -void sfSound_Pause(sfSound* Sound) +void sfSound_Pause(sfSound* sound) { - CSFML_CALL(Sound, Pause()) + CSFML_CALL(sound, Pause()) } //////////////////////////////////////////////////////////// /// Stop playing a sound //////////////////////////////////////////////////////////// -void sfSound_Stop(sfSound* Sound) +void sfSound_Stop(sfSound* sound) { - CSFML_CALL(Sound, Stop()) + CSFML_CALL(sound, Stop()) } //////////////////////////////////////////////////////////// /// Bind a sound buffer to a sound //////////////////////////////////////////////////////////// -void sfSound_SetBuffer(sfSound* Sound, sfSoundBuffer* Buffer) +void sfSound_SetBuffer(sfSound* sound, sfSoundBuffer* buffer) { - if (Buffer) + if (buffer) { - CSFML_CALL(Sound, SetBuffer(Buffer->This)) - Sound->Buffer = Buffer; + CSFML_CALL(sound, SetBuffer(buffer->This)) + sound->Buffer = buffer; } } @@ -91,67 +91,67 @@ void sfSound_SetBuffer(sfSound* Sound, sfSoundBuffer* Buffer) //////////////////////////////////////////////////////////// /// Get the sound buffer bound to a sound //////////////////////////////////////////////////////////// -sfSoundBuffer* sfSound_GetBuffer(sfSound* Sound) +sfSoundBuffer* sfSound_GetBuffer(sfSound* sound) { - CSFML_CHECK_RETURN(Sound, NULL) + CSFML_CHECK_RETURN(sound, NULL) - return Sound->Buffer; + return sound->Buffer; } //////////////////////////////////////////////////////////// /// Set a sound loop state //////////////////////////////////////////////////////////// -void sfSound_SetLoop(sfSound* Sound, sfBool Loop) +void sfSound_SetLoop(sfSound* sound, sfBool loop) { - CSFML_CALL(Sound, SetLoop(Loop == sfTrue)) + CSFML_CALL(sound, SetLoop(loop == sfTrue)) } //////////////////////////////////////////////////////////// /// Tell whether or not a sound is looping //////////////////////////////////////////////////////////// -sfBool sfSound_GetLoop(sfSound* Sound) +sfBool sfSound_GetLoop(sfSound* sound) { - CSFML_CALL_RETURN(Sound, GetLoop(), sfFalse) + CSFML_CALL_RETURN(sound, GetLoop(), sfFalse) } //////////////////////////////////////////////////////////// /// Get the status of a sound (stopped, paused, playing) //////////////////////////////////////////////////////////// -sfSoundStatus sfSound_GetStatus(sfSound* Sound) +sfSoundStatus sfSound_GetStatus(sfSound* sound) { - CSFML_CHECK_RETURN(Sound, sfStopped); + CSFML_CHECK_RETURN(sound, sfStopped); - return static_cast(Sound->This.GetStatus()); + return static_cast(sound->This.GetStatus()); } //////////////////////////////////////////////////////////// /// Set the pitch of a sound //////////////////////////////////////////////////////////// -void sfSound_SetPitch(sfSound* Sound, float Pitch) +void sfSound_SetPitch(sfSound* sound, float pitch) { - CSFML_CALL(Sound, SetPitch(Pitch)) + CSFML_CALL(sound, SetPitch(pitch)) } //////////////////////////////////////////////////////////// /// Set the volume of a sound //////////////////////////////////////////////////////////// -void sfSound_SetVolume(sfSound* Sound, float Volume) +void sfSound_SetVolume(sfSound* sound, float volume) { - CSFML_CALL(Sound, SetVolume(Volume)) + CSFML_CALL(sound, SetVolume(volume)) } //////////////////////////////////////////////////////////// /// Set the position of a sound //////////////////////////////////////////////////////////// -void sfSound_SetPosition(sfSound* Sound, float X, float Y, float Z) +void sfSound_SetPosition(sfSound* sound, float x, float y, float z) { - CSFML_CALL(Sound, SetPosition(sf::Vector3f(X, Y, Z))) + CSFML_CALL(sound, SetPosition(sf::Vector3f(x, y, z))) } @@ -160,9 +160,9 @@ void sfSound_SetPosition(sfSound* Sound, float X, float Y, float Z) /// position, or absolute. /// The default value is false (absolute) //////////////////////////////////////////////////////////// -void sfSound_SetRelativeToListener(sfSound* Sound, sfBool Relative) +void sfSound_SetRelativeToListener(sfSound* sound, sfBool relative) { - CSFML_CALL(Sound, SetRelativeToListener(Relative == sfTrue)); + CSFML_CALL(sound, SetRelativeToListener(relative == sfTrue)); } @@ -171,9 +171,9 @@ void sfSound_SetRelativeToListener(sfSound* Sound, sfBool Relative) /// the listener will hear the sound at its maximum volume. /// The default minimum distance is 1.0 //////////////////////////////////////////////////////////// -void sfSound_SetMinDistance(sfSound* Sound, float MinDistance) +void sfSound_SetMinDistance(sfSound* sound, float distance) { - CSFML_CALL(Sound, SetMinDistance(MinDistance)); + CSFML_CALL(sound, SetMinDistance(distance)); } @@ -182,50 +182,50 @@ void sfSound_SetMinDistance(sfSound* Sound, float MinDistance) /// more the sound will be attenuated with distance from listener. /// The default attenuation factor is 1.0 //////////////////////////////////////////////////////////// -void sfSound_SetAttenuation(sfSound* Sound, float Attenuation) +void sfSound_SetAttenuation(sfSound* sound, float attenuation) { - CSFML_CALL(Sound, SetAttenuation(Attenuation)); + CSFML_CALL(sound, SetAttenuation(attenuation)); } //////////////////////////////////////////////////////////// /// Set the current playing position of a sound //////////////////////////////////////////////////////////// -void sfSound_SetPlayingOffset(sfSound* Sound, float TimeOffset) +void sfSound_SetPlayingOffset(sfSound* sound, float timeOffset) { - CSFML_CALL(Sound, SetPlayingOffset(TimeOffset)); + CSFML_CALL(sound, SetPlayingOffset(timeOffset)); } //////////////////////////////////////////////////////////// /// Get the pitch of a sound //////////////////////////////////////////////////////////// -float sfSound_GetPitch(sfSound* Sound) +float sfSound_GetPitch(sfSound* sound) { - CSFML_CALL_RETURN(Sound, GetPitch(), 0.f) + CSFML_CALL_RETURN(sound, GetPitch(), 0.f) } //////////////////////////////////////////////////////////// /// Get the volume of a sound //////////////////////////////////////////////////////////// -float sfSound_GetVolume(sfSound* Sound) +float sfSound_GetVolume(sfSound* sound) { - CSFML_CALL_RETURN(Sound, GetVolume(), 0.f) + CSFML_CALL_RETURN(sound, GetVolume(), 0.f) } //////////////////////////////////////////////////////////// /// Get the position of a sound //////////////////////////////////////////////////////////// -void sfSound_GetPosition(sfSound* Sound, float* X, float* Y, float* Z) +void sfSound_GetPosition(sfSound* sound, float* x, float* y, float* z) { - CSFML_CHECK(Sound); + CSFML_CHECK(sound); - sf::Vector3f Position = Sound->This.GetPosition(); - if (X) *X = Position.x; - if (Y) *Y = Position.y; - if (Z) *Z = Position.z; + sf::Vector3f position = sound->This.GetPosition(); + if (x) *x = position.x; + if (y) *y = position.y; + if (z) *z = position.z; } @@ -233,34 +233,34 @@ void sfSound_GetPosition(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(sfSound* Sound) +CSFML_API sfBool sfSound_IsRelativeToListener(sfSound* sound) { - CSFML_CALL_RETURN(Sound, IsRelativeToListener(), sfFalse); + CSFML_CALL_RETURN(sound, IsRelativeToListener(), sfFalse); } //////////////////////////////////////////////////////////// /// Get the minimum distance of a sound //////////////////////////////////////////////////////////// -float sfSound_GetMinDistance(sfSound* Sound) +float sfSound_GetMinDistance(sfSound* sound) { - CSFML_CALL_RETURN(Sound, GetMinDistance(), 0.f); + CSFML_CALL_RETURN(sound, GetMinDistance(), 0.f); } //////////////////////////////////////////////////////////// /// Get the attenuation factor of a sound //////////////////////////////////////////////////////////// -float sfSound_GetAttenuation(sfSound* Sound) +float sfSound_GetAttenuation(sfSound* sound) { - CSFML_CALL_RETURN(Sound, GetAttenuation(), 0.f); + CSFML_CALL_RETURN(sound, GetAttenuation(), 0.f); } //////////////////////////////////////////////////////////// /// Get the current playing position of a sound //////////////////////////////////////////////////////////// -float sfSound_GetPlayingOffset(sfSound* Sound) +float sfSound_GetPlayingOffset(sfSound* sound) { - CSFML_CALL_RETURN(Sound, GetPlayingOffset(), 0.f) + CSFML_CALL_RETURN(sound, GetPlayingOffset(), 0.f) } diff --git a/CSFML/src/SFML/Audio/SoundBuffer.cpp b/CSFML/src/SFML/Audio/SoundBuffer.cpp index 2c28a65eb..8a85ba6b6 100644 --- a/CSFML/src/SFML/Audio/SoundBuffer.cpp +++ b/CSFML/src/SFML/Audio/SoundBuffer.cpp @@ -33,34 +33,34 @@ //////////////////////////////////////////////////////////// /// Create a new sound buffer and load it from a file //////////////////////////////////////////////////////////// -sfSoundBuffer* sfSoundBuffer_CreateFromFile(const char* Filename) +sfSoundBuffer* sfSoundBuffer_CreateFromFile(const char* filename) { - sfSoundBuffer* Buffer = new sfSoundBuffer; + sfSoundBuffer* buffer = new sfSoundBuffer; - if (!Buffer->This.LoadFromFile(Filename)) + if (!buffer->This.LoadFromFile(filename)) { - delete Buffer; - Buffer = NULL; + delete buffer; + buffer = NULL; } - return Buffer; + return buffer; } //////////////////////////////////////////////////////////// /// Create a new sound buffer and load it from a file in memory //////////////////////////////////////////////////////////// -sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const char* Data, size_t SizeInBytes) +sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const char* data, size_t sizeInBytes) { - sfSoundBuffer* Buffer = new sfSoundBuffer; + sfSoundBuffer* buffer = new sfSoundBuffer; - if (!Buffer->This.LoadFromMemory(Data, SizeInBytes)) + if (!buffer->This.LoadFromMemory(data, sizeInBytes)) { - delete Buffer; - Buffer = NULL; + delete buffer; + buffer = NULL; } - return Buffer; + return buffer; } @@ -69,78 +69,78 @@ sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const char* Data, size_t SizeInByt /// samples in memory - assumed format for samples is /// 16 bits signed integer //////////////////////////////////////////////////////////// -sfSoundBuffer* sfSoundBuffer_CreateFromSamples(const sfInt16* Samples, size_t SamplesCount, unsigned int ChannelsCount, unsigned int SampleRate) +sfSoundBuffer* sfSoundBuffer_CreateFromSamples(const sfInt16* samples, size_t samplesCount, unsigned int channelsCount, unsigned int sampleRate) { - sfSoundBuffer* Buffer = new sfSoundBuffer; + sfSoundBuffer* buffer = new sfSoundBuffer; - if (!Buffer->This.LoadFromSamples(Samples, SamplesCount, ChannelsCount, SampleRate)) + if (!buffer->This.LoadFromSamples(samples, samplesCount, channelsCount, sampleRate)) { - delete Buffer; - Buffer = NULL; + delete buffer; + buffer = NULL; } - return Buffer; + return buffer; } //////////////////////////////////////////////////////////// /// Destroy an existing sound buffer //////////////////////////////////////////////////////////// -void sfSoundBuffer_Destroy(sfSoundBuffer* SoundBuffer) +void sfSoundBuffer_Destroy(sfSoundBuffer* soundBuffer) { - delete SoundBuffer; + delete soundBuffer; } //////////////////////////////////////////////////////////// /// Save a sound buffer to a file //////////////////////////////////////////////////////////// -sfBool sfSoundBuffer_SaveToFile(sfSoundBuffer* SoundBuffer, const char* Filename) +sfBool sfSoundBuffer_SaveToFile(sfSoundBuffer* soundBuffer, const char* filename) { - CSFML_CALL_RETURN(SoundBuffer, SaveToFile(Filename), sfFalse) + CSFML_CALL_RETURN(soundBuffer, SaveToFile(filename), sfFalse) } //////////////////////////////////////////////////////////// /// Return the samples contained in a sound buffer //////////////////////////////////////////////////////////// -const sfInt16* sfSoundBuffer_GetSamples(sfSoundBuffer* SoundBuffer) +const sfInt16* sfSoundBuffer_GetSamples(sfSoundBuffer* soundBuffer) { - CSFML_CALL_RETURN(SoundBuffer, GetSamples(), NULL) + CSFML_CALL_RETURN(soundBuffer, GetSamples(), NULL) } //////////////////////////////////////////////////////////// /// Return the number of samples contained in a sound buffer //////////////////////////////////////////////////////////// -size_t sfSoundBuffer_GetSamplesCount(sfSoundBuffer* SoundBuffer) +size_t sfSoundBuffer_GetSamplesCount(sfSoundBuffer* soundBuffer) { - CSFML_CALL_RETURN(SoundBuffer, GetSamplesCount(), 0) + CSFML_CALL_RETURN(soundBuffer, GetSamplesCount(), 0) } //////////////////////////////////////////////////////////// /// Get the sample rate of a sound buffer //////////////////////////////////////////////////////////// -unsigned int sfSoundBuffer_GetSampleRate(sfSoundBuffer* SoundBuffer) +unsigned int sfSoundBuffer_GetSampleRate(sfSoundBuffer* soundBuffer) { - CSFML_CALL_RETURN(SoundBuffer, GetSampleRate(), 0) + CSFML_CALL_RETURN(soundBuffer, GetSampleRate(), 0) } //////////////////////////////////////////////////////////// /// Return the number of channels of a sound buffer (1 = mono, 2 = stereo, ...) //////////////////////////////////////////////////////////// -unsigned int sfSoundBuffer_GetChannelsCount(sfSoundBuffer* SoundBuffer) +unsigned int sfSoundBuffer_GetChannelsCount(sfSoundBuffer* soundBuffer) { - CSFML_CALL_RETURN(SoundBuffer, GetChannelsCount(), 0) + CSFML_CALL_RETURN(soundBuffer, GetChannelsCount(), 0) } //////////////////////////////////////////////////////////// /// Get the duration of a sound buffer //////////////////////////////////////////////////////////// -float sfSoundBuffer_GetDuration(sfSoundBuffer* SoundBuffer) +float sfSoundBuffer_GetDuration(sfSoundBuffer* soundBuffer) { - CSFML_CALL_RETURN(SoundBuffer, GetDuration(), 0.f) + CSFML_CALL_RETURN(soundBuffer, GetDuration(), 0.f) } diff --git a/CSFML/src/SFML/Audio/SoundBufferRecorder.cpp b/CSFML/src/SFML/Audio/SoundBufferRecorder.cpp index b5d705b43..a49c6c885 100644 --- a/CSFML/src/SFML/Audio/SoundBufferRecorder.cpp +++ b/CSFML/src/SFML/Audio/SoundBufferRecorder.cpp @@ -42,9 +42,9 @@ sfSoundBufferRecorder* sfSoundBufferRecorder_Create() //////////////////////////////////////////////////////////// /// Destroy an existing sound buffer recorder //////////////////////////////////////////////////////////// -void sfSoundBufferRecorder_Destroy(sfSoundBufferRecorder* SoundBufferRecorder) +void sfSoundBufferRecorder_Destroy(sfSoundBufferRecorder* soundBufferRecorder) { - delete SoundBufferRecorder; + delete soundBufferRecorder; } @@ -52,27 +52,27 @@ 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) +void sfSoundBufferRecorder_Start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate) { - CSFML_CALL(SoundBufferRecorder, Start(SampleRate)); + CSFML_CALL(soundBufferRecorder, Start(sampleRate)); } //////////////////////////////////////////////////////////// /// Stop the capture //////////////////////////////////////////////////////////// -void sfSoundBufferRecorder_Stop(sfSoundBufferRecorder* SoundBufferRecorder) +void sfSoundBufferRecorder_Stop(sfSoundBufferRecorder* soundBufferRecorder) { - CSFML_CALL(SoundBufferRecorder, Stop()); + CSFML_CALL(soundBufferRecorder, Stop()); } //////////////////////////////////////////////////////////// /// Get the sample rate of a sound buffer recorder //////////////////////////////////////////////////////////// -unsigned int sfSoundBufferRecorder_GetSampleRate(sfSoundBufferRecorder* SoundBufferRecorder) +unsigned int sfSoundBufferRecorder_GetSampleRate(sfSoundBufferRecorder* soundBufferRecorder) { - CSFML_CALL_RETURN(SoundBufferRecorder, GetSampleRate(), 0); + CSFML_CALL_RETURN(soundBufferRecorder, GetSampleRate(), 0); } @@ -80,11 +80,11 @@ unsigned int sfSoundBufferRecorder_GetSampleRate(sfSoundBufferRecorder* SoundBuf /// Get the sound buffer containing the captured audio data /// of a sound buffer recorder //////////////////////////////////////////////////////////// -sfSoundBuffer* sfSoundBufferRecorder_GetBuffer(sfSoundBufferRecorder* SoundBufferRecorder) +sfSoundBuffer* sfSoundBufferRecorder_GetBuffer(sfSoundBufferRecorder* soundBufferRecorder) { - CSFML_CHECK_RETURN(SoundBufferRecorder, NULL); + CSFML_CHECK_RETURN(soundBufferRecorder, NULL); - SoundBufferRecorder->SoundBuffer.This = SoundBufferRecorder->This.GetBuffer(); + soundBufferRecorder->SoundBuffer.This = soundBufferRecorder->This.GetBuffer(); - return &SoundBufferRecorder->SoundBuffer; + return &soundBufferRecorder->SoundBuffer; } diff --git a/CSFML/src/SFML/Audio/SoundRecorder.cpp b/CSFML/src/SFML/Audio/SoundRecorder.cpp index 6013608fb..9332ac87b 100644 --- a/CSFML/src/SFML/Audio/SoundRecorder.cpp +++ b/CSFML/src/SFML/Audio/SoundRecorder.cpp @@ -34,21 +34,21 @@ /// Construct a new sound recorder with callback functions /// for processing captured samples //////////////////////////////////////////////////////////// -sfSoundRecorder* sfSoundRecorder_Create(sfSoundRecorderStartCallback OnStart, - sfSoundRecorderProcessCallback OnProcess, - sfSoundRecorderStopCallback OnStop, - void* UserData) +sfSoundRecorder* sfSoundRecorder_Create(sfSoundRecorderStartCallback onStart, + sfSoundRecorderProcessCallback onProcess, + sfSoundRecorderStopCallback onStop, + void* userData) { - return new sfSoundRecorder(OnStart, OnProcess, OnStop, UserData); + return new sfSoundRecorder(onStart, onProcess, onStop, userData); } //////////////////////////////////////////////////////////// /// Destroy an existing sound recorder //////////////////////////////////////////////////////////// -void sfSoundRecorder_Destroy(sfSoundRecorder* SoundRecorder) +void sfSoundRecorder_Destroy(sfSoundRecorder* soundRecorder) { - delete SoundRecorder; + delete soundRecorder; } @@ -56,27 +56,27 @@ 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) +void sfSoundRecorder_Start(sfSoundRecorder* soundRecorder, unsigned int sampleRate) { - CSFML_CALL(SoundRecorder, Start(SampleRate)); + CSFML_CALL(soundRecorder, Start(sampleRate)); } //////////////////////////////////////////////////////////// /// Stop the capture //////////////////////////////////////////////////////////// -void sfSoundRecorder_Stop(sfSoundRecorder* SoundRecorder) +void sfSoundRecorder_Stop(sfSoundRecorder* soundRecorder) { - CSFML_CALL(SoundRecorder, Stop()); + CSFML_CALL(soundRecorder, Stop()); } //////////////////////////////////////////////////////////// /// Get the sample rate of a sound recorder //////////////////////////////////////////////////////////// -unsigned int sfSoundRecorder_GetSampleRate(sfSoundRecorder* SoundRecorder) +unsigned int sfSoundRecorder_GetSampleRate(sfSoundRecorder* soundRecorder) { - CSFML_CALL_RETURN(SoundRecorder, GetSampleRate(), 0); + CSFML_CALL_RETURN(soundRecorder, GetSampleRate(), 0); } diff --git a/CSFML/src/SFML/Audio/SoundStream.cpp b/CSFML/src/SFML/Audio/SoundStream.cpp index 209e99437..3a97ea369 100644 --- a/CSFML/src/SFML/Audio/SoundStream.cpp +++ b/CSFML/src/SFML/Audio/SoundStream.cpp @@ -33,60 +33,60 @@ //////////////////////////////////////////////////////////// /// Construct a new sound stream //////////////////////////////////////////////////////////// -sfSoundStream* sfSoundStream_Create(sfSoundStreamGetDataCallback OnGetData, - sfSoundStreamSeekCallback OnSeek, - unsigned int ChannelsCount, - unsigned int SampleRate, - void* UserData) +sfSoundStream* sfSoundStream_Create(sfSoundStreamGetDataCallback onGetData, + sfSoundStreamSeekCallback onSeek, + unsigned int channelsCount, + unsigned int sampleRate, + void* userData) { - return new sfSoundStream(OnGetData, OnSeek, ChannelsCount, SampleRate, UserData); + return new sfSoundStream(onGetData, onSeek, channelsCount, sampleRate, userData); } //////////////////////////////////////////////////////////// /// Destroy an existing sound stream //////////////////////////////////////////////////////////// -void sfSoundStream_Destroy(sfSoundStream* SoundStream) +void sfSoundStream_Destroy(sfSoundStream* soundStream) { - delete SoundStream; + delete soundStream; } //////////////////////////////////////////////////////////// /// Start playing a sound stream //////////////////////////////////////////////////////////// -void sfSoundStream_Play(sfSoundStream* SoundStream) +void sfSoundStream_Play(sfSoundStream* soundStream) { - CSFML_CALL(SoundStream, Play()); + CSFML_CALL(soundStream, Play()); } //////////////////////////////////////////////////////////// /// Pause a sound stream //////////////////////////////////////////////////////////// -void sfSoundStream_Pause(sfSoundStream* SoundStream) +void sfSoundStream_Pause(sfSoundStream* soundStream) { - CSFML_CALL(SoundStream, Pause()); + CSFML_CALL(soundStream, Pause()); } //////////////////////////////////////////////////////////// /// Stop playing a sound stream //////////////////////////////////////////////////////////// -void sfSoundStream_Stop(sfSoundStream* SoundStream) +void sfSoundStream_Stop(sfSoundStream* soundStream) { - CSFML_CALL(SoundStream, Stop()); + CSFML_CALL(soundStream, Stop()); } //////////////////////////////////////////////////////////// /// Get the status of a sound stream (stopped, paused, playing) //////////////////////////////////////////////////////////// -sfSoundStatus sfSoundStream_GetStatus(sfSoundStream* SoundStream) +sfSoundStatus sfSoundStream_GetStatus(sfSoundStream* soundStream) { - CSFML_CHECK_RETURN(SoundStream, sfStopped); + CSFML_CHECK_RETURN(soundStream, sfStopped); - return static_cast(SoundStream->This.GetStatus()); + return static_cast(soundStream->This.GetStatus()); } @@ -94,45 +94,45 @@ sfSoundStatus sfSoundStream_GetStatus(sfSoundStream* SoundStream) /// Return the number of channels of a sound stream /// (1 = mono, 2 = stereo) //////////////////////////////////////////////////////////// -unsigned int sfSoundStream_GetChannelsCount(sfSoundStream* SoundStream) +unsigned int sfSoundStream_GetChannelsCount(sfSoundStream* soundStream) { - CSFML_CALL_RETURN(SoundStream, GetChannelsCount(), 0); + CSFML_CALL_RETURN(soundStream, GetChannelsCount(), 0); } //////////////////////////////////////////////////////////// /// Get the sample rate of a sound stream //////////////////////////////////////////////////////////// -unsigned int sfSoundStream_GetSampleRate(sfSoundStream* SoundStream) +unsigned int sfSoundStream_GetSampleRate(sfSoundStream* soundStream) { - CSFML_CALL_RETURN(SoundStream, GetSampleRate(), 0); + CSFML_CALL_RETURN(soundStream, GetSampleRate(), 0); } //////////////////////////////////////////////////////////// /// Set the pitch of a sound stream //////////////////////////////////////////////////////////// -void sfSoundStream_SetPitch(sfSoundStream* SoundStream, float Pitch) +void sfSoundStream_SetPitch(sfSoundStream* soundStream, float pitch) { - CSFML_CALL(SoundStream, SetPitch(Pitch)); + CSFML_CALL(soundStream, SetPitch(pitch)); } //////////////////////////////////////////////////////////// /// Set the volume of a sound stream //////////////////////////////////////////////////////////// -void sfSoundStream_SetVolume(sfSoundStream* SoundStream, float Volume) +void sfSoundStream_SetVolume(sfSoundStream* soundStream, float volume) { - CSFML_CALL(SoundStream, SetVolume(Volume)); + CSFML_CALL(soundStream, SetVolume(volume)); } //////////////////////////////////////////////////////////// /// Set the position of a sound stream //////////////////////////////////////////////////////////// -void sfSoundStream_SetPosition(sfSoundStream* SoundStream, float X, float Y, float Z) +void sfSoundStream_SetPosition(sfSoundStream* soundStream, float x, float y, float z) { - CSFML_CALL(SoundStream, SetPosition(X, Y, Z)); + CSFML_CALL(soundStream, SetPosition(x, y, z)); } @@ -141,9 +141,9 @@ void sfSoundStream_SetPosition(sfSoundStream* SoundStream, float X, float Y, flo /// position, or absolute. /// The default value is false (absolute) //////////////////////////////////////////////////////////// -void sfSoundStream_SetRelativeToListener(sfSoundStream* SoundStream, sfBool Relative) +void sfSoundStream_SetRelativeToListener(sfSoundStream* soundStream, sfBool relative) { - CSFML_CALL(SoundStream, SetRelativeToListener(Relative == sfTrue)); + CSFML_CALL(soundStream, SetRelativeToListener(relative == sfTrue)); } @@ -152,9 +152,9 @@ void sfSoundStream_SetRelativeToListener(sfSoundStream* SoundStream, sfBool Rela /// the listener will hear the sound stream at its maximum volume. /// The default minimum distance is 1.0 //////////////////////////////////////////////////////////// -void sfSoundStream_SetMinDistance(sfSoundStream* SoundStream, float MinDistance) +void sfSoundStream_SetMinDistance(sfSoundStream* soundStream, float distance) { - CSFML_CALL(SoundStream, SetMinDistance(MinDistance)); + CSFML_CALL(soundStream, SetMinDistance(distance)); } @@ -163,59 +163,59 @@ void sfSoundStream_SetMinDistance(sfSoundStream* SoundStream, float MinDistance) /// more the sound stream will be attenuated with distance from listener. /// The default attenuation factor 1.0 //////////////////////////////////////////////////////////// -void sfSoundStream_SetAttenuation(sfSoundStream* SoundStream, float Attenuation) +void sfSoundStream_SetAttenuation(sfSoundStream* soundStream, float attenuation) { - CSFML_CALL(SoundStream, SetAttenuation(Attenuation)); + CSFML_CALL(soundStream, SetAttenuation(attenuation)); } //////////////////////////////////////////////////////////// /// Set the current playing position of a stream //////////////////////////////////////////////////////////// -void sfSoundStream_SetPlayingOffset(sfSoundStream* SoundStream, float TimeOffset) +void sfSoundStream_SetPlayingOffset(sfSoundStream* soundStream, float timeOffset) { - CSFML_CALL(SoundStream, SetPlayingOffset(TimeOffset)); + CSFML_CALL(soundStream, SetPlayingOffset(timeOffset)); } //////////////////////////////////////////////////////////// /// Set a stream loop state //////////////////////////////////////////////////////////// -void sfSoundStream_SetLoop(sfSoundStream* SoundStream, sfBool Loop) +void sfSoundStream_SetLoop(sfSoundStream* soundStream, sfBool loop) { - CSFML_CALL(SoundStream, SetLoop(Loop == sfTrue)); + CSFML_CALL(soundStream, SetLoop(loop == sfTrue)); } //////////////////////////////////////////////////////////// /// Get the pitch of a sound stream //////////////////////////////////////////////////////////// -float sfSoundStream_GetPitch(sfSoundStream* SoundStream) +float sfSoundStream_GetPitch(sfSoundStream* soundStream) { - CSFML_CALL_RETURN(SoundStream, GetPitch(), 0.f); + CSFML_CALL_RETURN(soundStream, GetPitch(), 0.f); } //////////////////////////////////////////////////////////// /// Get the volume of a sound stream //////////////////////////////////////////////////////////// -float sfSoundStream_GetVolume(sfSoundStream* SoundStream) +float sfSoundStream_GetVolume(sfSoundStream* soundStream) { - CSFML_CALL_RETURN(SoundStream, GetVolume(), 0.f); + CSFML_CALL_RETURN(soundStream, GetVolume(), 0.f); } //////////////////////////////////////////////////////////// /// Get the position of a sound stream //////////////////////////////////////////////////////////// -void sfSoundStream_GetPosition(sfSoundStream* SoundStream, float* X, float* Y, float* Z) +void sfSoundStream_GetPosition(sfSoundStream* soundStream, float* x, float* y, float* z) { - CSFML_CHECK(SoundStream); + CSFML_CHECK(soundStream); - sf::Vector3f Position = SoundStream->This.GetPosition(); - if (X) *X = Position.x; - if (Y) *Y = Position.y; - if (Z) *Z = Position.z; + sf::Vector3f position = soundStream->This.GetPosition(); + if (x) *x = position.x; + if (y) *y = position.y; + if (z) *z = position.z; } @@ -223,43 +223,43 @@ void sfSoundStream_GetPosition(sfSoundStream* SoundStream, float* X, float* Y, f /// Tell if the sound stream's position is relative to the listener's /// position, or if it's absolute //////////////////////////////////////////////////////////// -CSFML_API sfBool sfSoundStream_IsRelativeToListener(sfSoundStream* SoundStream) +CSFML_API sfBool sfSoundStream_IsRelativeToListener(sfSoundStream* soundStream) { - CSFML_CALL_RETURN(SoundStream, IsRelativeToListener(), sfFalse); + CSFML_CALL_RETURN(soundStream, IsRelativeToListener(), sfFalse); } //////////////////////////////////////////////////////////// /// Get the minimum distance of a sound stream //////////////////////////////////////////////////////////// -float sfSoundStream_GetMinDistance(sfSoundStream* SoundStream) +float sfSoundStream_GetMinDistance(sfSoundStream* soundStream) { - CSFML_CALL_RETURN(SoundStream, GetMinDistance(), 0.f); + CSFML_CALL_RETURN(soundStream, GetMinDistance(), 0.f); } //////////////////////////////////////////////////////////// /// Get the attenuation factor of a sound stream //////////////////////////////////////////////////////////// -float sfSoundStream_GetAttenuation(sfSoundStream* SoundStream) +float sfSoundStream_GetAttenuation(sfSoundStream* soundStream) { - CSFML_CALL_RETURN(SoundStream, GetAttenuation(), 0.f); + CSFML_CALL_RETURN(soundStream, GetAttenuation(), 0.f); } //////////////////////////////////////////////////////////// /// Tell whether or not a stream is looping //////////////////////////////////////////////////////////// -sfBool sfSoundStream_GetLoop(sfSoundStream* SoundStream) +sfBool sfSoundStream_GetLoop(sfSoundStream* soundStream) { - CSFML_CALL_RETURN(SoundStream, GetLoop(), sfFalse); + CSFML_CALL_RETURN(soundStream, GetLoop(), sfFalse); } //////////////////////////////////////////////////////////// /// Get the current playing position of a sound stream //////////////////////////////////////////////////////////// -float sfSoundStream_GetPlayingOffset(sfSoundStream* SoundStream) +float sfSoundStream_GetPlayingOffset(sfSoundStream* soundStream) { - CSFML_CALL_RETURN(SoundStream, GetPlayingOffset(), 0.f); + CSFML_CALL_RETURN(soundStream, GetPlayingOffset(), 0.f); } diff --git a/CSFML/src/SFML/Graphics/Color.cpp b/CSFML/src/SFML/Graphics/Color.cpp index dc1861cb7..1d5618e12 100644 --- a/CSFML/src/SFML/Graphics/Color.cpp +++ b/CSFML/src/SFML/Graphics/Color.cpp @@ -46,51 +46,57 @@ sfColor sfCyan = { 0, 255, 255, 255}; //////////////////////////////////////////////////////////// /// Construct a color from its 3 RGB components //////////////////////////////////////////////////////////// -sfColor sfColor_FromRGB(sfUint8 R, sfUint8 G, sfUint8 B) +sfColor sfColor_FromRGB(sfUint8 red, sfUint8 green, sfUint8 blue) { - return sfColor_FromRGBA(R, G, B, 255); + return sfColor_FromRGBA(red, green, blue, 255); } //////////////////////////////////////////////////////////// /// Construct a color from its 4 RGBA components //////////////////////////////////////////////////////////// -sfColor sfColor_FromRGBA(sfUint8 R, sfUint8 G, sfUint8 B, sfUint8 A) +sfColor sfColor_FromRGBA(sfUint8 red, sfUint8 green, sfUint8 blue, sfUint8 alpha) { - sfColor Color; + sfColor color; - Color.r = R; - Color.g = G; - Color.b = B; - Color.a = A; + color.r = red; + color.g = green; + color.b = blue; + color.a = alpha; - return Color; + return color; } //////////////////////////////////////////////////////////// /// Add two colors //////////////////////////////////////////////////////////// -sfColor sfColor_Add(sfColor Color1, sfColor Color2) +sfColor sfColor_Add(sfColor color1, sfColor color2) { - int R = std::min(Color1.r + Color2.r, 255); - int G = std::min(Color1.g + Color2.g, 255); - int B = std::min(Color1.b + Color2.b, 255); - int A = std::min(Color1.a + Color2.a, 255); + int red = std::min(color1.r + color2.r, 255); + int green = std::min(color1.g + color2.g, 255); + int blue = std::min(color1.b + color2.b, 255); + int alpha = std::min(color1.a + color2.a, 255); - return sfColor_FromRGBA(static_cast(R), static_cast(G), static_cast(B), static_cast(A)); + return sfColor_FromRGBA(static_cast(red), + static_cast(green), + static_cast(blue), + static_cast(alpha)); } //////////////////////////////////////////////////////////// /// Modulate two colors //////////////////////////////////////////////////////////// -sfColor sfColor_Modulate(sfColor Color1, sfColor Color2) +sfColor sfColor_Modulate(sfColor color1, sfColor color2) { - int R = Color1.r * Color2.r / 255; - int G = Color1.g * Color2.g / 255; - int B = Color1.b * Color2.b / 255; - int A = Color1.a * Color2.a / 255; + int red = color1.r * color2.r / 255; + int green = color1.g * color2.g / 255; + int blue = color1.b * color2.b / 255; + int alpha = color1.a * color2.a / 255; - return sfColor_FromRGBA(static_cast(R), static_cast(G), static_cast(B), static_cast(A)); + return sfColor_FromRGBA(static_cast(red), + static_cast(green), + static_cast(blue), + static_cast(alpha)); } diff --git a/CSFML/src/SFML/Graphics/Font.cpp b/CSFML/src/SFML/Graphics/Font.cpp index 82dafb553..8901aab0b 100644 --- a/CSFML/src/SFML/Graphics/Font.cpp +++ b/CSFML/src/SFML/Graphics/Font.cpp @@ -42,55 +42,55 @@ sfFont* sfFont_Create() //////////////////////////////////////////////////////////// /// Create a new font from a file //////////////////////////////////////////////////////////// -sfFont* sfFont_CreateFromFile(const char* Filename, unsigned int CharSize, const sfUint32* Charset) +sfFont* sfFont_CreateFromFile(const char* filename, unsigned int charSize, const sfUint32* charset) { - sfFont* Font = new sfFont; + sfFont* font = new sfFont; - bool bSucceeded = false; - if (Charset) - bSucceeded = Font->This.LoadFromFile(Filename, CharSize, Charset); + bool success = false; + if (charset) + success = font->This.LoadFromFile(filename, charSize, charset); else - bSucceeded = Font->This.LoadFromFile(Filename, CharSize); + success = font->This.LoadFromFile(filename, charSize); - if (!bSucceeded) + if (!success) { - delete Font; - Font = NULL; + delete font; + font = NULL; } - return Font; + return font; } //////////////////////////////////////////////////////////// /// Create a new font from a file in memory //////////////////////////////////////////////////////////// -sfFont* sfFont_CreateFromMemory(const char* Data, size_t SizeInBytes, unsigned int CharSize, const sfUint32* Charset) +sfFont* sfFont_CreateFromMemory(const char* data, size_t sizeInBytes, unsigned int charSize, const sfUint32* charset) { - sfFont* Font = new sfFont; + sfFont* font = new sfFont; - bool bSucceeded = false; - if (Charset) - bSucceeded = Font->This.LoadFromMemory(Data, SizeInBytes, CharSize, Charset); + bool success = false; + if (charset) + success = font->This.LoadFromMemory(data, sizeInBytes, charSize, charset); else - bSucceeded = Font->This.LoadFromMemory(Data, SizeInBytes, CharSize); + success = font->This.LoadFromMemory(data, sizeInBytes, charSize); - if (!bSucceeded) + if (!success) { - delete Font; - Font = NULL; + delete font; + font = NULL; } - return Font; + return font; } //////////////////////////////////////////////////////////// /// Destroy an existing font //////////////////////////////////////////////////////////// -void sfFont_Destroy(sfFont* Font) +void sfFont_Destroy(sfFont* font) { - delete Font; + delete font; } @@ -98,9 +98,9 @@ void sfFont_Destroy(sfFont* Font) /// Get the base size of characters in a font; /// All glyphs dimensions are based on this value //////////////////////////////////////////////////////////// -unsigned int sfFont_GetCharacterSize(sfFont* Font) +unsigned int sfFont_GetCharacterSize(sfFont* font) { - CSFML_CALL_RETURN(Font, GetCharacterSize(), 0); + CSFML_CALL_RETURN(font, GetCharacterSize(), 0); } @@ -109,7 +109,7 @@ unsigned int sfFont_GetCharacterSize(sfFont* Font) //////////////////////////////////////////////////////////// sfFont* sfFont_GetDefaultFont() { - static sfFont DefaultFont = {sf::Font::GetDefaultFont()}; + static sfFont defaultFont = {sf::Font::GetDefaultFont()}; - return &DefaultFont; + return &defaultFont; } diff --git a/CSFML/src/SFML/Graphics/Image.cpp b/CSFML/src/SFML/Graphics/Image.cpp index 9ef7a8f04..c72fa63d0 100644 --- a/CSFML/src/SFML/Graphics/Image.cpp +++ b/CSFML/src/SFML/Graphics/Image.cpp @@ -43,96 +43,96 @@ sfImage* sfImage_Create() //////////////////////////////////////////////////////////// /// Create a new image filled with a color //////////////////////////////////////////////////////////// -sfImage* sfImage_CreateFromColor(unsigned int Width, unsigned int Height, sfColor Color) +sfImage* sfImage_CreateFromColor(unsigned int width, unsigned int height, sfColor color) { - sfImage* Image = new sfImage; + sfImage* image = new sfImage; - if (!Image->This->Create(Width, Height, sf::Color(Color.r, Color.g, Color.b, Color.a))) + if (!image->This->Create(width, height, sf::Color(color.r, color.g, color.b, color.a))) { - delete Image; - Image = NULL; + delete image; + image = NULL; } - return Image; + return image; } //////////////////////////////////////////////////////////// /// Create a new image from an array of pixels in memory //////////////////////////////////////////////////////////// -sfImage* sfImage_CreateFromPixels(unsigned int Width, unsigned int Height, const sfUint8* Data) +sfImage* sfImage_CreateFromPixels(unsigned int width, unsigned int height, const sfUint8* data) { - sfImage* Image = new sfImage; + sfImage* image = new sfImage; - if (!Image->This->LoadFromPixels(Width, Height, Data)) + if (!image->This->LoadFromPixels(width, height, data)) { - delete Image; - Image = NULL; + delete image; + image = NULL; } - return Image; + return image; } //////////////////////////////////////////////////////////// /// Create a new image from a file //////////////////////////////////////////////////////////// -sfImage* sfImage_CreateFromFile(const char* Filename) +sfImage* sfImage_CreateFromFile(const char* filename) { - sfImage* Image = new sfImage; + sfImage* image = new sfImage; - if (!Image->This->LoadFromFile(Filename)) + if (!image->This->LoadFromFile(filename)) { - delete Image; - Image = NULL; + delete image; + image = NULL; } - return Image; + return image; } //////////////////////////////////////////////////////////// /// Create a new image from a file in memory //////////////////////////////////////////////////////////// -sfImage* sfImage_CreateFromMemory(const char* Data, size_t SizeInBytes) +sfImage* sfImage_CreateFromMemory(const char* data, size_t sizeInBytes) { - sfImage* Image = new sfImage; + sfImage* image = new sfImage; - if (!Image->This->LoadFromMemory(Data, SizeInBytes)) + if (!image->This->LoadFromMemory(data, sizeInBytes)) { - delete Image; - Image = NULL; + delete image; + image = NULL; } - return Image; + return image; } //////////////////////////////////////////////////////////// /// Destroy an existing image //////////////////////////////////////////////////////////// -void sfImage_Destroy(sfImage* Image) +void sfImage_Destroy(sfImage* image) { - delete Image; + delete image; } //////////////////////////////////////////////////////////// /// Save the content of an image to a file //////////////////////////////////////////////////////////// -sfBool sfImage_SaveToFile(sfImage* Image, const char* Filename) +sfBool sfImage_SaveToFile(sfImage* image, const char* filename) { - CSFML_CALL_PTR_RETURN(Image, SaveToFile(Filename), sfFalse); + CSFML_CALL_PTR_RETURN(image, SaveToFile(filename), sfFalse); } //////////////////////////////////////////////////////////// /// Create a transparency mask for an image from a specified colorkey //////////////////////////////////////////////////////////// -void sfImage_CreateMaskFromColor(sfImage* Image, sfColor ColorKey, sfUint8 Alpha) +void sfImage_CreateMaskFromColor(sfImage* image, sfColor colorKey, sfUint8 alpha) { - sf::Color SFMLColor(ColorKey.r, ColorKey.g, ColorKey.b, ColorKey.a); - CSFML_CALL_PTR(Image, CreateMaskFromColor(SFMLColor, Alpha)); + sf::Color SFMLColor(colorKey.r, colorKey.g, colorKey.b, colorKey.a); + CSFML_CALL_PTR(image, CreateMaskFromColor(SFMLColor, alpha)); } @@ -141,11 +141,11 @@ void sfImage_CreateMaskFromColor(sfImage* Image, sfColor ColorKey, sfUint8 Alpha /// This function does a slow pixel copy and should only /// be used at initialization time //////////////////////////////////////////////////////////// -void sfImage_Copy(sfImage* Image, sfImage* Source, unsigned int DestX, unsigned int DestY, sfIntRect SourceRect) +void sfImage_Copy(sfImage* image, sfImage* source, unsigned int destX, unsigned int destY, sfIntRect sourceRect) { - CSFML_CHECK(Source); - sf::IntRect SFMLRect(SourceRect.Left, SourceRect.Top, SourceRect.Right, SourceRect.Bottom); - CSFML_CALL_PTR(Image, Copy(*Source->This, DestX, DestY, SFMLRect)); + CSFML_CHECK(source); + sf::IntRect SFMLRect(sourceRect.Left, sourceRect.Top, sourceRect.Right, sourceRect.Bottom); + CSFML_CALL_PTR(image, Copy(*source->This, destX, destY, SFMLRect)); } @@ -153,11 +153,11 @@ void sfImage_Copy(sfImage* Image, sfImage* Source, unsigned int DestX, unsigned /// Create the image from the current contents of the /// given window //////////////////////////////////////////////////////////// -CSFML_API sfBool sfImage_CopyScreen(sfImage* Image, sfRenderWindow* Window, sfIntRect SourceRect) +CSFML_API sfBool sfImage_CopyScreen(sfImage* image, sfRenderWindow* window, sfIntRect sourceRect) { - CSFML_CHECK_RETURN(Window, sfFalse); - sf::IntRect SFMLRect(SourceRect.Left, SourceRect.Top, SourceRect.Right, SourceRect.Bottom); - CSFML_CALL_PTR_RETURN(Image, CopyScreen(Window->This, SFMLRect), sfFalse); + CSFML_CHECK_RETURN(window, sfFalse); + sf::IntRect SFMLRect(sourceRect.Left, sourceRect.Top, sourceRect.Right, sourceRect.Bottom); + CSFML_CALL_PTR_RETURN(image, CopyScreen(window->This, SFMLRect), sfFalse); } @@ -165,22 +165,22 @@ CSFML_API sfBool sfImage_CopyScreen(sfImage* Image, sfRenderWindow* Window, sfIn /// Change the color of a pixel of an image /// Don't forget to call Update when you end modifying pixels //////////////////////////////////////////////////////////// -void sfImage_SetPixel(sfImage* Image, unsigned int X, unsigned int Y, sfColor Color) +void sfImage_SetPixel(sfImage* image, unsigned int x, unsigned int y, sfColor color) { - sf::Color SFMLColor(Color.r, Color.g, Color.b, Color.a); - CSFML_CALL_PTR(Image, SetPixel(X, Y, SFMLColor)); + sf::Color SFMLColor(color.r, color.g, color.b, color.a); + CSFML_CALL_PTR(image, SetPixel(x, y, SFMLColor)); } //////////////////////////////////////////////////////////// /// Get a pixel from an image //////////////////////////////////////////////////////////// -sfColor sfImage_GetPixel(sfImage* Image, unsigned int X, unsigned int Y) +sfColor sfImage_GetPixel(sfImage* image, unsigned int x, unsigned int y) { - sfColor Color = {0, 0, 0, 0}; - CSFML_CHECK_RETURN(Image, Color); + sfColor color = {0, 0, 0, 0}; + CSFML_CHECK_RETURN(image, color); - sf::Color SFMLColor = Image->This->GetPixel(X, Y); + sf::Color SFMLColor = image->This->GetPixel(x, y); return sfColor_FromRGBA(SFMLColor.r, SFMLColor.g, SFMLColor.b, SFMLColor.a); } @@ -191,52 +191,52 @@ sfColor sfImage_GetPixel(sfImage* Image, unsigned int X, unsigned int Y) /// Array size is sfImage_GetWidth() x sfImage_GetHeight() x 4 /// This pointer becomes invalid if you reload or resize the image //////////////////////////////////////////////////////////// -const sfUint8* sfImage_GetPixelsPtr(sfImage* Image) +const sfUint8* sfImage_GetPixelsPtr(sfImage* image) { - CSFML_CALL_PTR_RETURN(Image, GetPixelsPtr(), NULL); + CSFML_CALL_PTR_RETURN(image, GetPixelsPtr(), NULL); } //////////////////////////////////////////////////////////// /// Bind the image for rendering //////////////////////////////////////////////////////////// -void sfImage_Bind(sfImage* Image) +void sfImage_Bind(sfImage* image) { - CSFML_CALL_PTR(Image, Bind()); + CSFML_CALL_PTR(image, Bind()); } //////////////////////////////////////////////////////////// /// Enable or disable image smooth filter //////////////////////////////////////////////////////////// -void sfImage_SetSmooth(sfImage* Image, sfBool Smooth) +void sfImage_SetSmooth(sfImage* image, sfBool smooth) { - CSFML_CALL_PTR(Image, SetSmooth(Smooth == sfTrue)); + CSFML_CALL_PTR(image, SetSmooth(smooth == sfTrue)); } //////////////////////////////////////////////////////////// /// Return the width of the image //////////////////////////////////////////////////////////// -unsigned int sfImage_GetWidth(sfImage* Image) +unsigned int sfImage_GetWidth(sfImage* image) { - CSFML_CALL_PTR_RETURN(Image, GetWidth(), 0); + CSFML_CALL_PTR_RETURN(image, GetWidth(), 0); } //////////////////////////////////////////////////////////// /// Return the height of the image //////////////////////////////////////////////////////////// -unsigned int sfImage_GetHeight(sfImage* Image) +unsigned int sfImage_GetHeight(sfImage* image) { - CSFML_CALL_PTR_RETURN(Image, GetHeight(), 0); + CSFML_CALL_PTR_RETURN(image, GetHeight(), 0); } //////////////////////////////////////////////////////////// /// Tells whether the smoothing filter is enabled or not on an image //////////////////////////////////////////////////////////// -sfBool sfImage_IsSmooth(sfImage* Image) +sfBool sfImage_IsSmooth(sfImage* image) { - CSFML_CALL_PTR_RETURN(Image, IsSmooth(), sfFalse); + CSFML_CALL_PTR_RETURN(image, IsSmooth(), sfFalse); } diff --git a/CSFML/src/SFML/Graphics/PostFX.cpp b/CSFML/src/SFML/Graphics/PostFX.cpp index 0d850330a..3a2d95575 100644 --- a/CSFML/src/SFML/Graphics/PostFX.cpp +++ b/CSFML/src/SFML/Graphics/PostFX.cpp @@ -34,88 +34,88 @@ //////////////////////////////////////////////////////////// /// Create a new post-fx from a file //////////////////////////////////////////////////////////// -sfPostFX* sfPostFX_CreateFromFile(const char* Filename) +sfPostFX* sfPostFX_CreateFromFile(const char* filename) { - sfPostFX* PostFX = new sfPostFX; + sfPostFX* postFX = new sfPostFX; - if (!PostFX->This.LoadFromFile(Filename)) + if (!postFX->This.LoadFromFile(filename)) { - delete PostFX; - PostFX = NULL; + delete postFX; + postFX = NULL; } - return PostFX; + return postFX; } //////////////////////////////////////////////////////////// /// Create a new post-fx from an effect source code //////////////////////////////////////////////////////////// -sfPostFX* sfPostFX_CreateFromMemory(const char* Effect) +sfPostFX* sfPostFX_CreateFromMemory(const char* effect) { - sfPostFX* PostFX = new sfPostFX; + sfPostFX* postFX = new sfPostFX; - if (!PostFX->This.LoadFromMemory(Effect)) + if (!postFX->This.LoadFromMemory(effect)) { - delete PostFX; - PostFX = NULL; + delete postFX; + postFX = NULL; } - return PostFX; + return postFX; } //////////////////////////////////////////////////////////// /// Destroy an existing post-fx //////////////////////////////////////////////////////////// -void sfPostFX_Destroy(sfPostFX* PostFX) +void sfPostFX_Destroy(sfPostFX* postFX) { - delete PostFX; + delete postFX; } //////////////////////////////////////////////////////////// /// Change a parameter of a post-fx (1 float) //////////////////////////////////////////////////////////// -void sfPostFX_SetParameter1(sfPostFX* PostFX, const char* Name, float X) +void sfPostFX_SetParameter1(sfPostFX* postFX, const char* name, float x) { - CSFML_CALL(PostFX, SetParameter(Name, X)) + CSFML_CALL(postFX, SetParameter(name, x)) } //////////////////////////////////////////////////////////// /// Change a parameter of a post-fx (2 floats) //////////////////////////////////////////////////////////// -void sfPostFX_SetParameter2(sfPostFX* PostFX, const char* Name, float X, float Y) +void sfPostFX_SetParameter2(sfPostFX* postFX, const char* name, float x, float y) { - CSFML_CALL(PostFX, SetParameter(Name, X, Y)) + CSFML_CALL(postFX, SetParameter(name, x, y)) } //////////////////////////////////////////////////////////// /// Change a parameter of a post-fx (3 floats) //////////////////////////////////////////////////////////// -void sfPostFX_SetParameter3(sfPostFX* PostFX, const char* Name, float X, float Y, float Z) +void sfPostFX_SetParameter3(sfPostFX* postFX, const char* name, float x, float y, float z) { - CSFML_CALL(PostFX, SetParameter(Name, X, Y, Z)) + CSFML_CALL(postFX, SetParameter(name, x, y, z)) } //////////////////////////////////////////////////////////// /// Change a parameter of a post-fx (4 floats) //////////////////////////////////////////////////////////// -void sfPostFX_SetParameter4(sfPostFX* PostFX, const char* Name, float X, float Y, float Z, float W) +void sfPostFX_SetParameter4(sfPostFX* postFX, const char* name, float x, float y, float z, float w) { - CSFML_CALL(PostFX, SetParameter(Name, X, Y, Z, W)) + CSFML_CALL(postFX, SetParameter(name, x, y, z, w)) } //////////////////////////////////////////////////////////// /// Set a texture parameter in a post-fx //////////////////////////////////////////////////////////// -void sfPostFX_SetTexture(sfPostFX* PostFX, const char* Name, sfImage* Texture) +void sfPostFX_SetTexture(sfPostFX* postFX, const char* name, sfImage* texture) { - CSFML_CALL(PostFX, SetTexture(Name, Texture ? Texture->This : NULL)) + CSFML_CALL(postFX, SetTexture(name, texture ? texture->This : NULL)) } diff --git a/CSFML/src/SFML/Graphics/Rect.cpp b/CSFML/src/SFML/Graphics/Rect.cpp index 3166ce79b..7b1012ffe 100644 --- a/CSFML/src/SFML/Graphics/Rect.cpp +++ b/CSFML/src/SFML/Graphics/Rect.cpp @@ -33,86 +33,86 @@ //////////////////////////////////////////////////////////// /// Move a rectangle by the given offset //////////////////////////////////////////////////////////// -void sfFloatRect_Offset(sfFloatRect* Rect, float OffsetX, float OffsetY) +void sfFloatRect_Offset(sfFloatRect* rect, float offsetX, float offsetY) { - CSFML_CHECK(Rect) - Rect->Left += OffsetX; - Rect->Right += OffsetX; - Rect->Top += OffsetY; - Rect->Bottom += OffsetY; + CSFML_CHECK(rect) + rect->Left += offsetX; + rect->Right += offsetX; + rect->Top += offsetY; + rect->Bottom += offsetY; } -void sfIntRect_Offset(sfIntRect* Rect, int OffsetX, int OffsetY) +void sfIntRect_Offset(sfIntRect* rect, int offsetX, int offsetY) { - CSFML_CHECK(Rect) - Rect->Left += OffsetX; - Rect->Right += OffsetX; - Rect->Top += OffsetY; - Rect->Bottom += OffsetY; + CSFML_CHECK(rect) + rect->Left += offsetX; + rect->Right += offsetX; + rect->Top += offsetY; + rect->Bottom += offsetY; } //////////////////////////////////////////////////////////// /// Check if a point is inside a rectangle's area //////////////////////////////////////////////////////////// -sfBool sfFloatRect_Contains(sfFloatRect* Rect, float X, float Y) +sfBool sfFloatRect_Contains(sfFloatRect* rect, float x, float y) { - CSFML_CHECK_RETURN(Rect, sfFalse) - return sf::FloatRect(Rect->Left, Rect->Top, Rect->Right, Rect->Bottom).Contains(X, Y); + CSFML_CHECK_RETURN(rect, sfFalse) + return sf::FloatRect(rect->Left, rect->Top, rect->Right, rect->Bottom).Contains(x, y); } -sfBool sfIntRect_Contains(sfIntRect* Rect, int X, int Y) +sfBool sfIntRect_Contains(sfIntRect* rect, int x, int y) { - CSFML_CHECK_RETURN(Rect, sfFalse) - return sf::IntRect(Rect->Left, Rect->Top, Rect->Right, Rect->Bottom).Contains(X, Y); + CSFML_CHECK_RETURN(rect, sfFalse) + return sf::IntRect(rect->Left, rect->Top, rect->Right, rect->Bottom).Contains(x, y); } //////////////////////////////////////////////////////////// /// Check intersection between two rectangles //////////////////////////////////////////////////////////// -sfBool sfFloatRect_Intersects(sfFloatRect* Rect1, sfFloatRect* Rect2, sfFloatRect* OverlappingRect) +sfBool sfFloatRect_Intersects(sfFloatRect* rect1, sfFloatRect* rect2, sfFloatRect* intersection) { - CSFML_CHECK_RETURN(Rect1, sfFalse) - CSFML_CHECK_RETURN(Rect2, sfFalse) + CSFML_CHECK_RETURN(rect1, sfFalse) + CSFML_CHECK_RETURN(rect2, sfFalse) - sf::FloatRect SFMLRect1(Rect1->Left, Rect1->Top, Rect1->Right, Rect1->Bottom); - sf::FloatRect SFMLRect2(Rect2->Left, Rect2->Top, Rect2->Right, Rect2->Bottom); + sf::FloatRect SFMLRect1(rect1->Left, rect1->Top, rect1->Right, rect1->Bottom); + sf::FloatRect SFMLRect2(rect2->Left, rect2->Top, rect2->Right, rect2->Bottom); - if (OverlappingRect) + if (intersection) { - sf::FloatRect Overlap; - bool Intersect = SFMLRect1.Intersects(SFMLRect2, Overlap); + sf::FloatRect overlap; + bool intersects = SFMLRect1.Intersects(SFMLRect2, overlap); - OverlappingRect->Left = Overlap.Left; - OverlappingRect->Top = Overlap.Top; - OverlappingRect->Right = Overlap.Right; - OverlappingRect->Bottom = Overlap.Bottom; + intersection->Left = overlap.Left; + intersection->Top = overlap.Top; + intersection->Right = overlap.Right; + intersection->Bottom = overlap.Bottom; - return Intersect; + return intersects; } else { return SFMLRect1.Intersects(SFMLRect2); } } -sfBool sfIntRect_Intersects(sfIntRect* Rect1, sfIntRect* Rect2, sfIntRect* OverlappingRect) +sfBool sfIntRect_Intersects(sfIntRect* rect1, sfIntRect* rect2, sfIntRect* intersection) { - CSFML_CHECK_RETURN(Rect1, sfFalse) - CSFML_CHECK_RETURN(Rect2, sfFalse) + CSFML_CHECK_RETURN(rect1, sfFalse) + CSFML_CHECK_RETURN(rect2, sfFalse) - sf::IntRect SFMLRect1(Rect1->Left, Rect1->Top, Rect1->Right, Rect1->Bottom); - sf::IntRect SFMLRect2(Rect2->Left, Rect2->Top, Rect2->Right, Rect2->Bottom); + sf::IntRect SFMLRect1(rect1->Left, rect1->Top, rect1->Right, rect1->Bottom); + sf::IntRect SFMLRect2(rect2->Left, rect2->Top, rect2->Right, rect2->Bottom); - if (OverlappingRect) + if (intersection) { - sf::IntRect Overlap; - bool Intersect = SFMLRect1.Intersects(SFMLRect2, Overlap); + sf::IntRect overlap; + bool intersects = SFMLRect1.Intersects(SFMLRect2, overlap); - OverlappingRect->Left = Overlap.Left; - OverlappingRect->Top = Overlap.Top; - OverlappingRect->Right = Overlap.Right; - OverlappingRect->Bottom = Overlap.Bottom; + intersection->Left = overlap.Left; + intersection->Top = overlap.Top; + intersection->Right = overlap.Right; + intersection->Bottom = overlap.Bottom; - return Intersect; + return intersects; } else { diff --git a/CSFML/src/SFML/Graphics/RenderImage.cpp b/CSFML/src/SFML/Graphics/RenderImage.cpp index f70582c3b..033d920d3 100644 --- a/CSFML/src/SFML/Graphics/RenderImage.cpp +++ b/CSFML/src/SFML/Graphics/RenderImage.cpp @@ -37,122 +37,122 @@ //////////////////////////////////////////////////////////// /// Construct a new renderimage //////////////////////////////////////////////////////////// -sfRenderImage* sfRenderImage_Create(unsigned int Width, unsigned int Height, sfBool DepthBuffer) +sfRenderImage* sfRenderImage_Create(unsigned int width, unsigned int height, sfBool depthBuffer) { - sfRenderImage* RenderImage = new sfRenderImage; - RenderImage->This.Create(Width, Height, DepthBuffer == sfTrue); - RenderImage->Target = new sfImage(const_cast(&RenderImage->This.GetImage())); - RenderImage->DefaultView = new sfView(const_cast(&RenderImage->This.GetDefaultView())); - RenderImage->CurrentView = RenderImage->DefaultView; + sfRenderImage* renderImage = new sfRenderImage; + renderImage->This.Create(width, height, depthBuffer == sfTrue); + renderImage->Target = new sfImage(const_cast(&renderImage->This.GetImage())); + renderImage->DefaultView = new sfView(const_cast(&renderImage->This.GetDefaultView())); + renderImage->CurrentView = renderImage->DefaultView; - return RenderImage; + return renderImage; } //////////////////////////////////////////////////////////// /// Destroy an existing renderimage //////////////////////////////////////////////////////////// -void sfRenderImage_Destroy(sfRenderImage* RenderImage) +void sfRenderImage_Destroy(sfRenderImage* renderImage) { - delete RenderImage->DefaultView; - delete RenderImage->Target; - delete RenderImage; + delete renderImage->DefaultView; + delete renderImage->Target; + delete renderImage; } //////////////////////////////////////////////////////////// /// Get the width of the rendering region of a renderimage //////////////////////////////////////////////////////////// -unsigned int sfRenderImage_GetWidth(sfRenderImage* RenderImage) +unsigned int sfRenderImage_GetWidth(sfRenderImage* renderImage) { - CSFML_CALL_RETURN(RenderImage, GetWidth(), 0); + CSFML_CALL_RETURN(renderImage, GetWidth(), 0); } //////////////////////////////////////////////////////////// /// Get the height of the rendering region of a renderimage //////////////////////////////////////////////////////////// -unsigned int sfRenderImage_GetHeight(sfRenderImage* RenderImage) +unsigned int sfRenderImage_GetHeight(sfRenderImage* renderImage) { - CSFML_CALL_RETURN(RenderImage, GetHeight(), 0); + CSFML_CALL_RETURN(renderImage, GetHeight(), 0); } //////////////////////////////////////////////////////////// /// Set a renderimage as the current target for rendering //////////////////////////////////////////////////////////// -sfBool sfRenderImage_SetActive(sfRenderImage* RenderImage, sfBool Active) +sfBool sfRenderImage_SetActive(sfRenderImage* renderImage, sfBool active) { - CSFML_CALL_RETURN(RenderImage, SetActive(Active == sfTrue), sfFalse) + CSFML_CALL_RETURN(renderImage, SetActive(active == sfTrue), sfFalse) } //////////////////////////////////////////////////////////// /// Draw something on a renderimage //////////////////////////////////////////////////////////// -void sfRenderImage_DrawPostFX(sfRenderImage* RenderImage, sfPostFX* PostFX) +void sfRenderImage_DrawPostFX(sfRenderImage* renderImage, sfPostFX* postFX) { - CSFML_CHECK(PostFX); - CSFML_CALL(RenderImage, Draw(PostFX->This)); + CSFML_CHECK(postFX); + CSFML_CALL(renderImage, Draw(postFX->This)); } -void sfRenderImage_DrawShape(sfRenderImage* RenderImage, sfShape* Shape) +void sfRenderImage_DrawShape(sfRenderImage* renderImage, sfShape* shape) { - CSFML_CHECK(Shape); - CSFML_CALL(RenderImage, Draw(Shape->This)); + CSFML_CHECK(shape); + CSFML_CALL(renderImage, Draw(shape->This)); } -void sfRenderImage_DrawSprite(sfRenderImage* RenderImage, sfSprite* Sprite) +void sfRenderImage_DrawSprite(sfRenderImage* renderImage, sfSprite* sprite) { - CSFML_CHECK(Sprite); - CSFML_CALL(RenderImage, Draw(Sprite->This)); + CSFML_CHECK(sprite); + CSFML_CALL(renderImage, Draw(sprite->This)); } -void sfRenderImage_DrawString(sfRenderImage* RenderImage, sfString* String) +void sfRenderImage_DrawString(sfRenderImage* renderImage, sfString* string) { - CSFML_CHECK(String); - CSFML_CALL(RenderImage, Draw(String->This)); + CSFML_CHECK(string); + CSFML_CALL(renderImage, Draw(string->This)); } //////////////////////////////////////////////////////////// /// Clear the renderimage with the given color //////////////////////////////////////////////////////////// -void sfRenderImage_Clear(sfRenderImage* RenderImage, sfColor Color) +void sfRenderImage_Clear(sfRenderImage* renderImage, sfColor color) { - sf::Color SFMLColor(Color.r, Color.g, Color.b, Color.a); + sf::Color SFMLColor(color.r, color.g, color.b, color.a); - CSFML_CALL(RenderImage, Clear(SFMLColor)); + CSFML_CALL(renderImage, Clear(SFMLColor)); } //////////////////////////////////////////////////////////// /// Change the current active view of a renderimage //////////////////////////////////////////////////////////// -void sfRenderImage_SetView(sfRenderImage* RenderImage, sfView* View) +void sfRenderImage_SetView(sfRenderImage* renderImage, sfView* view) { - CSFML_CHECK(View); - CSFML_CALL(RenderImage, SetView(*View->This)); - RenderImage->CurrentView = View; + CSFML_CHECK(view); + CSFML_CALL(renderImage, SetView(*view->This)); + renderImage->CurrentView = view; } //////////////////////////////////////////////////////////// /// Get the current active view of a renderimage //////////////////////////////////////////////////////////// -const sfView* sfRenderImage_GetView(sfRenderImage* RenderImage) +const sfView* sfRenderImage_GetView(sfRenderImage* renderImage) { - CSFML_CHECK_RETURN(RenderImage, NULL); + CSFML_CHECK_RETURN(renderImage, NULL); - return RenderImage->CurrentView; + return renderImage->CurrentView; } //////////////////////////////////////////////////////////// /// Get the default view of a renderimage //////////////////////////////////////////////////////////// -sfView* sfRenderImage_GetDefaultView(sfRenderImage* RenderImage) +sfView* sfRenderImage_GetDefaultView(sfRenderImage* renderImage) { - CSFML_CHECK_RETURN(RenderImage, NULL); + CSFML_CHECK_RETURN(renderImage, NULL); - return RenderImage->DefaultView; + return renderImage->DefaultView; } @@ -164,20 +164,20 @@ sfView* sfRenderImage_GetDefaultView(sfRenderImage* RenderImage) /// SFML to do internal optimizations and improve performances. /// This parameter is false by default //////////////////////////////////////////////////////////// -void sfRenderImage_PreserveOpenGLStates(sfRenderImage* RenderImage, sfBool Preserve) +void sfRenderImage_PreserveOpenGLStates(sfRenderImage* renderImage, sfBool preserve) { - CSFML_CALL(RenderImage, PreserveOpenGLStates(Preserve == sfTrue)); + CSFML_CALL(renderImage, PreserveOpenGLStates(preserve == sfTrue)); } //////////////////////////////////////////////////////////// /// Get the target image //////////////////////////////////////////////////////////// -sfImage* sfRenderImage_GetImage(sfRenderImage* RenderImage) +sfImage* sfRenderImage_GetImage(sfRenderImage* renderImage) { - CSFML_CHECK_RETURN(RenderImage, NULL); + CSFML_CHECK_RETURN(renderImage, NULL); - return RenderImage->Target; + return renderImage->Target; } diff --git a/CSFML/src/SFML/Graphics/Shape.cpp b/CSFML/src/SFML/Graphics/Shape.cpp index 729490168..5aa6c909f 100644 --- a/CSFML/src/SFML/Graphics/Shape.cpp +++ b/CSFML/src/SFML/Graphics/Shape.cpp @@ -43,114 +43,114 @@ sfShape* sfShape_Create() //////////////////////////////////////////////////////////// /// Create a new shape made of a single line //////////////////////////////////////////////////////////// -sfShape* sfShape_CreateLine(float P1X, float P1Y, float P2X, float P2Y, float Thickness, sfColor Col, float Outline, sfColor OutlineCol) +sfShape* sfShape_CreateLine(float p1x, float p1y, float p2x, float p2y, float thickness, sfColor color, float outline, sfColor outlineColor) { - sf::Color Color(Col.r, Col.g, Col.b, Col.a); - sf::Color OutlineColor(OutlineCol.r, OutlineCol.g, OutlineCol.b, OutlineCol.a); + sf::Color SFMLColor(color.r, color.g, color.b, color.a); + sf::Color SFMLOutlineColor(outlineColor.r, outlineColor.g, outlineColor.b, outlineColor.a); - sfShape* Shape = new sfShape; - Shape->This = sf::Shape::Line(P1X, P1Y, P2X, P2Y, Thickness, Color, Outline, OutlineColor); - return Shape; + sfShape* shape = new sfShape; + shape->This = sf::Shape::Line(p1x, p1y, p2x, p2y, thickness, SFMLColor, outline, SFMLOutlineColor); + return shape; } //////////////////////////////////////////////////////////// /// Create a new shape made of a single rectangle //////////////////////////////////////////////////////////// -sfShape* sfShape_CreateRectangle(float P1X, float P1Y, float P2X, float P2Y, sfColor Col, float Outline, sfColor OutlineCol) +sfShape* sfShape_CreateRectangle(float p1x, float p1y, float p2x, float p2y, sfColor color, float outline, sfColor outlineColor) { - sf::Color Color(Col.r, Col.g, Col.b, Col.a); - sf::Color OutlineColor(OutlineCol.r, OutlineCol.g, OutlineCol.b, OutlineCol.a); + sf::Color SFMLColor(color.r, color.g, color.b, color.a); + sf::Color SFMLOutlineColor(outlineColor.r, outlineColor.g, outlineColor.b, outlineColor.a); - sfShape* Shape = new sfShape; - Shape->This = sf::Shape::Rectangle(P1X, P1Y, P2X, P2Y, Color, Outline, OutlineColor); - return Shape; + sfShape* shape = new sfShape; + shape->This = sf::Shape::Rectangle(p1x, p1y, p2x, p2y, SFMLColor, outline, SFMLOutlineColor); + return shape; } //////////////////////////////////////////////////////////// /// Create a new shape made of a single circle //////////////////////////////////////////////////////////// -sfShape* sfShape_CreateCircle(float X, float Y, float Radius, sfColor Col, float Outline, sfColor OutlineCol) +sfShape* sfShape_CreateCircle(float x, float y, float radius, sfColor color, float outline, sfColor outlineColor) { - sf::Color Color(Col.r, Col.g, Col.b, Col.a); - sf::Color OutlineColor(OutlineCol.r, OutlineCol.g, OutlineCol.b, OutlineCol.a); + sf::Color SFMLColor(color.r, color.g, color.b, color.a); + sf::Color SFMLOutlineColor(outlineColor.r, outlineColor.g, outlineColor.b, outlineColor.a); - sfShape* Shape = new sfShape; - Shape->This = sf::Shape::Circle(X, Y, Radius, Color, Outline, OutlineColor); - return Shape; + sfShape* shape = new sfShape; + shape->This = sf::Shape::Circle(x, y, radius, SFMLColor, outline, SFMLOutlineColor); + return shape; } //////////////////////////////////////////////////////////// /// Destroy an existing shape //////////////////////////////////////////////////////////// -void sfShape_Destroy(sfShape* Shape) +void sfShape_Destroy(sfShape* shape) { - delete Shape; + delete shape; } //////////////////////////////////////////////////////////// /// Set the X position of a shape //////////////////////////////////////////////////////////// -void sfShape_SetX(sfShape* Shape, float X) +void sfShape_SetX(sfShape* shape, float x) { - CSFML_CALL(Shape, SetX(X)) + CSFML_CALL(shape, SetX(x)) } //////////////////////////////////////////////////////////// /// Set the Y position of a shape //////////////////////////////////////////////////////////// -void sfShape_SetY(sfShape* Shape, float Y) +void sfShape_SetY(sfShape* shape, float y) { - CSFML_CALL(Shape, SetY(Y)) + CSFML_CALL(shape, SetY(y)) } //////////////////////////////////////////////////////////// /// Set the position of a shape //////////////////////////////////////////////////////////// -void sfShape_SetPosition(sfShape* Shape, float X, float Y) +void sfShape_SetPosition(sfShape* shape, float x, float y) { - CSFML_CALL(Shape, SetPosition(sf::Vector2f(X, Y))) + CSFML_CALL(shape, SetPosition(sf::Vector2f(x, y))) } //////////////////////////////////////////////////////////// /// Set the horizontal scale of a shape //////////////////////////////////////////////////////////// -void sfShape_SetScaleX(sfShape* Shape, float Scale) +void sfShape_SetScaleX(sfShape* shape, float scale) { - CSFML_CALL(Shape, SetScaleX(Scale)) + CSFML_CALL(shape, SetScaleX(scale)) } //////////////////////////////////////////////////////////// /// Set the vertical scale of a shape //////////////////////////////////////////////////////////// -void sfShape_SetScaleY(sfShape* Shape, float Scale) +void sfShape_SetScaleY(sfShape* shape, float scale) { - CSFML_CALL(Shape, SetScaleY(Scale)) + CSFML_CALL(shape, SetScaleY(scale)) } //////////////////////////////////////////////////////////// /// Set the scale of a shape //////////////////////////////////////////////////////////// -void sfShape_SetScale(sfShape* Shape, float ScaleX, float ScaleY) +void sfShape_SetScale(sfShape* shape, float scaleX, float scaleY) { - CSFML_CALL(Shape, SetScale(sf::Vector2f(ScaleX, ScaleY))) + CSFML_CALL(shape, SetScale(sf::Vector2f(scaleX, scaleY))) } //////////////////////////////////////////////////////////// /// Set the orientation of a shape //////////////////////////////////////////////////////////// -void sfShape_SetRotation(sfShape* Shape, float Rotation) +void sfShape_SetRotation(sfShape* shape, float rotation) { - CSFML_CALL(Shape, SetRotation(Rotation)) + CSFML_CALL(shape, SetRotation(rotation)) } @@ -158,102 +158,102 @@ void sfShape_SetRotation(sfShape* Shape, float Rotation) /// Set the local origin of a shape, in coordinates /// relative to its left-top corner //////////////////////////////////////////////////////////// -void sfShape_SetOrigin(sfShape* Shape, float X, float Y) +void sfShape_SetOrigin(sfShape* shape, float x, float y) { - CSFML_CALL(Shape, SetOrigin(sf::Vector2f(X, Y))) + CSFML_CALL(shape, SetOrigin(sf::Vector2f(x, y))) } //////////////////////////////////////////////////////////// /// Set the color of a shape //////////////////////////////////////////////////////////// -void sfShape_SetColor(sfShape* Shape, sfColor Color) +void sfShape_SetColor(sfShape* shape, sfColor color) { - CSFML_CALL(Shape, SetColor(sf::Color(Color.r, Color.g, Color.b, Color.a))) + CSFML_CALL(shape, SetColor(sf::Color(color.r, color.g, color.b, color.a))) } //////////////////////////////////////////////////////////// /// Set the blending mode for a shape //////////////////////////////////////////////////////////// -void sfShape_SetBlendMode(sfShape* Shape, sfBlendMode Mode) +void sfShape_SetBlendMode(sfShape* shape, sfBlendMode mode) { - CSFML_CALL(Shape, SetBlendMode(static_cast(Mode))) + CSFML_CALL(shape, SetBlendMode(static_cast(mode))) } //////////////////////////////////////////////////////////// /// Get the X position of a shape //////////////////////////////////////////////////////////// -float sfShape_GetX(sfShape* Shape) +float sfShape_GetX(sfShape* shape) { - CSFML_CALL_RETURN(Shape, GetPosition().x, 0.f) + CSFML_CALL_RETURN(shape, GetPosition().x, 0.f) } //////////////////////////////////////////////////////////// /// Get the Y position of a shape //////////////////////////////////////////////////////////// -float sfShape_GetY(sfShape* Shape) +float sfShape_GetY(sfShape* shape) { - CSFML_CALL_RETURN(Shape, GetPosition().y, 0.f) + CSFML_CALL_RETURN(shape, GetPosition().y, 0.f) } //////////////////////////////////////////////////////////// /// Get the horizontal scale of a shape //////////////////////////////////////////////////////////// -float sfShape_GetScaleX(sfShape* Shape) +float sfShape_GetScaleX(sfShape* shape) { - CSFML_CALL_RETURN(Shape, GetScale().x, 0.f) + CSFML_CALL_RETURN(shape, GetScale().x, 0.f) } //////////////////////////////////////////////////////////// /// Get the vertical scale of a shape //////////////////////////////////////////////////////////// -float sfShape_GetScaleY(sfShape* Shape) +float sfShape_GetScaleY(sfShape* shape) { - CSFML_CALL_RETURN(Shape, GetScale().y, 0.f) + CSFML_CALL_RETURN(shape, GetScale().y, 0.f) } //////////////////////////////////////////////////////////// /// Get the orientation of a shape //////////////////////////////////////////////////////////// -float sfShape_GetRotation(sfShape* Shape) +float sfShape_GetRotation(sfShape* shape) { - CSFML_CALL_RETURN(Shape, GetRotation(), 0.f) + CSFML_CALL_RETURN(shape, GetRotation(), 0.f) } //////////////////////////////////////////////////////////// /// Get the X position of the origin a shape //////////////////////////////////////////////////////////// -float sfShape_GetOriginX(sfShape* Shape) +float sfShape_GetOriginX(sfShape* shape) { - CSFML_CALL_RETURN(Shape, GetOrigin().x, 0.f) + CSFML_CALL_RETURN(shape, GetOrigin().x, 0.f) } //////////////////////////////////////////////////////////// /// Get the Y position of the origin a shape //////////////////////////////////////////////////////////// -float sfShape_GetOriginY(sfShape* Shape) +float sfShape_GetOriginY(sfShape* shape) { - CSFML_CALL_RETURN(Shape, GetOrigin().y, 0.f) + CSFML_CALL_RETURN(shape, GetOrigin().y, 0.f) } //////////////////////////////////////////////////////////// /// Get the color of a shape //////////////////////////////////////////////////////////// -sfColor sfShape_GetColor(sfShape* Shape) +sfColor sfShape_GetColor(sfShape* shape) { - sfColor Color = {0, 0, 0, 0}; - CSFML_CHECK_RETURN(Shape, Color) + sfColor color = {0, 0, 0, 0}; + CSFML_CHECK_RETURN(Shape, color) - sf::Color SFMLColor = Shape->This.GetColor(); + sf::Color SFMLColor = shape->This.GetColor(); return sfColor_FromRGBA(SFMLColor.r, SFMLColor.g, SFMLColor.b, SFMLColor.a); } @@ -261,38 +261,38 @@ sfColor sfShape_GetColor(sfShape* Shape) //////////////////////////////////////////////////////////// /// Get the current blending mode of a shape //////////////////////////////////////////////////////////// -sfBlendMode sfShape_GetBlendMode(sfShape* Shape) +sfBlendMode sfShape_GetBlendMode(sfShape* shape) { - CSFML_CHECK_RETURN(Shape, sfBlendNone) + CSFML_CHECK_RETURN(shape, sfBlendNone) - return static_cast(Shape->This.GetBlendMode()); + return static_cast(shape->This.GetBlendMode()); } //////////////////////////////////////////////////////////// /// Move a shape //////////////////////////////////////////////////////////// -void sfShape_Move(sfShape* Shape, float OffsetX, float OffsetY) +void sfShape_Move(sfShape* shape, float offsetX, float offsetY) { - CSFML_CALL(Shape, Move(sf::Vector2f(OffsetX, OffsetY))) + CSFML_CALL(shape, Move(sf::Vector2f(offsetX, offsetY))) } //////////////////////////////////////////////////////////// /// Scale a shape //////////////////////////////////////////////////////////// -void sfShape_Scale(sfShape* Shape, float FactorX, float FactorY) +void sfShape_Scale(sfShape* shape, float factorX, float factorY) { - CSFML_CALL(Shape, Scale(sf::Vector2f(FactorX, FactorY))) + CSFML_CALL(shape, Scale(sf::Vector2f(factorX, factorY))) } //////////////////////////////////////////////////////////// /// Rotate a shape //////////////////////////////////////////////////////////// -void sfShape_Rotate(sfShape* Shape, float Angle) +void sfShape_Rotate(sfShape* shape, float angle) { - CSFML_CALL(Shape, Rotate(Angle)) + CSFML_CALL(shape, Rotate(angle)) } @@ -300,13 +300,13 @@ void sfShape_Rotate(sfShape* Shape, float Angle) /// Transform a point from global coordinates into the shape's local coordinates /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) //////////////////////////////////////////////////////////// -void sfShape_TransformToLocal(sfShape* Shape, float PointX, float PointY, float* X, float* Y) +void sfShape_TransformToLocal(sfShape* shape, float pointX, float pointY, float* x, float* y) { - CSFML_CHECK(Shape) + CSFML_CHECK(shape) - sf::Vector2f Point = Shape->This.TransformToLocal(sf::Vector2f(PointX, PointY)); - if (X) *X = Point.x; - if (Y) *Y = Point.y; + sf::Vector2f point = shape->This.TransformToLocal(sf::Vector2f(pointX, pointY)); + if (x) *x = point.x; + if (y) *y = point.y; } @@ -314,25 +314,25 @@ void sfShape_TransformToLocal(sfShape* Shape, float PointX, float PointY, float* /// Transform a point from the shape's local coordinates into global coordinates /// (ie it applies the object's origin, translation, rotation and scale to the point) //////////////////////////////////////////////////////////// -void sfShape_TransformToGlobal(sfShape* Shape, float PointX, float PointY, float* X, float* Y) +void sfShape_TransformToGlobal(sfShape* shape, float pointX, float pointY, float* x, float* y) { - CSFML_CHECK(Shape) + CSFML_CHECK(shape) - sf::Vector2f Point = Shape->This.TransformToGlobal(sf::Vector2f(PointX, PointY)); - if (X) *X = Point.x; - if (Y) *Y = Point.y; + sf::Vector2f point = shape->This.TransformToGlobal(sf::Vector2f(pointX, pointY)); + if (x) *x = point.x; + if (y) *y = point.y; } //////////////////////////////////////////////////////////// /// Add a point to a shape //////////////////////////////////////////////////////////// -void sfShape_AddPoint(sfShape* Shape, float X, float Y, sfColor Col, sfColor OutlineCol) +void sfShape_AddPoint(sfShape* shape, float x, float y, sfColor color, sfColor outlineColor) { - sf::Color Color(Col.r, Col.g, Col.b, Col.a); - sf::Color OutlineColor(OutlineCol.r, OutlineCol.g, OutlineCol.b, OutlineCol.a); + sf::Color SFMLColor(color.r, color.g, color.b, color.a); + sf::Color SFMLOutlineColor(outlineColor.r, outlineColor.g, outlineColor.b, outlineColor.a); - CSFML_CALL(Shape, AddPoint(X, Y, Color, OutlineColor)) + CSFML_CALL(shape, AddPoint(x, y, SFMLColor, SFMLOutlineColor)) } @@ -340,9 +340,9 @@ void sfShape_AddPoint(sfShape* Shape, float X, float Y, sfColor Col, sfColor Out /// Enable or disable filling a shape. /// Fill is enabled by default //////////////////////////////////////////////////////////// -void sfShape_EnableFill(sfShape* Shape, sfBool Enable) +void sfShape_EnableFill(sfShape* shape, sfBool enable) { - CSFML_CALL(Shape, EnableFill(Enable == sfTrue)) + CSFML_CALL(shape, EnableFill(enable == sfTrue)) } @@ -350,109 +350,109 @@ void sfShape_EnableFill(sfShape* Shape, sfBool Enable) /// Enable or disable drawing a shape outline. /// Outline is enabled by default //////////////////////////////////////////////////////////// -void sfShape_EnableOutline(sfShape* Shape, sfBool Enable) +void sfShape_EnableOutline(sfShape* shape, sfBool enable) { - CSFML_CALL(Shape, EnableOutline(Enable == sfTrue)) + CSFML_CALL(shape, EnableOutline(enable == sfTrue)) } //////////////////////////////////////////////////////////// /// Change the width of a shape outline //////////////////////////////////////////////////////////// -void sfShape_SetOutlineWidth(sfShape* Shape, float Width) +void sfShape_SetOutlineWidth(sfShape* shape, float width) { - CSFML_CALL(Shape, SetOutlineWidth(Width)) + CSFML_CALL(shape, SetOutlineWidth(width)) } //////////////////////////////////////////////////////////// /// Get the width of a shape outline //////////////////////////////////////////////////////////// -float sfShape_GetOutlineWidth(sfShape* Shape) +float sfShape_GetOutlineWidth(sfShape* shape) { - CSFML_CALL_RETURN(Shape, GetOutlineWidth(), 0.f) + CSFML_CALL_RETURN(shape, GetOutlineWidth(), 0.f) } //////////////////////////////////////////////////////////// /// Get the number of points composing a shape //////////////////////////////////////////////////////////// -unsigned int sfShape_GetNbPoints(sfShape* Shape) +unsigned int sfShape_GetNbPoints(sfShape* shape) { - CSFML_CALL_RETURN(Shape, GetNbPoints(), 0) + CSFML_CALL_RETURN(shape, GetNbPoints(), 0) } //////////////////////////////////////////////////////////// /// Get a point of a shape //////////////////////////////////////////////////////////// -void sfShape_GetPointPosition(sfShape* Shape, unsigned int Index, float* X, float* Y) +void sfShape_GetPointPosition(sfShape* shape, unsigned int index, float* x, float* y) { - CSFML_CHECK(Shape) + CSFML_CHECK(shape) - sf::Vector2f Point = Shape->This.GetPointPosition(Index); - if (X) *X = Point.x; - if (Y) *Y = Point.y; + sf::Vector2f point = shape->This.GetPointPosition(index); + if (x) *x = point.x; + if (y) *y = point.y; } //////////////////////////////////////////////////////////// /// Get a the color of a shape's point //////////////////////////////////////////////////////////// -sfColor sfShape_GetPointColor(sfShape* Shape, unsigned int Index) +sfColor sfShape_GetPointColor(sfShape* shape, unsigned int index) { - sfColor Color = {255, 255, 255, 255}; - CSFML_CHECK_RETURN(Shape, Color) + sfColor color = {255, 255, 255, 255}; + CSFML_CHECK_RETURN(Shape, color) - const sf::Color& SFMLColor = Shape->This.GetPointColor(Index); - Color.r = SFMLColor.r; - Color.g = SFMLColor.g; - Color.b = SFMLColor.b; - Color.a = SFMLColor.a; + const sf::Color& SFMLColor = shape->This.GetPointColor(index); + color.r = SFMLColor.r; + color.g = SFMLColor.g; + color.b = SFMLColor.b; + color.a = SFMLColor.a; - return Color; + return color; } //////////////////////////////////////////////////////////// /// Get a the outline color of a shape's point //////////////////////////////////////////////////////////// -sfColor sfShape_GetPointOutlineColor(sfShape* Shape, unsigned int Index) +sfColor sfShape_GetPointOutlineColor(sfShape* shape, unsigned int index) { - sfColor Color = {255, 255, 255, 255}; - CSFML_CHECK_RETURN(Shape, Color) + sfColor color = {255, 255, 255, 255}; + CSFML_CHECK_RETURN(Shape, color) - const sf::Color& SFMLColor = Shape->This.GetPointOutlineColor(Index); - Color.r = SFMLColor.r; - Color.g = SFMLColor.g; - Color.b = SFMLColor.b; - Color.a = SFMLColor.a; + const sf::Color& SFMLColor = shape->This.GetPointOutlineColor(index); + color.r = SFMLColor.r; + color.g = SFMLColor.g; + color.b = SFMLColor.b; + color.a = SFMLColor.a; - return Color; + return color; } //////////////////////////////////////////////////////////// /// Set a the position of a shape's point //////////////////////////////////////////////////////////// -void sfShape_SetPointPosition(sfShape* Shape, unsigned int Index, float X, float Y) +void sfShape_SetPointPosition(sfShape* shape, unsigned int index, float x, float y) { - CSFML_CALL(Shape, SetPointPosition(Index, X, Y)); + CSFML_CALL(shape, SetPointPosition(index, x, y)); } //////////////////////////////////////////////////////////// /// Set a the color of a shape's point //////////////////////////////////////////////////////////// -void sfShape_SetPointColor(sfShape* Shape, unsigned int Index, sfColor Color) +void sfShape_SetPointColor(sfShape* shape, unsigned int index, sfColor color) { - CSFML_CALL(Shape, SetPointColor(Index, sf::Color(Color.r, Color.g, Color.b, Color.a))); + CSFML_CALL(shape, SetPointColor(index, sf::Color(color.r, color.g, color.b, color.a))); } //////////////////////////////////////////////////////////// /// Set a the outline color of a shape's point //////////////////////////////////////////////////////////// -void sfShape_SetPointOutlineColor(sfShape* Shape, unsigned int Index, sfColor Color) +void sfShape_SetPointOutlineColor(sfShape* shape, unsigned int index, sfColor color) { - CSFML_CALL(Shape, SetPointOutlineColor(Index, sf::Color(Color.r, Color.g, Color.b, Color.a))); + CSFML_CALL(shape, SetPointOutlineColor(index, sf::Color(color.r, color.g, color.b, color.a))); } diff --git a/CSFML/src/SFML/Graphics/Sprite.cpp b/CSFML/src/SFML/Graphics/Sprite.cpp index 5afbbd7da..35175568d 100644 --- a/CSFML/src/SFML/Graphics/Sprite.cpp +++ b/CSFML/src/SFML/Graphics/Sprite.cpp @@ -37,86 +37,86 @@ //////////////////////////////////////////////////////////// sfSprite* sfSprite_Create() { - sfSprite* Sprite = new sfSprite; - Sprite->Image = NULL; - Sprite->SubRect.Left = Sprite->This.GetSubRect().Left; - Sprite->SubRect.Top = Sprite->This.GetSubRect().Top; - Sprite->SubRect.Right = Sprite->This.GetSubRect().Right; - Sprite->SubRect.Bottom = Sprite->This.GetSubRect().Bottom; + sfSprite* sprite = new sfSprite; + sprite->Image = NULL; + sprite->SubRect.Left = sprite->This.GetSubRect().Left; + sprite->SubRect.Top = sprite->This.GetSubRect().Top; + sprite->SubRect.Right = sprite->This.GetSubRect().Right; + sprite->SubRect.Bottom = sprite->This.GetSubRect().Bottom; - return Sprite; + return sprite; } //////////////////////////////////////////////////////////// /// Destroy an existing sprite //////////////////////////////////////////////////////////// -void sfSprite_Destroy(sfSprite* Sprite) +void sfSprite_Destroy(sfSprite* sprite) { - delete Sprite; + delete sprite; } //////////////////////////////////////////////////////////// /// Set the X position of a sprite //////////////////////////////////////////////////////////// -void sfSprite_SetX(sfSprite* Sprite, float X) +void sfSprite_SetX(sfSprite* sprite, float x) { - CSFML_CALL(Sprite, SetX(X)) + CSFML_CALL(sprite, SetX(x)) } //////////////////////////////////////////////////////////// /// Set the Y position of a sprite //////////////////////////////////////////////////////////// -void sfSprite_SetY(sfSprite* Sprite, float Y) +void sfSprite_SetY(sfSprite* sprite, float y) { - CSFML_CALL(Sprite, SetY(Y)) + CSFML_CALL(sprite, SetY(y)) } //////////////////////////////////////////////////////////// /// Set the position of a sprite //////////////////////////////////////////////////////////// -void sfSprite_SetPosition(sfSprite* Sprite, float X, float Y) +void sfSprite_SetPosition(sfSprite* sprite, float x, float y) { - CSFML_CALL(Sprite, SetPosition(sf::Vector2f(X, Y))) + CSFML_CALL(sprite, SetPosition(sf::Vector2f(x, y))) } //////////////////////////////////////////////////////////// /// Set the horizontal scale of a sprite //////////////////////////////////////////////////////////// -void sfSprite_SetScaleX(sfSprite* Sprite, float Scale) +void sfSprite_SetScaleX(sfSprite* sprite, float scale) { - CSFML_CALL(Sprite, SetScaleX(Scale)) + CSFML_CALL(sprite, SetScaleX(scale)) } //////////////////////////////////////////////////////////// /// Set the vertical scale of a sprite //////////////////////////////////////////////////////////// -void sfSprite_SetScaleY(sfSprite* Sprite, float Scale) +void sfSprite_SetScaleY(sfSprite* sprite, float scale) { - CSFML_CALL(Sprite, SetScaleY(Scale)) + CSFML_CALL(sprite, SetScaleY(scale)) } //////////////////////////////////////////////////////////// /// Set the scale of a sprite //////////////////////////////////////////////////////////// -void sfSprite_SetScale(sfSprite* Sprite, float ScaleX, float ScaleY) +void sfSprite_SetScale(sfSprite* sprite, float scaleX, float scaleY) { - CSFML_CALL(Sprite, SetScale(sf::Vector2f(ScaleX, ScaleY))) + CSFML_CALL(sprite, SetScale(sf::Vector2f(scaleX, scaleY))) } //////////////////////////////////////////////////////////// /// Set the orientation of a sprite //////////////////////////////////////////////////////////// -void sfSprite_SetRotation(sfSprite* Sprite, float Rotation) +void sfSprite_SetRotation(sfSprite* sprite, float rotation) { - CSFML_CALL(Sprite, SetRotation(Rotation)) + CSFML_CALL(sprite, SetRotation(rotation)) } @@ -124,102 +124,102 @@ void sfSprite_SetRotation(sfSprite* Sprite, float Rotation) /// Set the local origin of a sprite, in coordinates /// relative to its left-top corner //////////////////////////////////////////////////////////// -void sfSprite_SetOrigin(sfSprite* Sprite, float X, float Y) +void sfSprite_SetOrigin(sfSprite* sprite, float x, float y) { - CSFML_CALL(Sprite, SetOrigin(sf::Vector2f(X, Y))) + CSFML_CALL(sprite, SetOrigin(sf::Vector2f(x, y))) } //////////////////////////////////////////////////////////// /// Set the color of a sprite //////////////////////////////////////////////////////////// -void sfSprite_SetColor(sfSprite* Sprite, sfColor Color) +void sfSprite_SetColor(sfSprite* sprite, sfColor color) { - CSFML_CALL(Sprite, SetColor(sf::Color(Color.r, Color.g, Color.b, Color.a))) + CSFML_CALL(sprite, SetColor(sf::Color(color.r, color.g, color.b, color.a))) } //////////////////////////////////////////////////////////// /// Set the blending mode for a sprite //////////////////////////////////////////////////////////// -void sfSprite_SetBlendMode(sfSprite* Sprite, sfBlendMode Mode) +void sfSprite_SetBlendMode(sfSprite* sprite, sfBlendMode mode) { - CSFML_CALL(Sprite, SetBlendMode(static_cast(Mode))) + CSFML_CALL(sprite, SetBlendMode(static_cast(mode))) } //////////////////////////////////////////////////////////// /// Get the X position of a sprite //////////////////////////////////////////////////////////// -float sfSprite_GetX(sfSprite* Sprite) +float sfSprite_GetX(sfSprite* sprite) { - CSFML_CALL_RETURN(Sprite, GetPosition().x, 0.f) + CSFML_CALL_RETURN(sprite, GetPosition().x, 0.f) } //////////////////////////////////////////////////////////// /// Get the Y position of a sprite //////////////////////////////////////////////////////////// -float sfSprite_GetY(sfSprite* Sprite) +float sfSprite_GetY(sfSprite* sprite) { - CSFML_CALL_RETURN(Sprite, GetPosition().y, 0.f) + CSFML_CALL_RETURN(sprite, GetPosition().y, 0.f) } //////////////////////////////////////////////////////////// /// Get the horizontal scale of a sprite //////////////////////////////////////////////////////////// -float sfSprite_GetScaleX(sfSprite* Sprite) +float sfSprite_GetScaleX(sfSprite* sprite) { - CSFML_CALL_RETURN(Sprite, GetScale().x, 0.f) + CSFML_CALL_RETURN(sprite, GetScale().x, 0.f) } //////////////////////////////////////////////////////////// /// Get the vertical scale of a sprite //////////////////////////////////////////////////////////// -float sfSprite_GetScaleY(sfSprite* Sprite) +float sfSprite_GetScaleY(sfSprite* sprite) { - CSFML_CALL_RETURN(Sprite, GetScale().y, 0.f) + CSFML_CALL_RETURN(sprite, GetScale().y, 0.f) } //////////////////////////////////////////////////////////// /// Get the orientation of a sprite //////////////////////////////////////////////////////////// -float sfSprite_GetRotation(sfSprite* Sprite) +float sfSprite_GetRotation(sfSprite* sprite) { - CSFML_CALL_RETURN(Sprite, GetRotation(), 0.f) + CSFML_CALL_RETURN(sprite, GetRotation(), 0.f) } //////////////////////////////////////////////////////////// /// Get the X position of the origin a sprite //////////////////////////////////////////////////////////// -float sfSprite_GetOriginX(sfSprite* Sprite) +float sfSprite_GetOriginX(sfSprite* sprite) { - CSFML_CALL_RETURN(Sprite, GetOrigin().x, 0.f) + CSFML_CALL_RETURN(sprite, GetOrigin().x, 0.f) } //////////////////////////////////////////////////////////// /// Get the Y position of the origin a sprite //////////////////////////////////////////////////////////// -float sfSprite_GetOriginY(sfSprite* Sprite) +float sfSprite_GetOriginY(sfSprite* sprite) { - CSFML_CALL_RETURN(Sprite, GetOrigin().y, 0.f) + CSFML_CALL_RETURN(sprite, GetOrigin().y, 0.f) } //////////////////////////////////////////////////////////// /// Get the color of a sprite //////////////////////////////////////////////////////////// -sfColor sfSprite_GetColor(sfSprite* Sprite) +sfColor sfSprite_GetColor(sfSprite* sprite) { - sfColor Color = {0, 0, 0, 0}; - CSFML_CHECK_RETURN(Sprite, Color) + sfColor color = {0, 0, 0, 0}; + CSFML_CHECK_RETURN(sprite, color) - sf::Color SFMLColor = Sprite->This.GetColor(); + sf::Color SFMLColor = sprite->This.GetColor(); return sfColor_FromRGBA(SFMLColor.r, SFMLColor.g, SFMLColor.b, SFMLColor.a); } @@ -227,38 +227,38 @@ sfColor sfSprite_GetColor(sfSprite* Sprite) //////////////////////////////////////////////////////////// /// Get the current blending mode of a sprite //////////////////////////////////////////////////////////// -sfBlendMode sfSprite_GetBlendMode(sfSprite* Sprite) +sfBlendMode sfSprite_GetBlendMode(sfSprite* sprite) { - CSFML_CHECK_RETURN(Sprite, sfBlendNone) + CSFML_CHECK_RETURN(sprite, sfBlendNone) - return static_cast(Sprite->This.GetBlendMode()); + return static_cast(sprite->This.GetBlendMode()); } //////////////////////////////////////////////////////////// /// Move a sprite //////////////////////////////////////////////////////////// -void sfSprite_Move(sfSprite* Sprite, float OffsetX, float OffsetY) +void sfSprite_Move(sfSprite* sprite, float offsetX, float offsetY) { - CSFML_CALL(Sprite, Move(sf::Vector2f(OffsetX, OffsetY))) + CSFML_CALL(sprite, Move(sf::Vector2f(offsetX, offsetY))) } //////////////////////////////////////////////////////////// /// Scale a sprite //////////////////////////////////////////////////////////// -void sfSprite_Scale(sfSprite* Sprite, float FactorX, float FactorY) +void sfSprite_Scale(sfSprite* sprite, float factorX, float factorY) { - CSFML_CALL(Sprite, Scale(sf::Vector2f(FactorX, FactorY))) + CSFML_CALL(sprite, Scale(sf::Vector2f(factorX, factorY))) } //////////////////////////////////////////////////////////// /// Rotate a sprite //////////////////////////////////////////////////////////// -void sfSprite_Rotate(sfSprite* Sprite, float Angle) +void sfSprite_Rotate(sfSprite* sprite, float angle) { - CSFML_CALL(Sprite, Rotate(Angle)) + CSFML_CALL(sprite, Rotate(angle)) } @@ -266,13 +266,13 @@ void sfSprite_Rotate(sfSprite* Sprite, float Angle) /// Transform a point from global coordinates into the sprite's local coordinates /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) //////////////////////////////////////////////////////////// -void sfSprite_TransformToLocal(sfSprite* Sprite, float PointX, float PointY, float* X, float* Y) +void sfSprite_TransformToLocal(sfSprite* sprite, float pointX, float pointY, float* x, float* y) { - CSFML_CHECK(Sprite) + CSFML_CHECK(sprite) - sf::Vector2f Point = Sprite->This.TransformToLocal(sf::Vector2f(PointX, PointY)); - if (X) *X = Point.x; - if (Y) *Y = Point.y; + sf::Vector2f point = sprite->This.TransformToLocal(sf::Vector2f(pointX, pointY)); + if (x) *x = point.x; + if (y) *y = point.y; } @@ -280,25 +280,25 @@ void sfSprite_TransformToLocal(sfSprite* Sprite, float PointX, float PointY, flo /// Transform a point from the sprite's local coordinates into global coordinates /// (ie it applies the object's origin, translation, rotation and scale to the point) //////////////////////////////////////////////////////////// -void sfSprite_TransformToGlobal(sfSprite* Sprite, float PointX, float PointY, float* X, float* Y) +void sfSprite_TransformToGlobal(sfSprite* sprite, float pointX, float pointY, float* x, float* y) { - CSFML_CHECK(Sprite) + CSFML_CHECK(sprite) - sf::Vector2f Point = Sprite->This.TransformToGlobal(sf::Vector2f(PointX, PointY)); - if (X) *X = Point.x; - if (Y) *Y = Point.y; + sf::Vector2f point = sprite->This.TransformToGlobal(sf::Vector2f(pointX, pointY)); + if (x) *x = point.x; + if (y) *y = point.y; } //////////////////////////////////////////////////////////// /// Change the image of a sprite //////////////////////////////////////////////////////////// -void sfSprite_SetImage(sfSprite* Sprite, sfImage* Image) +void sfSprite_SetImage(sfSprite* sprite, sfImage* image) { - if (Image) + if (image) { - CSFML_CALL(Sprite, SetImage(*Image->This)) - Sprite->Image = Image; + CSFML_CALL(sprite, SetImage(*image->This)) + sprite->Image = image; } } @@ -306,89 +306,89 @@ void sfSprite_SetImage(sfSprite* Sprite, sfImage* Image) //////////////////////////////////////////////////////////// /// Set the sub-rectangle of a sprite inside the source image //////////////////////////////////////////////////////////// -void sfSprite_SetSubRect(sfSprite* Sprite, sfIntRect SubRect) +void sfSprite_SetSubRect(sfSprite* sprite, sfIntRect rectangle) { - CSFML_CALL(Sprite, SetSubRect(sf::IntRect(SubRect.Left, SubRect.Top, SubRect.Right, SubRect.Bottom))) - Sprite->SubRect = SubRect; + CSFML_CALL(sprite, SetSubRect(sf::IntRect(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom))) + sprite->SubRect = rectangle; } //////////////////////////////////////////////////////////// /// Resize a sprite (by changing its scale factors) //////////////////////////////////////////////////////////// -void sfSprite_Resize(sfSprite* Sprite, float Width, float Height) +void sfSprite_Resize(sfSprite* sprite, float width, float height) { - CSFML_CALL(Sprite, Resize(sf::Vector2f(Width, Height))) + CSFML_CALL(sprite, Resize(sf::Vector2f(width, height))) } //////////////////////////////////////////////////////////// /// Flip a sprite horizontally //////////////////////////////////////////////////////////// -void sfSprite_FlipX(sfSprite* Sprite, sfBool Flipped) +void sfSprite_FlipX(sfSprite* sprite, sfBool flipped) { - CSFML_CALL(Sprite, FlipX(Flipped == sfTrue)) + CSFML_CALL(sprite, FlipX(flipped == sfTrue)) } //////////////////////////////////////////////////////////// /// Flip a sprite vertically //////////////////////////////////////////////////////////// -void sfSprite_FlipY(sfSprite* Sprite, sfBool Flipped) +void sfSprite_FlipY(sfSprite* sprite, sfBool flipped) { - CSFML_CALL(Sprite, FlipY(Flipped == sfTrue)) + CSFML_CALL(sprite, FlipY(flipped == sfTrue)) } //////////////////////////////////////////////////////////// /// Get the source image of a sprite //////////////////////////////////////////////////////////// -sfImage* sfSprite_GetImage(sfSprite* Sprite) +sfImage* sfSprite_GetImage(sfSprite* sprite) { - CSFML_CHECK_RETURN(Sprite, NULL) + CSFML_CHECK_RETURN(sprite, NULL) - return Sprite->Image; + return sprite->Image; } //////////////////////////////////////////////////////////// /// Get the sub-rectangle of a sprite inside the source image //////////////////////////////////////////////////////////// -sfIntRect sfSprite_GetSubRect(sfSprite* Sprite) +sfIntRect sfSprite_GetSubRect(sfSprite* sprite) { - sfIntRect Rect = {0, 0, 0, 0}; - CSFML_CHECK_RETURN(Sprite, Rect) + sfIntRect rect = {0, 0, 0, 0}; + CSFML_CHECK_RETURN(sprite, rect) - return Sprite->SubRect; + return sprite->SubRect; } //////////////////////////////////////////////////////////// /// Get a sprite width //////////////////////////////////////////////////////////// -float sfSprite_GetWidth(sfSprite* Sprite) +float sfSprite_GetWidth(sfSprite* sprite) { - CSFML_CALL_RETURN(Sprite, GetSize().x, 0.f) + CSFML_CALL_RETURN(sprite, GetSize().x, 0.f) } //////////////////////////////////////////////////////////// /// Get a sprite height //////////////////////////////////////////////////////////// -float sfSprite_GetHeight(sfSprite* Sprite) +float sfSprite_GetHeight(sfSprite* sprite) { - CSFML_CALL_RETURN(Sprite, GetSize().y, 0.f) + CSFML_CALL_RETURN(sprite, GetSize().y, 0.f) } //////////////////////////////////////////////////////////// /// Get the color of a given pixel in a sprite //////////////////////////////////////////////////////////// -sfColor sfSprite_GetPixel(sfSprite* Sprite, unsigned int X, unsigned int Y) +sfColor sfSprite_GetPixel(sfSprite* sprite, unsigned int x, unsigned int y) { - sfColor Color = {0, 0, 0, 0}; - CSFML_CHECK_RETURN(Sprite, Color) + sfColor color = {0, 0, 0, 0}; + CSFML_CHECK_RETURN(sprite, color) - sf::Color SFMLColor = Sprite->This.GetPixel(X, Y); + sf::Color SFMLColor = sprite->This.GetPixel(x, y); return sfColor_FromRGBA(SFMLColor.r, SFMLColor.g, SFMLColor.b, SFMLColor.a); } diff --git a/CSFML/src/SFML/Graphics/String.cpp b/CSFML/src/SFML/Graphics/String.cpp index 39d4f2032..b176ce1b6 100644 --- a/CSFML/src/SFML/Graphics/String.cpp +++ b/CSFML/src/SFML/Graphics/String.cpp @@ -37,82 +37,82 @@ //////////////////////////////////////////////////////////// sfString* sfString_Create() { - sfString* String = new sfString; - String->Font = sfFont_GetDefaultFont(); + sfString* string = new sfString; + string->Font = sfFont_GetDefaultFont(); - return String; + return string; } //////////////////////////////////////////////////////////// /// Destroy an existing string //////////////////////////////////////////////////////////// -void sfString_Destroy(sfString* String) +void sfString_Destroy(sfString* string) { - delete String; + delete string; } //////////////////////////////////////////////////////////// /// Set the X position of a string //////////////////////////////////////////////////////////// -void sfString_SetX(sfString* String, float X) +void sfString_SetX(sfString* string, float x) { - CSFML_CALL(String, SetX(X)) + CSFML_CALL(string, SetX(x)) } //////////////////////////////////////////////////////////// /// Set the Y position of a string //////////////////////////////////////////////////////////// -void sfString_SetY(sfString* String, float Y) +void sfString_SetY(sfString* string, float y) { - CSFML_CALL(String, SetY(Y)) + CSFML_CALL(string, SetY(y)) } //////////////////////////////////////////////////////////// /// Set the position of a string //////////////////////////////////////////////////////////// -void sfString_SetPosition(sfString* String, float X, float Y) +void sfString_SetPosition(sfString* string, float x, float y) { - CSFML_CALL(String, SetPosition(sf::Vector2f(X, Y))) + CSFML_CALL(string, SetPosition(sf::Vector2f(x, y))) } //////////////////////////////////////////////////////////// /// Set the horizontal scale of a string //////////////////////////////////////////////////////////// -void sfString_SetScaleX(sfString* String, float Scale) +void sfString_SetScaleX(sfString* string, float scale) { - CSFML_CALL(String, SetScaleX(Scale)) + CSFML_CALL(string, SetScaleX(scale)) } //////////////////////////////////////////////////////////// /// Set the vertical scale of a string //////////////////////////////////////////////////////////// -void sfString_SetScaleY(sfString* String, float Scale) +void sfString_SetScaleY(sfString* string, float scale) { - CSFML_CALL(String, SetScaleY(Scale)) + CSFML_CALL(string, SetScaleY(scale)) } //////////////////////////////////////////////////////////// /// Set the scale of a string //////////////////////////////////////////////////////////// -void sfString_SetScale(sfString* String, float ScaleX, float ScaleY) +void sfString_SetScale(sfString* string, float scaleX, float scaleY) { - CSFML_CALL(String, SetScale(sf::Vector2f(ScaleX, ScaleY))) + CSFML_CALL(string, SetScale(sf::Vector2f(scaleX, scaleY))) } //////////////////////////////////////////////////////////// /// Set the orientation of a string //////////////////////////////////////////////////////////// -void sfString_SetRotation(sfString* String, float Rotation) +void sfString_SetRotation(sfString* string, float rotation) { - CSFML_CALL(String, SetRotation(Rotation)) + CSFML_CALL(string, SetRotation(rotation)) } @@ -120,102 +120,102 @@ void sfString_SetRotation(sfString* String, float Rotation) /// Set the local origin of a string, in coordinates /// relative to its left-top corner //////////////////////////////////////////////////////////// -void sfString_SetOrigin(sfString* String, float X, float Y) +void sfString_SetOrigin(sfString* string, float x, float y) { - CSFML_CALL(String, SetOrigin(sf::Vector2f(X, Y))) + CSFML_CALL(string, SetOrigin(sf::Vector2f(x, y))) } //////////////////////////////////////////////////////////// /// Set the color of a string //////////////////////////////////////////////////////////// -void sfString_SetColor(sfString* String, sfColor Color) +void sfString_SetColor(sfString* string, sfColor color) { - CSFML_CALL(String, SetColor(sf::Color(Color.r, Color.g, Color.b, Color.a))) + CSFML_CALL(string, SetColor(sf::Color(color.r, color.g, color.b, color.a))) } //////////////////////////////////////////////////////////// /// Set the blending mode for a string //////////////////////////////////////////////////////////// -void sfString_SetBlendMode(sfString* String, sfBlendMode Mode) +void sfString_SetBlendMode(sfString* string, sfBlendMode mode) { - CSFML_CALL(String, SetBlendMode(static_cast(Mode))) + CSFML_CALL(string, SetBlendMode(static_cast(mode))) } //////////////////////////////////////////////////////////// /// Get the X position of a string //////////////////////////////////////////////////////////// -float sfString_GetX(sfString* String) +float sfString_GetX(sfString* string) { - CSFML_CALL_RETURN(String, GetPosition().x, 0.f) + CSFML_CALL_RETURN(string, GetPosition().x, 0.f) } //////////////////////////////////////////////////////////// /// Get the Y position of a string //////////////////////////////////////////////////////////// -float sfString_GetY(sfString* String) +float sfString_GetY(sfString* string) { - CSFML_CALL_RETURN(String, GetPosition().y, 0.f) + CSFML_CALL_RETURN(string, GetPosition().y, 0.f) } //////////////////////////////////////////////////////////// /// Get the horizontal scale of a string //////////////////////////////////////////////////////////// -float sfString_GetScaleX(sfString* String) +float sfString_GetScaleX(sfString* string) { - CSFML_CALL_RETURN(String, GetScale().x, 0.f) + CSFML_CALL_RETURN(string, GetScale().x, 0.f) } //////////////////////////////////////////////////////////// /// Get the vertical scale of a string //////////////////////////////////////////////////////////// -float sfString_GetScaleY(sfString* String) +float sfString_GetScaleY(sfString* string) { - CSFML_CALL_RETURN(String, GetScale().y, 0.f) + CSFML_CALL_RETURN(string, GetScale().y, 0.f) } //////////////////////////////////////////////////////////// /// Get the orientation of a string //////////////////////////////////////////////////////////// -float sfString_GetRotation(sfString* String) +float sfString_GetRotation(sfString* string) { - CSFML_CALL_RETURN(String, GetRotation(), 0.f) + CSFML_CALL_RETURN(string, GetRotation(), 0.f) } //////////////////////////////////////////////////////////// /// Get the X position of the origin a string //////////////////////////////////////////////////////////// -float sfString_GetOriginX(sfString* String) +float sfString_GetOriginX(sfString* string) { - CSFML_CALL_RETURN(String, GetOrigin().x, 0.f) + CSFML_CALL_RETURN(string, GetOrigin().x, 0.f) } //////////////////////////////////////////////////////////// /// Get the top Y of the origin of a string //////////////////////////////////////////////////////////// -float sfString_GetOriginY(sfString* String) +float sfString_GetOriginY(sfString* string) { - CSFML_CALL_RETURN(String, GetOrigin().y, 0.f) + CSFML_CALL_RETURN(string, GetOrigin().y, 0.f) } //////////////////////////////////////////////////////////// /// Get the color of a string //////////////////////////////////////////////////////////// -sfColor sfString_GetColor(sfString* String) +sfColor sfString_GetColor(sfString* string) { - sfColor Color = {0, 0, 0, 0}; - CSFML_CHECK_RETURN(String, Color) + sfColor color = {0, 0, 0, 0}; + CSFML_CHECK_RETURN(string, color) - sf::Color SFMLColor = String->This.GetColor(); + sf::Color SFMLColor = string->This.GetColor(); return sfColor_FromRGBA(SFMLColor.r, SFMLColor.g, SFMLColor.b, SFMLColor.a); } @@ -223,38 +223,38 @@ sfColor sfString_GetColor(sfString* String) //////////////////////////////////////////////////////////// /// Get the current blending mode of a string //////////////////////////////////////////////////////////// -sfBlendMode sfString_GetBlendMode(sfString* String) +sfBlendMode sfString_GetBlendMode(sfString* string) { - CSFML_CHECK_RETURN(String, sfBlendNone) + CSFML_CHECK_RETURN(string, sfBlendNone) - return static_cast(String->This.GetBlendMode()); + return static_cast(string->This.GetBlendMode()); } //////////////////////////////////////////////////////////// /// Move a string //////////////////////////////////////////////////////////// -void sfString_Move(sfString* String, float OffsetX, float OffsetY) +void sfString_Move(sfString* string, float offsetX, float offsetY) { - CSFML_CALL(String, Move(sf::Vector2f(OffsetX, OffsetY))) + CSFML_CALL(string, Move(sf::Vector2f(offsetX, offsetY))) } //////////////////////////////////////////////////////////// /// Scale a string //////////////////////////////////////////////////////////// -void sfString_Scale(sfString* String, float FactorX, float FactorY) +void sfString_Scale(sfString* string, float factorX, float factorY) { - CSFML_CALL(String, Scale(sf::Vector2f(FactorX, FactorY))) + CSFML_CALL(string, Scale(sf::Vector2f(factorX, factorY))) } //////////////////////////////////////////////////////////// /// Rotate a string //////////////////////////////////////////////////////////// -void sfString_Rotate(sfString* String, float Angle) +void sfString_Rotate(sfString* string, float angle) { - CSFML_CALL(String, Rotate(Angle)) + CSFML_CALL(string, Rotate(angle)) } @@ -262,13 +262,13 @@ void sfString_Rotate(sfString* String, float Angle) /// Transform a point from global coordinates into the string's local coordinates /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) //////////////////////////////////////////////////////////// -void sfString_TransformToLocal(sfString* String, float PointX, float PointY, float* X, float* Y) +void sfString_TransformToLocal(sfString* string, float pointX, float pointY, float* x, float* y) { - CSFML_CHECK(String) + CSFML_CHECK(string) - sf::Vector2f Point = String->This.TransformToLocal(sf::Vector2f(PointX, PointY)); - if (X) *X = Point.x; - if (Y) *Y = Point.y; + sf::Vector2f point = string->This.TransformToLocal(sf::Vector2f(pointX, pointY)); + if (x) *x = point.x; + if (y) *y = point.y; } @@ -276,115 +276,115 @@ void sfString_TransformToLocal(sfString* String, float PointX, float PointY, flo /// Transform a point from the string's local coordinates into global coordinates /// (ie it applies the object's origin, translation, rotation and scale to the point) //////////////////////////////////////////////////////////// -void sfString_TransformToGlobal(sfString* String, float PointX, float PointY, float* X, float* Y) +void sfString_TransformToGlobal(sfString* string, float pointX, float pointY, float* x, float* y) { - CSFML_CHECK(String) + CSFML_CHECK(string) - sf::Vector2f Point = String->This.TransformToGlobal(sf::Vector2f(PointX, PointY)); - if (X) *X = Point.x; - if (Y) *Y = Point.y; + sf::Vector2f point = string->This.TransformToGlobal(sf::Vector2f(pointX, pointY)); + if (x) *x = point.x; + if (y) *y = point.y; } //////////////////////////////////////////////////////////// /// Set the text of a string (from a multibyte string) //////////////////////////////////////////////////////////// -void sfString_SetText(sfString* String, const char* Text) +void sfString_SetText(sfString* string, const char* text) { - CSFML_CALL(String, SetText(Text)) + CSFML_CALL(string, SetText(text)) } //////////////////////////////////////////////////////////// /// Set the text of a string (from a unicode string) //////////////////////////////////////////////////////////// -void sfString_SetUnicodeText(sfString* String, const sfUint32* Text) +void sfString_SetUnicodeText(sfString* string, const sfUint32* text) { - sf::Unicode::UTF32String UTF32Text = Text; - CSFML_CALL(String, SetText(UTF32Text)) + sf::Unicode::UTF32String UTF32Text = text; + CSFML_CALL(string, SetText(UTF32Text)) } //////////////////////////////////////////////////////////// /// Set the font of a string //////////////////////////////////////////////////////////// -void sfString_SetFont(sfString* String, sfFont* Font) +void sfString_SetFont(sfString* string, sfFont* font) { - CSFML_CHECK(Font); + CSFML_CHECK(font); - CSFML_CALL(String, SetFont(Font->This)) - String->Font = Font; + CSFML_CALL(string, SetFont(font->This)) + string->Font = font; } //////////////////////////////////////////////////////////// /// Set the size of a string //////////////////////////////////////////////////////////// -void sfString_SetSize(sfString* String, float Size) +void sfString_SetSize(sfString* string, float size) { - CSFML_CALL(String, SetSize(Size)) + CSFML_CALL(string, SetSize(size)) } //////////////////////////////////////////////////////////// /// Set the style of a string //////////////////////////////////////////////////////////// -void sfString_SetStyle(sfString* String, unsigned long Style) +void sfString_SetStyle(sfString* string, unsigned long style) { - CSFML_CALL(String, SetStyle(Style)) + CSFML_CALL(string, SetStyle(style)) } //////////////////////////////////////////////////////////// /// Get the text of a string (returns a unicode string) //////////////////////////////////////////////////////////// -const sfUint32* sfString_GetUnicodeText(sfString* String) +const sfUint32* sfString_GetUnicodeText(sfString* string) { - CSFML_CHECK_RETURN(String, NULL) + CSFML_CHECK_RETURN(string, NULL) - return static_cast(String->This.GetText()).c_str(); + return static_cast(string->This.GetText()).c_str(); } //////////////////////////////////////////////////////////// /// Get the text of a string (returns an ANSI string) //////////////////////////////////////////////////////////// -const char* sfString_GetText(sfString* String) +const char* sfString_GetText(sfString* string) { - CSFML_CHECK_RETURN(String, NULL) + CSFML_CHECK_RETURN(string, NULL) - String->Text = String->This.GetText(); + string->Text = string->This.GetText(); - return String->Text.c_str(); + return string->Text.c_str(); } //////////////////////////////////////////////////////////// /// Get the font used by a string //////////////////////////////////////////////////////////// -sfFont* sfString_GetFont(sfString* String) +sfFont* sfString_GetFont(sfString* string) { - CSFML_CHECK_RETURN(String, NULL) + CSFML_CHECK_RETURN(string, NULL) - return String->Font; + return string->Font; } //////////////////////////////////////////////////////////// /// Get the size of the characters of a string //////////////////////////////////////////////////////////// -float sfString_GetSize(sfString* String) +float sfString_GetSize(sfString* string) { - CSFML_CALL_RETURN(String, GetSize(), 0.f) + CSFML_CALL_RETURN(string, GetSize(), 0.f) } //////////////////////////////////////////////////////////// /// Get the style of a string //////////////////////////////////////////////////////////// -unsigned long sfString_GetStyle(sfString* String) +unsigned long sfString_GetStyle(sfString* string) { - CSFML_CALL_RETURN(String, GetStyle(), 0) + CSFML_CALL_RETURN(string, GetStyle(), 0) } @@ -393,29 +393,29 @@ unsigned long sfString_GetStyle(sfString* String) /// in coordinates relative to the string /// (note : translation, origin, rotation and scale are not applied) //////////////////////////////////////////////////////////// -void sfString_GetCharacterPos(sfString* String, size_t Index, float* X, float* Y) +void sfString_GetCharacterPos(sfString* string, size_t index, float* x, float* y) { - CSFML_CHECK(String); + CSFML_CHECK(string); - sf::Vector2f Pos = String->This.GetCharacterPos(Index); - if (X) *X = Pos.x; - if (Y) *Y = Pos.y; + sf::Vector2f pos = string->This.GetCharacterPos(index); + if (x) *x = pos.x; + if (y) *y = pos.y; } //////////////////////////////////////////////////////////// /// Get the bounding rectangle of a string on screen //////////////////////////////////////////////////////////// -sfFloatRect sfString_GetRect(sfString* String) +sfFloatRect sfString_GetRect(sfString* string) { - sfFloatRect Rect = {0.f, 0.f, 0.f, 0.f}; - CSFML_CHECK_RETURN(String, Rect) + sfFloatRect rect = {0.f, 0.f, 0.f, 0.f}; + CSFML_CHECK_RETURN(string, rect) - sf::FloatRect SFMLRect = String->This.GetRect(); - String->Rect.Left = SFMLRect.Left; - String->Rect.Top = SFMLRect.Top; - String->Rect.Right = SFMLRect.Right; - String->Rect.Bottom = SFMLRect.Bottom; + sf::FloatRect SFMLRect = string->This.GetRect(); + string->Rect.Left = SFMLRect.Left; + string->Rect.Top = SFMLRect.Top; + string->Rect.Right = SFMLRect.Right; + string->Rect.Bottom = SFMLRect.Bottom; - return String->Rect; + return string->Rect; } diff --git a/CSFML/src/SFML/Network/Ftp.cpp b/CSFML/src/SFML/Network/Ftp.cpp index 0ba3a5b12..36150b780 100644 --- a/CSFML/src/SFML/Network/Ftp.cpp +++ b/CSFML/src/SFML/Network/Ftp.cpp @@ -34,113 +34,113 @@ //////////////////////////////////////////////////////////// /// Destroy an existing Ftp directory response //////////////////////////////////////////////////////////// -void sfFtpListingResponse_Destroy(sfFtpListingResponse* FtpListingResponse) +void sfFtpListingResponse_Destroy(sfFtpListingResponse* ftpListingResponse) { - delete FtpListingResponse; + delete ftpListingResponse; } //////////////////////////////////////////////////////////// /// Convenience function to check if the response status code /// means a success //////////////////////////////////////////////////////////// -sfBool sfFtpListingResponse_IsOk(sfFtpListingResponse* FtpListingResponse) +sfBool sfFtpListingResponse_IsOk(sfFtpListingResponse* ftpListingResponse) { - CSFML_CALL_RETURN(FtpListingResponse, IsOk(), sfFalse); + CSFML_CALL_RETURN(ftpListingResponse, IsOk(), sfFalse); } //////////////////////////////////////////////////////////// /// Get the response status code //////////////////////////////////////////////////////////// -sfFtpStatus sfFtpListingResponse_GetStatus(sfFtpListingResponse* FtpListingResponse) +sfFtpStatus sfFtpListingResponse_GetStatus(sfFtpListingResponse* ftpListingResponse) { - CSFML_CHECK_RETURN(FtpListingResponse, sfFtpInvalidResponse); + CSFML_CHECK_RETURN(ftpListingResponse, sfFtpInvalidResponse); - return static_cast(FtpListingResponse->This.GetStatus()); + return static_cast(ftpListingResponse->This.GetStatus()); } //////////////////////////////////////////////////////////// /// Get the full message contained in the response //////////////////////////////////////////////////////////// -const char* sfFtpListingResponse_GetMessage(sfFtpListingResponse* FtpListingResponse) +const char* sfFtpListingResponse_GetMessage(sfFtpListingResponse* ftpListingResponse) { - CSFML_CHECK_RETURN(FtpListingResponse, NULL); + CSFML_CHECK_RETURN(ftpListingResponse, NULL); - return FtpListingResponse->This.GetMessage().c_str(); + return ftpListingResponse->This.GetMessage().c_str(); } //////////////////////////////////////////////////////////// /// Get the number of filenames in the listing //////////////////////////////////////////////////////////// -size_t sfFtpListingResponse_GetCount(sfFtpListingResponse* FtpListingResponse) +size_t sfFtpListingResponse_GetCount(sfFtpListingResponse* ftpListingResponse) { - CSFML_CALL_RETURN(FtpListingResponse, GetCount(), 0); + CSFML_CALL_RETURN(ftpListingResponse, GetCount(), 0); } //////////////////////////////////////////////////////////// /// Get the Index-th filename in the directory //////////////////////////////////////////////////////////// -const char* sfFtpListingResponse_GetFilename(sfFtpListingResponse* FtpListingResponse, size_t Index) +const char* sfFtpListingResponse_GetFilename(sfFtpListingResponse* ftpListingResponse, size_t index) { - CSFML_CHECK_RETURN(FtpListingResponse, NULL); + CSFML_CHECK_RETURN(ftpListingResponse, NULL); - return FtpListingResponse->This.GetFilename(Index).c_str(); + return ftpListingResponse->This.GetFilename(index).c_str(); } //////////////////////////////////////////////////////////// /// Destroy an existing Ftp directory response //////////////////////////////////////////////////////////// -void sfFtpDirectoryResponse_Destroy(sfFtpDirectoryResponse* FtpDirectoryResponse) +void sfFtpDirectoryResponse_Destroy(sfFtpDirectoryResponse* ftpDirectoryResponse) { - delete FtpDirectoryResponse; + delete ftpDirectoryResponse; } //////////////////////////////////////////////////////////// /// Convenience function to check if the response status code /// means a success //////////////////////////////////////////////////////////// -sfBool sfFtpDirectoryResponse_IsOk(sfFtpDirectoryResponse* FtpDirectoryResponse) +sfBool sfFtpDirectoryResponse_IsOk(sfFtpDirectoryResponse* ftpDirectoryResponse) { - CSFML_CALL_RETURN(FtpDirectoryResponse, IsOk(), sfFalse); + CSFML_CALL_RETURN(ftpDirectoryResponse, IsOk(), sfFalse); } //////////////////////////////////////////////////////////// /// Get the response status code //////////////////////////////////////////////////////////// -sfFtpStatus sfFtpDirectoryResponse_GetStatus(sfFtpDirectoryResponse* FtpDirectoryResponse) +sfFtpStatus sfFtpDirectoryResponse_GetStatus(sfFtpDirectoryResponse* ftpDirectoryResponse) { - CSFML_CHECK_RETURN(FtpDirectoryResponse, sfFtpInvalidResponse); + CSFML_CHECK_RETURN(ftpDirectoryResponse, sfFtpInvalidResponse); - return static_cast(FtpDirectoryResponse->This.GetStatus()); + return static_cast(ftpDirectoryResponse->This.GetStatus()); } //////////////////////////////////////////////////////////// /// Get the full message contained in the response //////////////////////////////////////////////////////////// -const char* sfFtpDirectoryResponse_GetMessage(sfFtpDirectoryResponse* FtpDirectoryResponse) +const char* sfFtpDirectoryResponse_GetMessage(sfFtpDirectoryResponse* ftpDirectoryResponse) { - CSFML_CHECK_RETURN(FtpDirectoryResponse, NULL); + CSFML_CHECK_RETURN(ftpDirectoryResponse, NULL); - return FtpDirectoryResponse->This.GetMessage().c_str(); + return ftpDirectoryResponse->This.GetMessage().c_str(); } //////////////////////////////////////////////////////////// /// Get the directory returned in the response //////////////////////////////////////////////////////////// -const char* sfFtpDirectoryResponse_GetDirectory(sfFtpDirectoryResponse* FtpDirectoryResponse) +const char* sfFtpDirectoryResponse_GetDirectory(sfFtpDirectoryResponse* ftpDirectoryResponse) { - CSFML_CHECK_RETURN(FtpDirectoryResponse, NULL); + CSFML_CHECK_RETURN(ftpDirectoryResponse, NULL); - return FtpDirectoryResponse->This.GetDirectory().c_str(); + return ftpDirectoryResponse->This.GetDirectory().c_str(); } //////////////////////////////////////////////////////////// /// Destroy an existing Ftp response //////////////////////////////////////////////////////////// -void sfFtpResponse_Destroy(sfFtpResponse* FtpResponse) +void sfFtpResponse_Destroy(sfFtpResponse* ftpResponse) { - delete FtpResponse; + delete ftpResponse; } @@ -148,31 +148,31 @@ void sfFtpResponse_Destroy(sfFtpResponse* FtpResponse) /// Convenience function to check if the response status code /// means a success //////////////////////////////////////////////////////////// -sfBool sfFtpResponse_IsOk(sfFtpResponse* FtpResponse) +sfBool sfFtpResponse_IsOk(sfFtpResponse* ftpResponse) { - CSFML_CALL_RETURN(FtpResponse, IsOk(), sfFalse); + CSFML_CALL_RETURN(ftpResponse, IsOk(), sfFalse); } //////////////////////////////////////////////////////////// /// Get the response status code //////////////////////////////////////////////////////////// -sfFtpStatus sfFtpResponse_GetStatus(sfFtpResponse* FtpResponse) +sfFtpStatus sfFtpResponse_GetStatus(sfFtpResponse* ftpResponse) { - CSFML_CHECK_RETURN(FtpResponse, sfFtpInvalidResponse); + CSFML_CHECK_RETURN(ftpResponse, sfFtpInvalidResponse); - return static_cast(FtpResponse->This.GetStatus()); + return static_cast(ftpResponse->This.GetStatus()); } //////////////////////////////////////////////////////////// /// Get the full message contained in the response //////////////////////////////////////////////////////////// -const char* sfFtpResponse_GetMessage(sfFtpResponse* FtpResponse) +const char* sfFtpResponse_GetMessage(sfFtpResponse* ftpResponse) { - CSFML_CHECK_RETURN(FtpResponse, NULL); + CSFML_CHECK_RETURN(ftpResponse, NULL); - return FtpResponse->This.GetMessage().c_str(); + return ftpResponse->This.GetMessage().c_str(); } @@ -188,77 +188,77 @@ sfFtp* sfFtp_Create() //////////////////////////////////////////////////////////// /// Destroy an existing Ftp //////////////////////////////////////////////////////////// -void sfFtp_Destroy(sfFtp* Ftp) +void sfFtp_Destroy(sfFtp* ftp) { - delete Ftp; + delete ftp; } //////////////////////////////////////////////////////////// /// Connect to the specified FTP server //////////////////////////////////////////////////////////// -sfFtpResponse* sfFtp_Connect(sfFtp* Ftp, sfIPAddress Server, unsigned short Port, float Timeout) +sfFtpResponse* sfFtp_Connect(sfFtp* ftp, sfIPAddress server, unsigned short port, float timeout) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - sf::IPAddress SFMLServer(Server.Address); + sf::IPAddress SFMLServer(server.Address); - return new sfFtpResponse(Ftp->This.Connect(SFMLServer, Port, Timeout)); + return new sfFtpResponse(ftp->This.Connect(SFMLServer, port, timeout)); } //////////////////////////////////////////////////////////// /// Log in using anonymous account //////////////////////////////////////////////////////////// -sfFtpResponse* sfFtp_LoginAnonymous(sfFtp* Ftp) +sfFtpResponse* sfFtp_LoginAnonymous(sfFtp* ftp) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - return new sfFtpResponse(Ftp->This.Login()); + return new sfFtpResponse(ftp->This.Login()); } //////////////////////////////////////////////////////////// /// Log in using a username and a password //////////////////////////////////////////////////////////// -sfFtpResponse* sfFtp_Login(sfFtp* Ftp, const char* UserName, const char* Password) +sfFtpResponse* sfFtp_Login(sfFtp* ftp, const char* userName, const char* password) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - return new sfFtpResponse(Ftp->This.Login(UserName ? UserName : "", Password ? Password : "")); + return new sfFtpResponse(ftp->This.Login(userName ? userName : "", password ? password : "")); } //////////////////////////////////////////////////////////// /// Close the connection with FTP server //////////////////////////////////////////////////////////// -sfFtpResponse* sfFtp_Disconnect(sfFtp* Ftp) +sfFtpResponse* sfFtp_Disconnect(sfFtp* ftp) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - return new sfFtpResponse(Ftp->This.Disconnect()); + return new sfFtpResponse(ftp->This.Disconnect()); } //////////////////////////////////////////////////////////// /// Send a null command just to prevent from being disconnected //////////////////////////////////////////////////////////// -sfFtpResponse* sfFtp_KeepAlive(sfFtp* Ftp) +sfFtpResponse* sfFtp_KeepAlive(sfFtp* ftp) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - return new sfFtpResponse(Ftp->This.KeepAlive()); + return new sfFtpResponse(ftp->This.KeepAlive()); } //////////////////////////////////////////////////////////// /// Get the current working directory //////////////////////////////////////////////////////////// -sfFtpDirectoryResponse* sfFtp_GetWorkingDirectory(sfFtp* Ftp) +sfFtpDirectoryResponse* sfFtp_GetWorkingDirectory(sfFtp* ftp) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - return new sfFtpDirectoryResponse(Ftp->This.GetWorkingDirectory()); + return new sfFtpDirectoryResponse(ftp->This.GetWorkingDirectory()); } @@ -266,101 +266,101 @@ sfFtpDirectoryResponse* sfFtp_GetWorkingDirectory(sfFtp* Ftp) /// Get the contents of the given directory /// (subdirectories and files) //////////////////////////////////////////////////////////// -sfFtpListingResponse* sfFtp_GetDirectoryListing(sfFtp* Ftp, const char* Directory) +sfFtpListingResponse* sfFtp_GetDirectoryListing(sfFtp* ftp, const char* directory) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - return new sfFtpListingResponse(Ftp->This.GetDirectoryListing(Directory ? Directory : "")); + return new sfFtpListingResponse(ftp->This.GetDirectoryListing(directory ? directory : "")); } //////////////////////////////////////////////////////////// /// Change the current working directory //////////////////////////////////////////////////////////// -sfFtpResponse* sfFtp_ChangeDirectory(sfFtp* Ftp, const char* Directory) +sfFtpResponse* sfFtp_ChangeDirectory(sfFtp* ftp, const char* directory) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - return new sfFtpResponse(Ftp->This.ChangeDirectory(Directory ? Directory : "")); + return new sfFtpResponse(ftp->This.ChangeDirectory(directory ? directory : "")); } //////////////////////////////////////////////////////////// /// Go to the parent directory of the current one //////////////////////////////////////////////////////////// -sfFtpResponse* sfFtp_ParentDirectory(sfFtp* Ftp) +sfFtpResponse* sfFtp_ParentDirectory(sfFtp* ftp) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - return new sfFtpResponse(Ftp->This.ParentDirectory()); + return new sfFtpResponse(ftp->This.ParentDirectory()); } //////////////////////////////////////////////////////////// /// Create a new directory //////////////////////////////////////////////////////////// -sfFtpResponse* sfFtp_MakeDirectory(sfFtp* Ftp, const char* Name) +sfFtpResponse* sfFtp_MakeDirectory(sfFtp* ftp, const char* name) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - return new sfFtpResponse(Ftp->This.MakeDirectory(Name ? Name : "")); + return new sfFtpResponse(ftp->This.MakeDirectory(name ? name : "")); } //////////////////////////////////////////////////////////// /// Remove an existing directory //////////////////////////////////////////////////////////// -sfFtpResponse* sfFtp_DeleteDirectory(sfFtp* Ftp, const char* Name) +sfFtpResponse* sfFtp_DeleteDirectory(sfFtp* ftp, const char* name) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - return new sfFtpResponse(Ftp->This.DeleteDirectory(Name ? Name : "")); + return new sfFtpResponse(ftp->This.DeleteDirectory(name ? name : "")); } //////////////////////////////////////////////////////////// /// Rename a file //////////////////////////////////////////////////////////// -sfFtpResponse* sfFtp_RenameFile(sfFtp* Ftp, const char* File, const char* NewName) +sfFtpResponse* sfFtp_RenameFile(sfFtp* ftp, const char* file, const char* newName) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - return new sfFtpResponse(Ftp->This.RenameFile(File ? File : "", NewName ? NewName : "")); + return new sfFtpResponse(ftp->This.RenameFile(file ? file : "", newName ? newName : "")); } //////////////////////////////////////////////////////////// /// Remove an existing file //////////////////////////////////////////////////////////// -sfFtpResponse* sfFtp_DeleteFile(sfFtp* Ftp, const char* Name) +sfFtpResponse* sfFtp_DeleteFile(sfFtp* ftp, const char* name) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - return new sfFtpResponse(Ftp->This.DeleteFile(Name ? Name : "")); + return new sfFtpResponse(ftp->This.DeleteFile(name ? name : "")); } //////////////////////////////////////////////////////////// /// Download a file from the server //////////////////////////////////////////////////////////// -sfFtpResponse* sfFtp_Download(sfFtp* Ftp, const char* DistantFile, const char* DestPath, sfFtpTransferMode Mode) +sfFtpResponse* sfFtp_Download(sfFtp* ftp, const char* distantFile, const char* destPath, sfFtpTransferMode mode) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - return new sfFtpResponse(Ftp->This.Download(DistantFile ? DistantFile : "", - DestPath ? DestPath : "", - static_cast(Mode))); + return new sfFtpResponse(ftp->This.Download(distantFile ? distantFile : "", + destPath ? destPath : "", + static_cast(mode))); } //////////////////////////////////////////////////////////// /// Upload a file to the server //////////////////////////////////////////////////////////// -sfFtpResponse* sfFtp_Upload(sfFtp* Ftp, const char* LocalFile, const char* DestPath, sfFtpTransferMode Mode) +sfFtpResponse* sfFtp_Upload(sfFtp* ftp, const char* localFile, const char* destPath, sfFtpTransferMode mode) { - CSFML_CHECK_RETURN(Ftp, NULL); + CSFML_CHECK_RETURN(ftp, NULL); - return new sfFtpResponse(Ftp->This.Upload(LocalFile ? LocalFile : "", - DestPath ? DestPath : "", - static_cast(Mode))); + return new sfFtpResponse(ftp->This.Upload(localFile ? localFile : "", + destPath ? destPath : "", + static_cast(mode))); } diff --git a/CSFML/src/SFML/Network/Http.cpp b/CSFML/src/SFML/Network/Http.cpp index f5bfa1159..f50d7b33d 100644 --- a/CSFML/src/SFML/Network/Http.cpp +++ b/CSFML/src/SFML/Network/Http.cpp @@ -42,20 +42,20 @@ sfHttpRequest* sfHttpRequest_Create() //////////////////////////////////////////////////////////// /// Destroy an existing Http request //////////////////////////////////////////////////////////// -void sfHttpRequest_Destroy(sfHttpRequest* HttpRequest) +void sfHttpRequest_Destroy(sfHttpRequest* httpRequest) { - delete HttpRequest; + delete 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) +void sfHttpRequest_SetField(sfHttpRequest* httpRequest, const char* field, const char* value) { - CSFML_CHECK(HttpRequest); - if (Field) - HttpRequest->This.SetField(Field, Value); + CSFML_CHECK(httpRequest); + if (field) + httpRequest->This.SetField(field, value); } @@ -63,9 +63,9 @@ 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) +void sfHttpRequest_SetMethod(sfHttpRequest* httpRequest, sfHttpMethod method) { - CSFML_CALL(HttpRequest, SetMethod(static_cast(Method))); + CSFML_CALL(httpRequest, SetMethod(static_cast(method))); } @@ -73,9 +73,9 @@ 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) +void sfHttpRequest_SetURI(sfHttpRequest* httpRequest, const char* URI) { - CSFML_CALL(HttpRequest, SetURI(URI ? URI : "")); + CSFML_CALL(httpRequest, SetURI(URI ? URI : "")); } @@ -83,9 +83,9 @@ 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) +void sfHttpRequest_SetHttpVersion(sfHttpRequest* httpRequest, unsigned int major, unsigned int minor) { - CSFML_CALL(HttpRequest, SetHttpVersion(Major, Minor)); + CSFML_CALL(httpRequest, SetHttpVersion(major, minor)); } @@ -94,60 +94,60 @@ void sfHttpRequest_SetHttpVersion(sfHttpRequest* HttpRequest, unsigned int Major /// makes sense only for POST requests. /// This parameter is empty by default //////////////////////////////////////////////////////////// -void sfHttpRequest_SetBody(sfHttpRequest* HttpRequest, const char* Body) +void sfHttpRequest_SetBody(sfHttpRequest* httpRequest, const char* body) { - CSFML_CALL(HttpRequest, SetBody(Body ? Body : "")); + CSFML_CALL(httpRequest, SetBody(body ? body : "")); } //////////////////////////////////////////////////////////// /// Destroy an existing Http response //////////////////////////////////////////////////////////// -void sfHttpResponse_Destroy(sfHttpResponse* HttpResponse) +void sfHttpResponse_Destroy(sfHttpResponse* httpResponse) { - delete HttpResponse; + delete httpResponse; } //////////////////////////////////////////////////////////// /// Get the value of a field; returns NULL if the field doesn't exist //////////////////////////////////////////////////////////// -const char* sfHttpResponse_GetField(sfHttpResponse* HttpResponse, const char* Field) +const char* sfHttpResponse_GetField(sfHttpResponse* httpResponse, const char* field) { - CSFML_CHECK_RETURN(HttpResponse, NULL); - if (!Field) + CSFML_CHECK_RETURN(httpResponse, NULL); + if (!field) return NULL; - return HttpResponse->This.GetField(Field).c_str(); + return httpResponse->This.GetField(field).c_str(); } //////////////////////////////////////////////////////////// /// Get the status of a response //////////////////////////////////////////////////////////// -sfHttpStatus sfHttpResponse_GetStatus(sfHttpResponse* HttpResponse) +sfHttpStatus sfHttpResponse_GetStatus(sfHttpResponse* httpResponse) { - CSFML_CHECK_RETURN(HttpResponse, sfHttpInvalidResponse); + CSFML_CHECK_RETURN(httpResponse, sfHttpInvalidResponse); - return static_cast(HttpResponse->This.GetStatus()); + return static_cast(httpResponse->This.GetStatus()); } //////////////////////////////////////////////////////////// /// Get the major HTTP version of a response //////////////////////////////////////////////////////////// -unsigned int sfHttpResponse_GetMajorVersion(sfHttpResponse* HttpResponse) +unsigned int sfHttpResponse_GetMajorVersion(sfHttpResponse* httpResponse) { - CSFML_CALL_RETURN(HttpResponse, GetMajorHttpVersion(), 0); + CSFML_CALL_RETURN(httpResponse, GetMajorHttpVersion(), 0); } //////////////////////////////////////////////////////////// /// Get the minor HTTP version of a response //////////////////////////////////////////////////////////// -unsigned int sfHttpResponse_GetMinorVersion(sfHttpResponse* HttpResponse) +unsigned int sfHttpResponse_GetMinorVersion(sfHttpResponse* httpResponse) { - CSFML_CALL_RETURN(HttpResponse, GetMinorHttpVersion(), 0); + CSFML_CALL_RETURN(httpResponse, GetMinorHttpVersion(), 0); } @@ -158,11 +158,11 @@ unsigned int sfHttpResponse_GetMinorVersion(sfHttpResponse* HttpResponse) /// - nothing (for HEAD requests) /// - an error message (in case of an error) //////////////////////////////////////////////////////////// -const char* sfHttpResponse_GetBody(sfHttpResponse* HttpResponse) +const char* sfHttpResponse_GetBody(sfHttpResponse* httpResponse) { - CSFML_CHECK_RETURN(HttpResponse, NULL); + CSFML_CHECK_RETURN(httpResponse, NULL); - return HttpResponse->This.GetBody().c_str(); + return httpResponse->This.GetBody().c_str(); } @@ -178,18 +178,18 @@ sfHttp* sfHttp_Create() //////////////////////////////////////////////////////////// /// Destroy an existing Http object //////////////////////////////////////////////////////////// -void sfHttp_Destroy(sfHttp* Http) +void sfHttp_Destroy(sfHttp* http) { - delete Http; + delete http; } //////////////////////////////////////////////////////////// /// Set the target host of a Http server //////////////////////////////////////////////////////////// -void sfHttp_SetHost(sfHttp* Http, const char* Host, unsigned short Port) +void sfHttp_SetHost(sfHttp* http, const char* host, unsigned short port) { - CSFML_CALL(Http, SetHost(Host ? Host : "", Port)); + CSFML_CALL(http, SetHost(host ? host : "", port)); } @@ -201,13 +201,13 @@ void sfHttp_SetHost(sfHttp* Http, const char* Host, unsigned short Port) /// not return instantly; use a thread if you don't want to block your /// application. //////////////////////////////////////////////////////////// -sfHttpResponse* sfHttp_SendRequest(sfHttp* Http, sfHttpRequest* Request, float Timeout) +sfHttpResponse* sfHttp_SendRequest(sfHttp* http, sfHttpRequest* request, float timeout) { - CSFML_CHECK_RETURN(Http, NULL); - CSFML_CHECK_RETURN(Request, NULL); + CSFML_CHECK_RETURN(http, NULL); + CSFML_CHECK_RETURN(request, NULL); - sfHttpResponse* Response = new sfHttpResponse; - Response->This = Http->This.SendRequest(Request->This, Timeout); + sfHttpResponse* response = new sfHttpResponse; + response->This = http->This.SendRequest(request->This, timeout); - return Response; + return response; } diff --git a/CSFML/src/SFML/Network/IPAddress.cpp b/CSFML/src/SFML/Network/IPAddress.cpp index d94c98eca..4bb9987da 100644 --- a/CSFML/src/SFML/Network/IPAddress.cpp +++ b/CSFML/src/SFML/Network/IPAddress.cpp @@ -35,20 +35,20 @@ namespace //////////////////////////////////////////////////////////// /// Helper function for converting a SFML address to a CSFML one //////////////////////////////////////////////////////////// - sfIPAddress FromSFMLAddress(sf::IPAddress Address) + sfIPAddress FromSFMLAddress(sf::IPAddress address) { - sfIPAddress Result; - strncpy(Result.Address, Address.ToString().c_str(), 16); + sfIPAddress result; + strncpy(result.Address, address.ToString().c_str(), 16); - return Result; + return result; } //////////////////////////////////////////////////////////// /// Helper function for converting a CSFML address to a SFML one //////////////////////////////////////////////////////////// - sf::IPAddress ToSFMLAddress(sfIPAddress Address) + sf::IPAddress ToSFMLAddress(sfIPAddress address) { - return sf::IPAddress(Address.Address); + return sf::IPAddress(address.Address); } } @@ -56,55 +56,55 @@ namespace //////////////////////////////////////////////////////////// /// Construct an address from a string //////////////////////////////////////////////////////////// -sfIPAddress sfIPAddress_FromString(const char* String) +sfIPAddress sfIPAddress_FromString(const char* string) { - return FromSFMLAddress(sf::IPAddress(String)); + return FromSFMLAddress(sf::IPAddress(string)); } //////////////////////////////////////////////////////////// /// Construct an address from 4 bytes //////////////////////////////////////////////////////////// -sfIPAddress sfIPAddress_FromBytes(sfUint8 Byte0, sfUint8 Byte1, sfUint8 Byte2, sfUint8 Byte3) +sfIPAddress sfIPAddress_FromBytes(sfUint8 byte0, sfUint8 byte1, sfUint8 byte2, sfUint8 byte3) { - return FromSFMLAddress(sf::IPAddress(Byte0, Byte1, Byte2, Byte3)); + return FromSFMLAddress(sf::IPAddress(byte0, byte1, byte2, byte3)); } //////////////////////////////////////////////////////////// /// Construct the address from a 32-bits integer //////////////////////////////////////////////////////////// -sfIPAddress sfIPAddress_FromInteger(sfUint32 Address) +sfIPAddress sfIPAddress_FromInteger(sfUint32 address) { - return FromSFMLAddress(sf::IPAddress(Address)); + return FromSFMLAddress(sf::IPAddress(address)); } //////////////////////////////////////////////////////////// /// Tell if an address is a valid one //////////////////////////////////////////////////////////// -sfBool sfIPAddress_IsValid(sfIPAddress Address) +sfBool sfIPAddress_IsValid(sfIPAddress address) { - return ToSFMLAddress(Address).IsValid() ? sfTrue : sfFalse; + return ToSFMLAddress(address).IsValid() ? sfTrue : sfFalse; } //////////////////////////////////////////////////////////// /// Get a string representation of an address //////////////////////////////////////////////////////////// -void sfIPAddress_ToString(sfIPAddress Address, char* String) +void sfIPAddress_ToString(sfIPAddress address, char* string) { - if (String) - strcpy(String, Address.Address); + if (string) + strcpy(string, address.Address); } //////////////////////////////////////////////////////////// /// Get an integer representation of the address //////////////////////////////////////////////////////////// -sfUint32 sfIPAddress_ToInteger(sfIPAddress Address) +sfUint32 sfIPAddress_ToInteger(sfIPAddress address) { - return ToSFMLAddress(Address).ToInteger(); + return ToSFMLAddress(address).ToInteger(); } @@ -123,9 +123,9 @@ sfIPAddress sfIPAddress_GetLocalAddress() /// distant website ; as a consequence, this function may be /// very slow -- use it as few as possible ! //////////////////////////////////////////////////////////// -sfIPAddress sfIPAddress_GetPublicAddress(float Timeout) +sfIPAddress sfIPAddress_GetPublicAddress(float timeout) { - return FromSFMLAddress(sf::IPAddress::GetPublicAddress(Timeout)); + return FromSFMLAddress(sf::IPAddress::GetPublicAddress(timeout)); } diff --git a/CSFML/src/SFML/Network/Packet.cpp b/CSFML/src/SFML/Network/Packet.cpp index 81e04cfaf..1fe50e46b 100644 --- a/CSFML/src/SFML/Network/Packet.cpp +++ b/CSFML/src/SFML/Network/Packet.cpp @@ -36,24 +36,24 @@ namespace /// Helper function to read a variable from a packet //////////////////////////////////////////////////////////// template - T PacketRead(sfPacket* Packet, T Default = 0) + T PacketRead(sfPacket* packet, T def = 0) { - CSFML_CHECK_RETURN(Packet, Default); + CSFML_CHECK_RETURN(packet, def); - T Value; - Packet->This >> Value; - return Value; + T value; + packet->This >> value; + return value; } //////////////////////////////////////////////////////////// /// Helper function to write a variable to a packet //////////////////////////////////////////////////////////// template - void PacketWrite(sfPacket* Packet, T Value) + void PacketWrite(sfPacket* packet, T value) { - CSFML_CHECK(Packet); + CSFML_CHECK(packet); - Packet->This << Value; + packet->This << value; } } @@ -70,27 +70,27 @@ sfPacket* sfPacket_Create() //////////////////////////////////////////////////////////// /// Destroy an existing packet //////////////////////////////////////////////////////////// -void sfPacket_Destroy(sfPacket* Packet) +void sfPacket_Destroy(sfPacket* packet) { - delete Packet; + delete packet; } //////////////////////////////////////////////////////////// /// Append data to the end of a packet //////////////////////////////////////////////////////////// -void sfPacket_Append(sfPacket* Packet, void* Data, size_t SizeInBytes) +void sfPacket_Append(sfPacket* packet, void* data, size_t sizeInBytes) { - CSFML_CALL(Packet, Append(Data, SizeInBytes)); + CSFML_CALL(packet, Append(data, sizeInBytes)); } //////////////////////////////////////////////////////////// /// Clear all the data of a packet /////////////////////////////////////////////////////////// -void sfPacket_Clear(sfPacket* Packet) +void sfPacket_Clear(sfPacket* packet) { - CSFML_CALL(Packet, Clear()); + CSFML_CALL(packet, Clear()); } @@ -99,36 +99,36 @@ void sfPacket_Clear(sfPacket* Packet) /// Warning : the returned pointer may be invalid after you /// append data to the packet //////////////////////////////////////////////////////////// -const char* sfPacket_GetData(sfPacket* Packet) +const char* sfPacket_GetData(sfPacket* packet) { - CSFML_CALL_RETURN(Packet, GetData(), NULL); + CSFML_CALL_RETURN(packet, GetData(), NULL); } //////////////////////////////////////////////////////////// /// Get the size of the data contained in a packet //////////////////////////////////////////////////////////// -size_t sfPacket_GetDataSize(sfPacket* Packet) +size_t sfPacket_GetDataSize(sfPacket* packet) { - CSFML_CALL_RETURN(Packet, GetDataSize(), 0); + CSFML_CALL_RETURN(packet, GetDataSize(), 0); } //////////////////////////////////////////////////////////// /// Tell if the reading position has reached the end of the packet //////////////////////////////////////////////////////////// -sfBool sfPacket_EndOfPacket(sfPacket* Packet) +sfBool sfPacket_EndOfPacket(sfPacket* packet) { - CSFML_CALL_RETURN(Packet, EndOfPacket(), sfFalse); + CSFML_CALL_RETURN(packet, EndOfPacket(), sfFalse); } //////////////////////////////////////////////////////////// /// Check if a packet is in a valid reading state //////////////////////////////////////////////////////////// -sfBool sfPacket_CanRead(sfPacket* Packet) +sfBool sfPacket_CanRead(sfPacket* packet) { - CSFML_CALL_RETURN(Packet, operator bool(), sfFalse); + CSFML_CALL_RETURN(packet, operator bool(), sfFalse); } @@ -138,30 +138,30 @@ sfBool sfPacket_CanRead(sfPacket* Packet) /// \param Packet : Packet to read /// //////////////////////////////////////////////////////////// -sfBool sfPacket_ReadBool(sfPacket* Packet) {return PacketRead(Packet);} -sfInt8 sfPacket_ReadInt8(sfPacket* Packet) {return PacketRead(Packet);} -sfUint8 sfPacket_ReadUint8(sfPacket* Packet) {return PacketRead(Packet);} -sfInt16 sfPacket_ReadInt16(sfPacket* Packet) {return PacketRead(Packet);} -sfUint16 sfPacket_ReadUint16(sfPacket* Packet) {return PacketRead(Packet);} -sfInt32 sfPacket_ReadInt32(sfPacket* Packet) {return PacketRead(Packet);} -sfUint32 sfPacket_ReadUint32(sfPacket* Packet) {return PacketRead(Packet);} -float sfPacket_ReadFloat(sfPacket* Packet) {return PacketRead(Packet);} -double sfPacket_ReadDouble(sfPacket* Packet) {return PacketRead(Packet);} +sfBool sfPacket_ReadBool(sfPacket* packet) {return PacketRead(packet);} +sfInt8 sfPacket_ReadInt8(sfPacket* packet) {return PacketRead(packet);} +sfUint8 sfPacket_ReadUint8(sfPacket* packet) {return PacketRead(packet);} +sfInt16 sfPacket_ReadInt16(sfPacket* packet) {return PacketRead(packet);} +sfUint16 sfPacket_ReadUint16(sfPacket* packet) {return PacketRead(packet);} +sfInt32 sfPacket_ReadInt32(sfPacket* packet) {return PacketRead(packet);} +sfUint32 sfPacket_ReadUint32(sfPacket* packet) {return PacketRead(packet);} +float sfPacket_ReadFloat(sfPacket* packet) {return PacketRead(packet);} +double sfPacket_ReadDouble(sfPacket* packet) {return PacketRead(packet);} -void sfPacket_ReadString(sfPacket* Packet, char* String) +void sfPacket_ReadString(sfPacket* packet, char* string) { - CSFML_CHECK(Packet); + CSFML_CHECK(packet); - if (String) - Packet->This >> String; + if (string) + packet->This >> string; } -void sfPacket_ReadWideString(sfPacket* Packet, wchar_t* String) +void sfPacket_ReadWideString(sfPacket* packet, wchar_t* string) { - CSFML_CHECK(Packet); + CSFML_CHECK(packet); - if (String) - Packet->This >> String; + if (string) + packet->This >> string; } @@ -171,28 +171,28 @@ void sfPacket_ReadWideString(sfPacket* Packet, wchar_t* String) /// \param Packet : Packet to write /// //////////////////////////////////////////////////////////// -void sfPacket_WriteBool(sfPacket* Packet, sfBool Value) {PacketWrite(Packet, static_cast(Value));} -void sfPacket_WriteInt8(sfPacket* Packet, sfInt8 Value) {PacketWrite(Packet, Value);} -void sfPacket_WriteUint8(sfPacket* Packet, sfUint8 Value) {PacketWrite(Packet, Value);} -void sfPacket_WriteInt16(sfPacket* Packet, sfInt16 Value) {PacketWrite(Packet, Value);} -void sfPacket_WriteUint16(sfPacket* Packet, sfUint16 Value) {PacketWrite(Packet, Value);} -void sfPacket_WriteInt32(sfPacket* Packet, sfInt32 Value) {PacketWrite(Packet, Value);} -void sfPacket_WriteUint32(sfPacket* Packet, sfUint32 Value) {PacketWrite(Packet, Value);} -void sfPacket_WriteFloat(sfPacket* Packet, float Value) {PacketWrite(Packet, Value);} -void sfPacket_WriteDouble(sfPacket* Packet, double Value) {PacketWrite(Packet, Value);} +void sfPacket_WriteBool(sfPacket* packet, sfBool value) {PacketWrite(packet, static_cast(value));} +void sfPacket_WriteInt8(sfPacket* packet, sfInt8 value) {PacketWrite(packet, value);} +void sfPacket_WriteUint8(sfPacket* packet, sfUint8 value) {PacketWrite(packet, value);} +void sfPacket_WriteInt16(sfPacket* packet, sfInt16 value) {PacketWrite(packet, value);} +void sfPacket_WriteUint16(sfPacket* packet, sfUint16 value) {PacketWrite(packet, value);} +void sfPacket_WriteInt32(sfPacket* packet, sfInt32 value) {PacketWrite(packet, value);} +void sfPacket_WriteUint32(sfPacket* packet, sfUint32 value) {PacketWrite(packet, value);} +void sfPacket_WriteFloat(sfPacket* packet, float value) {PacketWrite(packet, value);} +void sfPacket_WriteDouble(sfPacket* packet, double value) {PacketWrite(packet, value);} -void sfPacket_WriteString(sfPacket* Packet, const char* String) +void sfPacket_WriteString(sfPacket* packet, const char* string) { - CSFML_CHECK(Packet); + CSFML_CHECK(packet); - if (String) - Packet->This << String; + if (string) + packet->This << string; } -void sfPacket_WriteWideString(sfPacket* Packet, const wchar_t* String) +void sfPacket_WriteWideString(sfPacket* packet, const wchar_t* string) { - CSFML_CHECK(Packet); + CSFML_CHECK(packet); - if (String) - Packet->This << String; + if (string) + packet->This << string; } diff --git a/CSFML/src/SFML/Network/Selector.cpp b/CSFML/src/SFML/Network/Selector.cpp index 618952532..4f186f504 100644 --- a/CSFML/src/SFML/Network/Selector.cpp +++ b/CSFML/src/SFML/Network/Selector.cpp @@ -40,37 +40,37 @@ sfSelectorUDP* sfSelectorUDP_Create() {return new sfSelectorUDP;} //////////////////////////////////////////////////////////// /// Destroy an existing selector //////////////////////////////////////////////////////////// -void sfSelectorTCP_Destroy(sfSelectorTCP* Selector) {delete Selector;} -void sfSelectorUDP_Destroy(sfSelectorUDP* Selector) {delete Selector;} +void sfSelectorTCP_Destroy(sfSelectorTCP* selector) {delete selector;} +void sfSelectorUDP_Destroy(sfSelectorUDP* selector) {delete selector;} //////////////////////////////////////////////////////////// /// Add a socket to watch to a selector //////////////////////////////////////////////////////////// -void sfSelectorTCP_Add(sfSelectorTCP* Selector, sfSocketTCP* Socket) {CSFML_CALL(Selector, Add(Socket->This)); Selector->Sockets[Socket->This] = Socket;} -void sfSelectorUDP_Add(sfSelectorUDP* Selector, sfSocketUDP* Socket) {CSFML_CALL(Selector, Add(Socket->This)); Selector->Sockets[Socket->This] = Socket;} +void sfSelectorTCP_Add(sfSelectorTCP* selector, sfSocketTCP* socket) {CSFML_CALL(selector, Add(socket->This)); selector->Sockets[socket->This] = socket;} +void sfSelectorUDP_Add(sfSelectorUDP* selector, sfSocketUDP* socket) {CSFML_CALL(selector, Add(socket->This)); selector->Sockets[socket->This] = socket;} //////////////////////////////////////////////////////////// /// Remove a socket from a selector //////////////////////////////////////////////////////////// -void sfSelectorTCP_Remove(sfSelectorTCP* Selector, sfSocketTCP* Socket) {CSFML_CALL(Selector, Remove(Socket->This)); Selector->Sockets.erase(Socket->This);} -void sfSelectorUDP_Remove(sfSelectorUDP* Selector, sfSocketUDP* Socket) {CSFML_CALL(Selector, Remove(Socket->This)); Selector->Sockets.erase(Socket->This);} +void sfSelectorTCP_Remove(sfSelectorTCP* selector, sfSocketTCP* socket) {CSFML_CALL(selector, Remove(socket->This)); selector->Sockets.erase(socket->This);} +void sfSelectorUDP_Remove(sfSelectorUDP* selector, sfSocketUDP* socket) {CSFML_CALL(selector, Remove(socket->This)); selector->Sockets.erase(socket->This);} //////////////////////////////////////////////////////////// /// Remove all sockets from a selector //////////////////////////////////////////////////////////// -void sfSelectorTCP_Clear(sfSelectorTCP* Selector) {CSFML_CALL(Selector, Clear()); Selector->Sockets.clear();} -void sfSelectorUDP_Clear(sfSelectorUDP* Selector) {CSFML_CALL(Selector, Clear()); Selector->Sockets.clear();} +void sfSelectorTCP_Clear(sfSelectorTCP* selector) {CSFML_CALL(selector, Clear()); selector->Sockets.clear();} +void sfSelectorUDP_Clear(sfSelectorUDP* selector) {CSFML_CALL(selector, Clear()); selector->Sockets.clear();} //////////////////////////////////////////////////////////// /// 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 time is out //////////////////////////////////////////////////////////// -unsigned int sfSelectorTCP_Wait(sfSelectorTCP* Selector, float Timeout) {CSFML_CALL_RETURN(Selector, Wait(Timeout), 0);} -unsigned int sfSelectorUDP_Wait(sfSelectorUDP* Selector, float Timeout) {CSFML_CALL_RETURN(Selector, Wait(Timeout), 0);} +unsigned int sfSelectorTCP_Wait(sfSelectorTCP* selector, float timeout) {CSFML_CALL_RETURN(selector, Wait(timeout), 0);} +unsigned int sfSelectorUDP_Wait(sfSelectorUDP* selector, float timeout) {CSFML_CALL_RETURN(selector, Wait(timeout), 0);} //////////////////////////////////////////////////////////// @@ -78,13 +78,13 @@ unsigned int sfSelectorUDP_Wait(sfSelectorUDP* Selector, float Timeout) {CSFML_C /// ready for reading. The total number of sockets ready /// is the integer returned by the previous call to Wait() //////////////////////////////////////////////////////////// -sfSocketTCP* sfSelectorTCP_GetSocketReady(sfSelectorTCP* Selector, unsigned int Index) +sfSocketTCP* sfSelectorTCP_GetSocketReady(sfSelectorTCP* selector, unsigned int index) { - CSFML_CHECK_RETURN(Selector, NULL); - return Selector->Sockets[Selector->This.GetSocketReady(Index)]; + CSFML_CHECK_RETURN(selector, NULL); + return selector->Sockets[selector->This.GetSocketReady(index)]; } -sfSocketUDP* sfSelectorUDP_GetSocketReady(sfSelectorUDP* Selector, unsigned int Index) +sfSocketUDP* sfSelectorUDP_GetSocketReady(sfSelectorUDP* selector, unsigned int index) { - CSFML_CHECK_RETURN(Selector, NULL); - return Selector->Sockets[Selector->This.GetSocketReady(Index)]; + CSFML_CHECK_RETURN(selector, NULL); + return selector->Sockets[selector->This.GetSocketReady(index)]; } diff --git a/CSFML/src/SFML/Network/SocketTCP.cpp b/CSFML/src/SFML/Network/SocketTCP.cpp index be3591ef5..d1d860e46 100644 --- a/CSFML/src/SFML/Network/SocketTCP.cpp +++ b/CSFML/src/SFML/Network/SocketTCP.cpp @@ -45,12 +45,12 @@ sfSocketTCP* sfSocketTCP_Create() //////////////////////////////////////////////////////////// /// Destroy an existing TCP socket //////////////////////////////////////////////////////////// -void sfSocketTCP_Destroy(sfSocketTCP* Socket) +void sfSocketTCP_Destroy(sfSocketTCP* socket) { - if (Socket) + if (socket) { - Socket->This.Close(); - delete Socket; + socket->This.Close(); + delete socket; } } @@ -59,31 +59,31 @@ void sfSocketTCP_Destroy(sfSocketTCP* Socket) /// Change the blocking state of a TCP socket. /// The default behaviour of a socket is blocking //////////////////////////////////////////////////////////// -void sfSocketTCP_SetBlocking(sfSocketTCP* Socket, sfBool Blocking) +void sfSocketTCP_SetBlocking(sfSocketTCP* socket, sfBool blocking) { - CSFML_CALL(Socket, SetBlocking(Blocking == sfTrue)); + CSFML_CALL(socket, SetBlocking(blocking == sfTrue)); } //////////////////////////////////////////////////////////// /// Connect a TCP socket to another computer on a specified port //////////////////////////////////////////////////////////// -sfSocketStatus sfSocketTCP_Connect(sfSocketTCP* Socket, unsigned short Port, sfIPAddress HostAddress, float Timeout) +sfSocketStatus sfSocketTCP_Connect(sfSocketTCP* socket, unsigned short port, sfIPAddress host, float timeout) { - sf::IPAddress Address(HostAddress.Address); + sf::IPAddress address(host.Address); - CSFML_CHECK_RETURN(Socket, sfSocketError); + CSFML_CHECK_RETURN(socket, sfSocketError); - return static_cast(Socket->This.Connect(Port, Address, Timeout)); + return static_cast(socket->This.Connect(port, address, timeout)); } //////////////////////////////////////////////////////////// /// Listen to a specified port for incoming data or connections //////////////////////////////////////////////////////////// -sfBool sfSocketTCP_Listen(sfSocketTCP* Socket, unsigned short Port) +sfBool sfSocketTCP_Listen(sfSocketTCP* socket, unsigned short port) { - CSFML_CALL_RETURN(Socket, Listen(Port), sfFalse); + CSFML_CALL_RETURN(socket, Listen(port), sfFalse); } @@ -92,25 +92,25 @@ sfBool sfSocketTCP_Listen(sfSocketTCP* Socket, unsigned short Port) /// This function is blocking, ie. it won't return before /// a connection has been accepted //////////////////////////////////////////////////////////// -sfSocketStatus sfSocketTCP_Accept(sfSocketTCP* Socket, sfSocketTCP** Connected, sfIPAddress* Address) +sfSocketStatus sfSocketTCP_Accept(sfSocketTCP* socket, sfSocketTCP** connected, sfIPAddress* address) { - CSFML_CHECK_RETURN(Socket, sfSocketError); - CSFML_CHECK_RETURN(Connected, sfSocketError); + CSFML_CHECK_RETURN(socket, sfSocketError); + CSFML_CHECK_RETURN(connected, sfSocketError); // Call SFML internal function - sf::IPAddress ClientAddress; - sf::SocketTCP Client; - sf::Socket::Status Status = Socket->This.Accept(Client, &ClientAddress); - if (Status != sf::Socket::Done) - return static_cast(Status); + sf::IPAddress clientAddress; + sf::SocketTCP client; + sf::Socket::Status status = socket->This.Accept(client, &clientAddress); + if (status != sf::Socket::Done) + return static_cast(status); // Convert the client socket returned - *Connected = sfSocketTCP_Create(); - (*Connected)->This = Client; + *connected = sfSocketTCP_Create(); + (*connected)->This = client; // Convert the address if needed - if (Address) - strncpy(Address->Address, ClientAddress.ToString().c_str(), 16); + if (address) + strncpy(address->Address, clientAddress.ToString().c_str(), 16); return sfSocketDone; } @@ -119,29 +119,29 @@ sfSocketStatus sfSocketTCP_Accept(sfSocketTCP* Socket, sfSocketTCP** Connected, //////////////////////////////////////////////////////////// /// Send an array of bytes to the host (must be connected first) //////////////////////////////////////////////////////////// -sfSocketStatus sfSocketTCP_Send(sfSocketTCP* Socket, const char* Data, size_t Size) +sfSocketStatus sfSocketTCP_Send(sfSocketTCP* socket, const char* data, size_t size) { - CSFML_CHECK_RETURN(Socket, sfSocketError); + CSFML_CHECK_RETURN(socket, sfSocketError); - return static_cast(Socket->This.Send(Data, Size)); + return static_cast(socket->This.Send(data, size)); } //////////////////////////////////////////////////////////// /// Receive an array of bytes from the host (must be connected first) //////////////////////////////////////////////////////////// -sfSocketStatus sfSocketTCP_Receive(sfSocketTCP* Socket, char* Data, size_t MaxSize, size_t* SizeReceived) +sfSocketStatus sfSocketTCP_Receive(sfSocketTCP* socket, char* data, size_t maxSize, size_t* sizeReceived) { - CSFML_CHECK_RETURN(Socket, sfSocketError); + CSFML_CHECK_RETURN(socket, sfSocketError); - if (SizeReceived) + if (sizeReceived) { - return static_cast(Socket->This.Receive(Data, MaxSize, *SizeReceived)); + return static_cast(socket->This.Receive(data, maxSize, *sizeReceived)); } else { - std::size_t Size = 0; - return static_cast(Socket->This.Receive(Data, MaxSize, Size)); + std::size_t size = 0; + return static_cast(socket->This.Receive(data, maxSize, size)); } } @@ -149,24 +149,24 @@ sfSocketStatus sfSocketTCP_Receive(sfSocketTCP* Socket, char* Data, size_t MaxSi //////////////////////////////////////////////////////////// /// Send a packet of data to the host (must be connected first) //////////////////////////////////////////////////////////// -sfSocketStatus sfSocketTCP_SendPacket(sfSocketTCP* Socket, sfPacket* Packet) +sfSocketStatus sfSocketTCP_SendPacket(sfSocketTCP* socket, sfPacket* packet) { - CSFML_CHECK_RETURN(Socket, sfSocketError); - CSFML_CHECK_RETURN(Packet, sfSocketError); + CSFML_CHECK_RETURN(socket, sfSocketError); + CSFML_CHECK_RETURN(packet, sfSocketError); - return static_cast(Socket->This.Send(Packet->This)); + return static_cast(socket->This.Send(packet->This)); } //////////////////////////////////////////////////////////// /// Receive a packet from the host (must be connected first) //////////////////////////////////////////////////////////// -sfSocketStatus sfSocketTCP_ReceivePacket(sfSocketTCP* Socket, sfPacket* Packet) +sfSocketStatus sfSocketTCP_ReceivePacket(sfSocketTCP* socket, sfPacket* packet) { - CSFML_CHECK_RETURN(Socket, sfSocketError); - CSFML_CHECK_RETURN(Packet, sfSocketError); + CSFML_CHECK_RETURN(socket, sfSocketError); + CSFML_CHECK_RETURN(packet, sfSocketError); - return static_cast(Socket->This.Receive(Packet->This)); + return static_cast(socket->This.Receive(packet->This)); } @@ -174,7 +174,7 @@ sfSocketStatus sfSocketTCP_ReceivePacket(sfSocketTCP* Socket, sfPacket* Packet) /// Check if a socket is in a valid state ; this function /// can be called any time to check if the socket is OK //////////////////////////////////////////////////////////// -sfBool sfSocketTCP_IsValid(sfSocketTCP* Socket) +sfBool sfSocketTCP_IsValid(sfSocketTCP* socket) { - CSFML_CALL_RETURN(Socket, IsValid(), sfFalse); + CSFML_CALL_RETURN(socket, IsValid(), sfFalse); } diff --git a/CSFML/src/SFML/Network/SocketUDP.cpp b/CSFML/src/SFML/Network/SocketUDP.cpp index 58c9a2cbd..030408431 100644 --- a/CSFML/src/SFML/Network/SocketUDP.cpp +++ b/CSFML/src/SFML/Network/SocketUDP.cpp @@ -45,9 +45,9 @@ sfSocketUDP* sfSocketUDP_Create() //////////////////////////////////////////////////////////// /// Destroy an existing UDP socket //////////////////////////////////////////////////////////// -void sfSocketUDP_Destroy(sfSocketUDP* Socket) +void sfSocketUDP_Destroy(sfSocketUDP* socket) { - delete Socket; + delete socket; } @@ -55,41 +55,41 @@ void sfSocketUDP_Destroy(sfSocketUDP* Socket) /// Change the blocking state of a UDP socket. /// The default behaviour of a socket is blocking //////////////////////////////////////////////////////////// -void sfSocketUDP_SetBlocking(sfSocketUDP* Socket, sfBool Blocking) +void sfSocketUDP_SetBlocking(sfSocketUDP* socket, sfBool blocking) { - CSFML_CALL(Socket, SetBlocking(Blocking == sfTrue)); + CSFML_CALL(socket, SetBlocking(blocking == sfTrue)); } //////////////////////////////////////////////////////////// /// Bind a socket to a specific port //////////////////////////////////////////////////////////// -sfBool sfSocketUDP_Bind(sfSocketUDP* Socket, unsigned short Port) +sfBool sfSocketUDP_Bind(sfSocketUDP* socket, unsigned short port) { - CSFML_CALL_RETURN(Socket, Bind(Port), sfFalse); + CSFML_CALL_RETURN(socket, Bind(port), sfFalse); } //////////////////////////////////////////////////////////// /// Unbind a socket from its previous port, if any //////////////////////////////////////////////////////////// -sfBool sfSocketUDP_Unbind(sfSocketUDP* Socket) +sfBool sfSocketUDP_Unbind(sfSocketUDP* socket) { - CSFML_CALL_RETURN(Socket, Unbind(), sfFalse); + CSFML_CALL_RETURN(socket, Unbind(), sfFalse); } //////////////////////////////////////////////////////////// /// Send an array of bytes //////////////////////////////////////////////////////////// -sfSocketStatus sfSocketUDP_Send(sfSocketUDP* Socket, const char* Data, size_t Size, sfIPAddress Address, unsigned short Port) +sfSocketStatus sfSocketUDP_Send(sfSocketUDP* socket, const char* data, size_t size, sfIPAddress address, unsigned short port) { - CSFML_CHECK_RETURN(Socket, sfSocketError) + CSFML_CHECK_RETURN(socket, sfSocketError) // Convert the address - sf::IPAddress Receiver(Address.Address); + sf::IPAddress receiver(address.Address); - return static_cast(Socket->This.Send(Data, Size, Receiver, Port)); + return static_cast(socket->This.Send(data, size, receiver, port)); } @@ -98,27 +98,27 @@ sfSocketStatus sfSocketUDP_Send(sfSocketUDP* Socket, const char* Data, size_t Si /// This function is blocking, ie. it won't return before some /// bytes have been received //////////////////////////////////////////////////////////// -sfSocketStatus sfSocketUDP_Receive(sfSocketUDP* Socket, char* Data, size_t MaxSize, size_t* SizeReceived, sfIPAddress* Address, unsigned short* Port) +sfSocketStatus sfSocketUDP_Receive(sfSocketUDP* socket, char* data, size_t maxSize, size_t* sizeReceived, sfIPAddress* address, unsigned short* port) { CSFML_CHECK_RETURN(Socket, sfSocketError); // Call SFML internal function - sf::IPAddress Sender; - unsigned short SenderPort; - std::size_t Received; + sf::IPAddress sender; + unsigned short senderPort; + std::size_t received; - sf::Socket::Status Status = Socket->This.Receive(Data, MaxSize, Received, Sender, SenderPort); - if (Status != sf::Socket::Done) - return static_cast(Status); + sf::Socket::Status status = socket->This.Receive(data, maxSize, received, sender, senderPort); + if (status != sf::Socket::Done) + return static_cast(status); - if (SizeReceived) - *SizeReceived = Received; + if (sizeReceived) + *sizeReceived = received; - if (Address) - strncpy(Address->Address, Sender.ToString().c_str(), 16); + if (address) + strncpy(address->Address, sender.ToString().c_str(), 16); - if (Port) - *Port = SenderPort; + if (port) + *port = senderPort; return sfSocketDone; } @@ -127,15 +127,15 @@ sfSocketStatus sfSocketUDP_Receive(sfSocketUDP* Socket, char* Data, size_t MaxSi //////////////////////////////////////////////////////////// /// Send a packet of data //////////////////////////////////////////////////////////// -sfSocketStatus sfSocketUDP_SendPacket(sfSocketUDP* Socket, sfPacket* Packet, sfIPAddress Address, unsigned short Port) +sfSocketStatus sfSocketUDP_SendPacket(sfSocketUDP* socket, sfPacket* packet, sfIPAddress address, unsigned short port) { - CSFML_CHECK_RETURN(Socket, sfSocketError); - CSFML_CHECK_RETURN(Packet, sfSocketError); + CSFML_CHECK_RETURN(socket, sfSocketError); + CSFML_CHECK_RETURN(packet, sfSocketError); // Convert the address - sf::IPAddress Receiver(Address.Address); + sf::IPAddress receiver(address.Address); - return static_cast(Socket->This.Send(Packet->This, Receiver, Port)); + return static_cast(socket->This.Send(packet->This, receiver, port)); } @@ -144,22 +144,22 @@ sfSocketStatus sfSocketUDP_SendPacket(sfSocketUDP* Socket, sfPacket* Packet, sfI /// This function is blocking, ie. it won't return before a /// packet is received //////////////////////////////////////////////////////////// -sfSocketStatus sfSocketUDP_ReceivePacket(sfSocketUDP* Socket, sfPacket* Packet, sfIPAddress* Address, unsigned short* Port) +sfSocketStatus sfSocketUDP_ReceivePacket(sfSocketUDP* socket, sfPacket* packet, sfIPAddress* address, unsigned short* port) { - CSFML_CHECK_RETURN(Socket, sfSocketError); - CSFML_CHECK_RETURN(Packet, sfSocketError); + CSFML_CHECK_RETURN(socket, sfSocketError); + CSFML_CHECK_RETURN(packet, sfSocketError); - sf::IPAddress Sender; - unsigned short SenderPort; - sf::Socket::Status Status = Socket->This.Receive(Packet->This, Sender, SenderPort); - if (Status != sf::Socket::Done) - return static_cast(Status); + sf::IPAddress sender; + unsigned short senderPort; + sf::Socket::Status status = socket->This.Receive(packet->This, sender, senderPort); + if (status != sf::Socket::Done) + return static_cast(status); - if (Address) - strncpy(Address->Address, Sender.ToString().c_str(), 16); + if (address) + strncpy(address->Address, sender.ToString().c_str(), 16); - if (Port) - *Port = SenderPort; + if (port) + *port = senderPort; return sfSocketDone; } @@ -169,7 +169,7 @@ sfSocketStatus sfSocketUDP_ReceivePacket(sfSocketUDP* Socket, sfPacket* Packet, /// Check if a socket is in a valid state ; this function /// can be called any time to check if the socket is OK //////////////////////////////////////////////////////////// -sfBool sfSocketUDP_IsValid(sfSocketUDP* Socket) +sfBool sfSocketUDP_IsValid(sfSocketUDP* socket) { - CSFML_CALL_RETURN(Socket, IsValid(), sfFalse); + CSFML_CALL_RETURN(socket, IsValid(), sfFalse); } diff --git a/CSFML/src/SFML/System/Clock.cpp b/CSFML/src/SFML/System/Clock.cpp index e07909e70..675246e82 100644 --- a/CSFML/src/SFML/System/Clock.cpp +++ b/CSFML/src/SFML/System/Clock.cpp @@ -42,25 +42,25 @@ sfClock* sfClock_Create() //////////////////////////////////////////////////////////// /// Destroy an existing clock //////////////////////////////////////////////////////////// -void sfClock_Destroy(sfClock* Clock) +void sfClock_Destroy(sfClock* clock) { - delete Clock; + delete clock; } //////////////////////////////////////////////////////////// /// Get the time elapsed for a clock //////////////////////////////////////////////////////////// -float sfClock_GetTime(sfClock* Clock) +float sfClock_GetTime(sfClock* clock) { - CSFML_CALL_RETURN(Clock, GetElapsedTime(), 0.f) + CSFML_CALL_RETURN(clock, GetElapsedTime(), 0.f) } //////////////////////////////////////////////////////////// /// Restart a clock //////////////////////////////////////////////////////////// -void sfClock_Reset(sfClock* Clock) +void sfClock_Reset(sfClock* clock) { - CSFML_CALL(Clock, Reset()) + CSFML_CALL(clock, Reset()) } diff --git a/CSFML/src/SFML/System/Mutex.cpp b/CSFML/src/SFML/System/Mutex.cpp index 69a534cb1..08a58b1b7 100644 --- a/CSFML/src/SFML/System/Mutex.cpp +++ b/CSFML/src/SFML/System/Mutex.cpp @@ -42,25 +42,25 @@ sfMutex* sfMutex_Create() //////////////////////////////////////////////////////////// /// Destroy an existing mutex //////////////////////////////////////////////////////////// -void sfMutex_Destroy(sfMutex* Mutex) +void sfMutex_Destroy(sfMutex* mutex) { - delete Mutex; + delete mutex; } //////////////////////////////////////////////////////////// /// Lock a mutex //////////////////////////////////////////////////////////// -void sfMutex_Lock(sfMutex* Mutex) +void sfMutex_Lock(sfMutex* mutex) { - CSFML_CALL(Mutex, Lock()) + CSFML_CALL(mutex, Lock()) } //////////////////////////////////////////////////////////// /// Unlock a mutex //////////////////////////////////////////////////////////// -void sfMutex_Unlock(sfMutex* Mutex) +void sfMutex_Unlock(sfMutex* mutex) { - CSFML_CALL(Mutex, Unlock()) + CSFML_CALL(mutex, Unlock()) } diff --git a/CSFML/src/SFML/System/Randomizer.cpp b/CSFML/src/SFML/System/Randomizer.cpp index 010215303..feb8b4c25 100644 --- a/CSFML/src/SFML/System/Randomizer.cpp +++ b/CSFML/src/SFML/System/Randomizer.cpp @@ -34,9 +34,9 @@ /// Set the seed for the random numbers generator. Using a known seed /// allows you to reproduce the same sequence of random numbers //////////////////////////////////////////////////////////// -void sfRandom_SetSeed(unsigned int Seed) +void sfRandom_SetSeed(unsigned int seed) { - sf::Randomizer::SetSeed(Seed); + sf::Randomizer::SetSeed(seed); } @@ -52,16 +52,16 @@ unsigned int sfRandom_GetSeed() //////////////////////////////////////////////////////////// /// Get a random float number in a given range //////////////////////////////////////////////////////////// -float sfRandom_Float(float Begin, float End) +float sfRandom_Float(float begin, float end) { - return sf::Randomizer::Random(Begin, End); + return sf::Randomizer::Random(begin, end); } //////////////////////////////////////////////////////////// /// Get a random integer number in a given range //////////////////////////////////////////////////////////// -int sfRandom_Int(int Begin, int End) +int sfRandom_Int(int begin, int end) { - return sf::Randomizer::Random(Begin, End); + return sf::Randomizer::Random(begin, end); } diff --git a/CSFML/src/SFML/System/Thread.cpp b/CSFML/src/SFML/System/Thread.cpp index 64f0af1d4..4b312aeee 100644 --- a/CSFML/src/SFML/System/Thread.cpp +++ b/CSFML/src/SFML/System/Thread.cpp @@ -33,36 +33,36 @@ //////////////////////////////////////////////////////////// /// Construct a new thread from a function pointer //////////////////////////////////////////////////////////// -sfThread* sfThread_Create(void (*Function)(void*), void* UserData) +sfThread* sfThread_Create(void (*function)(void*), void* userData) { - return new sfThread(Function, UserData); + return new sfThread(function, userData); } //////////////////////////////////////////////////////////// /// Destroy an existing thread //////////////////////////////////////////////////////////// -void sfThread_Destroy(sfThread* Thread) +void sfThread_Destroy(sfThread* thread) { - delete Thread; + delete thread; } //////////////////////////////////////////////////////////// /// Run a thread //////////////////////////////////////////////////////////// -void sfThread_Launch(sfThread* Thread) +void sfThread_Launch(sfThread* thread) { - CSFML_CALL(Thread, Launch()); + CSFML_CALL(thread, Launch()); } //////////////////////////////////////////////////////////// /// Wait until a thread finishes //////////////////////////////////////////////////////////// -void sfThread_Wait(sfThread* Thread) +void sfThread_Wait(sfThread* thread) { - CSFML_CALL(Thread, Wait()); + CSFML_CALL(thread, Wait()); } @@ -72,7 +72,7 @@ void sfThread_Wait(sfThread* Thread) /// you should rather try to make the thread function /// terminate by itself //////////////////////////////////////////////////////////// -void sfThread_Terminate(sfThread* Thread) +void sfThread_Terminate(sfThread* thread) { - CSFML_CALL(Thread, Terminate()); + CSFML_CALL(thread, Terminate()); } diff --git a/CSFML/src/SFML/Window/Context.cpp b/CSFML/src/SFML/Window/Context.cpp index b34137e89..aa58a0abd 100644 --- a/CSFML/src/SFML/Window/Context.cpp +++ b/CSFML/src/SFML/Window/Context.cpp @@ -42,16 +42,16 @@ sfContext* sfContext_Create() //////////////////////////////////////////////////////////// /// Destroy an existing context //////////////////////////////////////////////////////////// -void sfContext_Destroy(sfContext* Context) +void sfContext_Destroy(sfContext* context) { - delete Context; + delete context; } //////////////////////////////////////////////////////////// /// Activate or deactivate a context //////////////////////////////////////////////////////////// -void sfContext_SetActive(sfContext* Context, sfBool Active) +void sfContext_SetActive(sfContext* context, sfBool active) { - CSFML_CALL(Context, SetActive(Active == sfTrue)) + CSFML_CALL(context, SetActive(active == sfTrue)) } diff --git a/CSFML/src/SFML/Window/Input.cpp b/CSFML/src/SFML/Window/Input.cpp index 352a0197d..640c417e9 100644 --- a/CSFML/src/SFML/Window/Input.cpp +++ b/CSFML/src/SFML/Window/Input.cpp @@ -33,51 +33,51 @@ //////////////////////////////////////////////////////////// /// Get the state of a key //////////////////////////////////////////////////////////// -sfBool sfInput_IsKeyDown(sfInput* Input, sfKeyCode KeyCode) +sfBool sfInput_IsKeyDown(sfInput* input, sfKeyCode code) { - CSFML_CALL_PTR_RETURN(Input, IsKeyDown((sf::Key::Code)KeyCode), sfFalse); + CSFML_CALL_PTR_RETURN(input, IsKeyDown((sf::Key::Code)code), sfFalse); } //////////////////////////////////////////////////////////// /// Get the state of a mouse button //////////////////////////////////////////////////////////// -sfBool sfInput_IsMouseButtonDown(sfInput* Input, sfMouseButton Button) +sfBool sfInput_IsMouseButtonDown(sfInput* input, sfMouseButton button) { - CSFML_CALL_PTR_RETURN(Input, IsMouseButtonDown((sf::Mouse::Button)Button), sfFalse); + CSFML_CALL_PTR_RETURN(input, IsMouseButtonDown((sf::Mouse::Button)button), sfFalse); } //////////////////////////////////////////////////////////// /// Get the state of a joystick button //////////////////////////////////////////////////////////// -sfBool sfInput_IsJoystickButtonDown(sfInput* Input, unsigned int JoyId, unsigned int Button) +sfBool sfInput_IsJoystickButtonDown(sfInput* input, unsigned int joyId, unsigned int button) { - CSFML_CALL_PTR_RETURN(Input, IsJoystickButtonDown(JoyId, Button), sfFalse); + CSFML_CALL_PTR_RETURN(input, IsJoystickButtonDown(joyId, button), sfFalse); } //////////////////////////////////////////////////////////// /// Get the mouse X position //////////////////////////////////////////////////////////// -int sfInput_GetMouseX(sfInput* Input) +int sfInput_GetMouseX(sfInput* input) { - CSFML_CALL_PTR_RETURN(Input, GetMouseX(), 0); + CSFML_CALL_PTR_RETURN(input, GetMouseX(), 0); } //////////////////////////////////////////////////////////// /// Get the mouse Y position //////////////////////////////////////////////////////////// -int sfInput_GetMouseY(sfInput* Input) +int sfInput_GetMouseY(sfInput* input) { - CSFML_CALL_PTR_RETURN(Input, GetMouseY(), 0); + CSFML_CALL_PTR_RETURN(input, GetMouseY(), 0); } //////////////////////////////////////////////////////////// /// Get the joystick position on a given axis //////////////////////////////////////////////////////////// -float sfInput_GetJoystickAxis(sfInput* Input, unsigned int JoyId, sfJoyAxis Axis) +float sfInput_GetJoystickAxis(sfInput* input, unsigned int joyId, sfJoyAxis axis) { - CSFML_CALL_PTR_RETURN(Input, GetJoystickAxis(JoyId, (sf::Joy::Axis)Axis), 0.f); + CSFML_CALL_PTR_RETURN(input, GetJoystickAxis(joyId, (sf::Joy::Axis)axis), 0.f); } diff --git a/CSFML/src/SFML/Window/VideoMode.cpp b/CSFML/src/SFML/Window/VideoMode.cpp index c8d701459..daba44b3e 100644 --- a/CSFML/src/SFML/Window/VideoMode.cpp +++ b/CSFML/src/SFML/Window/VideoMode.cpp @@ -36,13 +36,13 @@ //////////////////////////////////////////////////////////// sfVideoMode sfVideoMode_GetDesktopMode() { - sf::VideoMode Desktop = sf::VideoMode::GetDesktopMode(); - sfVideoMode Ret; - Ret.Width = Desktop.Width; - Ret.Height = Desktop.Height; - Ret.BitsPerPixel = Desktop.BitsPerPixel; + sf::VideoMode desktop = sf::VideoMode::GetDesktopMode(); + sfVideoMode ret; + ret.Width = desktop.Width; + ret.Height = desktop.Height; + ret.BitsPerPixel = desktop.BitsPerPixel; - return Ret; + return ret; } @@ -51,15 +51,15 @@ sfVideoMode sfVideoMode_GetDesktopMode() /// Index must be in range [0, GetModesCount()[ /// Modes are sorted from best to worst //////////////////////////////////////////////////////////// -sfVideoMode sfVideoMode_GetMode(size_t Index) +sfVideoMode sfVideoMode_GetMode(size_t index) { - sf::VideoMode Mode = sf::VideoMode::GetMode(Index); - sfVideoMode Ret; - Ret.Width = Mode.Width; - Ret.Height = Mode.Height; - Ret.BitsPerPixel = Mode.BitsPerPixel; + sf::VideoMode mode = sf::VideoMode::GetMode(index); + sfVideoMode ret; + ret.Width = mode.Width; + ret.Height = mode.Height; + ret.BitsPerPixel = mode.BitsPerPixel; - return Ret; + return ret; } @@ -75,8 +75,8 @@ size_t sfVideoMode_GetModesCount() //////////////////////////////////////////////////////////// /// Tell whether or not a video mode is supported //////////////////////////////////////////////////////////// -sfBool sfVideoMode_IsValid(sfVideoMode Mode) +sfBool sfVideoMode_IsValid(sfVideoMode mode) { - sf::VideoMode VideoMode(Mode.Width, Mode.Height, Mode.BitsPerPixel); - return VideoMode.IsValid() ? sfTrue : sfFalse; + sf::VideoMode videoMode(mode.Width, mode.Height, mode.BitsPerPixel); + return videoMode.IsValid() ? sfTrue : sfFalse; } diff --git a/CSFML/src/SFML/Window/Window.cpp b/CSFML/src/SFML/Window/Window.cpp index af3723984..55b870a28 100644 --- a/CSFML/src/SFML/Window/Window.cpp +++ b/CSFML/src/SFML/Window/Window.cpp @@ -33,161 +33,161 @@ //////////////////////////////////////////////////////////// /// Construct a new window //////////////////////////////////////////////////////////// -sfWindow* sfWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfContextSettings Params) +sfWindow* sfWindow_Create(sfVideoMode mode, const char* title, unsigned long style, sfContextSettings settings) { // Convert video mode - sf::VideoMode VideoMode(Mode.Width, Mode.Height, Mode.BitsPerPixel); + sf::VideoMode videoMode(mode.Width, mode.Height, mode.BitsPerPixel); // Create the window - sfWindow* Window = new sfWindow; - sf::ContextSettings Settings(Params.DepthBits, Params.StencilBits, Params.AntialiasingLevel); - Window->This.Create(VideoMode, Title, Style, Settings); - Window->Input.This = &Window->This.GetInput(); + sfWindow* window = new sfWindow; + sf::ContextSettings params(settings.DepthBits, settings.StencilBits, settings.AntialiasingLevel); + window->This.Create(videoMode, title, style, params); + window->Input.This = &window->This.GetInput(); - return Window; + return window; } //////////////////////////////////////////////////////////// /// Construct a window from an existing control //////////////////////////////////////////////////////////// -sfWindow* sfWindow_CreateFromHandle(sfWindowHandle Handle, sfContextSettings Params) +sfWindow* sfWindow_CreateFromHandle(sfWindowHandle handle, sfContextSettings settings) { - sfWindow* Window = new sfWindow; - sf::ContextSettings Settings(Params.DepthBits, Params.StencilBits, Params.AntialiasingLevel); - Window->This.Create(Handle, Settings); - Window->Input.This = &Window->This.GetInput(); + sfWindow* window = new sfWindow; + sf::ContextSettings params(settings.DepthBits, settings.StencilBits, settings.AntialiasingLevel); + window->This.Create(handle, params); + window->Input.This = &window->This.GetInput(); - return Window; + return window; } //////////////////////////////////////////////////////////// /// Destroy an existing window //////////////////////////////////////////////////////////// -void sfWindow_Destroy(sfWindow* Window) +void sfWindow_Destroy(sfWindow* window) { - delete Window; + delete window; } //////////////////////////////////////////////////////////// /// Close a window (but doesn't destroy the internal data) //////////////////////////////////////////////////////////// -void sfWindow_Close(sfWindow* Window) +void sfWindow_Close(sfWindow* window) { - CSFML_CALL(Window, Close()); + CSFML_CALL(window, Close()); } //////////////////////////////////////////////////////////// /// Tell whether or not a window is opened //////////////////////////////////////////////////////////// -sfBool sfWindow_IsOpened(sfWindow* Window) +sfBool sfWindow_IsOpened(sfWindow* window) { - CSFML_CALL_RETURN(Window, IsOpened(), sfFalse); + CSFML_CALL_RETURN(window, IsOpened(), sfFalse); } //////////////////////////////////////////////////////////// /// Get the width of the rendering region of a window //////////////////////////////////////////////////////////// -unsigned int sfWindow_GetWidth(sfWindow* Window) +unsigned int sfWindow_GetWidth(sfWindow* window) { - CSFML_CALL_RETURN(Window, GetWidth(), 0) + CSFML_CALL_RETURN(window, GetWidth(), 0) } //////////////////////////////////////////////////////////// /// Get the height of the rendering region of a window //////////////////////////////////////////////////////////// -unsigned int sfWindow_GetHeight(sfWindow* Window) +unsigned int sfWindow_GetHeight(sfWindow* window) { - CSFML_CALL_RETURN(Window, GetHeight(), 0) + CSFML_CALL_RETURN(window, GetHeight(), 0) } //////////////////////////////////////////////////////////// /// Get the creation settings of a window //////////////////////////////////////////////////////////// -sfContextSettings sfWindow_GetSettings(sfWindow* Window) +sfContextSettings sfWindow_GetSettings(sfWindow* window) { - sfContextSettings Settings = {0, 0, 0}; - CSFML_CHECK_RETURN(Window, Settings); + sfContextSettings settings = {0, 0, 0}; + CSFML_CHECK_RETURN(window, settings); - const sf::ContextSettings& Params = Window->This.GetSettings(); - Settings.DepthBits = Params.DepthBits; - Settings.StencilBits = Params.StencilBits; - Settings.AntialiasingLevel = Params.AntialiasingLevel; + const sf::ContextSettings& params = window->This.GetSettings(); + settings.DepthBits = params.DepthBits; + settings.StencilBits = params.StencilBits; + settings.AntialiasingLevel = params.AntialiasingLevel; - return Settings; + return settings; } //////////////////////////////////////////////////////////// /// Get the event on top of events stack of a window, if any, and pop it //////////////////////////////////////////////////////////// -sfBool sfWindow_GetEvent(sfWindow* Window, sfEvent* Event) +sfBool sfWindow_GetEvent(sfWindow* window, sfEvent* event) { - CSFML_CHECK_RETURN(Window, sfFalse); - CSFML_CHECK_RETURN(Event, sfFalse); + CSFML_CHECK_RETURN(window, sfFalse); + CSFML_CHECK_RETURN(event, sfFalse); // Get the event sf::Event SFMLEvent; - sfBool Ret = Window->This.GetEvent(SFMLEvent); + sfBool ret = window->This.GetEvent(SFMLEvent); // No event, return - if (!Ret) + if (!ret) return sfFalse; // Convert its type - Event->Type = static_cast(SFMLEvent.Type); + event->Type = static_cast(SFMLEvent.Type); // Fill its fields - switch (Event->Type) + switch (event->Type) { case sfEvtResized : - Event->Size.Width = SFMLEvent.Size.Width; - Event->Size.Height = SFMLEvent.Size.Height; + event->Size.Width = SFMLEvent.Size.Width; + event->Size.Height = SFMLEvent.Size.Height; break; case sfEvtTextEntered : - Event->Text.Unicode = SFMLEvent.Text.Unicode; + event->Text.Unicode = SFMLEvent.Text.Unicode; break; case sfEvtKeyReleased : case sfEvtKeyPressed : - Event->Key.Code = static_cast(SFMLEvent.Key.Code); - Event->Key.Alt = SFMLEvent.Key.Alt ? sfTrue : sfFalse; - Event->Key.Control = SFMLEvent.Key.Control ? sfTrue : sfFalse; - Event->Key.Shift = SFMLEvent.Key.Shift ? sfTrue : sfFalse; + event->Key.Code = static_cast(SFMLEvent.Key.Code); + event->Key.Alt = SFMLEvent.Key.Alt ? sfTrue : sfFalse; + event->Key.Control = SFMLEvent.Key.Control ? sfTrue : sfFalse; + event->Key.Shift = SFMLEvent.Key.Shift ? sfTrue : sfFalse; break; case sfEvtMouseWheelMoved : - Event->MouseWheel.Delta = SFMLEvent.MouseWheel.Delta; + event->MouseWheel.Delta = SFMLEvent.MouseWheel.Delta; break; case sfEvtMouseButtonPressed : case sfEvtMouseButtonReleased : - Event->MouseButton.Button = static_cast(SFMLEvent.MouseButton.Button); - Event->MouseButton.X = SFMLEvent.MouseButton.X; - Event->MouseButton.Y = SFMLEvent.MouseButton.Y; + event->MouseButton.Button = static_cast(SFMLEvent.MouseButton.Button); + event->MouseButton.X = SFMLEvent.MouseButton.X; + event->MouseButton.Y = SFMLEvent.MouseButton.Y; break; case sfEvtMouseMoved : - Event->MouseMove.X = SFMLEvent.MouseMove.X; - Event->MouseMove.Y = SFMLEvent.MouseMove.Y; + event->MouseMove.X = SFMLEvent.MouseMove.X; + event->MouseMove.Y = SFMLEvent.MouseMove.Y; break; case sfEvtJoyButtonPressed : case sfEvtJoyButtonReleased : - Event->JoyButton.JoystickId = SFMLEvent.JoyButton.JoystickId; - Event->JoyButton.Button = SFMLEvent.JoyButton.Button; + event->JoyButton.JoystickId = SFMLEvent.JoyButton.JoystickId; + event->JoyButton.Button = SFMLEvent.JoyButton.Button; break; case sfEvtJoyMoved : - Event->JoyMove.JoystickId = SFMLEvent.JoyMove.JoystickId; - Event->JoyMove.Axis = static_cast(SFMLEvent.JoyMove.Axis); - Event->JoyMove.Position = SFMLEvent.JoyMove.Position; + event->JoyMove.JoystickId = SFMLEvent.JoyMove.JoystickId; + event->JoyMove.Axis = static_cast(SFMLEvent.JoyMove.Axis); + event->JoyMove.Position = SFMLEvent.JoyMove.Position; break; default : @@ -201,27 +201,27 @@ sfBool sfWindow_GetEvent(sfWindow* Window, sfEvent* Event) //////////////////////////////////////////////////////////// /// Enable / disable vertical synchronization on a window //////////////////////////////////////////////////////////// -void sfWindow_UseVerticalSync(sfWindow* Window, sfBool Enabled) +void sfWindow_UseVerticalSync(sfWindow* window, sfBool enabled) { - CSFML_CALL(Window, UseVerticalSync(Enabled == sfTrue)) + CSFML_CALL(window, UseVerticalSync(enabled == sfTrue)) } //////////////////////////////////////////////////////////// /// Show or hide the mouse cursor on a window //////////////////////////////////////////////////////////// -void sfWindow_ShowMouseCursor(sfWindow* Window, sfBool Show) +void sfWindow_ShowMouseCursor(sfWindow* window, sfBool show) { - CSFML_CALL(Window, ShowMouseCursor(Show == sfTrue)) + CSFML_CALL(window, ShowMouseCursor(show == sfTrue)) } //////////////////////////////////////////////////////////// /// Change the position of the mouse cursor on a window //////////////////////////////////////////////////////////// -void sfWindow_SetCursorPosition(sfWindow* Window, unsigned int Left, unsigned int Top) +void sfWindow_SetCursorPosition(sfWindow* window, unsigned int left, unsigned int top) { - CSFML_CALL(Window, SetCursorPosition(Left, Top)) + CSFML_CALL(window, SetCursorPosition(left, top)) } @@ -229,27 +229,27 @@ void sfWindow_SetCursorPosition(sfWindow* Window, unsigned int Left, unsigned in /// Change the position of a window on screen. /// Only works for top-level windows //////////////////////////////////////////////////////////// -void sfWindow_SetPosition(sfWindow* Window, int Left, int Top) +void sfWindow_SetPosition(sfWindow* window, int left, int top) { - CSFML_CALL(Window, SetPosition(Left, Top)) + CSFML_CALL(window, SetPosition(left, top)) } //////////////////////////////////////////////////////////// /// Change the size of the rendering region of a window //////////////////////////////////////////////////////////// -void sfWindow_SetSize(sfWindow* Window, unsigned int Width, unsigned int Height) +void sfWindow_SetSize(sfWindow* window, unsigned int width, unsigned int height) { - CSFML_CALL(Window, SetSize(Width, Height)) + CSFML_CALL(window, SetSize(width, height)) } //////////////////////////////////////////////////////////// /// Show or hide a window //////////////////////////////////////////////////////////// -void sfWindow_Show(sfWindow* Window, sfBool State) +void sfWindow_Show(sfWindow* window, sfBool show) { - CSFML_CALL(Window, Show(State == sfTrue)) + CSFML_CALL(window, Show(show == sfTrue)) } @@ -257,75 +257,72 @@ void sfWindow_Show(sfWindow* Window, sfBool State) /// Enable or disable automatic key-repeat for keydown events. /// Automatic key-repeat is enabled by default //////////////////////////////////////////////////////////// -void sfWindow_EnableKeyRepeat(sfWindow* Window, sfBool Enabled) +void sfWindow_EnableKeyRepeat(sfWindow* window, sfBool enabled) { - CSFML_CALL(Window, EnableKeyRepeat(Enabled == sfTrue)) + CSFML_CALL(window, EnableKeyRepeat(enabled == sfTrue)) } //////////////////////////////////////////////////////////// /// Change the window's icon //////////////////////////////////////////////////////////// -void sfWindow_SetIcon(sfWindow* Window, unsigned int Width, unsigned int Height, sfUint8* Pixels) +void sfWindow_SetIcon(sfWindow* window, unsigned int width, unsigned int height, sfUint8* pixels) { - CSFML_CALL(Window, SetIcon(Width, Height, Pixels)) + CSFML_CALL(window, SetIcon(width, height, pixels)) } //////////////////////////////////////////////////////////// /// Activate or deactivate a window as the current target for rendering //////////////////////////////////////////////////////////// -sfBool sfWindow_SetActive(sfWindow* Window, sfBool Active) +sfBool sfWindow_SetActive(sfWindow* window, sfBool active) { - CSFML_CALL_RETURN(Window, SetActive(Active == sfTrue), sfFalse) + CSFML_CALL_RETURN(window, SetActive(active == sfTrue), sfFalse) } //////////////////////////////////////////////////////////// /// Display a window on screen //////////////////////////////////////////////////////////// -void sfWindow_Display(sfWindow* Window) +void sfWindow_Display(sfWindow* window) { - CSFML_CALL(Window, Display()) + CSFML_CALL(window, Display()) } //////////////////////////////////////////////////////////// /// Get the input manager of a window //////////////////////////////////////////////////////////// -sfInput* sfWindow_GetInput(sfWindow* Window) +sfInput* sfWindow_GetInput(sfWindow* window) { - CSFML_CHECK_RETURN(Window, NULL); + CSFML_CHECK_RETURN(window, NULL); - return &Window->Input; + return &window->Input; } //////////////////////////////////////////////////////////// /// Limit the framerate to a maximum fixed frequency for a window //////////////////////////////////////////////////////////// -void sfWindow_SetFramerateLimit(sfWindow* Window, unsigned int Limit) +void sfWindow_SetFramerateLimit(sfWindow* window, unsigned int limit) { - CSFML_CALL(Window, SetFramerateLimit(Limit)) + CSFML_CALL(window, SetFramerateLimit(limit)) } //////////////////////////////////////////////////////////// /// Get time elapsed since last frame of a window //////////////////////////////////////////////////////////// -float sfWindow_GetFrameTime(sfWindow* Window) +float sfWindow_GetFrameTime(sfWindow* window) { - CSFML_CALL_RETURN(Window, GetFrameTime(), 0.f) + CSFML_CALL_RETURN(window, GetFrameTime(), 0.f) } //////////////////////////////////////////////////////////// /// Change the joystick threshold, ie. the value below which /// no move event will be generated -/// -/// \param Threshold : New threshold, in range [0, 100] -/// //////////////////////////////////////////////////////////// -void sfWindow_SetJoystickThreshold(sfWindow* Window, float Threshold) +void sfWindow_SetJoystickThreshold(sfWindow* window, float threshold) { - CSFML_CALL(Window, SetJoystickThreshold(Threshold)) + CSFML_CALL(window, SetJoystickThreshold(threshold)) } diff --git a/build/vc2008/sfml-audio.vcproj b/build/vc2008/sfml-audio.vcproj index df3739486..7cb109ac1 100644 --- a/build/vc2008/sfml-audio.vcproj +++ b/build/vc2008/sfml-audio.vcproj @@ -347,14 +347,6 @@ RelativePath="..\..\src\SFML\Audio\AudioDevice.hpp" > - - - - @@ -368,7 +360,7 @@ > diff --git a/build/vc2008/sfml-main.vcproj b/build/vc2008/sfml-main.vcproj index 429ccbefd..81e537066 100644 --- a/build/vc2008/sfml-main.vcproj +++ b/build/vc2008/sfml-main.vcproj @@ -147,16 +147,10 @@ - - - - + diff --git a/build/vc2008/sfml-network.vcproj b/build/vc2008/sfml-network.vcproj index 008d030bd..0b64587ef 100644 --- a/build/vc2008/sfml-network.vcproj +++ b/build/vc2008/sfml-network.vcproj @@ -343,7 +343,7 @@ > @@ -368,7 +368,7 @@ > + + diff --git a/build/vc2008/sfml-system.vcproj b/build/vc2008/sfml-system.vcproj index 0e4c066bb..a8b8d0017 100644 --- a/build/vc2008/sfml-system.vcproj +++ b/build/vc2008/sfml-system.vcproj @@ -372,7 +372,7 @@ > + + + + + + + + diff --git a/build/vc2008/sfml-window.vcproj b/build/vc2008/sfml-window.vcproj index e393f9f40..6b7b363ff 100644 --- a/build/vc2008/sfml-window.vcproj +++ b/build/vc2008/sfml-window.vcproj @@ -428,7 +428,7 @@ > diff --git a/dotnet/extlibs/csfml-audio.dll b/dotnet/extlibs/csfml-audio.dll index 1a9fa5e86..1a5de30f2 100644 Binary files a/dotnet/extlibs/csfml-audio.dll and b/dotnet/extlibs/csfml-audio.dll differ diff --git a/dotnet/extlibs/csfml-graphics.dll b/dotnet/extlibs/csfml-graphics.dll index 9101c0ad0..f86b75d6d 100644 Binary files a/dotnet/extlibs/csfml-graphics.dll and b/dotnet/extlibs/csfml-graphics.dll differ diff --git a/dotnet/extlibs/csfml-window.dll b/dotnet/extlibs/csfml-window.dll index 0d8fdf60c..9e7f8e7b7 100644 Binary files a/dotnet/extlibs/csfml-window.dll and b/dotnet/extlibs/csfml-window.dll differ diff --git a/dotnet/samples/opengl/sample-opengl.csproj b/dotnet/samples/opengl/sample-opengl.csproj index 62d169524..4670690b2 100644 --- a/dotnet/samples/opengl/sample-opengl.csproj +++ b/dotnet/samples/opengl/sample-opengl.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.21022 2.0 {160AE11E-138A-4B77-9642-EA74F9A79B4D} WinExe @@ -21,7 +21,7 @@ true full false - bin\Debug\ + ..\bin\ DEBUG;TRACE prompt 4 diff --git a/dotnet/samples/post-fx/sample-postfx.csproj b/dotnet/samples/post-fx/sample-postfx.csproj index e81c9f58a..9a776eb81 100644 --- a/dotnet/samples/post-fx/sample-postfx.csproj +++ b/dotnet/samples/post-fx/sample-postfx.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.21022 2.0 {9D4738F7-34EA-433A-A765-AF85A52A174D} WinExe @@ -19,7 +19,7 @@ true full false - bin\Debug\ + ..\bin\ DEBUG;TRACE prompt 4 diff --git a/dotnet/samples/sound/sample-sound.csproj b/dotnet/samples/sound/sample-sound.csproj index b354e87c5..465b0fefe 100644 --- a/dotnet/samples/sound/sample-sound.csproj +++ b/dotnet/samples/sound/sample-sound.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.21022 2.0 {16E177F3-A0FF-4091-8521-562E0EBAA3AB} Exe @@ -21,7 +21,7 @@ true full false - bin\Debug\ + ..\bin\ DEBUG;TRACE prompt 4 diff --git a/dotnet/samples/sound_capture/sample-soundcapture.csproj b/dotnet/samples/sound_capture/sample-soundcapture.csproj index 3805abfad..3ce78e72a 100644 --- a/dotnet/samples/sound_capture/sample-soundcapture.csproj +++ b/dotnet/samples/sound_capture/sample-soundcapture.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.21022 2.0 {F2F48990-F81E-41BA-AD01-168F6178C807} Exe @@ -21,7 +21,7 @@ true full false - bin\Debug\ + ..\bin\ DEBUG;TRACE prompt 4 diff --git a/dotnet/samples/window/sample-window.csproj b/dotnet/samples/window/sample-window.csproj index ebe1ca5ec..9eb0b8956 100644 --- a/dotnet/samples/window/sample-window.csproj +++ b/dotnet/samples/window/sample-window.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.21022 2.0 {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF} WinExe @@ -19,10 +19,11 @@ true full false - bin\Debug\ + ..\bin\ DEBUG;TRACE prompt 4 + false pdbonly diff --git a/include/SFML/Audio/AudioResource.hpp b/include/SFML/Audio/AudioResource.hpp deleted file mode 100644 index 410466dd5..000000000 --- a/include/SFML/Audio/AudioResource.hpp +++ /dev/null @@ -1,67 +0,0 @@ -//////////////////////////////////////////////////////////// -// -// SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) -// -// This software is provided 'as-is', without any express or implied warranty. -// In no event will the authors be held liable for any damages arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it freely, -// subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; -// you must not claim that you wrote the original software. -// If you use this software in a product, an acknowledgment -// in the product documentation would be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, -// and must not be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. -// -//////////////////////////////////////////////////////////// - -#ifndef SFML_AUDIORESOURCE_HPP -#define SFML_AUDIORESOURCE_HPP - -//////////////////////////////////////////////////////////// -// Headers -//////////////////////////////////////////////////////////// -#include - - -namespace sf -{ -//////////////////////////////////////////////////////////// -/// Abstract base class for every class that owns a -/// device-dependant resource -- allow them to initialize / shutdown -/// even when the audio context is not created -//////////////////////////////////////////////////////////// -class SFML_API AudioResource -{ -protected : - - //////////////////////////////////////////////////////////// - /// Default constructor - /// - //////////////////////////////////////////////////////////// - AudioResource(); - - //////////////////////////////////////////////////////////// - /// Copy constructor - /// - //////////////////////////////////////////////////////////// - AudioResource(const AudioResource&); - - //////////////////////////////////////////////////////////// - /// Destructor - /// - //////////////////////////////////////////////////////////// - virtual ~AudioResource(); -}; - -} // namespace sf - - -#endif // SFML_AUDIORESOURCE_HPP diff --git a/include/SFML/Audio/Listener.hpp b/include/SFML/Audio/Listener.hpp index 95227cacf..34b39372b 100644 --- a/include/SFML/Audio/Listener.hpp +++ b/include/SFML/Audio/Listener.hpp @@ -47,10 +47,10 @@ public : /// Change the global volume of all the sounds. /// The default volume is 100 /// - /// \param Volume : New global volume, in the range [0, 100] + /// \param volume : New global volume, in the range [0, 100] /// //////////////////////////////////////////////////////////// - static void SetGlobalVolume(float Volume); + static void SetGlobalVolume(float volume); //////////////////////////////////////////////////////////// /// Get the current value of the global volume of all the sounds @@ -64,19 +64,19 @@ public : /// Change the position of the listener (take 3 values). /// The default position is (0, 0, 0) /// - /// \param X, Y, Z : Position of the listener in the world + /// \param x, y, z : Position of the listener in the world /// //////////////////////////////////////////////////////////// - static void SetPosition(float X, float Y, float Z); + static void SetPosition(float x, float y, float z); //////////////////////////////////////////////////////////// /// Change the position of the listener (take a 3D vector). /// The default position is (0, 0, 0) /// - /// \param Position : Position of the listener in the world + /// \param position : Position of the listener in the world /// //////////////////////////////////////////////////////////// - static void SetPosition(const Vector3f& Position); + static void SetPosition(const Vector3f& position); //////////////////////////////////////////////////////////// /// Get the current position of the listener @@ -91,20 +91,20 @@ public : /// he must look at) (take 3 values). /// The default target is (0, 0, -1) /// - /// \param X, Y, Z : Position of the point the listener must look at + /// \param x, y, z : Position of the point the listener must look at /// //////////////////////////////////////////////////////////// - static void SetTarget(float X, float Y, float Z); + static void SetTarget(float x, float y, float z); //////////////////////////////////////////////////////////// /// Change the orientation of the listener (the point /// he must look at) (take a 3D vector). /// The default target is (0, 0, -1) /// - /// \param Target : Position of the point the listener must look at + /// \param target : Position of the point the listener must look at /// //////////////////////////////////////////////////////////// - static void SetTarget(const Vector3f& Target); + static void SetTarget(const Vector3f& target); //////////////////////////////////////////////////////////// /// Get the current orientation of the listener (the point diff --git a/include/SFML/Audio/Music.hpp b/include/SFML/Audio/Music.hpp index 826a7f6ae..37169ac48 100644 --- a/include/SFML/Audio/Music.hpp +++ b/include/SFML/Audio/Music.hpp @@ -52,11 +52,11 @@ public : //////////////////////////////////////////////////////////// /// Construct the music with a buffer size /// - /// \param BufferSize : Size of the internal buffer, expressed in number of samples + /// \param bufferSize : Size of the internal buffer, expressed in number of samples /// (ie. size taken by the music in memory) (44100 by default) /// //////////////////////////////////////////////////////////// - Music(std::size_t BufferSize = 44100); + Music(std::size_t bufferSize = 44100); //////////////////////////////////////////////////////////// /// Destructor @@ -67,23 +67,23 @@ public : //////////////////////////////////////////////////////////// /// Open a music file (doesn't play it -- call Play() for that) /// - /// \param Filename : Path of the music file to open + /// \param filename : Path of the music file to open /// /// \return True if loading has been successful /// //////////////////////////////////////////////////////////// - bool OpenFromFile(const std::string& Filename); + bool OpenFromFile(const std::string& filename); //////////////////////////////////////////////////////////// /// Open a music file from memory (doesn't play it -- call Play() for that) /// - /// \param Data : Pointer to the file data in memory - /// \param SizeInBytes : Size of the data to load, in bytes + /// \param data : Pointer to the file data in memory + /// \param sizeInBytes : Size of the data to load, in bytes /// /// \return True if loading has been successful /// //////////////////////////////////////////////////////////// - bool OpenFromMemory(const char* Data, std::size_t SizeInBytes); + bool OpenFromMemory(const char* data, std::size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Get the music duration @@ -99,13 +99,13 @@ private : /// /see SoundStream::OnGetData /// //////////////////////////////////////////////////////////// - virtual bool OnGetData(Chunk& Data); + virtual bool OnGetData(Chunk& data); //////////////////////////////////////////////////////////// /// /see SoundStream::OnSeek /// //////////////////////////////////////////////////////////// - virtual void OnSeek(float TimeOffset); + virtual void OnSeek(float timeOffset); //////////////////////////////////////////////////////////// // Member data diff --git a/include/SFML/Audio/Sound.hpp b/include/SFML/Audio/Sound.hpp index 691d6338c..f96943898 100644 --- a/include/SFML/Audio/Sound.hpp +++ b/include/SFML/Audio/Sound.hpp @@ -28,9 +28,9 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include -#include #include @@ -42,7 +42,7 @@ class SoundBuffer; /// Sound defines the properties of a sound such as position, /// volume, pitch, etc. //////////////////////////////////////////////////////////// -class SFML_API Sound : public AudioResource +class SFML_API Sound { public : @@ -65,22 +65,22 @@ public : //////////////////////////////////////////////////////////// /// Construct the sound from its parameters /// - /// \param Buffer : Sound buffer to play (NULL by default) - /// \param Loop : Loop flag (false by default) - /// \param Pitch : Value of the pitch (1 by default) - /// \param Volume : Volume (100 by default) - /// \param Position : Position (0, 0, 0 by default) + /// \param buffer : Sound buffer to play (NULL by default) + /// \param loop : Loop flag (false by default) + /// \param pitch : Value of the pitch (1 by default) + /// \param volume : Volume (100 by default) + /// \param position : Position (0, 0, 0 by default) /// //////////////////////////////////////////////////////////// - Sound(const SoundBuffer& Buffer, bool Loop = false, float Pitch = 1.f, float Volume = 100.f, const Vector3f& Position = Vector3f(0, 0, 0)); + Sound(const SoundBuffer& buffer, bool loop = false, float pitch = 1.f, float volume = 100.f, const Vector3f& position = Vector3f(0, 0, 0)); //////////////////////////////////////////////////////////// /// Copy constructor /// - /// \param Copy : Instance to copy + /// \param copy : Instance to copy /// //////////////////////////////////////////////////////////// - Sound(const Sound& Copy); + Sound(const Sound& copy); //////////////////////////////////////////////////////////// /// Destructor @@ -109,93 +109,93 @@ public : //////////////////////////////////////////////////////////// /// Set the source buffer /// - /// \param Buffer : New sound buffer to bind to the sound + /// \param buffer : New sound buffer to bind to the sound /// //////////////////////////////////////////////////////////// - void SetBuffer(const SoundBuffer& Buffer); + void SetBuffer(const SoundBuffer& buffer); //////////////////////////////////////////////////////////// /// Set the sound loop state. /// This parameter is disabled by default /// - /// \param Loop : True to play in loop, false to play once + /// \param loop : True to play in loop, false to play once /// //////////////////////////////////////////////////////////// - void SetLoop(bool Loop); + void SetLoop(bool loop); //////////////////////////////////////////////////////////// /// Set the sound pitch. /// The default pitch is 1 /// - /// \param Pitch : New pitch + /// \param pitch : New pitch /// //////////////////////////////////////////////////////////// - void SetPitch(float Pitch); + void SetPitch(float pitch); //////////////////////////////////////////////////////////// /// Set the sound volume. /// The default volume is 100 /// - /// \param Volume : Volume (in range [0, 100]) + /// \param volume : Volume (in range [0, 100]) /// //////////////////////////////////////////////////////////// - void SetVolume(float Volume); + void SetVolume(float volume); //////////////////////////////////////////////////////////// /// Set the sound position (take 3 values). /// The default position is (0, 0, 0) /// - /// \param X, Y, Z : Position of the sound in the world + /// \param x, y, z : Position of the sound in the world /// //////////////////////////////////////////////////////////// - void SetPosition(float X, float Y, float Z); + void SetPosition(float x, float y, float z); //////////////////////////////////////////////////////////// /// Set the sound position (take a 3D vector). /// The default position is (0, 0, 0) /// - /// \param Position : Position of the sound in the world + /// \param position : Position of the sound in the world /// //////////////////////////////////////////////////////////// - void SetPosition(const Vector3f& Position); + void SetPosition(const Vector3f& position); //////////////////////////////////////////////////////////// /// Make the sound's position relative to the listener's /// position, or absolute. /// The default value is false (absolute) /// - /// \param Relative : True to set the position relative, false to set it absolute + /// \param relative : True to set the position relative, false to set it absolute /// //////////////////////////////////////////////////////////// - void SetRelativeToListener(bool Relative); + void SetRelativeToListener(bool 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 /// - /// \param MinDistance : New minimum distance for the sound + /// \param distance : New minimum distance for the sound /// //////////////////////////////////////////////////////////// - void SetMinDistance(float MinDistance); + void SetMinDistance(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 /// - /// \param Attenuation : New attenuation factor for the sound + /// \param attenuation : New attenuation factor for the sound /// //////////////////////////////////////////////////////////// - void SetAttenuation(float Attenuation); + void SetAttenuation(float attenuation); //////////////////////////////////////////////////////////// /// Set the current playing position of the sound /// - /// \param TimeOffset : New playing position, expressed in seconds + /// \param timeOffset : New playing position, expressed in seconds /// //////////////////////////////////////////////////////////// - void SetPlayingOffset(float TimeOffset); + void SetPlayingOffset(float timeOffset); //////////////////////////////////////////////////////////// /// Get the source buffer @@ -286,7 +286,7 @@ public : /// \return Reference to the sound /// //////////////////////////////////////////////////////////// - Sound& operator =(const Sound& Other); + Sound& operator =(const Sound& other); private : diff --git a/include/SFML/Audio/SoundBuffer.hpp b/include/SFML/Audio/SoundBuffer.hpp index af459f41c..7b32a6692 100644 --- a/include/SFML/Audio/SoundBuffer.hpp +++ b/include/SFML/Audio/SoundBuffer.hpp @@ -28,8 +28,8 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include -#include #include #include @@ -40,7 +40,7 @@ namespace sf /// SoundBuffer is the low-level for loading and manipulating /// sound buffers //////////////////////////////////////////////////////////// -class SFML_API SoundBuffer : public AudioResource, public Resource +class SFML_API SoundBuffer : public Resource { public : @@ -53,10 +53,10 @@ public : //////////////////////////////////////////////////////////// /// Copy constructor /// - /// \param Copy : Instance to copy + /// \param copy : Instance to copy /// //////////////////////////////////////////////////////////// - SoundBuffer(const SoundBuffer& Copy); + SoundBuffer(const SoundBuffer& copy); //////////////////////////////////////////////////////////// /// Destructor @@ -67,47 +67,47 @@ public : //////////////////////////////////////////////////////////// /// Load the sound buffer from a file /// - /// \param Filename : Path of the sound file to load + /// \param filename : Path of the sound file to load /// /// \return True if loading has been successful /// //////////////////////////////////////////////////////////// - bool LoadFromFile(const std::string& Filename); + bool LoadFromFile(const std::string& filename); //////////////////////////////////////////////////////////// /// Load the sound buffer from a file in memory /// - /// \param Data : Pointer to the file data in memory - /// \param SizeInBytes : Size of the data to load, in bytes + /// \param data : Pointer to the file data in memory + /// \param sizeInBytes : Size of the data to load, in bytes /// /// \return True if loading has been successful /// //////////////////////////////////////////////////////////// - bool LoadFromMemory(const char* Data, std::size_t SizeInBytes); + bool LoadFromMemory(const char* data, std::size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Load the sound buffer from an array of samples - assumed format for /// samples is 16 bits signed integer /// - /// \param Samples : Pointer to the samples in memory - /// \param SamplesCount : Number of samples pointed by Samples - /// \param ChannelsCount : Number of channels (1 = mono, 2 = stereo, ...) - /// \param SampleRate : Frequency (number of samples to play per second) + /// \param samples : Pointer to the samples in memory + /// \param samplesCount : Number of samples pointed by Samples + /// \param channelsCount : Number of channels (1 = mono, 2 = stereo, ...) + /// \param sampleRate : Frequency (number of samples to play per second) /// /// \return True if loading has been successful /// //////////////////////////////////////////////////////////// - bool LoadFromSamples(const Int16* Samples, std::size_t SamplesCount, unsigned int ChannelsCount, unsigned int SampleRate); + bool LoadFromSamples(const Int16* samples, std::size_t samplesCount, unsigned int channelsCount, unsigned int sampleRate); //////////////////////////////////////////////////////////// /// Save the sound buffer to a file /// - /// \param Filename : Path of the sound file to write + /// \param filename : Path of the sound file to write /// /// \return True if saving has been successful /// //////////////////////////////////////////////////////////// - bool SaveToFile(const std::string& Filename) const; + bool SaveToFile(const std::string& filename) const; //////////////////////////////////////////////////////////// /// Return the sound samples @@ -152,12 +152,12 @@ public : //////////////////////////////////////////////////////////// /// Assignment operator /// - /// \param Other : Instance to assign + /// \param other : Instance to assign /// /// \return Reference to the sound buffer /// //////////////////////////////////////////////////////////// - SoundBuffer& operator =(const SoundBuffer& Other); + SoundBuffer& operator =(const SoundBuffer& other); private : @@ -166,13 +166,13 @@ private : //////////////////////////////////////////////////////////// /// Update the internal buffer with the audio samples /// - /// \param ChannelsCount : Number of channels - /// \param SampleRate : Sample rate + /// \param channelsCount : Number of channels + /// \param sampleRate : Sample rate /// /// \return True on success /// //////////////////////////////////////////////////////////// - bool Update(unsigned int ChannelsCount, unsigned int SampleRate); + bool Update(unsigned int channelsCount, unsigned int sampleRate); //////////////////////////////////////////////////////////// // Member data diff --git a/include/SFML/Audio/SoundBufferRecorder.hpp b/include/SFML/Audio/SoundBufferRecorder.hpp index e949a1cb1..14353b253 100644 --- a/include/SFML/Audio/SoundBufferRecorder.hpp +++ b/include/SFML/Audio/SoundBufferRecorder.hpp @@ -63,7 +63,7 @@ private : /// /see SoundBuffer::OnProcessSamples /// //////////////////////////////////////////////////////////// - virtual bool OnProcessSamples(const Int16* Samples, std::size_t SamplesCount); + virtual bool OnProcessSamples(const Int16* samples, std::size_t samplesCount); //////////////////////////////////////////////////////////// /// /see SoundBuffer::OnStop diff --git a/include/SFML/Audio/SoundRecorder.hpp b/include/SFML/Audio/SoundRecorder.hpp index 551a4b906..c7260f9a2 100644 --- a/include/SFML/Audio/SoundRecorder.hpp +++ b/include/SFML/Audio/SoundRecorder.hpp @@ -52,11 +52,11 @@ public : /// Start the capture. /// Warning : only one capture can happen at the same time /// - /// \param SampleRate : Sound frequency (the more samples, the higher the quality) + /// \param sampleRate : Sound frequency (the more samples, the higher the quality) /// (44100 by default = CD quality) /// //////////////////////////////////////////////////////////// - void Start(unsigned int SampleRate = 44100); + void Start(unsigned int sampleRate = 44100); //////////////////////////////////////////////////////////// /// Stop the capture @@ -102,13 +102,13 @@ private : //////////////////////////////////////////////////////////// /// Process a new chunk of recorded samples /// - /// \param Samples : Pointer to the new chunk of recorded samples - /// \param SamplesCount : Number of samples pointed by Samples + /// \param samples : Pointer to the new chunk of recorded samples + /// \param samplesCount : Number of samples pointed by Samples /// /// \return False to stop recording audio data, true to continue /// //////////////////////////////////////////////////////////// - virtual bool OnProcessSamples(const Int16* Samples, std::size_t SamplesCount) = 0; + virtual bool OnProcessSamples(const Int16* samples, std::size_t samplesCount) = 0; //////////////////////////////////////////////////////////// /// Stop recording audio data diff --git a/include/SFML/Audio/SoundStream.hpp b/include/SFML/Audio/SoundStream.hpp index a5e79e00b..4cb839165 100644 --- a/include/SFML/Audio/SoundStream.hpp +++ b/include/SFML/Audio/SoundStream.hpp @@ -117,10 +117,10 @@ public : //////////////////////////////////////////////////////////// /// Set the current playing position of the stream /// - /// \param TimeOffset : New playing position, expressed in seconds + /// \param timeOffset : New playing position, expressed in seconds /// //////////////////////////////////////////////////////////// - void SetPlayingOffset(float TimeOffset); + void SetPlayingOffset(float timeOffset); //////////////////////////////////////////////////////////// /// Get the current playing position of the stream @@ -134,10 +134,10 @@ public : /// Set the stream loop state. /// This parameter is disabled by default /// - /// \param Loop : True to play in loop, false to play once + /// \param loop : True to play in loop, false to play once /// //////////////////////////////////////////////////////////// - void SetLoop(bool Loop); + void SetLoop(bool loop); //////////////////////////////////////////////////////////// /// Tell whether or not the stream is looping @@ -158,11 +158,11 @@ protected : //////////////////////////////////////////////////////////// /// Set the audio stream parameters, you must call it before Play() /// - /// \param ChannelsCount : Number of channels - /// \param SampleRate : Sample rate + /// \param channelsCount : Number of channels + /// \param sampleRate : Sample rate /// //////////////////////////////////////////////////////////// - void Initialize(unsigned int ChannelsCount, unsigned int SampleRate); + void Initialize(unsigned int channelsCount, unsigned int sampleRate); private : @@ -175,31 +175,31 @@ private : //////////////////////////////////////////////////////////// /// Called each time new audio data is needed to feed the stream /// - /// \param Data : New chunk of data to stream + /// \param data : New chunk of data to stream /// /// \return True to continue playback, false to stop /// //////////////////////////////////////////////////////////// - virtual bool OnGetData(Chunk& Data) = 0; + virtual bool OnGetData(Chunk& data) = 0; //////////////////////////////////////////////////////////// /// Called to move the current reading position /// - /// \param TimeOffset : New read position, expressed in seconds + /// \param timeOffset : New read position, expressed in seconds /// //////////////////////////////////////////////////////////// - virtual void OnSeek(float TimeOffset) = 0; + virtual void OnSeek(float timeOffset) = 0; //////////////////////////////////////////////////////////// /// Fill a new buffer with audio data, and push it to the /// playing queue /// - /// \param Buffer : Buffer to fill + /// \param buffer : Buffer to fill /// /// \return True if the derived class has requested to stop /// //////////////////////////////////////////////////////////// - bool FillAndPushBuffer(unsigned int Buffer); + bool FillAndPushBuffer(unsigned int buffer); //////////////////////////////////////////////////////////// /// Fill the buffers queue with all available buffers diff --git a/include/SFML/Graphics/Color.hpp b/include/SFML/Graphics/Color.hpp index 5f4d4d7a1..ba617f345 100644 --- a/include/SFML/Graphics/Color.hpp +++ b/include/SFML/Graphics/Color.hpp @@ -50,53 +50,13 @@ public : //////////////////////////////////////////////////////////// /// Construct the color from its 4 RGBA components /// - /// \param R : Red component (0 .. 255) - /// \param G : Green component (0 .. 255) - /// \param B : Blue component (0 .. 255) - /// \param A : Alpha component (0 .. 255) (255 by default) + /// \param red : Red component (0 .. 255) + /// \param green : Green component (0 .. 255) + /// \param blue : Blue component (0 .. 255) + /// \param alpha : Alpha (opacity) component (0 .. 255) (255 by default) /// //////////////////////////////////////////////////////////// - Color(Uint8 R, Uint8 G, Uint8 B, Uint8 A = 255); - - //////////////////////////////////////////////////////////// - /// Operator += overload to add a color - /// - /// \param Other : Color to add - /// - /// \return Component-wise saturated addition of the two colors - /// - //////////////////////////////////////////////////////////// - Color& operator +=(const Color& Other); - - //////////////////////////////////////////////////////////// - /// Operator *= overload to modulate a color - /// - /// \param Other : Color to modulate - /// - /// \return Component-wise multiplication of the two colors - /// - //////////////////////////////////////////////////////////// - Color& operator *=(const Color& Other); - - //////////////////////////////////////////////////////////// - /// Compare two colors (for equality) - /// - /// \param Other : Color to compare - /// - /// \return True if colors are equal - /// - //////////////////////////////////////////////////////////// - bool operator ==(const Color& Other) const; - - //////////////////////////////////////////////////////////// - /// Compare two colors (for difference) - /// - /// \param Other : Color to compare - /// - /// \return True if colors are different - /// - //////////////////////////////////////////////////////////// - bool operator !=(const Color& Other) const; + Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = 255); //////////////////////////////////////////////////////////// // Static member data @@ -119,27 +79,71 @@ public : Uint8 a; ///< Alpha (transparency) component }; +//////////////////////////////////////////////////////////// +/// Compare two colors (for equality) +/// +/// \param left : Left operand +/// \param right : Right operand +/// +/// \return True if colors are equal +/// +//////////////////////////////////////////////////////////// +bool operator ==(const Color& left, const Color& right); + +//////////////////////////////////////////////////////////// +/// Compare two colors (for difference) +/// +/// \param left : Left operand +/// \param right : Right operand +/// +/// \return True if colors are different +/// +//////////////////////////////////////////////////////////// +bool operator !=(const Color& left, const Color& right); + //////////////////////////////////////////////////////////// /// Operator + overload to add two colors /// -/// \param Color1 : First color -/// \param Color2 : Second color +/// \param left : Left operand +/// \param right : Right operand /// /// \return Component-wise saturated addition of the two colors /// //////////////////////////////////////////////////////////// -SFML_API Color operator +(const Color& Color1, const Color& Color2); +SFML_API Color operator +(const Color& left, const Color& right); //////////////////////////////////////////////////////////// /// Operator * overload to modulate two colors /// -/// \param Color1 : First color -/// \param Color2 : Second color +/// \param left : Left operand +/// \param right : Right operand /// /// \return Component-wise multiplication of the two colors /// //////////////////////////////////////////////////////////// -SFML_API Color operator *(const Color& Color1, const Color& Color2); +SFML_API Color operator *(const Color& left, const Color& right); + +//////////////////////////////////////////////////////////// +/// Operator += overload to add a color +/// +/// \param left : Left operand +/// \param right : Right operand +/// +/// \return Component-wise saturated addition of the two colors +/// +//////////////////////////////////////////////////////////// +Color& operator +=(Color& left, const Color& right); + +//////////////////////////////////////////////////////////// +/// Operator *= overload to modulate a color +/// +/// \param left : Left operand +/// \param right : Right operand +/// +/// \return Component-wise multiplication of the two colors +/// +//////////////////////////////////////////////////////////// +Color& operator *=(Color& left, const Color& right); } // namespace sf diff --git a/include/SFML/Graphics/Drawable.hpp b/include/SFML/Graphics/Drawable.hpp index 8b23267c0..5076eda7b 100644 --- a/include/SFML/Graphics/Drawable.hpp +++ b/include/SFML/Graphics/Drawable.hpp @@ -62,13 +62,13 @@ public : //////////////////////////////////////////////////////////// /// Default constructor /// - /// \param Position : Position of the object (0, 0 by default) - /// \param Scale : Scale factor (1, 1 by default) - /// \param Rotation : Orientation, in degrees (0 by default) - /// \param Col : Color of the object (white by default) + /// \param position : Position of the object ((0, 0) by default) + /// \param scale : Scale factor ((1, 1) by default) + /// \param rotation : Orientation, in degrees (0 by default) + /// \param color : Color of the object (white by default) /// //////////////////////////////////////////////////////////// - Drawable(const Vector2f& Position = Vector2f(0, 0), const Vector2f& Scale = Vector2f(1, 1), float Rotation = 0.f, const Color& Col = Color(255, 255, 255, 255)); + Drawable(const Vector2f& position = Vector2f(0, 0), const Vector2f& scale = Vector2f(1, 1), float rotation = 0.f, const Color& color = Color(255, 255, 255)); //////////////////////////////////////////////////////////// /// Virtual destructor @@ -79,44 +79,44 @@ public : //////////////////////////////////////////////////////////// /// Set the position of the object (take 2 values) /// - /// \param X : New X coordinate - /// \param Y : New Y coordinate + /// \param x : New X coordinate + /// \param y : New Y coordinate /// //////////////////////////////////////////////////////////// - void SetPosition(float X, float Y); + void SetPosition(float x, float y); //////////////////////////////////////////////////////////// /// Set the position of the object (take a 2D vector) /// - /// \param Position : New position + /// \param position : New position /// //////////////////////////////////////////////////////////// - void SetPosition(const Vector2f& Position); + void SetPosition(const Vector2f& position); //////////////////////////////////////////////////////////// /// Set the X position of the object /// - /// \param X : New X coordinate + /// \param x : New X coordinate /// //////////////////////////////////////////////////////////// - void SetX(float X); + void SetX(float x); //////////////////////////////////////////////////////////// /// Set the Y position of the object /// - /// \param Y : New Y coordinate + /// \param y : New Y coordinate /// //////////////////////////////////////////////////////////// - void SetY(float Y); + void SetY(float y); //////////////////////////////////////////////////////////// /// Set the scale of the object (take 2 values) /// - /// \param ScaleX : New horizontal scale (must be strictly positive) - /// \param ScaleY : New vertical scale (must be strictly positive) + /// \param factorX : New horizontal scale (must be strictly positive) + /// \param factorY : New vertical scale (must be strictly positive) /// //////////////////////////////////////////////////////////// - void SetScale(float ScaleX, float ScaleY); + void SetScale(float factorX, float factorY); //////////////////////////////////////////////////////////// /// Set the scale of the object (take a 2D vector) @@ -124,70 +124,70 @@ public : /// \param Scale : New scale (both values must be strictly positive) /// //////////////////////////////////////////////////////////// - void SetScale(const Vector2f& Scale); + void SetScale(const Vector2f& scale); //////////////////////////////////////////////////////////// /// Set the X scale factor of the object /// - /// \param X : New X scale factor + /// \param factor : New X scale factor /// //////////////////////////////////////////////////////////// - void SetScaleX(float FactorX); + void SetScaleX(float factor); //////////////////////////////////////////////////////////// /// Set the Y scale factor of the object /// - /// \param Y : New Y scale factor + /// \param factor : New Y scale factor /// //////////////////////////////////////////////////////////// - void SetScaleY(float FactorY); + void SetScaleY(float factor); //////////////////////////////////////////////////////////// /// Set the local origin of the object, in coordinates relative to the /// top-left of the object (take 2 values). /// The default origin is (0, 0) /// - /// \param OriginX : X coordinate of the origin - /// \param OriginY : Y coordinate of the origin + /// \param x : X coordinate of the origin + /// \param y : Y coordinate of the origin /// //////////////////////////////////////////////////////////// - void SetOrigin(float OriginX, float OriginY); + void SetOrigin(float x, float y); //////////////////////////////////////////////////////////// /// Set the local origin of the object, in coordinates relative to the /// top-left of the object (take a 2D vector). /// The default origin is (0, 0) /// - /// \param Origin : New origin + /// \param origin : New origin /// //////////////////////////////////////////////////////////// - void SetOrigin(const Vector2f& Origin); + void SetOrigin(const Vector2f& origin); //////////////////////////////////////////////////////////// /// Set the orientation of the object /// - /// \param Rotation : Angle of rotation, in degrees + /// \param angle : Angle of rotation, in degrees /// //////////////////////////////////////////////////////////// - void SetRotation(float Rotation); + void SetRotation(float angle); //////////////////////////////////////////////////////////// /// Set the color of the object. /// The default color is white /// - /// \param Col : New color + /// \param color : New color /// //////////////////////////////////////////////////////////// - void SetColor(const Color& Col); + void SetColor(const Color& color); //////////////////////////////////////////////////////////// /// Set the blending mode for the object. /// The default blend mode is Blend::Alpha /// - /// \param Mode : New blending mode + /// \param mode : New blending mode /// //////////////////////////////////////////////////////////// - void SetBlendMode(Blend::Mode Mode); + void SetBlendMode(Blend::Mode mode); //////////////////////////////////////////////////////////// /// Get the position of the object @@ -241,36 +241,36 @@ public : //////////////////////////////////////////////////////////// /// Move the object of a given offset (take 2 values) /// - /// \param OffsetX : X offset - /// \param OffsetY : Y offset + /// \param offsetX : X offset + /// \param offsetY : Y offset /// //////////////////////////////////////////////////////////// - void Move(float OffsetX, float OffsetY); + void Move(float offsetX, float offsetY); //////////////////////////////////////////////////////////// /// Move the object of a given offset (take a 2D vector) /// - /// \param Offset : Amount of units to move the object of + /// \param offset : Amount of units to move the object of /// //////////////////////////////////////////////////////////// - void Move(const Vector2f& Offset); + void Move(const Vector2f& offset); //////////////////////////////////////////////////////////// /// Scale the object (take 2 values) /// - /// \param FactorX : Scaling factor on X (must be strictly positive) - /// \param FactorY : Scaling factor on Y (must be strictly positive) + /// \param factorX : Scaling factor on X (must be strictly positive) + /// \param factorY : Scaling factor on Y (must be strictly positive) /// //////////////////////////////////////////////////////////// - void Scale(float FactorX, float FactorY); + void Scale(float factorX, float factorY); //////////////////////////////////////////////////////////// /// Scale the object (take a 2D vector) /// - /// \param Factor : Scaling factors (both values must be strictly positive) + /// \param factor : Scaling factors (both values must be strictly positive) /// //////////////////////////////////////////////////////////// - void Scale(const Vector2f& Factor); + void Scale(const Vector2f& factor); //////////////////////////////////////////////////////////// /// Rotate the object @@ -284,23 +284,23 @@ public : /// Transform a point from global coordinates into local coordinates /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) /// - /// \param Point : Point to transform + /// \param point : Point to transform /// /// \return Transformed point /// //////////////////////////////////////////////////////////// - sf::Vector2f TransformToLocal(const sf::Vector2f& Point) const; + sf::Vector2f TransformToLocal(const sf::Vector2f& point) const; //////////////////////////////////////////////////////////// /// Transform a point from local coordinates into global coordinates /// (ie it applies the object's origin, translation, rotation and scale to the point) /// - /// \param Point : Point to transform + /// \param point : Point to transform /// /// \return Transformed point /// //////////////////////////////////////////////////////////// - sf::Vector2f TransformToGlobal(const sf::Vector2f& Point) const; + sf::Vector2f TransformToGlobal(const sf::Vector2f& point) const; protected : @@ -327,18 +327,18 @@ private : //////////////////////////////////////////////////////////// /// Draw the object into the specified window /// - /// \param Target : Target into which render the object + /// \param target : Target into which render the object /// //////////////////////////////////////////////////////////// - void Draw(RenderTarget& Target) const; + void Draw(RenderTarget& target) const; //////////////////////////////////////////////////////////// /// Render the specific geometry of the object /// - /// \param Target : Target into which render the object + /// \param target : Target into which render the object /// //////////////////////////////////////////////////////////// - virtual void Render(RenderTarget& Target) const = 0; + virtual void Render(RenderTarget& target) const = 0; //////////////////////////////////////////////////////////// // Member data diff --git a/include/SFML/Graphics/Font.hpp b/include/SFML/Graphics/Font.hpp index 866b974d0..d36d2aa17 100644 --- a/include/SFML/Graphics/Font.hpp +++ b/include/SFML/Graphics/Font.hpp @@ -64,27 +64,27 @@ public : //////////////////////////////////////////////////////////// /// Load the font from a file /// - /// \param Filename : Font file to load - /// \param CharSize : Size of characters in bitmap - the bigger, the higher quality (30 by default) - /// \param Charset : Characters set to generate (by default, contains the ISO-8859-1 printable characters) + /// \param filename : Font file to load + /// \param charSize : Size of characters in bitmap - the bigger, the higher quality (30 by default) + /// \param charset : Characters set to generate (by default, contains the ISO-8859-1 printable characters) /// /// \return True if loading was successful /// //////////////////////////////////////////////////////////// - bool LoadFromFile(const std::string& Filename, unsigned int CharSize = 30, const Unicode::Text& Charset = ourDefaultCharset); + bool LoadFromFile(const std::string& filename, unsigned int charSize = 30, const Unicode::Text& charset = ourDefaultCharset); //////////////////////////////////////////////////////////// /// Load the font from a file in memory /// - /// \param Data : Pointer to the data to load - /// \param SizeInBytes : Size of the data, in bytes - /// \param CharSize : Size of characters in bitmap - the bigger, the higher quality (30 by default) - /// \param Charset : Characters set to generate (by default, contains the ISO-8859-1 printable characters) + /// \param data : Pointer to the data to load + /// \param sizeInBytes : Size of the data, in bytes + /// \param charSize : Size of characters in bitmap - the bigger, the higher quality (30 by default) + /// \param charset : Characters set to generate (by default, contains the ISO-8859-1 printable characters) /// /// \return True if loading was successful /// //////////////////////////////////////////////////////////// - bool LoadFromMemory(const char* Data, std::size_t SizeInBytes, unsigned int CharSize = 30, const Unicode::Text& Charset = ourDefaultCharset); + bool LoadFromMemory(const char* data, std::size_t sizeInBytes, unsigned int charSize = 30, const Unicode::Text& charset = ourDefaultCharset); //////////////////////////////////////////////////////////// /// Get the base size of characters in the font; @@ -99,12 +99,12 @@ public : /// Get the description of a glyph (character) /// given by its unicode value /// - /// \param CodePoint : Unicode value of the character to get + /// \param codePoint : Unicode value of the character to get /// /// \return Glyph's visual settings, or an invalid glyph if character not found /// //////////////////////////////////////////////////////////// - const Glyph& GetGlyph(Uint32 CodePoint) const; + const Glyph& GetGlyph(Uint32 codePoint) const; //////////////////////////////////////////////////////////// /// Get the image containing the rendered characters (glyphs) diff --git a/include/SFML/Graphics/Image.hpp b/include/SFML/Graphics/Image.hpp index a52f0fda8..cc8f799c7 100644 --- a/include/SFML/Graphics/Image.hpp +++ b/include/SFML/Graphics/Image.hpp @@ -57,30 +57,30 @@ public : //////////////////////////////////////////////////////////// /// Copy constructor /// - /// \param Copy : instance to copy + /// \param copy : instance to copy /// //////////////////////////////////////////////////////////// - Image(const Image& Copy); + Image(const Image& copy); //////////////////////////////////////////////////////////// /// Construct an empty image /// - /// \param Width : Image width - /// \param Height : Image height - /// \param Col : Image color (black by default) + /// \param width : Image width + /// \param height : Image height + /// \param color : Image color (black by default) /// //////////////////////////////////////////////////////////// - Image(unsigned int Width, unsigned int Height, const Color& Col = Color(0, 0, 0, 255)); + Image(unsigned int width, unsigned int height, const Color& color = Color(0, 0, 0)); //////////////////////////////////////////////////////////// /// Construct the image from pixels in memory /// - /// \param Width : Image width - /// \param Height : Image height - /// \param Data : Pointer to the pixels in memory (assumed format is RGBA) + /// \param width : Image width + /// \param height : Image height + /// \param pixels : Pointer to the pixels in memory (assumed format is RGBA) /// //////////////////////////////////////////////////////////// - Image(unsigned int Width, unsigned int Height, const Uint8* Data); + Image(unsigned int width, unsigned int height, const Uint8* pixels); //////////////////////////////////////////////////////////// /// Destructor @@ -96,108 +96,108 @@ public : /// \return True if loading was successful /// //////////////////////////////////////////////////////////// - bool LoadFromFile(const std::string& Filename); + bool LoadFromFile(const std::string& filename); //////////////////////////////////////////////////////////// /// Load the image from a file in memory /// - /// \param Data : Pointer to the file data in memory - /// \param SizeInBytes : Size of the data to load, in bytes + /// \param data : Pointer to the file data in memory + /// \param sizeInBytes : Size of the data to load, in bytes /// /// \return True if loading was successful /// //////////////////////////////////////////////////////////// - bool LoadFromMemory(const char* Data, std::size_t SizeInBytes); + bool LoadFromMemory(const char* data, std::size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Load the image directly from an array of pixels /// - /// \param Width : Image width - /// \param Height : Image height - /// \param Data : Pointer to the pixels in memory (assumed format is RGBA) + /// \param width : Image width + /// \param height : Image height + /// \param pixels : Pointer to the pixels in memory (assumed format is RGBA) /// /// \return True if loading was successful /// //////////////////////////////////////////////////////////// - bool LoadFromPixels(unsigned int Width, unsigned int Height, const Uint8* Data); + bool LoadFromPixels(unsigned int width, unsigned int height, const Uint8* pixels); //////////////////////////////////////////////////////////// /// Save the content of the image to a file /// - /// \param Filename : Path of the file to save (overwritten if already exist) + /// \param filename : Path of the file to save (overwritten if already exist) /// /// \return True if saving was successful /// //////////////////////////////////////////////////////////// - bool SaveToFile(const std::string& Filename) const; + bool SaveToFile(const std::string& filename) const; //////////////////////////////////////////////////////////// /// Create an empty image /// - /// \param Width : Image width - /// \param Height : Image height - /// \param Col : Image color (black by default) + /// \param width : Image width + /// \param height : Image height + /// \param color : Image color (black by default) /// /// \return True if creation was successful /// //////////////////////////////////////////////////////////// - bool Create(unsigned int Width, unsigned int Height, Color Col = Color(0, 0, 0, 255)); + bool Create(unsigned int width, unsigned int height, const Color& color = Color(0, 0, 0)); //////////////////////////////////////////////////////////// /// Create transparency mask from a specified colorkey /// - /// \param ColorKey : Color to become transparent - /// \param Alpha : Alpha value to use for transparent pixels (0 by default) + /// \param transparentColor : Color to become transparent + /// \param alpha : Alpha value to assign to transparent pixels (0 by default) /// //////////////////////////////////////////////////////////// - void CreateMaskFromColor(Color ColorKey, Uint8 Alpha = 0); + void CreateMaskFromColor(const Color& transparentColor, Uint8 alpha = 0); //////////////////////////////////////////////////////////// /// Copy pixels from another image onto this one. /// This function does a slow pixel copy and should only /// be used at initialization time /// - /// \param Source : Source image to copy - /// \param DestX : X coordinate of the destination position - /// \param DestY : Y coordinate of the destination position - /// \param SourceRect : Sub-rectangle of the source image to copy (empty by default - entire image) - /// \param ApplyAlpha : Should the copy take in account the source transparency? (false by default) + /// \param source : Source image to copy + /// \param destX : X coordinate of the destination position + /// \param destY : Y coordinate of the destination position + /// \param sourceRect : Sub-rectangle of the source image to copy (empty by default - entire image) + /// \param applyAlpha : Should the copy take in account the source transparency? (false by default) /// //////////////////////////////////////////////////////////// - void Copy(const Image& Source, unsigned int DestX, unsigned int DestY, const IntRect& SourceRect = IntRect(0, 0, 0, 0), bool ApplyAlpha = false); + void Copy(const Image& source, unsigned int destX, unsigned int destY, const IntRect& sourceRect = IntRect(0, 0, 0, 0), bool applyAlpha = false); //////////////////////////////////////////////////////////// /// Create the image from the current contents of the /// given window /// - /// \param Window : Window to capture - /// \param SourceRect : Sub-rectangle of the screen to copy (empty by default - entire image) + /// \param window : Window to capture + /// \param sourceRect : Sub-rectangle of the screen to copy (empty by default - entire image) /// /// \return True if copy was successful /// //////////////////////////////////////////////////////////// - bool CopyScreen(RenderWindow& Window, const IntRect& SourceRect = IntRect(0, 0, 0, 0)); + bool CopyScreen(RenderWindow& window, const IntRect& sourceRect = IntRect(0, 0, 0, 0)); //////////////////////////////////////////////////////////// /// Change the color of a pixel /// - /// \param X : X coordinate of pixel in the image - /// \param Y : Y coordinate of pixel in the image - /// \param Col : New color for pixel (X, Y) + /// \param x : X coordinate of pixel in the image + /// \param y : Y coordinate of pixel in the image + /// \param color : New color for pixel (x, y) /// //////////////////////////////////////////////////////////// - void SetPixel(unsigned int X, unsigned int Y, const Color& Col); + void SetPixel(unsigned int x, unsigned int y, const Color& color); //////////////////////////////////////////////////////////// /// Get a pixel from the image /// - /// \param X : X coordinate of pixel in the image - /// \param Y : Y coordinate of pixel in the image + /// \param x : X coordinate of pixel in the image + /// \param y : Y coordinate of pixel in the image /// - /// \return Color of pixel (X, Y) + /// \return Color of pixel (x, y) /// //////////////////////////////////////////////////////////// - const Color& GetPixel(unsigned int X, unsigned int Y) const; + const Color& GetPixel(unsigned int x, unsigned int y) const; //////////////////////////////////////////////////////////// /// Get a read-only pointer to the array of pixels (RGBA 8 bits integers components) @@ -219,10 +219,10 @@ public : /// Enable or disable image smooth filter. /// This parameter is enabled by default /// - /// \param Smooth : True to enable smoothing filter, false to disable it + /// \param smooth : True to enable smoothing filter, false to disable it /// //////////////////////////////////////////////////////////// - void SetSmooth(bool Smooth); + void SetSmooth(bool smooth); //////////////////////////////////////////////////////////// /// Return the width of the image @@ -252,33 +252,33 @@ public : /// Convert a subrect expressed in pixels, into float /// texture coordinates /// - /// \param Rect : Sub-rectangle of image to convert - /// \param Adjust : Pass true to apply the half-texel adjustment + /// \param rectangle : Sub-rectangle of image to convert + /// \param adjust : Pass true to apply the half-texel adjustment (true by default) /// /// \return Texture coordinates corresponding to the sub-rectangle /// //////////////////////////////////////////////////////////// - FloatRect GetTexCoords(const IntRect& Rect, bool Adjust = true) const; + FloatRect GetTexCoords(const IntRect& rectangle, bool adjust = true) const; //////////////////////////////////////////////////////////// /// Get a valid texture size according to hardware support /// - /// \param Size : Size to convert + /// \param Size : size to convert /// /// \return Valid nearest size (greater than or equal to specified size) /// //////////////////////////////////////////////////////////// - static unsigned int GetValidTextureSize(unsigned int Size); + static unsigned int GetValidTextureSize(unsigned int size); //////////////////////////////////////////////////////////// /// Assignment operator /// - /// \param Other : instance to assign + /// \param other : instance to assign /// /// \return Reference to the image /// //////////////////////////////////////////////////////////// - Image& operator =(const Image& Other); + Image& operator =(const Image& other); private : @@ -309,10 +309,10 @@ private : /// its content. /// For internal use only (see RenderImage class). /// - /// \param Source : RenderImage that will update the image + /// \param source : RenderImage that will update the image /// //////////////////////////////////////////////////////////// - void ExternalUpdate(RenderImage& Source); + void ExternalUpdate(RenderImage& source); //////////////////////////////////////////////////////////// /// Reset the image attributes diff --git a/include/SFML/Graphics/Matrix3.hpp b/include/SFML/Graphics/Matrix3.hpp index cfc4e6d10..25ad90b44 100644 --- a/include/SFML/Graphics/Matrix3.hpp +++ b/include/SFML/Graphics/Matrix3.hpp @@ -61,33 +61,33 @@ public : //////////////////////////////////////////////////////////// /// Build a matrix from a set of transformations /// - /// \param Center : Origin for the transformations - /// \param Translation : Translation offset - /// \param Rotation : Rotation angle in degrees - /// \param Scale : Scaling factors + /// \param origin : Origin for the transformations + /// \param translation : Translation offset + /// \param rotation : Rotation angle in degrees + /// \param scale : Scaling factors /// //////////////////////////////////////////////////////////// - void SetFromTransformations(const Vector2f& Center, const Vector2f& Translation, float Rotation, const Vector2f& Scale); + void SetFromTransformations(const Vector2f& origin, const Vector2f& translation, float rotation, const Vector2f& scale); //////////////////////////////////////////////////////////// /// Build a matrix from a projection /// - /// \param Center : Center of the view - /// \param Size : Size of the view - /// \param Rotation : Angle of rotation of the view rectangle, in degrees + /// \param center : Center of the view + /// \param size : Size of the view + /// \param rotation : Angle of rotation of the view rectangle, in degrees /// //////////////////////////////////////////////////////////// - void SetFromProjection(const Vector2f& Center, const Vector2f& Size, float Rotation); + void SetFromProjection(const Vector2f& center, const Vector2f& size, float rotation); //////////////////////////////////////////////////////////// /// Transform a point by the matrix /// - /// \param Point : Point to transform + /// \param point : Point to transform /// /// \return Transformed point /// //////////////////////////////////////////////////////////// - Vector2f Transform(const Vector2f& Point) const; + Vector2f Transform(const Vector2f& point) const; //////////////////////////////////////////////////////////// /// Return the inverse of the matrix @@ -109,34 +109,34 @@ public : //////////////////////////////////////////////////////////// /// Operator () overloads to access the matrix elements /// - /// \param Row : Element row (0 based) - /// \param Col : Element column (0 based) + /// \param row : Element row (0 based) + /// \param column : Element column (0 based) /// /// \return Matrix element (Row, Col) /// //////////////////////////////////////////////////////////// - float operator ()(unsigned int Row, unsigned int Col) const; - float& operator ()(unsigned int Row, unsigned int Col); + float operator ()(unsigned int row, unsigned int column) const; + float& operator ()(unsigned int row, unsigned int column); //////////////////////////////////////////////////////////// /// Operator * overload to multiply two matrices /// - /// \param Mat : Matrix to multiply + /// \param right : Matrix to multiply /// - /// \return this * Mat + /// \return this * right /// //////////////////////////////////////////////////////////// - Matrix3 operator *(const Matrix3& Mat) const; + Matrix3 operator *(const Matrix3& right) const; //////////////////////////////////////////////////////////// /// Operator *= overload to multiply-assign two matrices /// - /// \param Mat : Matrix to multiply + /// \param right : Matrix to multiply /// - /// \return this * Mat + /// \return this * right /// //////////////////////////////////////////////////////////// - Matrix3& operator *=(const Matrix3& Mat); + Matrix3& operator *=(const Matrix3& right); //////////////////////////////////////////////////////////// // Static member data diff --git a/include/SFML/Graphics/Matrix3.inl b/include/SFML/Graphics/Matrix3.inl index 5e1849626..9be900621 100644 --- a/include/SFML/Graphics/Matrix3.inl +++ b/include/SFML/Graphics/Matrix3.inl @@ -52,22 +52,22 @@ inline Matrix3::Matrix3(float a00, float a01, float a02, //////////////////////////////////////////////////////////// /// Build a matrix from a set of transformations //////////////////////////////////////////////////////////// -inline void Matrix3::SetFromTransformations(const Vector2f& Center, const Vector2f& Translation, float Rotation, const Vector2f& Scale) +inline void Matrix3::SetFromTransformations(const Vector2f& origin, const Vector2f& translation, float rotation, const Vector2f& scale) { // Combine the transformations - float Angle = Rotation * 3.141592654f / 180.f; - float Cos = static_cast(cos(Angle)); - float Sin = static_cast(sin(Angle)); - float SxCos = Scale.x * Cos; - float SyCos = Scale.y * Cos; - float SxSin = Scale.x * Sin; - float SySin = Scale.y * Sin; - float Tx = -Center.x * SxCos - Center.y * SySin + Translation.x; - float Ty = Center.x * SxSin - Center.y * SyCos + Translation.y; + float angle = rotation * 3.141592654f / 180.f; + float cosine = static_cast(cos(angle)); + float sine = static_cast(sin(angle)); + float sxCos = scale.x * cosine; + float syCos = scale.y * cosine; + float sxSin = scale.x * sine; + float sySin = scale.y * sine; + float tx = -origin.x * sxCos - origin.y * sySin + translation.x; + float ty = origin.x * sxSin - origin.y * syCos + translation.y; // Rebuild the matrix - myData[0] = SxCos; myData[4] = SySin; myData[8] = 0.f; myData[12] = Tx; - myData[1] = -SxSin; myData[5] = SyCos; myData[9] = 0.f; myData[13] = Ty; + myData[0] = sxCos; myData[4] = sySin; myData[8] = 0.f; myData[12] = tx; + myData[1] = -sxSin; myData[5] = syCos; myData[9] = 0.f; myData[13] = ty; myData[2] = 0.f; myData[6] = 0.f; myData[10] = 1.f; myData[14] = 0.f; myData[3] = 0.f; myData[7] = 0.f; myData[11] = 0.f; myData[15] = 1.f; } @@ -76,36 +76,36 @@ inline void Matrix3::SetFromTransformations(const Vector2f& Center, const Vector //////////////////////////////////////////////////////////// /// Build a matrix from a projection //////////////////////////////////////////////////////////// -inline void Matrix3::SetFromProjection(const Vector2f& Center, const Vector2f& Size, float Rotation) +inline void Matrix3::SetFromProjection(const Vector2f& center, const Vector2f& size, float rotation) { // Rotation components - float Angle = Rotation * 3.141592654f / 180.f; - float Cos = static_cast(cos(Angle)); - float Sin = static_cast(sin(Angle)); - float Tx = -Center.x * Cos - Center.y * Sin + Center.x; - float Ty = Center.x * Sin - Center.y * Cos + Center.y; + float angle = rotation * 3.141592654f / 180.f; + float cosine = static_cast(cos(angle)); + float sine = static_cast(sin(angle)); + float tx = -center.x * cosine - center.y * sine + center.x; + float ty = center.x * sine - center.y * cosine + center.y; // Projection components - float A = 2.f / Size.x; - float B = -2.f / Size.y; - float C = -A * Center.x; - float D = -B * Center.y; + float a = 2.f / size.x; + float b = -2.f / size.y; + float c = -a * center.x; + float d = -b * center.y; // Rebuild the projection matrix - myData[0] = A * Cos; myData[4] = A * Sin; myData[8] = 0.f; myData[12] = A * Tx + C; - myData[1] = -B * Sin; myData[5] = B * Cos; myData[9] = 0.f; myData[13] = B * Ty + D; - myData[2] = 0.f; myData[6] = 0.f; myData[10] = 1.f; myData[14] = 0.f; - myData[3] = 0.f; myData[7] = 0.f; myData[11] = 0.f; myData[15] = 1.f; + myData[0] = a * cosine; myData[4] = a * sine; myData[8] = 0.f; myData[12] = a * tx + c; + myData[1] = -b * sine; myData[5] = b * cosine; myData[9] = 0.f; myData[13] = b * ty + d; + myData[2] = 0.f; myData[6] = 0.f; myData[10] = 1.f; myData[14] = 0.f; + myData[3] = 0.f; myData[7] = 0.f; myData[11] = 0.f; myData[15] = 1.f; } //////////////////////////////////////////////////////////// /// Transform a point by the matrix //////////////////////////////////////////////////////////// -inline Vector2f Matrix3::Transform(const Vector2f& Point) const +inline Vector2f Matrix3::Transform(const Vector2f& point) const { - return Vector2f(myData[0] * Point.x + myData[4] * Point.y + myData[12], - myData[1] * Point.x + myData[5] * Point.y + myData[13]); + return Vector2f(myData[0] * point.x + myData[4] * point.y + myData[12], + myData[1] * point.x + myData[5] * point.y + myData[13]); } @@ -115,22 +115,22 @@ inline Vector2f Matrix3::Transform(const Vector2f& Point) const inline Matrix3 Matrix3::GetInverse() const { // Compute the determinant - float Det = myData[0] * (myData[15] * myData[5] - myData[7] * myData[13]) - + float det = myData[0] * (myData[15] * myData[5] - myData[7] * myData[13]) - myData[1] * (myData[15] * myData[4] - myData[7] * myData[12]) + myData[3] * (myData[13] * myData[4] - myData[5] * myData[12]); // Compute the inverse if determinant is not zero - if ((Det < -1E-7f) || (Det > 1E-7f)) + if ((det < -1E-7f) || (det > 1E-7f)) { - return Matrix3( (myData[15] * myData[5] - myData[7] * myData[13]) / Det, - -(myData[15] * myData[4] - myData[7] * myData[12]) / Det, - (myData[13] * myData[4] - myData[5] * myData[12]) / Det, - -(myData[15] * myData[1] - myData[3] * myData[13]) / Det, - (myData[15] * myData[0] - myData[3] * myData[12]) / Det, - -(myData[13] * myData[0] - myData[1] * myData[12]) / Det, - (myData[7] * myData[1] - myData[3] * myData[5]) / Det, - -(myData[7] * myData[0] - myData[3] * myData[4]) / Det, - (myData[5] * myData[0] - myData[1] * myData[4]) / Det); + return Matrix3( (myData[15] * myData[5] - myData[7] * myData[13]) / det, + -(myData[15] * myData[4] - myData[7] * myData[12]) / det, + (myData[13] * myData[4] - myData[5] * myData[12]) / det, + -(myData[15] * myData[1] - myData[3] * myData[13]) / det, + (myData[15] * myData[0] - myData[3] * myData[12]) / det, + -(myData[13] * myData[0] - myData[1] * myData[12]) / det, + (myData[7] * myData[1] - myData[3] * myData[5]) / det, + -(myData[7] * myData[0] - myData[3] * myData[4]) / det, + (myData[5] * myData[0] - myData[1] * myData[4]) / det); } else { @@ -152,9 +152,9 @@ inline const float* Matrix3::Get4x4Elements() const //////////////////////////////////////////////////////////// /// Operator () overloads to access the matrix elements //////////////////////////////////////////////////////////// -inline float Matrix3::operator ()(unsigned int Row, unsigned int Col) const +inline float Matrix3::operator ()(unsigned int row, unsigned int column) const { - switch (Row + Col * 3) + switch (row + column * 3) { case 0 : return myData[0]; case 1 : return myData[1]; @@ -169,9 +169,9 @@ inline float Matrix3::operator ()(unsigned int Row, unsigned int Col) const default : return myData[0]; } } -inline float& Matrix3::operator ()(unsigned int Row, unsigned int Col) +inline float& Matrix3::operator ()(unsigned int row, unsigned int column) { - switch (Row + Col * 3) + switch (row + column * 3) { case 0 : return myData[0]; case 1 : return myData[1]; @@ -191,24 +191,24 @@ inline float& Matrix3::operator ()(unsigned int Row, unsigned int Col) //////////////////////////////////////////////////////////// /// Operator * overload to multiply two matrices //////////////////////////////////////////////////////////// -inline Matrix3 Matrix3::operator *(const Matrix3& Mat) const +inline Matrix3 Matrix3::operator *(const Matrix3& right) const { - return Matrix3(myData[0] * Mat.myData[0] + myData[4] * Mat.myData[1] + myData[12] * Mat.myData[3], - myData[0] * Mat.myData[4] + myData[4] * Mat.myData[5] + myData[12] * Mat.myData[7], - myData[0] * Mat.myData[12] + myData[4] * Mat.myData[13] + myData[12] * Mat.myData[15], - myData[1] * Mat.myData[0] + myData[5] * Mat.myData[1] + myData[13] * Mat.myData[3], - myData[1] * Mat.myData[4] + myData[5] * Mat.myData[5] + myData[13] * Mat.myData[7], - myData[1] * Mat.myData[12] + myData[5] * Mat.myData[13] + myData[13] * Mat.myData[15], - myData[3] * Mat.myData[0] + myData[7] * Mat.myData[1] + myData[15] * Mat.myData[3], - myData[3] * Mat.myData[4] + myData[7] * Mat.myData[5] + myData[15] * Mat.myData[7], - myData[3] * Mat.myData[12] + myData[7] * Mat.myData[13] + myData[15] * Mat.myData[15]); + return Matrix3(myData[0] * right.myData[0] + myData[4] * right.myData[1] + myData[12] * right.myData[3], + myData[0] * right.myData[4] + myData[4] * right.myData[5] + myData[12] * right.myData[7], + myData[0] * right.myData[12] + myData[4] * right.myData[13] + myData[12] * right.myData[15], + myData[1] * right.myData[0] + myData[5] * right.myData[1] + myData[13] * right.myData[3], + myData[1] * right.myData[4] + myData[5] * right.myData[5] + myData[13] * right.myData[7], + myData[1] * right.myData[12] + myData[5] * right.myData[13] + myData[13] * right.myData[15], + myData[3] * right.myData[0] + myData[7] * right.myData[1] + myData[15] * right.myData[3], + myData[3] * right.myData[4] + myData[7] * right.myData[5] + myData[15] * right.myData[7], + myData[3] * right.myData[12] + myData[7] * right.myData[13] + myData[15] * right.myData[15]); } //////////////////////////////////////////////////////////// /// Operator *= overload to multiply-assign two matrices //////////////////////////////////////////////////////////// -inline Matrix3& Matrix3::operator *=(const Matrix3& Mat) +inline Matrix3& Matrix3::operator *=(const Matrix3& right) { - return *this = *this * Mat; + return *this = *this * right; } diff --git a/include/SFML/Graphics/PostFX.hpp b/include/SFML/Graphics/PostFX.hpp index bd5a00230..349f96561 100644 --- a/include/SFML/Graphics/PostFX.hpp +++ b/include/SFML/Graphics/PostFX.hpp @@ -53,10 +53,10 @@ public : //////////////////////////////////////////////////////////// /// Copy constructor /// - /// \param Copy : Instance to copy + /// \param copy : Instance to copy /// //////////////////////////////////////////////////////////// - PostFX(const PostFX& Copy); + PostFX(const PostFX& copy); //////////////////////////////////////////////////////////// /// Destructor @@ -67,77 +67,77 @@ public : //////////////////////////////////////////////////////////// /// Load the effect from a file /// - /// \param Filename : Path of the effect file to load + /// \param filename : Path of the effect file to load /// /// \return True on success /// //////////////////////////////////////////////////////////// - bool LoadFromFile(const std::string& Filename); + bool LoadFromFile(const std::string& filename); //////////////////////////////////////////////////////////// /// Load the effect from a text in memory /// - /// \param Effect : String containing the effect code + /// \param effect : String containing the code of the effect /// /// \return True on success /// //////////////////////////////////////////////////////////// - bool LoadFromMemory(const std::string& Effect); + bool LoadFromMemory(const std::string& effect); //////////////////////////////////////////////////////////// /// Change a parameter of the effect (1 float) /// - /// \param Name : Parameter name in the effect - /// \param X : Value to assign + /// \param name : Name of the parameter in the effect + /// \param x : Value to assign /// //////////////////////////////////////////////////////////// - void SetParameter(const std::string& Name, float X); + void SetParameter(const std::string& name, float x); //////////////////////////////////////////////////////////// /// Change a parameter of the effect (2 floats) /// - /// \param Name : Parameter name in the effect - /// \param X, Y : Values to assign + /// \param name : Name of the parameter in the effect + /// \param x, y : Values to assign /// //////////////////////////////////////////////////////////// - void SetParameter(const std::string& Name, float X, float Y); + void SetParameter(const std::string& Name, float x, float y); //////////////////////////////////////////////////////////// /// Change a parameter of the effect (3 floats) /// - /// \param Name : Parameter name in the effect - /// \param X, Y, Z : Values to assign + /// \param name : Name of the parameter in the effect + /// \param x, y, z : Values to assign /// //////////////////////////////////////////////////////////// - void SetParameter(const std::string& Name, float X, float Y, float Z); + void SetParameter(const std::string& Name, float x, float y, float z); //////////////////////////////////////////////////////////// /// Change a parameter of the effect (4 floats) /// - /// \param Name : Parameter name in the effect - /// \param X, Y, Z, W : Values to assign + /// \param name : Name of the parameter in the effect + /// \param x, y, z, w : Values to assign /// //////////////////////////////////////////////////////////// - void SetParameter(const std::string& Name, float X, float Y, float Z, float W); + void SetParameter(const std::string& Name, float x, float y, float Z, float w); //////////////////////////////////////////////////////////// /// Set a texture parameter /// - /// \param Name : Texture name in the effect - /// \param Texture : Image to set (pass NULL to use content of current framebuffer) + /// \param name : Name of the texture in the effect + /// \param texture : Image to set (pass NULL to use content of current framebuffer) /// //////////////////////////////////////////////////////////// - void SetTexture(const std::string& Name, const Image* Texture); + void SetTexture(const std::string& name, const Image* texture); //////////////////////////////////////////////////////////// /// Assignment operator /// - /// \param Other : Instance to assign + /// \param other : Instance to assign /// /// \return Reference to the post-effect /// //////////////////////////////////////////////////////////// - PostFX& operator =(const PostFX& Other); + PostFX& operator =(const PostFX& other); //////////////////////////////////////////////////////////// /// Tell whether or not the system supports post-effects @@ -153,7 +153,7 @@ protected : /// /see Drawable::Render /// //////////////////////////////////////////////////////////// - virtual void Render(RenderTarget& Target) const; + virtual void Render(RenderTarget& target) const; private : @@ -161,12 +161,12 @@ private : /// Preprocess a SFML effect file /// to convert it to a valid GLSL fragment shader /// - /// \param File : Stream containing the code to process + /// \param file : Stream containing the code to process /// /// \return Valid fragment shader source code /// //////////////////////////////////////////////////////////// - static std::string PreprocessEffect(std::istream& File); + static std::string PreprocessEffect(std::istream& file); //////////////////////////////////////////////////////////// /// Create the program and attach the shaders diff --git a/include/SFML/Graphics/Rect.hpp b/include/SFML/Graphics/Rect.hpp index e956d6acb..8985fa1e1 100644 --- a/include/SFML/Graphics/Rect.hpp +++ b/include/SFML/Graphics/Rect.hpp @@ -52,13 +52,13 @@ public : //////////////////////////////////////////////////////////// /// Construct the rectangle from its coordinates /// - /// \param LeftCoord : Left coordinate of the rectangle - /// \param TopCoord : Top coordinate of the rectangle - /// \param RightCoord : Right coordinate of the rectangle - /// \param BottomCoord : Bottom coordinate of the rectangle + /// \param left : Left coordinate of the rectangle + /// \param top : Top coordinate of the rectangle + /// \param right : Right coordinate of the rectangle + /// \param bottom : Bottom coordinate of the rectangle /// //////////////////////////////////////////////////////////// - Rect(T LeftCoord, T TopCoord, T RightCoord, T BottomCoord); + Rect(T left, T top, T right, T bottom); //////////////////////////////////////////////////////////// /// Get the size of the rectangle @@ -79,62 +79,62 @@ public : //////////////////////////////////////////////////////////// /// Move the whole rectangle by the given offset /// - /// \param OffsetX : Horizontal offset - /// \param OffsetY : Vertical offset + /// \param offsetX : Horizontal offset + /// \param offsetY : Vertical offset /// //////////////////////////////////////////////////////////// - void Offset(T OffsetX, T OffsetY); + void Offset(T offsetX, T offsetY); //////////////////////////////////////////////////////////// /// Move the whole rectangle by the given offset /// - /// \param Off : Offset to apply to the current position + /// \param offset : Offset to apply to the current position /// //////////////////////////////////////////////////////////// - void Offset(const Vector2& Off); + void Offset(const Vector2& offset); //////////////////////////////////////////////////////////// /// Check if a point is inside the rectangle's area /// - /// \param X : X coordinate of the point to test - /// \param Y : Y coordinate of the point to test + /// \param x : X coordinate of the point to test + /// \param y : Y coordinate of the point to test /// /// \return True if the point is inside /// //////////////////////////////////////////////////////////// - bool Contains(T X, T Y) const; + bool Contains(T x, T y) const; //////////////////////////////////////////////////////////// /// Check if a point is inside the rectangle's area /// - /// \param Point : Point to test + /// \param point : Point to test /// /// \return True if the point is inside /// //////////////////////////////////////////////////////////// - bool Contains(const Vector2& Point) const; + bool Contains(const Vector2& point) const; //////////////////////////////////////////////////////////// /// Check intersection between two rectangles /// - /// \param Rectangle : Rectangle to test + /// \param rectangle : Rectangle to test /// /// \return True if rectangles overlap /// //////////////////////////////////////////////////////////// - bool Intersects(const Rect& Rectangle) const; + bool Intersects(const Rect& rectangle) const; //////////////////////////////////////////////////////////// /// Check intersection between two rectangles and return the /// resulting rectangle /// - /// \param Rectangle : Rectangle to test - /// \param OverlappingRect : Rectangle to be filled with the overlapping rect + /// \param rectangle : Rectangle to test + /// \param intersection : Rectangle to be filled with the intersection of both rectangles /// /// \return True if rectangles overlap /// //////////////////////////////////////////////////////////// - bool Intersects(const Rect& Rectangle, Rect& OverlappingRect) const; + bool Intersects(const Rect& rectangle, Rect& intersection) const; //////////////////////////////////////////////////////////// // Member data diff --git a/include/SFML/Graphics/Rect.inl b/include/SFML/Graphics/Rect.inl index e22ed5712..78c2f2606 100644 --- a/include/SFML/Graphics/Rect.inl +++ b/include/SFML/Graphics/Rect.inl @@ -41,11 +41,11 @@ Bottom(0) /// Construct the color from its coordinates //////////////////////////////////////////////////////////// template -Rect::Rect(T LeftCoord, T TopCoord, T RightCoord, T BottomCoord) : -Left (LeftCoord), -Top (TopCoord), -Right (RightCoord), -Bottom(BottomCoord) +Rect::Rect(T left, T top, T right, T bottom) : +Left (left), +Top (top), +Right (right), +Bottom(bottom) { } @@ -75,12 +75,12 @@ Vector2 Rect::GetCenter() const /// Move the whole rectangle by the given offset //////////////////////////////////////////////////////////// template -void Rect::Offset(T OffsetX, T OffsetY) +void Rect::Offset(T offsetX, T offsetY) { - Left += OffsetX; - Right += OffsetX; - Top += OffsetY; - Bottom += OffsetY; + Left += offsetX; + Right += offsetX; + Top += offsetY; + Bottom += offsetY; } @@ -88,9 +88,9 @@ void Rect::Offset(T OffsetX, T OffsetY) /// Move the whole rectangle by the given offset //////////////////////////////////////////////////////////// template -void Rect::Offset(const Vector2& Off) +void Rect::Offset(const Vector2& offset) { - Offset(Off.x, Off.y); + Offset(offset.x, offset.y); } @@ -98,9 +98,9 @@ void Rect::Offset(const Vector2& Off) /// Check if a point is inside the rectangle's area //////////////////////////////////////////////////////////// template -bool Rect::Contains(T X, T Y) const +bool Rect::Contains(T x, T y) const { - return (X >= Left) && (X <= Right) && (Y >= Top) && (Y <= Bottom); + return (x >= Left) && (x <= Right) && (y >= Top) && (y <= Bottom); } @@ -108,9 +108,9 @@ bool Rect::Contains(T X, T Y) const /// Check if a point is inside the rectangle's area //////////////////////////////////////////////////////////// template -bool Rect::Contains(const Vector2& Point) const +bool Rect::Contains(const Vector2& point) const { - return Contains(Point.x, Point.y); + return Contains(point.x, point.y); } @@ -118,16 +118,16 @@ bool Rect::Contains(const Vector2& Point) const /// Check intersection between two rectangles //////////////////////////////////////////////////////////// template -bool Rect::Intersects(const Rect& Rectangle) const +bool Rect::Intersects(const Rect& rectangle) const { // Compute overlapping rect - Rect Overlapping(std::max(Left, Rectangle.Left), - std::max(Top, Rectangle.Top), - std::min(Right, Rectangle.Right), - std::min(Bottom, Rectangle.Bottom)); + Rect overlapping(std::max(Left, rectangle.Left), + std::max(Top, rectangle.Top), + std::min(Right, rectangle.Right), + std::min(Bottom, rectangle.Bottom)); // If overlapping rect is valid, then there is intersection - return (Overlapping.Left < Overlapping.Right) && (Overlapping.Top < Overlapping.Bottom); + return (overlapping.Left < overlapping.Right) && (overlapping.Top < overlapping.Bottom); } @@ -136,23 +136,23 @@ bool Rect::Intersects(const Rect& Rectangle) const /// resulting rectangle //////////////////////////////////////////////////////////// template -bool Rect::Intersects(const Rect& Rectangle, Rect& OverlappingRect) const +bool Rect::Intersects(const Rect& rectangle, Rect& intersection) const { // Compute overlapping rect - Rect Overlapping(std::max(Left, Rectangle.Left), - std::max(Top, Rectangle.Top), - std::min(Right, Rectangle.Right), - std::min(Bottom, Rectangle.Bottom)); + Rect overlapping(std::max(Left, rectangle.Left), + std::max(Top, rectangle.Top), + std::min(Right, rectangle.Right), + std::min(Bottom, rectangle.Bottom)); // If overlapping rect is valid, then there is intersection - if ((Overlapping.Left < Overlapping.Right) && (Overlapping.Top < Overlapping.Bottom)) + if ((overlapping.Left < overlapping.Right) && (overlapping.Top < overlapping.Bottom)) { - OverlappingRect = Overlapping; + intersection = overlapping; return true; } else { - OverlappingRect = Rect(0, 0, 0, 0); + intersection = Rect(0, 0, 0, 0); return false; } } diff --git a/include/SFML/Graphics/RenderImage.hpp b/include/SFML/Graphics/RenderImage.hpp index b9477f6a5..1c8b3b733 100644 --- a/include/SFML/Graphics/RenderImage.hpp +++ b/include/SFML/Graphics/RenderImage.hpp @@ -63,25 +63,25 @@ public : //////////////////////////////////////////////////////////// /// Create the render image from its dimensions /// - /// \param Width : Width of the render image - /// \param Height : Height of the render image - /// \param DepthBuffer : Do you want a depth buffer attached? (false by default) + /// \param width : Width of the render image + /// \param height : Height of the render image + /// \param depthBuffer : Do you want a depth buffer attached? (false by default) /// /// \return True if creation has been successful /// //////////////////////////////////////////////////////////// - bool Create(unsigned int Width, unsigned int Height, bool DepthBuffer = false); + bool Create(unsigned int width, unsigned int height, bool depthBuffer = false); //////////////////////////////////////////////////////////// /// Activate of deactivate the render-image as the current target /// for rendering /// - /// \param Active : True to activate, false to deactivate (true by default) + /// \param active : True to activate, false to deactivate (true by default) /// /// \return True if operation was successful, false otherwise /// //////////////////////////////////////////////////////////// - bool SetActive(bool Active = true); + bool SetActive(bool active = true); //////////////////////////////////////////////////////////// /// Get the width of the rendering region of the image @@ -123,19 +123,19 @@ private : /// /see RenderTarget::Activate /// //////////////////////////////////////////////////////////// - virtual bool Activate(bool Active); + virtual bool Activate(bool active); //////////////////////////////////////////////////////////// /// Update the pixels of the target image. /// This function is called automatically by the image when it /// needs to update its pixels, and is only meant for internal use. /// - /// \param Target : Target image to update + /// \param target : Target image to update /// /// \return True if the new pixels are flipped vertically /// //////////////////////////////////////////////////////////// - bool UpdateImage(Image& Target); + bool UpdateImage(Image& target); //////////////////////////////////////////////////////////// // Member data diff --git a/include/SFML/Graphics/RenderTarget.hpp b/include/SFML/Graphics/RenderTarget.hpp index ea303d9c1..4c7c16fed 100644 --- a/include/SFML/Graphics/RenderTarget.hpp +++ b/include/SFML/Graphics/RenderTarget.hpp @@ -53,18 +53,18 @@ public : //////////////////////////////////////////////////////////// /// Clear the entire target with a single color /// - /// \param FillColor : Color to use to clear the render target + /// \param color : Color to use to clear the render target /// //////////////////////////////////////////////////////////// - void Clear(const Color& FillColor = Color(0, 0, 0)); + void Clear(const Color& color = Color(0, 0, 0)); //////////////////////////////////////////////////////////// /// Draw something into the target /// - /// \param Object : Object to draw + /// \param object : Object to draw /// //////////////////////////////////////////////////////////// - virtual void Draw(const Drawable& Object); + virtual void Draw(const Drawable& object); //////////////////////////////////////////////////////////// /// Get the width of the rendering region of the target @@ -85,10 +85,10 @@ public : //////////////////////////////////////////////////////////// /// Change the current active view. /// - /// \param NewView : New view to use (pass GetDefaultView() to set the default view) + /// \param view : New view to use (pass GetDefaultView() to set the default view) /// //////////////////////////////////////////////////////////// - void SetView(const View& NewView); + void SetView(const View& view); //////////////////////////////////////////////////////////// /// Get the current view @@ -114,10 +114,10 @@ public : /// SFML to do internal optimizations and improve performances. /// This parameter is false by default /// - /// \param Preserve : True to preserve OpenGL states, false to let SFML optimize + /// \param preserve : True to preserve OpenGL states, false to let SFML optimize /// //////////////////////////////////////////////////////////// - void PreserveOpenGLStates(bool Preserve); + void PreserveOpenGLStates(bool preserve); protected : @@ -138,12 +138,12 @@ private : //////////////////////////////////////////////////////////// /// Activate the target for rendering /// - /// \param Active : True to activate rendering, false to deactivate + /// \param active : True to activate rendering, false to deactivate /// /// \return True if activation succeeded /// //////////////////////////////////////////////////////////// - virtual bool Activate(bool Active) = 0; + virtual bool Activate(bool active) = 0; //////////////////////////////////////////////////////////// /// Set the OpenGL render states needed for the SFML rendering diff --git a/include/SFML/Graphics/RenderWindow.hpp b/include/SFML/Graphics/RenderWindow.hpp index bd66376b1..394720534 100644 --- a/include/SFML/Graphics/RenderWindow.hpp +++ b/include/SFML/Graphics/RenderWindow.hpp @@ -55,22 +55,22 @@ public : //////////////////////////////////////////////////////////// /// Construct the window /// - /// \param Mode : Video mode to use - /// \param Title : Title of the window - /// \param WindowStyle : Window style (Resize | Close by default) - /// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values) + /// \param mode : Video mode to use + /// \param title : Title of the window + /// \param style : Window style (Resize | Close by default) + /// \param settings : Additional settings for the underlying OpenGL context (see default constructor for default values) /// //////////////////////////////////////////////////////////// - RenderWindow(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const ContextSettings& Settings = ContextSettings()); + RenderWindow(VideoMode mode, const std::string& title, unsigned long style = Style::Resize | Style::Close, const ContextSettings& settings = ContextSettings()); //////////////////////////////////////////////////////////// /// Construct the window from an existing control /// - /// \param Handle : Platform-specific handle of the control - /// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values) + /// \param handle : Platform-specific handle of the control + /// \param settings : Additional settings for the underlying OpenGL context (see default constructor for default values) /// //////////////////////////////////////////////////////////// - RenderWindow(WindowHandle Handle, const ContextSettings& Settings = ContextSettings()); + RenderWindow(WindowHandle handle, const ContextSettings& settings = ContextSettings()); //////////////////////////////////////////////////////////// /// Destructor @@ -106,26 +106,26 @@ public : /// Convert a point in window coordinates into view coordinates /// This version uses the current view of the window /// - /// \param WindowX : X coordinate of the point to convert, relative to the window - /// \param WindowY : Y coordinate of the point to convert, relative to the window + /// \param x : X coordinate of the point to convert, relative to the window + /// \param y : Y coordinate of the point to convert, relative to the window /// /// \return Converted point /// //////////////////////////////////////////////////////////// - sf::Vector2f ConvertCoords(unsigned int WindowX, unsigned int WindowY) const; + sf::Vector2f ConvertCoords(unsigned int x, unsigned int y) const; //////////////////////////////////////////////////////////// /// Convert a point in window coordinates into view coordinates /// This version uses the given view /// - /// \param WindowX : X coordinate of the point to convert, relative to the window - /// \param WindowY : Y coordinate of the point to convert, relative to the window - /// \param TargetView : Target view to convert the point to + /// \param x : X coordinate of the point to convert, relative to the window + /// \param y : Y coordinate of the point to convert, relative to the window + /// \param view : Target view to convert the point to /// /// \return Converted point /// //////////////////////////////////////////////////////////// - sf::Vector2f ConvertCoords(unsigned int WindowX, unsigned int WindowY, const View& TargetView) const; + sf::Vector2f ConvertCoords(unsigned int x, unsigned int y, const View& view) const; private : @@ -139,7 +139,7 @@ private : /// /see RenderTarget::Activate /// //////////////////////////////////////////////////////////// - virtual bool Activate(bool Active); + virtual bool Activate(bool active); }; } // namespace sf diff --git a/include/SFML/Graphics/Shape.hpp b/include/SFML/Graphics/Shape.hpp index 37fb3c4f6..ff31c86ac 100644 --- a/include/SFML/Graphics/Shape.hpp +++ b/include/SFML/Graphics/Shape.hpp @@ -40,7 +40,7 @@ namespace sf /// helper functions to draw simple shapes like /// lines, rectangles, circles, etc. //////////////////////////////////////////////////////////// -class SFML_API Shape : public sf::Drawable +class SFML_API Shape : public Drawable { public : @@ -53,22 +53,22 @@ public : //////////////////////////////////////////////////////////// /// Add a point to the shape /// - /// \param X, Y : Position of the point - /// \param Col : Color of the point (white by default) - /// \param OutlineCol : Outline color of the point (black by default) + /// \param x, y : Position of the point + /// \param color : Color of the point (white by default) + /// \param outlineColor : Outline color of the point (black by default) /// //////////////////////////////////////////////////////////// - void AddPoint(float X, float Y, const Color& Col = Color(255, 255, 255), const Color& OutlineCol = Color(0, 0, 0)); + void AddPoint(float x, float y, const Color& color = Color(255, 255, 255), const Color& outlineColor = Color(0, 0, 0)); //////////////////////////////////////////////////////////// /// Add a point to the shape /// - /// \param Position : Position of the point - /// \param Col : Color of the point (white by default) - /// \param OutlineCol : Outline color of the point (black by default) + /// \param position : Position of the point + /// \param color : Color of the point (white by default) + /// \param outlineColor : Outline color of the point (black by default) /// //////////////////////////////////////////////////////////// - void AddPoint(const Vector2f& Position, const Color& Col = Color(255, 255, 255), const Color& OutlineCol = Color(0, 0, 0)); + void AddPoint(const Vector2f& position, const Color& color = Color(255, 255, 255), const Color& outlineColor = Color(0, 0, 0)); //////////////////////////////////////////////////////////// /// Get the number of points composing the shape @@ -82,94 +82,94 @@ public : /// Enable or disable filling the shape. /// Fill is enabled by default /// - /// \param Enable : True to enable, false to disable + /// \param enable : True to enable, false to disable /// //////////////////////////////////////////////////////////// - void EnableFill(bool Enable); + void EnableFill(bool enable); //////////////////////////////////////////////////////////// /// Enable or disable drawing the shape outline. /// Outline is enabled by default /// - /// \param Enable : True to enable, false to disable + /// \param enable : True to enable, false to disable /// //////////////////////////////////////////////////////////// - void EnableOutline(bool Enable); + void EnableOutline(bool enable); //////////////////////////////////////////////////////////// /// Set the position of a point /// - /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] - /// \param Position : New position of the Index-th point + /// \param index : Index of the point, in range [0, GetNbPoints() - 1] + /// \param position : New position of the index-th point /// //////////////////////////////////////////////////////////// - void SetPointPosition(unsigned int Index, const Vector2f& Position); + void SetPointPosition(unsigned int index, const Vector2f& position); //////////////////////////////////////////////////////////// /// Set the position of a point /// - /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] - /// \param X : New X coordinate of the Index-th point - /// \param Y : New Y coordinate of the Index-th point + /// \param index : Index of the point, in range [0, GetNbPoints() - 1] + /// \param x : New X coordinate of the index-th point + /// \param y : New Y coordinate of the index-th point /// //////////////////////////////////////////////////////////// - void SetPointPosition(unsigned int Index, float X, float Y); + void SetPointPosition(unsigned int index, float x, float y); //////////////////////////////////////////////////////////// /// Set the color of a point /// - /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] - /// \param Col : New color of the Index-th point + /// \param index : Index of the point, in range [0, GetNbPoints() - 1] + /// \param color : New color of the index-th point /// //////////////////////////////////////////////////////////// - void SetPointColor(unsigned int Index, const Color& Col); + void SetPointColor(unsigned int index, const Color& color); //////////////////////////////////////////////////////////// /// Set the outline color of a point /// - /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] - /// \param OutlineCol : New outline color of the Index-th point + /// \param index : Index of the point, in range [0, GetNbPoints() - 1] + /// \param outlineColor : New outline color of the index-th point /// //////////////////////////////////////////////////////////// - void SetPointOutlineColor(unsigned int Index, const Color& OutlineCol); + void SetPointOutlineColor(unsigned int index, const Color& outlineColor); //////////////////////////////////////////////////////////// /// Change the width of the shape outline /// - /// \param Width : New width + /// \param width : New width /// //////////////////////////////////////////////////////////// - void SetOutlineWidth(float Width); + void SetOutlineWidth(float width); //////////////////////////////////////////////////////////// /// Get the position of a point /// - /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] + /// \param index : Index of the point, in range [0, GetNbPoints() - 1] /// - /// \return Position of the Index-th point + /// \return Position of the index-th point /// //////////////////////////////////////////////////////////// - const Vector2f& GetPointPosition(unsigned int Index) const; + const Vector2f& GetPointPosition(unsigned int index) const; //////////////////////////////////////////////////////////// /// Get the color of a point /// - /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] + /// \param Index : index of the point, in range [0, GetNbPoints() - 1] /// - /// \return Color of the Index-th point + /// \return Color of the index-th point /// //////////////////////////////////////////////////////////// - const Color& GetPointColor(unsigned int Index) const; + const Color& GetPointColor(unsigned int index) const; //////////////////////////////////////////////////////////// /// Get the outline color of a point /// - /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] + /// \param index : Index of the point, in range [0, GetNbPoints() - 1] /// - /// \return Outline color of the Index-th point + /// \return Outline color of the index-th point /// //////////////////////////////////////////////////////////// - const Color& GetPointOutlineColor(unsigned int Index) const; + const Color& GetPointOutlineColor(unsigned int index) const; //////////////////////////////////////////////////////////// /// Get the width of the shape outline @@ -182,76 +182,76 @@ public : //////////////////////////////////////////////////////////// /// Create a shape made of a single line (use floats) /// - /// \param P1X, P1Y : Position of the first point - /// \param P2X, P2Y : Position second point - /// \param Thickness : Line thickness - /// \param Col : Color used to draw the line - /// \param Outline : Outline width (0 by default) - /// \param OutlineCol : Color used to draw the outline (black by default) + /// \param p1x, p1y : Position of the first point + /// \param p2x, p2y : Position second point + /// \param thickness : Line thickness + /// \param color : Color used to draw the line + /// \param outline : Outline width (0 by default) + /// \param outlineColor : Color used to draw the outline (black by default) /// //////////////////////////////////////////////////////////// - static Shape Line(float P1X, float P1Y, float P2X, float P2Y, float Thickness, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); + static Shape Line(float p1x, float p1y, float p2x, float p2y, float thickness, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0)); //////////////////////////////////////////////////////////// /// Create a shape made of a single line (use vectors) /// - /// \param P1X, P1Y : Position of the first point - /// \param P2X, P2Y : Position second point - /// \param Thickness : Line thickness - /// \param Col : Color used to draw the line - /// \param Outline : Outline width (0 by default) - /// \param OutlineCol : Color used to draw the outline (black by default) + /// \param p1 : Position of the first point + /// \param p2 : Position second point + /// \param thickness : Line thickness + /// \param color : Color used to draw the line + /// \param outline : Outline width (0 by default) + /// \param outlineColor : Color used to draw the outline (black by default) /// //////////////////////////////////////////////////////////// - static Shape Line(const Vector2f& P1, const Vector2f& P2, float Thickness, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); + static Shape Line(const Vector2f& p1, const Vector2f& p2, float thickness, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0)); //////////////////////////////////////////////////////////// /// Create a shape made of a single rectangle (use floats) /// - /// \param P1X, P1Y : Position of the first point - /// \param P2X, P2Y : Position second point - /// \param Col : Color used to fill the rectangle - /// \param Outline : Outline width (0 by default) - /// \param OutlineCol : Color used to draw the outline (black by default) + /// \param p1x, p1y : Position of the first point + /// \param p2x, p2y : Position second point + /// \param color : Color used to fill the rectangle + /// \param outline : Outline width (0 by default) + /// \param outlineColor : Color used to draw the outline (black by default) /// //////////////////////////////////////////////////////////// - static Shape Rectangle(float P1X, float P1Y, float P2X, float P2Y, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); + static Shape Rectangle(float p1x, float p1y, float p2x, float p2y, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0)); //////////////////////////////////////////////////////////// /// Create a shape made of a single rectangle (use vectors) /// - /// \param P1 : Position of the first point - /// \param P2 : Position second point - /// \param Col : Color used to fill the rectangle - /// \param Outline : Outline width (0 by default) - /// \param OutlineCol : Color used to draw the outline (black by default) + /// \param p1 : Position of the first point + /// \param p2 : Position second point + /// \param color : Color used to fill the rectangle + /// \param outline : Outline width (0 by default) + /// \param outlineColor : Color used to draw the outline (black by default) /// //////////////////////////////////////////////////////////// - static Shape Rectangle(const Vector2f& P1, const Vector2f& P2, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); + static Shape Rectangle(const Vector2f& p1, const Vector2f& p2, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0)); //////////////////////////////////////////////////////////// /// Create a shape made of a single circle (use floats) /// - /// \param X, Y : Position of the center - /// \param Radius : Radius - /// \param Col : Color used to fill the circle - /// \param Outline : Outline width (0 by default) - /// \param OutlineCol : Color used to draw the outline (black by default) + /// \param x, y : Position of the center + /// \param radius : Radius + /// \param color : Color used to fill the circle + /// \param outline : Outline width (0 by default) + /// \param outlineColor : Color used to draw the outline (black by default) /// //////////////////////////////////////////////////////////// - static Shape Circle(float X, float Y, float Radius, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); + static Shape Circle(float x, float y, float radius, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0)); //////////////////////////////////////////////////////////// /// Create a shape made of a single circle (use vectors) /// - /// \param Center : Position of the center - /// \param Radius : Radius - /// \param Col : Color used to fill the circle - /// \param Outline : Outline width (0 by default) - /// \param OutlineCol : Color used to draw the outline (black by default) + /// \param center : Position of the center + /// \param radius : Radius + /// \param color : Color used to fill the circle + /// \param outline : Outline width (0 by default) + /// \param outlineColor : Color used to draw the outline (black by default) /// //////////////////////////////////////////////////////////// - static Shape Circle(const Vector2f& Center, float Radius, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); + static Shape Circle(const Vector2f& center, float radius, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0)); protected : @@ -259,7 +259,7 @@ protected : /// /see Drawable::Render /// //////////////////////////////////////////////////////////// - virtual void Render(RenderTarget& Target) const; + virtual void Render(RenderTarget& target) const; private : @@ -272,21 +272,21 @@ private : //////////////////////////////////////////////////////////// /// Compute the normal of a given 2D segment /// - /// \param P1 : First point of the segment - /// \param P2 : Second point of the segment - /// \param Normal : Calculated normal + /// \param p1 : First point of the segment + /// \param p2 : Second point of the segment + /// \param normal : Calculated normal /// /// \return False if the normal couldn't be calculated (segment is null) /// //////////////////////////////////////////////////////////// - static bool ComputeNormal(const Vector2f& P1, const Vector2f& P2, Vector2f& Normal); + static bool ComputeNormal(const Vector2f& p1, const Vector2f& p2, Vector2f& normal); //////////////////////////////////////////////////////////// /// Defines a simple 2D point //////////////////////////////////////////////////////////// struct Point { - Point(const Vector2f& Pos = Vector2f(0, 0), const Color& C = Color(255, 255, 255), const Color& OutlineC = Color(255, 255, 255)); + Point(const Vector2f& position = Vector2f(0, 0), const Color& color = Color(255, 255, 255), const Color& outlineColor = Color(255, 255, 255)); Vector2f Position; ///< Position Vector2f Normal; ///< Extruded normal diff --git a/include/SFML/Graphics/Sprite.hpp b/include/SFML/Graphics/Sprite.hpp index d5d835e04..4967d5640 100644 --- a/include/SFML/Graphics/Sprite.hpp +++ b/include/SFML/Graphics/Sprite.hpp @@ -54,66 +54,66 @@ public : //////////////////////////////////////////////////////////// /// Construct the sprite from a source image /// - /// \param Img : Image of the sprite - /// \param Position : Position of the sprite (0, 0 by default) - /// \param Scale : Scale factor (1, 1 by default) - /// \param Rotation : Orientation, in degrees (0 by default) - /// \param Col : Color of the sprite (white by default) + /// \param image : Image of the sprite + /// \param position : Position of the sprite (0, 0 by default) + /// \param scale : Scale factor (1, 1 by default) + /// \param rotation : Orientation, in degrees (0 by default) + /// \param color : Color of the sprite (white by default) /// //////////////////////////////////////////////////////////// - Sprite(const Image& Img, const Vector2f& Position = Vector2f(0, 0), const Vector2f& Scale = Vector2f(1, 1), float Rotation = 0.f, const Color& Col = Color(255, 255, 255, 255)); + Sprite(const Image& image, const Vector2f& position = Vector2f(0, 0), const Vector2f& scale = Vector2f(1, 1), float rotation = 0.f, const Color& color = Color(255, 255, 255, 255)); //////////////////////////////////////////////////////////// /// Change the image of the sprite /// - /// \param Img : New image + /// \param image : New image /// //////////////////////////////////////////////////////////// - void SetImage(const Image& Img); + void SetImage(const Image& image); //////////////////////////////////////////////////////////// /// Set the sub-rectangle of the sprite inside the source image. /// By default, the subrect covers the entire source image /// - /// \param SubRect : New sub-rectangle + /// \param rectangle : New sub-rectangle /// //////////////////////////////////////////////////////////// - void SetSubRect(const IntRect& SubRect); + void SetSubRect(const IntRect& rectangle); //////////////////////////////////////////////////////////// /// Resize the sprite (by changing its scale factors) (take 2 values). /// The default size is defined by the subrect /// - /// \param Width : New width (must be strictly positive) - /// \param Height : New height (must be strictly positive) + /// \param width : New width (must be strictly positive) + /// \param height : New height (must be strictly positive) /// //////////////////////////////////////////////////////////// - void Resize(float Width, float Height); + void Resize(float width, float height); //////////////////////////////////////////////////////////// /// Resize the sprite (by changing its scale factors) (take a 2D vector). /// The default size is defined by the subrect /// - /// \param Size : New size (both coordinates must be strictly positive) + /// \param size : New size (both coordinates must be strictly positive) /// //////////////////////////////////////////////////////////// - void Resize(const Vector2f& Size); + void Resize(const Vector2f& size); //////////////////////////////////////////////////////////// /// Flip the sprite horizontally /// - /// \param Flipped : True to flip the sprite + /// \param flipped : True to flip the sprite /// //////////////////////////////////////////////////////////// - void FlipX(bool Flipped); + void FlipX(bool flipped); //////////////////////////////////////////////////////////// /// Flip the sprite vertically /// - /// \param Flipped : True to flip the sprite + /// \param flipped : True to flip the sprite /// //////////////////////////////////////////////////////////// - void FlipY(bool Flipped); + void FlipY(bool flipped); //////////////////////////////////////////////////////////// /// Get the source image of the sprite @@ -143,13 +143,13 @@ public : /// Get the color of a given pixel in the sprite /// (point is in local coordinates) /// - /// \param X : X coordinate of the pixel to get - /// \param Y : Y coordinate of the pixel to get + /// \param x : X coordinate of the pixel to get + /// \param y : Y coordinate of the pixel to get /// - /// \return Color of pixel (X, Y) + /// \return Color of pixel (x, y) /// //////////////////////////////////////////////////////////// - Color GetPixel(unsigned int X, unsigned int Y) const; + Color GetPixel(unsigned int x, unsigned int y) const; protected : @@ -157,7 +157,7 @@ protected : /// /see Drawable::Render /// //////////////////////////////////////////////////////////// - virtual void Render(RenderTarget& Target) const; + virtual void Render(RenderTarget& target) const; private : diff --git a/include/SFML/Graphics/String.hpp b/include/SFML/Graphics/String.hpp index b0ca81bf0..6c930817d 100644 --- a/include/SFML/Graphics/String.hpp +++ b/include/SFML/Graphics/String.hpp @@ -65,46 +65,46 @@ public : //////////////////////////////////////////////////////////// /// Construct the string from any kind of text /// - /// \param Text : Text assigned to the string - /// \param Font : Font used to draw the string (SFML built-in font by default) - /// \param Size : Characters size (30 by default) + /// \param text : Text assigned to the string + /// \param font : Font used to draw the string (SFML built-in font by default) + /// \param size : Characters size (30 by default) /// //////////////////////////////////////////////////////////// - explicit String(const Unicode::Text& Text, const Font& CharFont = Font::GetDefaultFont(), float Size = 30.f); + explicit String(const Unicode::Text& text, const Font& font = Font::GetDefaultFont(), float size = 30.f); //////////////////////////////////////////////////////////// /// Set the text (from any kind of string) /// - /// \param Text : New text + /// \param text : New text /// //////////////////////////////////////////////////////////// - void SetText(const Unicode::Text& Text); + void SetText(const Unicode::Text& text); //////////////////////////////////////////////////////////// /// Set the font of the string /// - /// \param Font : Font to use + /// \param font : Font to use /// //////////////////////////////////////////////////////////// - void SetFont(const Font& CharFont); + void SetFont(const Font& font); //////////////////////////////////////////////////////////// /// Set the size of the string /// The default size is 30 /// - /// \param Size : New size, in pixels + /// \param size : New size, in pixels /// //////////////////////////////////////////////////////////// - void SetSize(float Size); + void SetSize(float size); //////////////////////////////////////////////////////////// /// Set the style of the text /// The default style is Regular /// - /// \param TextStyle : New text style, (combination of Style enum values) + /// \param style : New text style (combination of Style enum values) /// //////////////////////////////////////////////////////////// - void SetStyle(unsigned long TextStyle); + void SetStyle(unsigned long style); //////////////////////////////////////////////////////////// /// Get the text (the returned text can be converted implicitely to any kind of string) @@ -143,12 +143,12 @@ public : /// in coordinates relative to the string /// (note : translation, center, rotation and scale are not applied) /// - /// \param Index : Index of the character + /// \param index : Index of the character /// - /// \return Position of the Index-th character (end of string if Index is out of range) + /// \return Position of the index-th character (end of string if Index is out of range) /// //////////////////////////////////////////////////////////// - sf::Vector2f GetCharacterPos(std::size_t Index) const; + sf::Vector2f GetCharacterPos(std::size_t index) const; //////////////////////////////////////////////////////////// /// Get the string rectangle on screen @@ -164,7 +164,7 @@ protected : /// /see Drawable::Render /// //////////////////////////////////////////////////////////// - virtual void Render(RenderTarget& Target) const; + virtual void Render(RenderTarget& target) const; private : diff --git a/include/SFML/Graphics/View.hpp b/include/SFML/Graphics/View.hpp index c163739b3..1bdb4fe83 100644 --- a/include/SFML/Graphics/View.hpp +++ b/include/SFML/Graphics/View.hpp @@ -60,61 +60,61 @@ public : //////////////////////////////////////////////////////////// /// Construct the view from a rectangle /// - /// \param Rectangle : Rectangle defining the view + /// \param rectangle : Rectangle defining the view /// //////////////////////////////////////////////////////////// - explicit View(const FloatRect& Rectangle); + explicit View(const FloatRect& rectangle); //////////////////////////////////////////////////////////// /// Construct the view from its center and size /// - /// \param Center : Center of the view - /// \param HalfSize : Size of the view + /// \param center : Center of the view + /// \param size : Size of the view /// //////////////////////////////////////////////////////////// - View(const Vector2f& Center, const Vector2f& Size); + View(const Vector2f& center, const Vector2f& size); //////////////////////////////////////////////////////////// /// Change the center of the view /// - /// \param X : X coordinate of the new center - /// \param Y : Y coordinate of the new center + /// \param x : X coordinate of the new center + /// \param y : Y coordinate of the new center /// //////////////////////////////////////////////////////////// - void SetCenter(float X, float Y); + void SetCenter(float x, float y); //////////////////////////////////////////////////////////// /// Change the center of the view /// - /// \param Center : New center + /// \param center : New center /// //////////////////////////////////////////////////////////// - void SetCenter(const Vector2f& Center); + void SetCenter(const Vector2f& center); //////////////////////////////////////////////////////////// /// Change the size of the view /// - /// \param Width : New width - /// \param Height : New height + /// \param width : New width + /// \param height : New height /// //////////////////////////////////////////////////////////// - void SetSize(float Width, float Height); + void SetSize(float width, float height); //////////////////////////////////////////////////////////// /// Change the size of the view /// - /// \param HalfSize : New half-size + /// \param size : New half-size /// //////////////////////////////////////////////////////////// - void SetSize(const Vector2f& Size); + void SetSize(const Vector2f& size); //////////////////////////////////////////////////////////// /// Set the angle of rotation of the view /// - /// \param Angle : New angle, in degrees + /// \param angle : New angle, in degrees /// //////////////////////////////////////////////////////////// - void SetRotation(float Angle); + void SetRotation(float angle); //////////////////////////////////////////////////////////// /// Set the target viewport @@ -126,19 +126,19 @@ public : /// For example, a view which takes the left side of the target would /// be defined with View.SetViewport(sf::FloatRect(0, 0, 0.5, 1)). /// - /// \param Viewport : New viewport + /// \param viewport : New viewport /// //////////////////////////////////////////////////////////// - void SetViewport(const FloatRect& Viewport); + void SetViewport(const FloatRect& viewport); //////////////////////////////////////////////////////////// /// Reset the view to the given rectangle. /// Note: this function resets the rotation angle to 0. /// - /// \param Rectangle : Rectangle defining the view + /// \param rectangle : Rectangle defining the view /// //////////////////////////////////////////////////////////// - void Reset(const FloatRect& Rectangle); + void Reset(const FloatRect& rectangle); //////////////////////////////////////////////////////////// /// Get the center of the view @@ -175,35 +175,35 @@ public : //////////////////////////////////////////////////////////// /// Move the view /// - /// \param OffsetX : Offset to move the view, on X axis - /// \param OffsetY : Offset to move the view, on Y axis + /// \param offsetX : Offset to move the view, on X axis + /// \param offsetY : Offset to move the view, on Y axis /// //////////////////////////////////////////////////////////// - void Move(float OffsetX, float OffsetY); + void Move(float offsetX, float offsetY); //////////////////////////////////////////////////////////// /// Move the view /// - /// \param Offset : Offset to move the view + /// \param offset : Offset to move the view /// //////////////////////////////////////////////////////////// - void Move(const Vector2f& Offset); + void Move(const Vector2f& offset); //////////////////////////////////////////////////////////// /// Rotate the view /// - /// \param Angle : Angle to rotate, in degrees + /// \param angle : Angle to rotate, in degrees /// //////////////////////////////////////////////////////////// - void Rotate(float Angle); + void Rotate(float angle); //////////////////////////////////////////////////////////// /// Resize the view rectangle to simulate a zoom / unzoom effect /// - /// \param Factor : Zoom factor to apply, relative to the current size + /// \param factor : Zoom factor to apply, relative to the current size /// //////////////////////////////////////////////////////////// - void Zoom(float Factor); + void Zoom(float factor); //////////////////////////////////////////////////////////// /// Get the projection matrix of the view diff --git a/include/SFML/Network/Ftp.hpp b/include/SFML/Network/Ftp.hpp index f2f1bd33d..8331b2d43 100644 --- a/include/SFML/Network/Ftp.hpp +++ b/include/SFML/Network/Ftp.hpp @@ -136,11 +136,11 @@ public : //////////////////////////////////////////////////////////// /// Default constructor /// - /// \param Code : Response status code (InvalidResponse by default) - /// \param Message : Response message (empty by default) + /// \param code : Response status code (InvalidResponse by default) + /// \param message : Response message (empty by default) /// //////////////////////////////////////////////////////////// - Response(Status Code = InvalidResponse, const std::string& Message = ""); + Response(Status code = InvalidResponse, const std::string& message = ""); //////////////////////////////////////////////////////////// /// Convenience function to check if the response status code @@ -186,10 +186,10 @@ public : //////////////////////////////////////////////////////////// /// Default constructor /// - /// \param Resp : Source response + /// \param response : Source response /// //////////////////////////////////////////////////////////// - DirectoryResponse(Response Resp); + DirectoryResponse(Response response); //////////////////////////////////////////////////////////// /// Get the directory returned in the response @@ -218,11 +218,11 @@ public : //////////////////////////////////////////////////////////// /// Default constructor /// - /// \param Resp : Source response - /// \param Data : Data containing the raw listing + /// \param response : Source response + /// \param data : Data containing the raw listing /// //////////////////////////////////////////////////////////// - ListingResponse(Response Resp, const std::vector& Data); + ListingResponse(Response response, const std::vector& data); //////////////////////////////////////////////////////////// /// Get the number of filenames in the listing @@ -235,12 +235,12 @@ public : //////////////////////////////////////////////////////////// /// Get the Index-th filename in the directory /// - /// \param Index : Index of the filename to get + /// \param index : Index of the filename to get /// /// \return Index-th filename /// //////////////////////////////////////////////////////////// - const std::string& GetFilename(std::size_t Index) const; + const std::string& GetFilename(std::size_t index) const; private : @@ -260,14 +260,14 @@ public : //////////////////////////////////////////////////////////// /// Connect to the specified FTP server /// - /// \param Server : FTP server to connect to - /// \param Port : Port used for connection (21 by default, standard FTP port) - /// \param Timeout : Maximum time to wait, in seconds (0 by default, means no timeout) + /// \param server : FTP server to connect to + /// \param port : Port used for connection (21 by default, standard FTP port) + /// \param timeout : Maximum time to wait, in seconds (0 by default, means no timeout) /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// - Response Connect(const IPAddress& Server, unsigned short Port = 21, float Timeout = 0.f); + Response Connect(const IPAddress& server, unsigned short port = 21, float timeout = 0.f); //////////////////////////////////////////////////////////// /// Log in using anonymous account @@ -280,13 +280,13 @@ public : //////////////////////////////////////////////////////////// /// Log in using a username and a password /// - /// \param UserName : User name - /// \param Password : Password + /// \param name : User name + /// \param password : Password /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// - Response Login(const std::string& UserName, const std::string& Password); + Response Login(const std::string& name, const std::string& password); //////////////////////////////////////////////////////////// /// Close the connection with FTP server @@ -316,22 +316,22 @@ public : /// Get the contents of the given directory /// (subdirectories and files) /// - /// \param Directory : Directory to list ("" by default, the current one) + /// \param directory : Directory to list ("" by default, the current one) /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// - ListingResponse GetDirectoryListing(const std::string& Directory = ""); + ListingResponse GetDirectoryListing(const std::string& directory = ""); //////////////////////////////////////////////////////////// /// Change the current working directory /// - /// \param Directory : New directory, relative to the current one + /// \param directory : New directory, relative to the current one /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// - Response ChangeDirectory(const std::string& Directory); + Response ChangeDirectory(const std::string& directory); //////////////////////////////////////////////////////////// /// Go to the parent directory of the current one @@ -344,12 +344,12 @@ public : //////////////////////////////////////////////////////////// /// Create a new directory /// - /// \param Name : Name of the directory to create + /// \param name : Name of the directory to create /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// - Response MakeDirectory(const std::string& Name); + Response MakeDirectory(const std::string& name); //////////////////////////////////////////////////////////// /// Remove an existing directory @@ -359,65 +359,65 @@ public : /// \return Server response to the request /// //////////////////////////////////////////////////////////// - Response DeleteDirectory(const std::string& Name); + Response DeleteDirectory(const std::string& name); //////////////////////////////////////////////////////////// /// Rename a file /// - /// \param File : File to rename - /// \param NewName : New name + /// \param file : File to rename + /// \param newName : New name /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// - Response RenameFile(const std::string& File, const std::string& NewName); + Response RenameFile(const std::string& file, const std::string& newName); //////////////////////////////////////////////////////////// /// Remove an existing file /// - /// \param Name : File to remove + /// \param name : File to remove /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// - Response DeleteFile(const std::string& Name); + Response DeleteFile(const std::string& name); //////////////////////////////////////////////////////////// /// Download a file from the server /// - /// \param DistantFile : Path of the distant file to download - /// \param DestPath : Where to put to file on the local computer - /// \param Mode : Transfer mode (binary by default) + /// \param distantFile : Path of the distant file to download + /// \param destPath : Where to put to file on the local computer + /// \param mode : Transfer mode (binary by default) /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// - Response Download(const std::string& DistantFile, const std::string& DestPath, TransferMode Mode = Binary); + Response Download(const std::string& distantFile, const std::string& destPath, TransferMode mode = Binary); //////////////////////////////////////////////////////////// /// Upload a file to the server /// - /// \param LocalFile : Path of the local file to upload - /// \param DestPath : Where to put to file on the server - /// \param Mode : Transfer mode (binary by default) + /// \param localFile : Path of the local file to upload + /// \param destPath : Where to put to file on the server + /// \param mode : Transfer mode (binary by default) /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// - Response Upload(const std::string& LocalFile, const std::string& DestPath, TransferMode Mode = Binary); + Response Upload(const std::string& localFile, const std::string& destPath, TransferMode mode = Binary); private : //////////////////////////////////////////////////////////// /// Send a command to the FTP server /// - /// \param Command : Command to send - /// \param Parameter : Command parameter ("" by default) + /// \param command : Command to send + /// \param parameter : Command parameter ("" by default) /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// - Response SendCommand(const std::string& Command, const std::string& Parameter = ""); + Response SendCommand(const std::string& command, const std::string& parameter = ""); //////////////////////////////////////////////////////////// /// Receive a response from the server diff --git a/include/SFML/Network/Http.hpp b/include/SFML/Network/Http.hpp index 54e5c1fcc..0cc7afce2 100644 --- a/include/SFML/Network/Http.hpp +++ b/include/SFML/Network/Http.hpp @@ -68,30 +68,30 @@ public : //////////////////////////////////////////////////////////// /// Default constructor /// - /// \param RequestMethod : Method to use for the request (Get by default) - /// \param URI : Target URI ("/" by default -- index page) - /// \param Body : Content of the request's body (empty by default) + /// \param method : Method to use for the request (Get by default) + /// \param URI : Target URI ("/" by default -- index page) + /// \param body : Content of the request's body (empty by default) /// //////////////////////////////////////////////////////////// - Request(Method RequestMethod = Get, const std::string& URI = "/", const std::string& Body = ""); + Request(Method method = Get, const std::string& URI = "/", const std::string& body = ""); //////////////////////////////////////////////////////////// /// Set the value of a field; the field is added if it doesn't exist /// - /// \param Field : Name of the field to set (case-insensitive) - /// \param Value : Value of the field + /// \param field : Name of the field to set (case-insensitive) + /// \param value : Value of the field /// //////////////////////////////////////////////////////////// - void SetField(const std::string& Field, const std::string& Value); + void SetField(const std::string& field, const std::string& value); //////////////////////////////////////////////////////////// /// Set the request method. /// This parameter is Http::Request::Get by default /// - /// \param RequestMethod : Method to use for the request + /// \param method : Method to use for the request /// //////////////////////////////////////////////////////////// - void SetMethod(Method RequestMethod); + void SetMethod(Method method); //////////////////////////////////////////////////////////// /// Set the target URI of the request. @@ -106,21 +106,21 @@ public : /// Set the HTTP version of the request. /// This parameter is 1.0 by default /// - /// \param Major : Major version number - /// \param Minor : Minor version number + /// \param major : Major version number + /// \param minor : Minor version number /// //////////////////////////////////////////////////////////// - void SetHttpVersion(unsigned int Major, unsigned int Minor); + void SetHttpVersion(unsigned int major, unsigned int minor); //////////////////////////////////////////////////////////// /// Set the body of the request. This parameter is optional and /// makes sense only for POST requests. /// This parameter is empty by default /// - /// \param Body : Content of the request body + /// \param body : Content of the request body /// //////////////////////////////////////////////////////////// - void SetBody(const std::string& Body); + void SetBody(const std::string& body); private : @@ -137,12 +137,12 @@ public : //////////////////////////////////////////////////////////// /// Check if the given field has been defined /// - /// \param Field : Name of the field to check (case-insensitive) + /// \param field : Name of the field to check (case-insensitive) /// /// \return True if the field exists /// //////////////////////////////////////////////////////////// - bool HasField(const std::string& Field) const; + bool HasField(const std::string& field) const; //////////////////////////////////////////////////////////// // Types @@ -213,12 +213,12 @@ public : //////////////////////////////////////////////////////////// /// Get the value of a field /// - /// \param Field : Name of the field to get (case-insensitive) + /// \param field : Name of the field to get (case-insensitive) /// /// \return Value of the field, or empty string if not found /// //////////////////////////////////////////////////////////// - const std::string& GetField(const std::string& Field) const; + const std::string& GetField(const std::string& field) const; //////////////////////////////////////////////////////////// /// Get the header's status code @@ -263,10 +263,10 @@ public : //////////////////////////////////////////////////////////// /// Construct the header from a response string /// - /// \param Data : Content of the response's header to parse + /// \param data : Content of the response's header to parse /// //////////////////////////////////////////////////////////// - void FromString(const std::string& Data); + void FromString(const std::string& data); //////////////////////////////////////////////////////////// // Types @@ -292,20 +292,20 @@ public : //////////////////////////////////////////////////////////// /// Construct the Http instance with the target host /// - /// \param Host : Web server to connect to - /// \param Port : Port to use for connection (0 by default -- use the standard port of the protocol used) + /// \param host : Web server to connect to + /// \param port : Port to use for connection (0 by default -- use the standard port of the protocol used) /// //////////////////////////////////////////////////////////// - Http(const std::string& Host, unsigned short Port = 0); + Http(const std::string& host, unsigned short port = 0); //////////////////////////////////////////////////////////// /// Set the target host /// - /// \param Host : Web server to connect to - /// \param Port : Port to use for connection (0 by default -- use the standard port of the protocol used) + /// \param host : Web server to connect to + /// \param port : Port to use for connection (0 by default -- use the standard port of the protocol used) /// //////////////////////////////////////////////////////////// - void SetHost(const std::string& Host, unsigned short Port = 0); + void SetHost(const std::string& host, unsigned short port = 0); //////////////////////////////////////////////////////////// /// Send a HTTP request and return the server's response. @@ -315,13 +315,13 @@ public : /// not return instantly; use a thread if you don't want to block your /// application. /// - /// \param Req : Request to send - /// \param Timeout : Maximum time to wait, in seconds (0 by default, means no timeout) + /// \param request : Request to send + /// \param timeout : Maximum time to wait, in seconds (0 by default, means no timeout) /// /// \return Server's response /// //////////////////////////////////////////////////////////// - Response SendRequest(const Request& Req, float Timeout = 0.f); + Response SendRequest(const Request& request, float timeout = 0.f); private : diff --git a/include/SFML/Network/IPAddress.hpp b/include/SFML/Network/IPAddress.hpp index 638dc4788..072faa57c 100644 --- a/include/SFML/Network/IPAddress.hpp +++ b/include/SFML/Network/IPAddress.hpp @@ -52,38 +52,38 @@ public : //////////////////////////////////////////////////////////// /// Construct the address from a string /// - /// \param Address : IP address ("xxx.xxx.xxx.xxx") or network name + /// \param address : IP address ("xxx.xxx.xxx.xxx") or network name /// //////////////////////////////////////////////////////////// - IPAddress(const std::string& Address); + IPAddress(const std::string& address); //////////////////////////////////////////////////////////// /// Construct the address from a C-style string ; /// Needed for implicit conversions from literal strings to IPAddress to work /// - /// \param Address : IP address ("xxx.xxx.xxx.xxx") or network name + /// \param address : IP address ("xxx.xxx.xxx.xxx") or network name /// //////////////////////////////////////////////////////////// - IPAddress(const char* Address); + IPAddress(const char* address); //////////////////////////////////////////////////////////// /// Construct the address from 4 bytes /// - /// \param Byte0 : First byte of the address - /// \param Byte1 : Second byte of the address - /// \param Byte2 : Third byte of the address - /// \param Byte3 : Fourth byte of the address + /// \param byte0 : First byte of the address + /// \param byte1 : Second byte of the address + /// \param byte2 : Third byte of the address + /// \param byte3 : Fourth byte of the address /// //////////////////////////////////////////////////////////// - IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3); + IPAddress(Uint8 byte0, Uint8 byte1, Uint8 byte2, Uint8 byte3); //////////////////////////////////////////////////////////// /// Construct the address from a 32-bits integer /// - /// \param Address : 4 bytes of the address packed into a 32-bits integer + /// \param address : 4 bytes of the address packed into a 32-bits integer /// //////////////////////////////////////////////////////////// - IPAddress(Uint32 Address); + IPAddress(Uint32 address); //////////////////////////////////////////////////////////// /// Tell if the address is a valid one @@ -123,72 +123,72 @@ public : /// distant website ; as a consequence, this function may be /// very slow -- use it as few as possible ! /// - /// \param Timeout : Maximum time to wait, in seconds (0 by default : no timeout) + /// \param timeout : Maximum time to wait, in seconds (0 by default : no timeout) /// /// \return Public IP address /// //////////////////////////////////////////////////////////// - static IPAddress GetPublicAddress(float Timeout = 0.f); + static IPAddress GetPublicAddress(float timeout = 0.f); //////////////////////////////////////////////////////////// /// Comparison operator == /// - /// \param Other : Address to compare + /// \param other : Address to compare /// - /// \return True if *this == Other + /// \return True if *this == other /// //////////////////////////////////////////////////////////// - bool operator ==(const IPAddress& Other) const; + bool operator ==(const IPAddress& other) const; //////////////////////////////////////////////////////////// /// Comparison operator != /// - /// \param Other : Address to compare + /// \param other : Address to compare /// - /// \return True if *this != Other + /// \return True if *this != other /// //////////////////////////////////////////////////////////// - bool operator !=(const IPAddress& Other) const; + bool operator !=(const IPAddress& other) const; //////////////////////////////////////////////////////////// /// Comparison operator < /// - /// \param Other : Address to compare + /// \param other : Address to compare /// - /// \return True if *this < Other + /// \return True if *this < other /// //////////////////////////////////////////////////////////// - bool operator <(const IPAddress& Other) const; + bool operator <(const IPAddress& other) const; //////////////////////////////////////////////////////////// /// Comparison operator > /// - /// \param Other : Address to compare + /// \param other : Address to compare /// - /// \return True if *this > Other + /// \return True if *this > other /// //////////////////////////////////////////////////////////// - bool operator >(const IPAddress& Other) const; + bool operator >(const IPAddress& other) const; //////////////////////////////////////////////////////////// /// Comparison operator <= /// - /// \param Other : Address to compare + /// \param other : Address to compare /// - /// \return True if *this <= Other + /// \return True if *this <= other /// //////////////////////////////////////////////////////////// - bool operator <=(const IPAddress& Other) const; + bool operator <=(const IPAddress& other) const; //////////////////////////////////////////////////////////// /// Comparison operator >= /// - /// \param Other : Address to compare + /// \param other : Address to compare /// - /// \return True if *this >= Other + /// \return True if *this >= other /// //////////////////////////////////////////////////////////// - bool operator >=(const IPAddress& Other) const; + bool operator >=(const IPAddress& other) const; //////////////////////////////////////////////////////////// // Static member data @@ -212,7 +212,7 @@ private : /// \return Reference to the input stream /// //////////////////////////////////////////////////////////// -SFML_API std::istream& operator >>(std::istream& Stream, IPAddress& Address); +SFML_API std::istream& operator >>(std::istream& stream, IPAddress& address); //////////////////////////////////////////////////////////// /// Operator << overload to print an address to an output stream @@ -223,7 +223,7 @@ SFML_API std::istream& operator >>(std::istream& Stream, IPAddress& Address); /// \return Reference to the output stream /// //////////////////////////////////////////////////////////// -SFML_API std::ostream& operator <<(std::ostream& Stream, const IPAddress& Address); +SFML_API std::ostream& operator <<(std::ostream& stream, const IPAddress& address); } // namespace sf diff --git a/include/SFML/Network/Packet.hpp b/include/SFML/Network/Packet.hpp index 9c5463f42..05cd9159f 100644 --- a/include/SFML/Network/Packet.hpp +++ b/include/SFML/Network/Packet.hpp @@ -57,11 +57,11 @@ public : //////////////////////////////////////////////////////////// /// Append data to the end of the packet /// - /// \param Data : Pointer to the bytes to append - /// \param SizeInBytes : Number of bytes to append + /// \param data : Pointer to the bytes to append + /// \param sizeInBytes : Number of bytes to append /// //////////////////////////////////////////////////////////// - void Append(const void* Data, std::size_t SizeInBytes); + void Append(const void* data, std::size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Clear the packet data @@ -107,37 +107,37 @@ public : /// Operator >> overloads to extract data from the packet /// //////////////////////////////////////////////////////////// - Packet& operator >>(bool& Data); - Packet& operator >>(Int8& Data); - Packet& operator >>(Uint8& Data); - Packet& operator >>(Int16& Data); - Packet& operator >>(Uint16& Data); - Packet& operator >>(Int32& Data); - Packet& operator >>(Uint32& Data); - Packet& operator >>(float& Data); - Packet& operator >>(double& Data); - Packet& operator >>(char* Data); - Packet& operator >>(std::string& Data); - Packet& operator >>(wchar_t* Data); - Packet& operator >>(std::wstring& Data); + Packet& operator >>(bool& data); + Packet& operator >>(Int8& data); + Packet& operator >>(Uint8& data); + Packet& operator >>(Int16& data); + Packet& operator >>(Uint16& data); + Packet& operator >>(Int32& data); + Packet& operator >>(Uint32& data); + Packet& operator >>(float& data); + Packet& operator >>(double& data); + Packet& operator >>(char* data); + Packet& operator >>(std::string& data); + Packet& operator >>(wchar_t* data); + Packet& operator >>(std::wstring& data); //////////////////////////////////////////////////////////// /// Operator << overloads to put data into the packet /// //////////////////////////////////////////////////////////// - Packet& operator <<(bool Data); - Packet& operator <<(Int8 Data); - Packet& operator <<(Uint8 Data); - Packet& operator <<(Int16 Data); - Packet& operator <<(Uint16 Data); - Packet& operator <<(Int32 Data); - Packet& operator <<(Uint32 Data); - Packet& operator <<(float Data); - Packet& operator <<(double Data); - Packet& operator <<(const char* Data); - Packet& operator <<(const std::string& Data); - Packet& operator <<(const wchar_t* Data); - Packet& operator <<(const std::wstring& Data); + Packet& operator <<(bool data); + Packet& operator <<(Int8 data); + Packet& operator <<(Uint8 data); + Packet& operator <<(Int16 data); + Packet& operator <<(Uint16 data); + Packet& operator <<(Int32 data); + Packet& operator <<(Uint32 data); + Packet& operator <<(float data); + Packet& operator <<(double data); + Packet& operator <<(const char* data); + Packet& operator <<(const std::string& data); + Packet& operator <<(const wchar_t* data); + Packet& operator <<(const std::wstring& data); private : @@ -147,31 +147,31 @@ private : //////////////////////////////////////////////////////////// /// Check if the packet can extract a given size of bytes /// - /// \param Size : Size to check + /// \param size : Size to check /// /// \return True if Size bytes can be read from the packet's data /// //////////////////////////////////////////////////////////// - bool CheckSize(std::size_t Size); + bool CheckSize(std::size_t size); //////////////////////////////////////////////////////////// /// Called before the packet is sent to the network /// - /// \param DataSize : Variable to fill with the size of data to send + /// \param dataSize : Variable to fill with the size of data to send /// /// \return Pointer to the array of bytes to send /// //////////////////////////////////////////////////////////// - virtual const char* OnSend(std::size_t& DataSize); + virtual const char* OnSend(std::size_t& dataSize); //////////////////////////////////////////////////////////// /// Called after the packet has been received from the network /// - /// \param Data : Pointer to the array of received bytes - /// \param DataSize : Size of the array of bytes + /// \param data : Pointer to the array of received bytes + /// \param dataSize : Size of the array of bytes /// //////////////////////////////////////////////////////////// - virtual void OnReceive(const char* Data, std::size_t DataSize); + virtual void OnReceive(const char* data, std::size_t dataSize); //////////////////////////////////////////////////////////// // Member data diff --git a/include/SFML/Network/Selector.hpp b/include/SFML/Network/Selector.hpp index 588a72c1c..ffb071a50 100644 --- a/include/SFML/Network/Selector.hpp +++ b/include/SFML/Network/Selector.hpp @@ -48,18 +48,18 @@ public : //////////////////////////////////////////////////////////// /// Add a socket to watch /// - /// \param Socket : Socket to add + /// \param socket : Socket to add /// //////////////////////////////////////////////////////////// - void Add(Type Socket); + void Add(Type socket); //////////////////////////////////////////////////////////// /// Remove a socket /// - /// \param Socket : Socket to remove + /// \param socket : Socket to remove /// //////////////////////////////////////////////////////////// - void Remove(Type Socket); + void Remove(Type socket); //////////////////////////////////////////////////////////// /// Remove all sockets @@ -72,24 +72,24 @@ public : /// This functions will return either when at least one socket /// is ready, or when the given time is out /// - /// \param Timeout : Timeout, in seconds (0 by default : no timeout) + /// \param timeout : Timeout, in seconds (0 by default : no timeout) /// /// \return Number of sockets ready to be read /// //////////////////////////////////////////////////////////// - unsigned int Wait(float Timeout = 0.f); + unsigned int Wait(float timeout = 0.f); //////////////////////////////////////////////////////////// /// After a call to Wait(), get the Index-th socket which is /// ready for reading. The total number of sockets ready /// is the integer returned by the previous call to Wait() /// - /// \param Index : Index of the socket to get + /// \param index : Index of the socket to get /// - /// \return The Index-th socket + /// \return The index-th socket /// //////////////////////////////////////////////////////////// - Type GetSocketReady(unsigned int Index); + Type GetSocketReady(unsigned int index); private : diff --git a/include/SFML/Network/Selector.inl b/include/SFML/Network/Selector.inl index 40ac948af..2c905f1f3 100644 --- a/include/SFML/Network/Selector.inl +++ b/include/SFML/Network/Selector.inl @@ -27,12 +27,12 @@ /// Add a socket to watch //////////////////////////////////////////////////////////// template -void Selector::Add(Type Socket) +void Selector::Add(Type socket) { - if (Socket.IsValid()) + if (socket.IsValid()) { - SelectorBase::Add(Socket.mySocket); - mySockets[Socket.mySocket] = Socket; + SelectorBase::Add(socket.mySocket); + mySockets[socket.mySocket] = socket; } } @@ -41,13 +41,13 @@ void Selector::Add(Type Socket) /// Remove a socket //////////////////////////////////////////////////////////// template -void Selector::Remove(Type Socket) +void Selector::Remove(Type socket) { - typename SocketTable::iterator It = mySockets.find(Socket.mySocket); - if (It != mySockets.end()) + typename SocketTable::iterator it = mySockets.find(socket.mySocket); + if (it != mySockets.end()) { - SelectorBase::Remove(Socket.mySocket); - mySockets.erase(It); + SelectorBase::Remove(socket.mySocket); + mySockets.erase(it); } } @@ -69,13 +69,13 @@ void Selector::Clear() /// is ready, or when the given time is out //////////////////////////////////////////////////////////// template -unsigned int Selector::Wait(float Timeout) +unsigned int Selector::Wait(float timeout) { // No socket in the selector : return 0 if (mySockets.empty()) return 0; - return SelectorBase::Wait(Timeout); + return SelectorBase::Wait(timeout); } @@ -85,13 +85,13 @@ unsigned int Selector::Wait(float Timeout) /// is the integer returned by the previous call to Wait() //////////////////////////////////////////////////////////// template -Type Selector::GetSocketReady(unsigned int Index) +Type Selector::GetSocketReady(unsigned int index) { - SocketHelper::SocketType Socket = SelectorBase::GetSocketReady(Index); + SocketHelper::SocketType socket = SelectorBase::GetSocketReady(index); - typename SocketTable::const_iterator It = mySockets.find(Socket); - if (It != mySockets.end()) - return It->second; + typename SocketTable::const_iterator it = mySockets.find(socket); + if (it != mySockets.end()) + return it->second; else - return Type(Socket); + return Type(socket); } diff --git a/include/SFML/Network/SelectorBase.hpp b/include/SFML/Network/SelectorBase.hpp index 4b9e9157a..a032aa043 100644 --- a/include/SFML/Network/SelectorBase.hpp +++ b/include/SFML/Network/SelectorBase.hpp @@ -53,18 +53,18 @@ public : //////////////////////////////////////////////////////////// /// Add a socket to watch /// - /// \param Socket : Socket to add + /// \param socket : Socket to add /// //////////////////////////////////////////////////////////// - void Add(SocketHelper::SocketType Socket); + void Add(SocketHelper::SocketType socket); //////////////////////////////////////////////////////////// /// Remove a socket /// - /// \param Socket : Socket to remove + /// \param socket : Socket to remove /// //////////////////////////////////////////////////////////// - void Remove(SocketHelper::SocketType Socket); + void Remove(SocketHelper::SocketType socket); //////////////////////////////////////////////////////////// /// Remove all sockets @@ -77,24 +77,24 @@ public : /// This functions will return either when at least one socket /// is ready, or when the given time is out /// - /// \param Timeout : Timeout, in seconds (0 by default : no timeout) + /// \param timeout : Timeout, in seconds (0 by default : no timeout) /// /// \return Number of sockets ready to be read /// //////////////////////////////////////////////////////////// - unsigned int Wait(float Timeout = 0.f); + unsigned int Wait(float timeout = 0.f); //////////////////////////////////////////////////////////// /// After a call to Wait(), get the Index-th socket which is /// ready for reading. The total number of sockets ready /// is the integer returned by the previous call to Wait() /// - /// \param Index : Index of the socket to get + /// \param index : Index of the socket to get /// - /// \return The Index-th socket + /// \return The index-th socket /// //////////////////////////////////////////////////////////// - SocketHelper::SocketType GetSocketReady(unsigned int Index); + SocketHelper::SocketType GetSocketReady(unsigned int index); private : diff --git a/include/SFML/Network/SocketTCP.hpp b/include/SFML/Network/SocketTCP.hpp index 964686a59..745604612 100644 --- a/include/SFML/Network/SocketTCP.hpp +++ b/include/SFML/Network/SocketTCP.hpp @@ -56,89 +56,89 @@ public : /// Change the blocking state of the socket. /// The default behaviour of a socket is blocking /// - /// \param Blocking : Pass true to set the socket as blocking, or false for non-blocking + /// \param blocking : Pass true to set the socket as blocking, or false for non-blocking /// //////////////////////////////////////////////////////////// - void SetBlocking(bool Blocking); + void SetBlocking(bool blocking); //////////////////////////////////////////////////////////// /// Connect to another computer on a specified port /// - /// \param Port : Port to use for transfers (warning : ports < 1024 are reserved) - /// \param HostAddress : IP Address of the host to connect to - /// \param Timeout : Maximum time to wait, in seconds (0 by default : no timeout) (this parameter is ignored for non-blocking sockets) + /// \param port : Port to use for transfers (warning : ports < 1024 are reserved) + /// \param host : IP Address of the host to connect to + /// \param timeout : Maximum time to wait, in seconds (0 by default : no timeout) (this parameter is ignored for non-blocking sockets) /// /// \return True if operation has been successful /// //////////////////////////////////////////////////////////// - Socket::Status Connect(unsigned short Port, const IPAddress& HostAddress, float Timeout = 0.f); + Socket::Status Connect(unsigned short port, const IPAddress& host, float timeout = 0.f); //////////////////////////////////////////////////////////// /// Listen to a specified port for incoming data or connections /// - /// \param Port : Port to listen to + /// \param port : Port to listen to /// /// \return True if operation has been successful /// //////////////////////////////////////////////////////////// - bool Listen(unsigned short Port); + bool Listen(unsigned short port); //////////////////////////////////////////////////////////// /// Wait for a connection (must be listening to a port). /// This function will block if the socket is blocking /// - /// \param Connected : Socket containing the connection with the connected client - /// \param Address : Pointer to an address to fill with client infos (NULL by default) + /// \param connected : Socket containing the connection with the connected client + /// \param address : Pointer to an address to fill with client infos (NULL by default) /// /// \return Status code /// //////////////////////////////////////////////////////////// - Socket::Status Accept(SocketTCP& Connected, IPAddress* Address = NULL); + Socket::Status Accept(SocketTCP& connected, IPAddress* address = NULL); //////////////////////////////////////////////////////////// /// Send an array of bytes to the host (must be connected first) /// - /// \param Data : Pointer to the bytes to send - /// \param Size : Number of bytes to send + /// \param data : Pointer to the bytes to send + /// \param size : Number of bytes to send /// /// \return Status code /// //////////////////////////////////////////////////////////// - Socket::Status Send(const char* Data, std::size_t Size); + Socket::Status Send(const char* data, std::size_t size); //////////////////////////////////////////////////////////// /// Receive an array of bytes from the host (must be connected first). /// This function will block if the socket is blocking /// - /// \param Data : Pointer to a byte array to fill (make sure it is big enough) - /// \param MaxSize : Maximum number of bytes to read - /// \param SizeReceived : Number of bytes received + /// \param data : Pointer to a byte array to fill (make sure it is big enough) + /// \param maxSize : Maximum number of bytes to read + /// \param sizeReceived : Number of bytes received /// /// \return Status code /// //////////////////////////////////////////////////////////// - Socket::Status Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived); + Socket::Status Receive(char* data, std::size_t maxSize, std::size_t& sizeReceived); //////////////////////////////////////////////////////////// /// Send a packet of data to the host (must be connected first) /// - /// \param PacketToSend : Packet to send + /// \param packet : Packet to send /// /// \return Status code /// //////////////////////////////////////////////////////////// - Socket::Status Send(Packet& PacketToSend); + Socket::Status Send(Packet& packet); //////////////////////////////////////////////////////////// /// Receive a packet from the host (must be connected first). /// This function will block if the socket is blocking /// - /// \param PacketToReceive : Packet to fill with received data + /// \param packet : Packet to fill with received data /// /// \return Status code /// //////////////////////////////////////////////////////////// - Socket::Status Receive(Packet& PacketToReceive); + Socket::Status Receive(Packet& packet); //////////////////////////////////////////////////////////// /// Close the socket @@ -160,34 +160,34 @@ public : //////////////////////////////////////////////////////////// /// Comparison operator == /// - /// \param Other : Socket to compare + /// \param other : Socket to compare /// - /// \return True if *this == Other + /// \return True if *this == other /// //////////////////////////////////////////////////////////// - bool operator ==(const SocketTCP& Other) const; + bool operator ==(const SocketTCP& other) const; //////////////////////////////////////////////////////////// /// Comparison operator != /// - /// \param Other : Socket to compare + /// \param other : Socket to compare /// - /// \return True if *this != Other + /// \return True if *this != other /// //////////////////////////////////////////////////////////// - bool operator !=(const SocketTCP& Other) const; + bool operator !=(const SocketTCP& other) const; //////////////////////////////////////////////////////////// /// Comparison operator <. /// Provided for compatibility with standard containers, as /// comparing two sockets doesn't make much sense... /// - /// \param Other : Socket to compare + /// \param other : Socket to compare /// - /// \return True if *this < Other + /// \return True if *this < other /// //////////////////////////////////////////////////////////// - bool operator <(const SocketTCP& Other) const; + bool operator <(const SocketTCP& other) const; private : @@ -197,18 +197,18 @@ private : /// Construct the socket from a socket descriptor /// (for internal use only) /// - /// \param Descriptor : Socket descriptor + /// \param descriptor : Socket descriptor /// //////////////////////////////////////////////////////////// - SocketTCP(SocketHelper::SocketType Descriptor); + SocketTCP(SocketHelper::SocketType descriptor); //////////////////////////////////////////////////////////// /// Create the socket /// - /// \param Descriptor : System socket descriptor to use (0 by default -- create a new socket) + /// \param descriptor : System socket descriptor to use (0 by default -- create a new socket) /// //////////////////////////////////////////////////////////// - void Create(SocketHelper::SocketType Descriptor = 0); + void Create(SocketHelper::SocketType descriptor = 0); //////////////////////////////////////////////////////////// // Member data diff --git a/include/SFML/Network/SocketUDP.hpp b/include/SFML/Network/SocketUDP.hpp index 37df3f7dd..785e7a9fc 100644 --- a/include/SFML/Network/SocketUDP.hpp +++ b/include/SFML/Network/SocketUDP.hpp @@ -56,20 +56,20 @@ public : /// Change the blocking state of the socket. /// The default behaviour of a socket is blocking /// - /// \param Blocking : Pass true to set the socket as blocking, or false for non-blocking + /// \param blocking : Pass true to set the socket as blocking, or false for non-blocking /// //////////////////////////////////////////////////////////// - void SetBlocking(bool Blocking); + void SetBlocking(bool blocking); //////////////////////////////////////////////////////////// /// Bind the socket to a specific port /// - /// \param Port : Port to bind the socket to + /// \param port : Port to bind the socket to /// /// \return True if operation has been successful /// //////////////////////////////////////////////////////////// - bool Bind(unsigned short Port); + bool Bind(unsigned short port); //////////////////////////////////////////////////////////// /// Unbind the socket from its previous port, if any @@ -82,55 +82,55 @@ public : //////////////////////////////////////////////////////////// /// Send an array of bytes /// - /// \param Data : Pointer to the bytes to send - /// \param Size : Number of bytes to send - /// \param Address : Address of the computer to send the packet to - /// \param Port : Port to send the data to + /// \param data : Pointer to the bytes to send + /// \param size : Number of bytes to send + /// \param address : Address of the computer to send the packet to + /// \param port : Port to send the data to /// /// \return Status code /// //////////////////////////////////////////////////////////// - Socket::Status Send(const char* Data, std::size_t Size, const IPAddress& Address, unsigned short Port); + Socket::Status Send(const char* data, std::size_t size, const IPAddress& address, unsigned short port); //////////////////////////////////////////////////////////// /// Receive an array of bytes. /// This function will block if the socket is blocking /// - /// \param Data : Pointer to a byte array to fill (make sure it is big enough) - /// \param MaxSize : Maximum number of bytes to read - /// \param SizeReceived : Number of bytes received - /// \param Address : Address of the computer which sent the data - /// \param Port : Port on which the remote computer sent the data + /// \param data : Pointer to a byte array to fill (make sure it is big enough) + /// \param maxSize : Maximum number of bytes to read + /// \param sizeReceived : Number of bytes received + /// \param address : Address of the computer which sent the data + /// \param port : Port on which the remote computer sent the data /// /// \return Status code /// //////////////////////////////////////////////////////////// - Socket::Status Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived, IPAddress& Address, unsigned short& Port); + Socket::Status Receive(char* data, std::size_t maxSize, std::size_t& sizeReceived, IPAddress& address, unsigned short& port); //////////////////////////////////////////////////////////// /// Send a packet of data /// - /// \param PacketToSend : Packet to send - /// \param Address : Address of the computer to send the packet to - /// \param Port : Port to send the data to + /// \param packet : Packet to send + /// \param address : Address of the computer to send the packet to + /// \param port : Port to send the data to /// /// \return Status code /// //////////////////////////////////////////////////////////// - Socket::Status Send(Packet& PacketToSend, const IPAddress& Address, unsigned short Port); + Socket::Status Send(Packet& packet, const IPAddress& address, unsigned short port); //////////////////////////////////////////////////////////// /// Receive a packet. /// This function will block if the socket is blocking /// - /// \param PacketToReceive : Packet to fill with received data - /// \param Address : Address of the computer which sent the packet - /// \param Port : Port on which the remote computer sent the data + /// \param packet : Packet to fill with received data + /// \param Address : Address of the computer which sent the packet + /// \param Port : Port on which the remote computer sent the data /// /// \return Status code /// //////////////////////////////////////////////////////////// - Socket::Status Receive(Packet& PacketToReceive, IPAddress& Address, unsigned short& Port); + Socket::Status Receive(Packet& packet, IPAddress& address, unsigned short& port); //////////////////////////////////////////////////////////// /// Close the socket @@ -160,34 +160,34 @@ public : //////////////////////////////////////////////////////////// /// Comparison operator == /// - /// \param Other : Socket to compare + /// \param other : Socket to compare /// - /// \return True if *this == Other + /// \return True if *this == other /// //////////////////////////////////////////////////////////// - bool operator ==(const SocketUDP& Other) const; + bool operator ==(const SocketUDP& other) const; //////////////////////////////////////////////////////////// /// Comparison operator != /// - /// \param Other : Socket to compare + /// \param other : Socket to compare /// - /// \return True if *this != Other + /// \return True if *this != other /// //////////////////////////////////////////////////////////// - bool operator !=(const SocketUDP& Other) const; + bool operator !=(const SocketUDP& other) const; //////////////////////////////////////////////////////////// /// Comparison operator <. /// Provided for compatibility with standard containers, as /// comparing two sockets doesn't make much sense... /// - /// \param Other : Socket to compare + /// \param other : Socket to compare /// - /// \return True if *this < Other + /// \return True if *this < other /// //////////////////////////////////////////////////////////// - bool operator <(const SocketUDP& Other) const; + bool operator <(const SocketUDP& other) const; private : @@ -197,18 +197,18 @@ private : /// Construct the socket from a socket descriptor /// (for internal use only) /// - /// \param Descriptor : Socket descriptor + /// \param descriptor : Socket descriptor /// //////////////////////////////////////////////////////////// - SocketUDP(SocketHelper::SocketType Descriptor); + SocketUDP(SocketHelper::SocketType descriptor); //////////////////////////////////////////////////////////// /// Create the socket /// - /// \param Descriptor : System socket descriptor to use (0 by default -- create a new socket) + /// \param descriptor : System socket descriptor to use (0 by default -- create a new socket) /// //////////////////////////////////////////////////////////// - void Create(SocketHelper::SocketType Descriptor = 0); + void Create(SocketHelper::SocketType descriptor = 0); //////////////////////////////////////////////////////////// // Member data diff --git a/include/SFML/Network/Win32/SocketHelper.hpp b/include/SFML/Network/Win32/SocketHelper.hpp index 6199c0a2c..2ebf88993 100644 --- a/include/SFML/Network/Win32/SocketHelper.hpp +++ b/include/SFML/Network/Win32/SocketHelper.hpp @@ -59,21 +59,21 @@ public : //////////////////////////////////////////////////////////// /// Close / destroy a socket /// - /// \param Socket : Socket to close + /// \param socket : Socket to close /// /// \return True on success /// //////////////////////////////////////////////////////////// - static bool Close(SocketType Socket); + static bool Close(SocketType socket); //////////////////////////////////////////////////////////// /// Set a socket as blocking or non-blocking /// - /// \param Socket : Socket to modify - /// \param Block : New blocking state of the socket + /// \param socket : Socket to modify + /// \param block : New blocking state of the socket /// //////////////////////////////////////////////////////////// - static void SetBlocking(SocketType Socket, bool Block); + static void SetBlocking(SocketType socket, bool block); //////////////////////////////////////////////////////////// /// Get the last socket error status diff --git a/include/SFML/System/Lock.hpp b/include/SFML/System/Lock.hpp index 6f84f7349..cca38f56b 100644 --- a/include/SFML/System/Lock.hpp +++ b/include/SFML/System/Lock.hpp @@ -46,10 +46,10 @@ public : //////////////////////////////////////////////////////////// /// Construct the lock with a target mutex (lock it) /// - /// @param Mutex : Mutex to lock + /// \param mutex : Mutex to lock /// //////////////////////////////////////////////////////////// - Lock(Mutex& Mutex); + Lock(Mutex& mutex); //////////////////////////////////////////////////////////// /// Destructor (unlocks the mutex) diff --git a/include/SFML/System/Randomizer.hpp b/include/SFML/System/Randomizer.hpp index cb9585e79..1bcdeba57 100644 --- a/include/SFML/System/Randomizer.hpp +++ b/include/SFML/System/Randomizer.hpp @@ -45,10 +45,10 @@ public : /// Set the seed for the generator. Using a known seed /// allows you to reproduce the same sequence of random number /// - /// \param Seed : Number to use as the seed + /// \param seed : Number to use as the seed /// //////////////////////////////////////////////////////////// - static void SetSeed(unsigned int Seed); + static void SetSeed(unsigned int seed); //////////////////////////////////////////////////////////// /// Get the seed used to generate random numbers the generator. @@ -61,24 +61,24 @@ public : //////////////////////////////////////////////////////////// /// Get a random float number in a given range /// - /// \return Start : Start of the range - /// \return End : End of the range + /// \return begin : Beginning of the range + /// \return end : End of the range /// - /// \return Random number in [Begin, End] + /// \return Random number in [begin, end] /// //////////////////////////////////////////////////////////// - static float Random(float Begin, float End); + static float Random(float begin, float end); //////////////////////////////////////////////////////////// /// Get a random integer number in a given range /// - /// \return Start : Start of the range - /// \return End : End of the range + /// \return begin : Beginning of the range + /// \return end : End of the range /// - /// \return Random number in [Begin, End] + /// \return Random number in [begin, end] /// //////////////////////////////////////////////////////////// - static int Random(int Begin, int End); + static int Random(int begin, int end); }; } // namespace sf diff --git a/include/SFML/System/Resource.hpp b/include/SFML/System/Resource.hpp index 8f5088dc5..bef0c6be9 100644 --- a/include/SFML/System/Resource.hpp +++ b/include/SFML/System/Resource.hpp @@ -60,10 +60,10 @@ protected : //////////////////////////////////////////////////////////// /// Copy constructor /// - /// \param Copy : Resource to copy + /// \param copy : Resource to copy /// //////////////////////////////////////////////////////////// - Resource(const Resource& Copy); + Resource(const Resource& copy); //////////////////////////////////////////////////////////// /// Destructor @@ -74,12 +74,12 @@ protected : //////////////////////////////////////////////////////////// /// Assignment operator /// - /// \param Other : Resource to copy + /// \param other : Resource to copy /// /// \return Reference to this /// //////////////////////////////////////////////////////////// - Resource& operator =(const Resource& Other); + Resource& operator =(const Resource& other); private : @@ -88,18 +88,18 @@ private : //////////////////////////////////////////////////////////// /// Connect a ResourcePtr to this resource /// - /// \param Observer : Observer to add + /// \param observer : Observer to add /// //////////////////////////////////////////////////////////// - void Connect(ResourcePtr& Observer) const; + void Connect(ResourcePtr& observer) const; //////////////////////////////////////////////////////////// /// Disconnect a ResourcePtr from this resource /// - /// \param Observer : Observer to remove + /// \param observer : Observer to remove /// //////////////////////////////////////////////////////////// - void Disconnect(ResourcePtr& Observer) const; + void Disconnect(ResourcePtr& observer) const; //////////////////////////////////////////////////////////// // Member data @@ -126,18 +126,18 @@ public : //////////////////////////////////////////////////////////// /// Construct from a raw resource /// - /// \param Resource : Internal resource + /// \param resource : Internal resource /// //////////////////////////////////////////////////////////// - ResourcePtr(const T* Resource); + ResourcePtr(const T* resource); //////////////////////////////////////////////////////////// /// Copy constructor /// - /// \param Copy : Instance to copy + /// \param copy : Instance to copy /// //////////////////////////////////////////////////////////// - ResourcePtr(const ResourcePtr& Copy); + ResourcePtr(const ResourcePtr& copy); //////////////////////////////////////////////////////////// /// Destructor @@ -148,22 +148,22 @@ public : //////////////////////////////////////////////////////////// /// Assignment operator from another ResourcePtr /// - /// \param Other : Resource pointer to assign + /// \param other : Resource pointer to assign /// /// \return Reference to this /// //////////////////////////////////////////////////////////// - ResourcePtr& operator =(const ResourcePtr& Other); + ResourcePtr& operator =(const ResourcePtr& other); //////////////////////////////////////////////////////////// /// Assignment operator from a raw resource /// - /// \param Resource : Resource to assign + /// \param resource : Resource to assign /// /// \return Reference to this /// //////////////////////////////////////////////////////////// - ResourcePtr& operator =(const T* Resource); + ResourcePtr& operator =(const T* resource); //////////////////////////////////////////////////////////// /// Cast operator to implicitely convert the resource pointer to diff --git a/include/SFML/System/Resource.inl b/include/SFML/System/Resource.inl index c4276a191..357cc5e44 100644 --- a/include/SFML/System/Resource.inl +++ b/include/SFML/System/Resource.inl @@ -72,9 +72,9 @@ Resource& Resource::operator =(const Resource&) /// Connect a ResourcePtr to this resource //////////////////////////////////////////////////////////// template -void Resource::Connect(ResourcePtr& Observer) const +void Resource::Connect(ResourcePtr& observer) const { - myObservers.insert(&Observer); + myObservers.insert(&observer); } @@ -82,7 +82,7 @@ void Resource::Connect(ResourcePtr& Observer) const /// Disconnect a ResourcePtr from this resource //////////////////////////////////////////////////////////// template -void Resource::Disconnect(ResourcePtr& Observer) const +void Resource::Disconnect(ResourcePtr& observer) const { - myObservers.erase(&Observer); + myObservers.erase(&observer); } diff --git a/include/SFML/System/ResourcePtr.inl b/include/SFML/System/ResourcePtr.inl index dbfcd0d76..2399bc04c 100644 --- a/include/SFML/System/ResourcePtr.inl +++ b/include/SFML/System/ResourcePtr.inl @@ -38,8 +38,8 @@ myResource(NULL) /// Construct from a raw resource //////////////////////////////////////////////////////////// template -ResourcePtr::ResourcePtr(const T* Resource) : -myResource(Resource) +ResourcePtr::ResourcePtr(const T* resource) : +myResource(resource) { if (myResource) myResource->Connect(*this); @@ -50,8 +50,8 @@ myResource(Resource) /// Copy constructor //////////////////////////////////////////////////////////// template -ResourcePtr::ResourcePtr(const ResourcePtr& Copy) : -myResource(Copy.myResource) +ResourcePtr::ResourcePtr(const ResourcePtr& copy) : +myResource(copy.myResource) { if (myResource) myResource->Connect(*this); @@ -73,12 +73,12 @@ ResourcePtr::~ResourcePtr() /// Assignment operator from another ResourcePtr //////////////////////////////////////////////////////////// template -ResourcePtr& ResourcePtr::operator =(const ResourcePtr& Other) +ResourcePtr& ResourcePtr::operator =(const ResourcePtr& other) { if (myResource) myResource->Disconnect(*this); - myResource = Other.myResource; + myResource = other.myResource; if (myResource) myResource->Connect(*this); @@ -91,12 +91,12 @@ ResourcePtr& ResourcePtr::operator =(const ResourcePtr& Other) /// Assignment operator from a raw resource //////////////////////////////////////////////////////////// template -ResourcePtr& ResourcePtr::operator =(const T* Resource) +ResourcePtr& ResourcePtr::operator =(const T* resource) { if (myResource) myResource->Disconnect(*this); - myResource = Resource; + myResource = resource; if (myResource) myResource->Connect(*this); diff --git a/include/SFML/System/Sleep.hpp b/include/SFML/System/Sleep.hpp index 7338cdfa1..279e6ad09 100644 --- a/include/SFML/System/Sleep.hpp +++ b/include/SFML/System/Sleep.hpp @@ -36,10 +36,10 @@ namespace sf //////////////////////////////////////////////////////////// /// Make the current thread sleep for a given time /// -/// \param Duration : Time to sleep, in seconds (must be >= 0) +/// \param duration : Time to sleep, in seconds (must be >= 0) /// //////////////////////////////////////////////////////////// -void SFML_API Sleep(float Duration); +void SFML_API Sleep(float duration); } // namespace sf diff --git a/include/SFML/System/Thread.hpp b/include/SFML/System/Thread.hpp index 4c123c738..4048b5e84 100644 --- a/include/SFML/System/Thread.hpp +++ b/include/SFML/System/Thread.hpp @@ -56,11 +56,11 @@ public : //////////////////////////////////////////////////////////// /// Construct the thread from a function pointer /// - /// \param Function : Entry point of the thread - /// \param UserData : Data to pass to the thread function (NULL by default) + /// \param function : Entry point of the thread + /// \param userData : Data to pass to the thread function (NULL by default) /// //////////////////////////////////////////////////////////// - Thread(FuncType Function, void* UserData = NULL); + Thread(FuncType function, void* userData = NULL); //////////////////////////////////////////////////////////// /// Virtual destructor diff --git a/include/SFML/System/ThreadLocal.hpp b/include/SFML/System/ThreadLocal.hpp index 37b95033c..9219ac619 100644 --- a/include/SFML/System/ThreadLocal.hpp +++ b/include/SFML/System/ThreadLocal.hpp @@ -54,10 +54,10 @@ public : //////////////////////////////////////////////////////////// /// Default constructor /// - /// \param Value : Optional value to initalize the variable (NULL by default) + /// \param value : Optional value to initalize the variable (NULL by default) /// //////////////////////////////////////////////////////////// - ThreadLocal(void* Value = NULL); + ThreadLocal(void* value = NULL); //////////////////////////////////////////////////////////// /// Destructor @@ -71,7 +71,7 @@ public : /// \param Value : Value of the variable for this thread /// //////////////////////////////////////////////////////////// - void SetValue(void* Value); + void SetValue(void* value); //////////////////////////////////////////////////////////// /// Retrieve the thread-specific value of the variable diff --git a/include/SFML/System/ThreadLocalPtr.hpp b/include/SFML/System/ThreadLocalPtr.hpp index ffc759373..cfdd1ab9c 100644 --- a/include/SFML/System/ThreadLocalPtr.hpp +++ b/include/SFML/System/ThreadLocalPtr.hpp @@ -44,10 +44,10 @@ public : //////////////////////////////////////////////////////////// /// Default constructor /// - /// \param Value : Optional value to initalize the variable (NULL by default) + /// \param value : Optional value to initalize the variable (NULL by default) /// //////////////////////////////////////////////////////////// - ThreadLocalPtr(T* Value = NULL); + ThreadLocalPtr(T* value = NULL); //////////////////////////////////////////////////////////// /// Operator * overload to return a reference to the variable @@ -76,22 +76,22 @@ public : //////////////////////////////////////////////////////////// /// Assignment operator /// - /// \param Value : New pointer value to assign for this thread + /// \param value : New pointer value to assign for this thread /// /// \return Reference to this /// //////////////////////////////////////////////////////////// - ThreadLocalPtr& operator =(T* Value); + ThreadLocalPtr& operator =(T* value); //////////////////////////////////////////////////////////// /// Assignment operator /// - /// \param Other : Other thread-local pointer value to assign + /// \param other : Other thread-local pointer value to assign /// /// \return Reference to this /// //////////////////////////////////////////////////////////// - ThreadLocalPtr& operator =(const ThreadLocalPtr& Other); + ThreadLocalPtr& operator =(const ThreadLocalPtr& other); }; } // namespace sf diff --git a/include/SFML/System/Unicode.hpp b/include/SFML/System/Unicode.hpp index f807fb36a..46a88c149 100644 --- a/include/SFML/System/Unicode.hpp +++ b/include/SFML/System/Unicode.hpp @@ -73,19 +73,19 @@ public : //////////////////////////////////////////////////////////// /// Construct the unicode text from any type of string /// - /// \param Str : String to convert + /// \param str : String to convert /// //////////////////////////////////////////////////////////// - Text(const char* Str); - Text(const wchar_t* Str); - Text(const Uint8* Str); - Text(const Uint16* Str); - Text(const Uint32* Str); - Text(const std::string& Str); - Text(const std::wstring& Str); - Text(const Unicode::UTF8String& Str); - Text(const Unicode::UTF16String& Str); - Text(const Unicode::UTF32String& Str); + Text(const char* str); + Text(const wchar_t* str); + Text(const Uint8* str); + Text(const Uint16* str); + Text(const Uint32* str); + Text(const std::string& str); + Text(const std::wstring& str); + Text(const Unicode::UTF8String& str); + Text(const Unicode::UTF16String& str); + Text(const Unicode::UTF32String& str); //////////////////////////////////////////////////////////// /// Operator to cast the text to any type of string @@ -111,158 +111,158 @@ public : /// Generic function to convert an UTF-32 characters range /// to an ANSI characters range, using the given locale /// - /// \param Begin : Iterator pointing to the beginning of the input sequence - /// \param End : Iterator pointing to the end of the input sequence - /// \param Output : Iterator pointing to the beginning of the output sequence - /// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) - /// \param Locale : Locale to use for conversion (uses the current one by default) + /// \param begin : Iterator pointing to the beginning of the input sequence + /// \param end : Iterator pointing to the end of the input sequence + /// \param output : Iterator pointing to the beginning of the output sequence + /// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) + /// \param locale : Locale to use for conversion (uses the current one by default) /// /// \return Iterator to the end of the output sequence which has been written /// //////////////////////////////////////////////////////////// template - static Out UTF32ToANSI(In Begin, In End, Out Output, char Replacement = '?', const std::locale& Locale = GetDefaultLocale()); + static Out UTF32ToANSI(In begin, In end, Out output, char replacement = '?', const std::locale& locale = GetDefaultLocale()); //////////////////////////////////////////////////////////// /// Generic function to convert an ANSI characters range /// to an UTF-32 characters range, using the given locale /// - /// \param Begin : Iterator pointing to the beginning of the input sequence - /// \param End : Iterator pointing to the end of the input sequence - /// \param Output : Iterator pointing to the beginning of the output sequence - /// \param Locale : Locale to use for conversion (uses the current one by default) + /// \param begin : Iterator pointing to the beginning of the input sequence + /// \param end : Iterator pointing to the end of the input sequence + /// \param output : Iterator pointing to the beginning of the output sequence + /// \param locale : Locale to use for conversion (uses the current one by default) /// /// \return Iterator to the end of the output sequence which has been written /// //////////////////////////////////////////////////////////// template - static Out ANSIToUTF32(In Begin, In End, Out Output, const std::locale& Locale = GetDefaultLocale()); + static Out ANSIToUTF32(In begin, In end, Out output, const std::locale& locale = GetDefaultLocale()); //////////////////////////////////////////////////////////// /// Generic function to convert an UTF-8 characters range /// to an UTF-16 characters range, using the given locale /// - /// \param Begin : Iterator pointing to the beginning of the input sequence - /// \param End : Iterator pointing to the end of the input sequence - /// \param Output : Iterator pointing to the beginning of the output sequence - /// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) + /// \param begin : Iterator pointing to the beginning of the input sequence + /// \param end : Iterator pointing to the end of the input sequence + /// \param output : Iterator pointing to the beginning of the output sequence + /// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) /// /// \return Iterator to the end of the output sequence which has been written /// //////////////////////////////////////////////////////////// template - static Out UTF8ToUTF16(In Begin, In End, Out Output, Uint16 Replacement = '?'); + static Out UTF8ToUTF16(In begin, In end, Out output, Uint16 replacement = '?'); //////////////////////////////////////////////////////////// /// Generic function to convert an UTF-8 characters range /// to an UTF-32 characters range, using the given locale /// - /// \param Begin : Iterator pointing to the beginning of the input sequence - /// \param End : Iterator pointing to the end of the input sequence - /// \param Output : Iterator pointing to the beginning of the output sequence - /// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) + /// \param begin : Iterator pointing to the beginning of the input sequence + /// \param end : Iterator pointing to the end of the input sequence + /// \param output : Iterator pointing to the beginning of the output sequence + /// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) /// /// \return Iterator to the end of the output sequence which has been written /// //////////////////////////////////////////////////////////// template - static Out UTF8ToUTF32(In Begin, In End, Out Output, Uint32 Replacement = '?'); + static Out UTF8ToUTF32(In begin, In end, Out output, Uint32 replacement = '?'); //////////////////////////////////////////////////////////// /// Generic function to convert an UTF-16 characters range /// to an UTF-8 characters range, using the given locale /// - /// \param Begin : Iterator pointing to the beginning of the input sequence - /// \param End : Iterator pointing to the end of the input sequence - /// \param Output : Iterator pointing to the beginning of the output sequence - /// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) + /// \param begin : Iterator pointing to the beginning of the input sequence + /// \param end : Iterator pointing to the end of the input sequence + /// \param output : Iterator pointing to the beginning of the output sequence + /// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) /// /// \return Iterator to the end of the output sequence which has been written /// //////////////////////////////////////////////////////////// template - static Out UTF16ToUTF8(In Begin, In End, Out Output, Uint8 Replacement = '?'); + static Out UTF16ToUTF8(In begin, In end, Out output, Uint8 replacement = '?'); //////////////////////////////////////////////////////////// /// Generic function to convert an UTF-16 characters range /// to an UTF-32 characters range, using the given locale /// - /// \param Begin : Iterator pointing to the beginning of the input sequence - /// \param End : Iterator pointing to the end of the input sequence - /// \param Output : Iterator pointing to the beginning of the output sequence - /// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) + /// \param begin : Iterator pointing to the beginning of the input sequence + /// \param end : Iterator pointing to the end of the input sequence + /// \param output : Iterator pointing to the beginning of the output sequence + /// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) /// /// \return Iterator to the end of the output sequence which has been written /// //////////////////////////////////////////////////////////// template - static Out UTF16ToUTF32(In Begin, In End, Out Output, Uint32 Replacement = '?'); + static Out UTF16ToUTF32(In begin, In end, Out output, Uint32 replacement = '?'); //////////////////////////////////////////////////////////// /// Generic function to convert an UTF-32 characters range /// to an UTF-8 characters range, using the given locale /// - /// \param Begin : Iterator pointing to the beginning of the input sequence - /// \param End : Iterator pointing to the end of the input sequence - /// \param Output : Iterator pointing to the beginning of the output sequence - /// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) + /// \param begin : Iterator pointing to the beginning of the input sequence + /// \param end : Iterator pointing to the end of the input sequence + /// \param output : Iterator pointing to the beginning of the output sequence + /// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) /// /// \return Iterator to the end of the output sequence which has been written /// //////////////////////////////////////////////////////////// template - static Out UTF32ToUTF8(In Begin, In End, Out Output, Uint8 Replacement = '?'); + static Out UTF32ToUTF8(In begin, In end, Out output, Uint8 replacement = '?'); //////////////////////////////////////////////////////////// /// Generic function to convert an UTF-32 characters range /// to an UTF-16 characters range, using the given locale /// - /// \param Begin : Iterator pointing to the beginning of the input sequence - /// \param End : Iterator pointing to the end of the input sequence - /// \param Output : Iterator pointing to the beginning of the output sequence - /// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) + /// \param begin : Iterator pointing to the beginning of the input sequence + /// \param end : Iterator pointing to the end of the input sequence + /// \param output : Iterator pointing to the beginning of the output sequence + /// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) /// /// \return Iterator to the end of the output sequence which has been written /// //////////////////////////////////////////////////////////// template - static Out UTF32ToUTF16(In Begin, In End, Out Output, Uint16 Replacement = '?'); + static Out UTF32ToUTF16(In begin, In end, Out output, Uint16 replacement = '?'); //////////////////////////////////////////////////////////// /// Get the number of characters composing an UTF-8 string /// - /// \param Begin : Iterator pointing to the beginning of the input sequence - /// \param End : Iterator pointing to the end of the input sequence + /// \param begin : Iterator pointing to the beginning of the input sequence + /// \param end : Iterator pointing to the end of the input sequence /// /// \return Count of the characters in the string /// //////////////////////////////////////////////////////////// template - static std::size_t GetUTF8Length(In Begin, In End); + static std::size_t GetUTF8Length(In begin, In end); //////////////////////////////////////////////////////////// /// Get the number of characters composing an UTF-16 string /// - /// \param Begin : Iterator pointing to the beginning of the input sequence - /// \param End : Iterator pointing to the end of the input sequence + /// \param begin : Iterator pointing to the beginning of the input sequence + /// \param end : Iterator pointing to the end of the input sequence /// /// \return Count of the characters in the string /// //////////////////////////////////////////////////////////// template - static std::size_t GetUTF16Length(In Begin, In End); + static std::size_t GetUTF16Length(In begin, In end); //////////////////////////////////////////////////////////// /// Get the number of characters composing an UTF-32 string /// - /// \param Begin : Iterator pointing to the beginning of the input sequence - /// \param End : Iterator pointing to the end of the input sequence + /// \param begin : Iterator pointing to the beginning of the input sequence + /// \param end : Iterator pointing to the end of the input sequence /// /// \return Count of the characters in the string /// //////////////////////////////////////////////////////////// template - static std::size_t GetUTF32Length(In Begin, In End); + static std::size_t GetUTF32Length(In begin, In end); private : diff --git a/include/SFML/System/Unicode.inl b/include/SFML/System/Unicode.inl index a16981103..5ddeaabe0 100644 --- a/include/SFML/System/Unicode.inl +++ b/include/SFML/System/Unicode.inl @@ -28,34 +28,34 @@ /// to an ANSI characters range, using the given locale //////////////////////////////////////////////////////////// template -inline Out Unicode::UTF32ToANSI(In Begin, In End, Out Output, char Replacement, const std::locale& Locale) +inline Out Unicode::UTF32ToANSI(In begin, In end, Out output, char replacement, const std::locale& locale) { #ifdef __MINGW32__ // MinGW has a almost no support for unicode stuff // As a consequence, the MinGW version of this function can only use the default locale // and ignores the one passed as parameter - while (Begin < End) + while (begin < end) { - char Char = 0; - if (wctomb(&Char, static_cast(*Begin++)) >= 0) - *Output++ = Char; - else if (Replacement) - *Output++ = Replacement; + char character = 0; + if (wctomb(&character, static_cast(*begin++)) >= 0) + *output++ = character; + else if (replacement) + *output++ = replacement; } #else // Get the facet of the locale which deals with character conversion - const std::ctype& Facet = std::use_facet< std::ctype >(Locale); + const std::ctype& facet = std::use_facet< std::ctype >(locale); // Use the facet to convert each character of the input string - while (Begin < End) - *Output++ = Facet.narrow(static_cast(*Begin++), Replacement); + while (begin < end) + *output++ = facet.narrow(static_cast(*begin++), replacement); #endif - return Output; + return output; } @@ -64,33 +64,33 @@ inline Out Unicode::UTF32ToANSI(In Begin, In End, Out Output, char Replacement, /// to an UTF-32 characters range, using the given locale //////////////////////////////////////////////////////////// template -inline Out Unicode::ANSIToUTF32(In Begin, In End, Out Output, const std::locale& Locale) +inline Out Unicode::ANSIToUTF32(In begin, In end, Out output, const std::locale& locale) { #ifdef __MINGW32__ // MinGW has a almost no support for unicode stuff // As a consequence, the MinGW version of this function can only use the default locale // and ignores the one passed as parameter - while (Begin < End) + while (begin < end) { - wchar_t Char = 0; - mbtowc(&Char, &*Begin, 1); + wchar_t character = 0; + mbtowc(&character, &*begin, 1); Begin++; - *Output++ = static_cast(Char); + *output++ = static_cast(character); } #else // Get the facet of the locale which deals with character conversion - const std::ctype& Facet = std::use_facet< std::ctype >(Locale); + const std::ctype& facet = std::use_facet< std::ctype >(locale); // Use the facet to convert each character of the input string - while (Begin < End) - *Output++ = static_cast(Facet.widen(*Begin++)); + while (begin < end) + *output++ = static_cast(facet.widen(*begin++)); #endif - return Output; + return output; } @@ -99,59 +99,59 @@ inline Out Unicode::ANSIToUTF32(In Begin, In End, Out Output, const std::locale& /// to an UTF-16 characters range, using the given locale //////////////////////////////////////////////////////////// template -inline Out Unicode::UTF8ToUTF16(In Begin, In End, Out Output, Uint16 Replacement) +inline Out Unicode::UTF8ToUTF16(In begin, In end, Out output, Uint16 replacement) { - while (Begin < End) + while (begin < end) { - Uint32 c = 0; - int TrailingBytes = UTF8TrailingBytes[static_cast(*Begin)]; - if (Begin + TrailingBytes < End) + Uint32 character = 0; + int trailingBytes = UTF8TrailingBytes[static_cast(*begin)]; + if (begin + trailingBytes < end) { // First decode the UTF-8 character - switch (TrailingBytes) + switch (trailingBytes) { - case 5 : c += *Begin++; c <<= 6; - case 4 : c += *Begin++; c <<= 6; - case 3 : c += *Begin++; c <<= 6; - case 2 : c += *Begin++; c <<= 6; - case 1 : c += *Begin++; c <<= 6; - case 0 : c += *Begin++; + case 5 : character += *begin++; character <<= 6; + case 4 : character += *begin++; character <<= 6; + case 3 : character += *begin++; character <<= 6; + case 2 : character += *begin++; character <<= 6; + case 1 : character += *begin++; character <<= 6; + case 0 : character += *begin++; } - c -= UTF8Offsets[TrailingBytes]; + character -= UTF8Offsets[trailingBytes]; // Then encode it in UTF-16 - if (c < 0xFFFF) + if (character < 0xFFFF) { // Character can be converted directly to 16 bits, just need to check it's in the valid range - if ((c >= 0xD800) && (c <= 0xDFFF)) + if ((character >= 0xD800) && (character <= 0xDFFF)) { // Invalid character (this range is reserved) - if (Replacement) - *Output++ = Replacement; + if (replacement) + *output++ = replacement; } else { // Valid character directly convertible to 16 bits - *Output++ = static_cast(c); + *Output++ = static_cast(character); } } - else if (c > 0x0010FFFF) + else if (character > 0x0010FFFF) { // Invalid character (greater than the maximum unicode value) - if (Replacement) - *Output++ = Replacement; + if (replacement) + *output++ = replacement; } else { // Character will be converted to 2 UTF-16 elements - c -= 0x0010000; - *Output++ = static_cast((c >> 10) + 0xD800); - *Output++ = static_cast((c & 0x3FFUL) + 0xDC00); + character -= 0x0010000; + *output++ = static_cast((character >> 10) + 0xD800); + *output++ = static_cast((character & 0x3FFUL) + 0xDC00); } } } - return Output; + return output; } @@ -160,42 +160,42 @@ inline Out Unicode::UTF8ToUTF16(In Begin, In End, Out Output, Uint16 Replacement /// to an UTF-32 characters range, using the given locale //////////////////////////////////////////////////////////// template -inline Out Unicode::UTF8ToUTF32(In Begin, In End, Out Output, Uint32 Replacement) +inline Out Unicode::UTF8ToUTF32(In begin, In end, Out output, Uint32 replacement) { - while (Begin < End) + while (begin < end) { - Uint32 c = 0; - int TrailingBytes = UTF8TrailingBytes[static_cast(*Begin)]; - if (Begin + TrailingBytes < End) + Uint32 character = 0; + int trailingBytes = UTF8TrailingBytes[static_cast(*begin)]; + if (begin + trailingBytes < end) { // First decode the UTF-8 character - switch (TrailingBytes) + switch (trailingBytes) { - case 5 : c += *Begin++; c <<= 6; - case 4 : c += *Begin++; c <<= 6; - case 3 : c += *Begin++; c <<= 6; - case 2 : c += *Begin++; c <<= 6; - case 1 : c += *Begin++; c <<= 6; - case 0 : c += *Begin++; + case 5 : character += *begin++; character <<= 6; + case 4 : character += *begin++; character <<= 6; + case 3 : character += *begin++; character <<= 6; + case 2 : character += *begin++; character <<= 6; + case 1 : character += *begin++; character <<= 6; + case 0 : character += *begin++; } - c -= UTF8Offsets[TrailingBytes]; + character -= UTF8Offsets[trailingBytes]; // Then write it if valid - if ((c < 0xD800) || (c > 0xDFFF)) + if ((character < 0xD800) || (character > 0xDFFF)) { // Valid UTF-32 character - *Output++ = c; + *output++ = character; } else { // Invalid UTF-32 character - if (Replacement) - *Output++ = Replacement; + if (replacement) + *output++ = replacement; } } } - return Output; + return output; } @@ -204,71 +204,71 @@ inline Out Unicode::UTF8ToUTF32(In Begin, In End, Out Output, Uint32 Replacement /// to an UTF-8 characters range, using the given locale //////////////////////////////////////////////////////////// template -inline Out Unicode::UTF16ToUTF8(In Begin, In End, Out Output, Uint8 Replacement) +inline Out Unicode::UTF16ToUTF8(In begin, In end, Out output, Uint8 replacement) { - while (Begin < End) + while (begin < end) { - Uint32 c = *Begin++; + Uint32 character = *begin++; // If it's a surrogate pair, first convert to a single UTF-32 character - if ((c >= 0xD800) && (c <= 0xDBFF)) + if ((character >= 0xD800) && (character <= 0xDBFF)) { - if (Begin < End) + if (begin < end) { // The second element is valid : convert the two elements to a UTF-32 character - Uint32 d = *Begin++; + Uint32 d = *begin++; if ((d >= 0xDC00) && (d <= 0xDFFF)) - c = static_cast(((c - 0xD800) << 10) + (d - 0xDC00) + 0x0010000); + character = static_cast(((character - 0xD800) << 10) + (d - 0xDC00) + 0x0010000); } else { // Invalid second element - if (Replacement) - *Output++ = Replacement; + if (replacement) + *output++ = replacement; } } // Then convert to UTF-8 - if (c > 0x0010FFFF) + if (character > 0x0010FFFF) { // Invalid character (greater than the maximum unicode value) - if (Replacement) - *Output++ = Replacement; + if (replacement) + *output++ = replacement; } else { // Valid character // Get number of bytes to write - int BytesToWrite = 1; - if (c < 0x80) BytesToWrite = 1; - else if (c < 0x800) BytesToWrite = 2; - else if (c < 0x10000) BytesToWrite = 3; - else if (c <= 0x0010FFFF) BytesToWrite = 4; + int bytesToWrite = 1; + if (character < 0x80) bytesToWrite = 1; + else if (character < 0x800) bytesToWrite = 2; + else if (character < 0x10000) bytesToWrite = 3; + else if (character <= 0x0010FFFF) bytesToWrite = 4; // Extract bytes to write - Uint8 Bytes[4]; - switch (BytesToWrite) + Uint8 bytes[4]; + switch (bytesToWrite) { - case 4 : Bytes[3] = static_cast((c | 0x80) & 0xBF); c >>= 6; - case 3 : Bytes[2] = static_cast((c | 0x80) & 0xBF); c >>= 6; - case 2 : Bytes[1] = static_cast((c | 0x80) & 0xBF); c >>= 6; - case 1 : Bytes[0] = static_cast (c | UTF8FirstBytes[BytesToWrite]); + case 4 : bytes[3] = static_cast((character | 0x80) & 0xBF); character >>= 6; + case 3 : bytes[2] = static_cast((character | 0x80) & 0xBF); character >>= 6; + case 2 : bytes[1] = static_cast((character | 0x80) & 0xBF); character >>= 6; + case 1 : bytes[0] = static_cast (character | UTF8FirstBytes[bytesToWrite]); } // Add them to the output - const Uint8* CurByte = Bytes; - switch (BytesToWrite) + const Uint8* currentByte = bytes; + switch (bytesToWrite) { - case 4 : *Output++ = *CurByte++; - case 3 : *Output++ = *CurByte++; - case 2 : *Output++ = *CurByte++; - case 1 : *Output++ = *CurByte++; + case 4 : *output++ = *currentByte++; + case 3 : *output++ = *currentByte++; + case 2 : *output++ = *currentByte++; + case 1 : *output++ = *currentByte++; } } } - return Output; + return output; } @@ -277,44 +277,44 @@ inline Out Unicode::UTF16ToUTF8(In Begin, In End, Out Output, Uint8 Replacement) /// to an UTF-32 characters range, using the given locale //////////////////////////////////////////////////////////// template -inline Out Unicode::UTF16ToUTF32(In Begin, In End, Out Output, Uint32 Replacement) +inline Out Unicode::UTF16ToUTF32(In begin, In end, Out output, Uint32 replacement) { - while (Begin < End) + while (begin < end) { - Uint16 c = *Begin++; - if ((c >= 0xD800) && (c <= 0xDBFF)) + Uint16 character = *begin++; + if ((character >= 0xD800) && (character <= 0xDBFF)) { // We have a surrogate pair, ie. a character composed of two elements - if (Begin < End) + if (begin < end) { - Uint16 d = *Begin++; + Uint16 d = *begin++; if ((d >= 0xDC00) && (d <= 0xDFFF)) { // The second element is valid : convert the two elements to a UTF-32 character - *Output++ = static_cast(((c - 0xD800) << 10) + (d - 0xDC00) + 0x0010000); + *output++ = static_cast(((character - 0xD800) << 10) + (d - 0xDC00) + 0x0010000); } else { // Invalid second element - if (Replacement) - *Output++ = Replacement; + if (replacement) + *output++ = replacement; } } } - else if ((c >= 0xDC00) && (c <= 0xDFFF)) + else if ((character >= 0xDC00) && (character <= 0xDFFF)) { // Invalid character - if (Replacement) - *Output++ = Replacement; + if (replacement) + *output++ = replacement; } else { // Valid character directly convertible to UTF-32 - *Output++ = static_cast(c); + *output++ = static_cast(character); } } - return Output; + return output; } @@ -323,51 +323,51 @@ inline Out Unicode::UTF16ToUTF32(In Begin, In End, Out Output, Uint32 Replacemen /// to an UTF-8 characters range, using the given locale //////////////////////////////////////////////////////////// template -inline Out Unicode::UTF32ToUTF8(In Begin, In End, Out Output, Uint8 Replacement) +inline Out Unicode::UTF32ToUTF8(In begin, In end, Out output, Uint8 replacement) { - while (Begin < End) + while (begin < end) { - Uint32 c = *Begin++; - if (c > 0x0010FFFF) + Uint32 character = *begin++; + if (character > 0x0010FFFF) { // Invalid character (greater than the maximum unicode value) - if (Replacement) - *Output++ = Replacement; + if (replacement) + *output++ = replacement; } else { // Valid character // Get number of bytes to write - int BytesToWrite = 1; - if (c < 0x80) BytesToWrite = 1; - else if (c < 0x800) BytesToWrite = 2; - else if (c < 0x10000) BytesToWrite = 3; - else if (c <= 0x0010FFFF) BytesToWrite = 4; + int bytesToWrite = 1; + if (character < 0x80) bytesToWrite = 1; + else if (character < 0x800) bytesToWrite = 2; + else if (character < 0x10000) bytesToWrite = 3; + else if (character <= 0x0010FFFF) bytesToWrite = 4; // Extract bytes to write - Uint8 Bytes[4]; - switch (BytesToWrite) + Uint8 bytes[4]; + switch (bytesToWrite) { - case 4 : Bytes[3] = static_cast((c | 0x80) & 0xBF); c >>= 6; - case 3 : Bytes[2] = static_cast((c | 0x80) & 0xBF); c >>= 6; - case 2 : Bytes[1] = static_cast((c | 0x80) & 0xBF); c >>= 6; - case 1 : Bytes[0] = static_cast (c | UTF8FirstBytes[BytesToWrite]); + case 4 : bytes[3] = static_cast((character | 0x80) & 0xBF); character >>= 6; + case 3 : bytes[2] = static_cast((character | 0x80) & 0xBF); character >>= 6; + case 2 : bytes[1] = static_cast((character | 0x80) & 0xBF); character >>= 6; + case 1 : bytes[0] = static_cast (character | UTF8FirstBytes[bytesToWrite]); } // Add them to the output - const Uint8* CurByte = Bytes; - switch (BytesToWrite) + const Uint8* currentByte = bytes; + switch (bytesToWrite) { - case 4 : *Output++ = *CurByte++; - case 3 : *Output++ = *CurByte++; - case 2 : *Output++ = *CurByte++; - case 1 : *Output++ = *CurByte++; + case 4 : *output++ = *currentByte++; + case 3 : *output++ = *currentByte++; + case 2 : *output++ = *currentByte++; + case 1 : *output++ = *currentByte++; } } } - return Output; + return output; } @@ -376,42 +376,42 @@ inline Out Unicode::UTF32ToUTF8(In Begin, In End, Out Output, Uint8 Replacement) /// to an UTF-16 characters range, using the given locale //////////////////////////////////////////////////////////// template -inline Out Unicode::UTF32ToUTF16(In Begin, In End, Out Output, Uint16 Replacement) +inline Out Unicode::UTF32ToUTF16(In begin, In end, Out output, Uint16 replacement) { - while (Begin < End) + while (begin < end) { - Uint32 c = *Begin++; - if (c < 0xFFFF) + Uint32 character = *begin++; + if (character < 0xFFFF) { // Character can be converted directly to 16 bits, just need to check it's in the valid range - if ((c >= 0xD800) && (c <= 0xDFFF)) + if ((character >= 0xD800) && (character <= 0xDFFF)) { // Invalid character (this range is reserved) - if (Replacement) - *Output++ = Replacement; + if (replacement) + *output++ = replacement; } else { // Valid character directly convertible to 16 bits - *Output++ = static_cast(c); + *output++ = static_cast(character); } } - else if (c > 0x0010FFFF) + else if (character > 0x0010FFFF) { // Invalid character (greater than the maximum unicode value) - if (Replacement) - *Output++ = Replacement; + if (replacement) + *output++ = replacement; } else { // Character will be converted to 2 UTF-16 elements - c -= 0x0010000; - *Output++ = static_cast((c >> 10) + 0xD800); - *Output++ = static_cast((c & 0x3FFUL) + 0xDC00); + character -= 0x0010000; + *output++ = static_cast((character >> 10) + 0xD800); + *output++ = static_cast((character & 0x3FFUL) + 0xDC00); } } - return Output; + return output; } @@ -419,19 +419,19 @@ inline Out Unicode::UTF32ToUTF16(In Begin, In End, Out Output, Uint16 Replacemen /// Get the number of characters composing an UTF-8 string //////////////////////////////////////////////////////////// template -inline std::size_t Unicode::GetUTF8Length(In Begin, In End) +inline std::size_t Unicode::GetUTF8Length(In begin, In end) { - std::size_t Length = 0; - while (Begin < End) + std::size_t length = 0; + while (begin < end) { - int NbBytes = UTF8TrailingBytes[static_cast(*Begin)]; - if (Begin + NbBytes < End) - ++Length; + int nbBytes = UTF8TrailingBytes[static_cast(*begin)]; + if (begin + nbBytes < end) + ++length; - Begin += NbBytes + 1; + begin += nbBytes + 1; } - return Length; + return length; } @@ -439,28 +439,28 @@ inline std::size_t Unicode::GetUTF8Length(In Begin, In End) /// Get the number of characters composing an UTF-16 string //////////////////////////////////////////////////////////// template -inline std::size_t Unicode::GetUTF16Length(In Begin, In End) +inline std::size_t Unicode::GetUTF16Length(In begin, In end) { - std::size_t Length = 0; - while (Begin < End) + std::size_t length = 0; + while (begin < end) { - if ((*Begin >= 0xD800) && (*Begin <= 0xDBFF)) + if ((*begin >= 0xD800) && (*begin <= 0xDBFF)) { - ++Begin; - if ((Begin < End) && ((*Begin >= 0xDC00) && (*Begin <= 0xDFFF))) + ++begin; + if ((begin < end) && ((*begin >= 0xDC00) && (*begin <= 0xDFFF))) { - ++Length; + ++length; } } else { - ++Length; + ++length; } - ++Begin; + ++begin; } - return Length; + return length; } @@ -468,7 +468,7 @@ inline std::size_t Unicode::GetUTF16Length(In Begin, In End) /// Get the number of characters composing an UTF-32 string //////////////////////////////////////////////////////////// template -inline std::size_t Unicode::GetUTF32Length(In Begin, In End) +inline std::size_t Unicode::GetUTF32Length(In begin, In end) { - return End - Begin; + return end - begin; } diff --git a/include/SFML/System/Vector2.hpp b/include/SFML/System/Vector2.hpp index 0a5267c7b..71208ddbf 100644 --- a/include/SFML/System/Vector2.hpp +++ b/include/SFML/System/Vector2.hpp @@ -63,145 +63,145 @@ public : //////////////////////////////////////////////////////////// /// Operator - overload ; returns the opposite of a vector /// -/// \param V : Vector to negate +/// \param left : Vector to negate /// -/// \return -V +/// \return -left /// //////////////////////////////////////////////////////////// template -Vector2 operator -(const Vector2& V); +Vector2 operator -(const Vector2& left); //////////////////////////////////////////////////////////// /// Operator += overload ; add two vectors and assign to the first op /// -/// \param V1 : First vector -/// \param V2 : Second vector +/// \param left : First vector +/// \param right : Second vector /// -/// \return V1 + V2 +/// \return left + right /// //////////////////////////////////////////////////////////// template -Vector2& operator +=(Vector2& V1, const Vector2& V2); +Vector2& operator +=(Vector2& left, const Vector2& right); //////////////////////////////////////////////////////////// /// Operator -= overload ; subtract two vectors and assign to the first op /// -/// \param V1 : First vector -/// \param V2 : Second vector +/// \param left : First vector +/// \param right : Second vector /// -/// \return V1 - V2 +/// \return left - right /// //////////////////////////////////////////////////////////// template -Vector2& operator -=(Vector2& V1, const Vector2& V2); +Vector2& operator -=(Vector2& left, const Vector2& right); //////////////////////////////////////////////////////////// /// Operator + overload ; adds two vectors /// -/// \param V1 : First vector -/// \param V2 : Second vector +/// \param left : First vector +/// \param right : Second vector /// -/// \return V1 + V2 +/// \return left + right /// //////////////////////////////////////////////////////////// template -Vector2 operator +(const Vector2& V1, const Vector2& V2); +Vector2 operator +(const Vector2& left, const Vector2& right); //////////////////////////////////////////////////////////// /// Operator - overload ; subtracts two vectors /// -/// \param V1 : First vector -/// \param V2 : Second vector +/// \param left : First vector +/// \param right : Second vector /// -/// \return V1 - V2 +/// \return left - right /// //////////////////////////////////////////////////////////// template -Vector2 operator -(const Vector2& V1, const Vector2& V2); +Vector2 operator -(const Vector2& left, const Vector2& right); //////////////////////////////////////////////////////////// /// Operator * overload ; multiply a vector by a scalar value /// -/// \param V : Vector -/// \param X : Scalar value +/// \param left : Vector +/// \param right : Scalar value /// -/// \return V * X +/// \return left * right /// //////////////////////////////////////////////////////////// template -Vector2 operator *(const Vector2& V, T X); +Vector2 operator *(const Vector2& left, T right); //////////////////////////////////////////////////////////// /// Operator * overload ; multiply a scalar value by a vector /// -/// \param X : Scalar value -/// \param V : Vector +/// \param left : Scalar value +/// \param right : Vector /// -/// \return X * V +/// \return left * right /// //////////////////////////////////////////////////////////// template -Vector2 operator *(T X, const Vector2& V); +Vector2 operator *(T left, const Vector2& right); //////////////////////////////////////////////////////////// /// Operator *= overload ; multiply-assign a vector by a scalar value /// -/// \param V : Vector -/// \param X : Scalar value +/// \param left : Vector +/// \param right : Scalar value /// -/// \return V * X +/// \return left * right /// //////////////////////////////////////////////////////////// template -Vector2& operator *=(Vector2& V, T X); +Vector2& operator *=(Vector2& left, T right); //////////////////////////////////////////////////////////// /// Operator / overload ; divide a vector by a scalar value /// -/// \param V : Vector -/// \param X : Scalar value +/// \param left : Vector +/// \param right : Scalar value /// -/// \return V / X +/// \return left / right /// //////////////////////////////////////////////////////////// template -Vector2 operator /(const Vector2& V, T X); +Vector2 operator /(const Vector2& left, T right); //////////////////////////////////////////////////////////// /// Operator /= overload ; divide-assign a vector by a scalar value /// -/// \param V : Vector -/// \param X : Scalar value +/// \param left : Vector +/// \param right : Scalar value /// -/// \return V / X +/// \return left / right /// //////////////////////////////////////////////////////////// template -Vector2& operator /=(Vector2& V, T X); +Vector2& operator /=(Vector2& left, T right); //////////////////////////////////////////////////////////// /// Operator == overload ; compares the equality of two vectors /// -/// \param V1 : First vector -/// \param V2 : Second vector +/// \param left : First vector +/// \param right : Second vector /// -/// \return True if V1 is equal to V2 +/// \return True if left is equal to right /// //////////////////////////////////////////////////////////// template -bool operator ==(const Vector2& V1, const Vector2& V2); +bool operator ==(const Vector2& left, const Vector2& right); //////////////////////////////////////////////////////////// /// Operator != overload ; compares the difference of two vectors /// -/// \param V1 : First vector -/// \param V2 : Second vector +/// \param left : First vector +/// \param right : Second vector /// -/// \return True if V1 is different than V2 +/// \return True if left is different than right /// //////////////////////////////////////////////////////////// template -bool operator !=(const Vector2& V1, const Vector2& V2); +bool operator !=(const Vector2& left, const Vector2& right); #include diff --git a/include/SFML/System/Vector2.inl b/include/SFML/System/Vector2.inl index febd49366..4f3394518 100644 --- a/include/SFML/System/Vector2.inl +++ b/include/SFML/System/Vector2.inl @@ -51,9 +51,9 @@ y(Y) /// Operator - overload ; returns the opposite of a vector //////////////////////////////////////////////////////////// template -Vector2 operator -(const Vector2& V) +Vector2 operator -(const Vector2& left) { - return Vector2(-V.x, -V.y); + return Vector2(-left.x, -left.y); } @@ -61,12 +61,12 @@ Vector2 operator -(const Vector2& V) /// Operator += overload ; add two vectors and assign to the first op //////////////////////////////////////////////////////////// template -Vector2& operator +=(Vector2& V1, const Vector2& V2) +Vector2& operator +=(Vector2& left, const Vector2& right) { - V1.x += V2.x; - V1.y += V2.y; + left.x += right.x; + left.y += right.y; - return V1; + return left; } @@ -74,12 +74,12 @@ Vector2& operator +=(Vector2& V1, const Vector2& V2) /// Operator -= overload ; subtract two vectors and assign to the first op //////////////////////////////////////////////////////////// template -Vector2& operator -=(Vector2& V1, const Vector2& V2) +Vector2& operator -=(Vector2& left, const Vector2& right) { - V1.x -= V2.x; - V1.y -= V2.y; + left.x -= right.x; + left.y -= right.y; - return V1; + return left; } @@ -87,9 +87,9 @@ Vector2& operator -=(Vector2& V1, const Vector2& V2) /// Operator + overload ; adds two vectors //////////////////////////////////////////////////////////// template -Vector2 operator +(const Vector2& V1, const Vector2& V2) +Vector2 operator +(const Vector2& left, const Vector2& right) { - return Vector2(V1.x + V2.x, V1.y + V2.y); + return Vector2(left.x + right.x, left.y + right.y); } @@ -97,9 +97,9 @@ Vector2 operator +(const Vector2& V1, const Vector2& V2) /// Operator - overload ; subtracts two vectors //////////////////////////////////////////////////////////// template -Vector2 operator -(const Vector2& V1, const Vector2& V2) +Vector2 operator -(const Vector2& left, const Vector2& right) { - return Vector2(V1.x - V2.x, V1.y - V2.y); + return Vector2(left.x - right.x, left.y - right.y); } @@ -107,9 +107,9 @@ Vector2 operator -(const Vector2& V1, const Vector2& V2) /// Operator * overload ; multiply a vector by a scalar value //////////////////////////////////////////////////////////// template -Vector2 operator *(const Vector2& V, T X) +Vector2 operator *(const Vector2& left, T right) { - return Vector2(V.x * X, V.y * X); + return Vector2(left.x * right, left.y * right); } @@ -117,9 +117,9 @@ Vector2 operator *(const Vector2& V, T X) /// Operator * overload ; multiply a scalar value by a vector //////////////////////////////////////////////////////////// template -Vector2 operator *(T X, const Vector2& V) +Vector2 operator *(T left, const Vector2& right) { - return Vector2(V.x * X, V.y * X); + return Vector2(right.x * left, right.y * left); } @@ -127,12 +127,12 @@ Vector2 operator *(T X, const Vector2& V) /// Operator *= overload ; multiply-assign a vector by a scalar value //////////////////////////////////////////////////////////// template -Vector2& operator *=(Vector2& V, T X) +Vector2& operator *=(Vector2& left, T right) { - V.x *= X; - V.y *= X; + left.x *= right; + left.y *= right; - return V; + return left; } @@ -140,9 +140,9 @@ Vector2& operator *=(Vector2& V, T X) /// Operator / overload ; divide a vector by a scalar value //////////////////////////////////////////////////////////// template -Vector2 operator /(const Vector2& V, T X) +Vector2 operator /(const Vector2& left, T right) { - return Vector2(V.x / X, V.y / X); + return Vector2(left.x / right, left.y / right); } @@ -150,12 +150,12 @@ Vector2 operator /(const Vector2& V, T X) /// Operator /= overload ; divide-assign a vector by a scalar value //////////////////////////////////////////////////////////// template -Vector2& operator /=(Vector2& V, T X) +Vector2& operator /=(Vector2& left, T right) { - V.x /= X; - V.y /= X; + left.x /= right; + left.y /= right; - return V; + return left; } @@ -163,9 +163,9 @@ Vector2& operator /=(Vector2& V, T X) /// Operator == overload ; compares the equality of two vectors //////////////////////////////////////////////////////////// template -bool operator ==(const Vector2& V1, const Vector2& V2) +bool operator ==(const Vector2& left, const Vector2& right) { - return (V1.x == V2.x) && (V1.y == V2.y); + return (left.x == right.x) && (left.y == right.y); } @@ -173,7 +173,7 @@ bool operator ==(const Vector2& V1, const Vector2& V2) /// Operator != overload ; compares the difference of two vectors //////////////////////////////////////////////////////////// template -bool operator !=(const Vector2& V1, const Vector2& V2) +bool operator !=(const Vector2& left, const Vector2& right) { - return (V1.x != V2.x) || (V1.y != V2.y); + return (left.x != right.x) || (left.y != right.y); } diff --git a/include/SFML/System/Vector3.hpp b/include/SFML/System/Vector3.hpp index 6ab4b84c1..073b9cf81 100644 --- a/include/SFML/System/Vector3.hpp +++ b/include/SFML/System/Vector3.hpp @@ -65,145 +65,145 @@ public : //////////////////////////////////////////////////////////// /// Operator - overload ; returns the opposite of a vector /// -/// \param V : Vector to negate +/// \param left : Vector to negate /// -/// \return -V +/// \return -left /// //////////////////////////////////////////////////////////// template -Vector3 operator -(const Vector3& V); +Vector3 operator -(const Vector3& left); //////////////////////////////////////////////////////////// /// Operator += overload ; add two vectors and assign to the first op /// -/// \param V1 : First vector -/// \param V2 : Second vector +/// \param left : First vector +/// \param right : Second vector /// -/// \return V1 + V2 +/// \return left + V2 /// //////////////////////////////////////////////////////////// template -Vector3& operator +=(Vector3& V1, const Vector3& V2); +Vector3& operator +=(Vector3& left, const Vector3& right); //////////////////////////////////////////////////////////// /// Operator -= overload ; subtract two vectors and assign to the first op /// -/// \param V1 : First vector -/// \param V2 : Second vector +/// \param left : First vector +/// \param right : Second vector /// -/// \return V1 - V2 +/// \return left - right /// //////////////////////////////////////////////////////////// template -Vector3& operator -=(Vector3& V1, const Vector3& V2); +Vector3& operator -=(Vector3& left, const Vector3& right); //////////////////////////////////////////////////////////// /// Operator + overload ; adds two vectors /// -/// \param V1 : First vector -/// \param V2 : Second vector +/// \param left : First vector +/// \param right : Second vector /// -/// \return V1 + V2 +/// \return left + right /// //////////////////////////////////////////////////////////// template -Vector3 operator +(const Vector3& V1, const Vector3& V2); +Vector3 operator +(const Vector3& left, const Vector3& right); //////////////////////////////////////////////////////////// /// Operator - overload ; subtracts two vectors /// -/// \param V1 : First vector -/// \param V2 : Second vector +/// \param left : First vector +/// \param right : Second vector /// -/// \return V1 - V2 +/// \return left - rightright /// //////////////////////////////////////////////////////////// template -Vector3 operator -(const Vector3& V1, const Vector3& V2); +Vector3 operator -(const Vector3& left, const Vector3& right); //////////////////////////////////////////////////////////// /// Operator * overload ; multiply a vector by a scalar value /// -/// \param V : Vector -/// \param X : Scalar value +/// \param left : Vector +/// \param right : Scalar value /// -/// \return V * X +/// \return left * right /// //////////////////////////////////////////////////////////// template -Vector3 operator *(const Vector3& V, T X); +Vector3 operator *(const Vector3& left, T right); //////////////////////////////////////////////////////////// /// Operator * overload ; multiply a scalar value by a vector /// -/// \param X : Scalar value -/// \param V : Vector +/// \param left : Scalar value +/// \param right : Vector /// -/// \return X * V +/// \return left * right /// //////////////////////////////////////////////////////////// template -Vector3 operator *(T X, const Vector3& V); +Vector3 operator *(T left, const Vector3& right); //////////////////////////////////////////////////////////// /// Operator *= overload ; multiply-assign a vector by a scalar value /// -/// \param V : Vector -/// \param X : Scalar value +/// \param left : Vector +/// \param right : Scalar value /// -/// \return V * X +/// \return left * right /// //////////////////////////////////////////////////////////// template -Vector3& operator *=(Vector3& V, T X); +Vector3& operator *=(Vector3& left, T right); //////////////////////////////////////////////////////////// /// Operator / overload ; divide a vector by a scalar value /// -/// \param V : Vector -/// \param X : Scalar value +/// \param left : Vector +/// \param right : Scalar value /// -/// \return V / X +/// \return left / right /// //////////////////////////////////////////////////////////// template -Vector3 operator /(const Vector3& V, T X); +Vector3 operator /(const Vector3& left, T right); //////////////////////////////////////////////////////////// /// Operator /= overload ; divide-assign a vector by a scalar value /// -/// \param V : Vector -/// \param X : Scalar value +/// \param left : Vector +/// \param right : Scalar value /// -/// \return V / X +/// \return left / right /// //////////////////////////////////////////////////////////// template -Vector3& operator /=(Vector3& V, T X); +Vector3& operator /=(Vector3& left, T right); //////////////////////////////////////////////////////////// /// Operator == overload ; compares the equality of two vectors /// -/// \param V1 : First vector -/// \param V2 : Second vector +/// \param left : First vector +/// \param right : Second vector /// -/// \return True if V1 is equal to V2 +/// \return True if left is equal to right /// //////////////////////////////////////////////////////////// template -bool operator ==(const Vector3& V1, const Vector3& V2); +bool operator ==(const Vector3& left, const Vector3& right); //////////////////////////////////////////////////////////// /// Operator != overload ; compares the difference of two vectors /// -/// \param V1 : First vector -/// \param V2 : Second vector +/// \param left : First vector +/// \param right : Second vector /// -/// \return True if V1 is different than V2 +/// \return True if left is different than right /// //////////////////////////////////////////////////////////// template -bool operator !=(const Vector3& V1, const Vector3& V2); +bool operator !=(const Vector3& left, const Vector3& right); #include diff --git a/include/SFML/System/Vector3.inl b/include/SFML/System/Vector3.inl index 859460180..ccae26700 100644 --- a/include/SFML/System/Vector3.inl +++ b/include/SFML/System/Vector3.inl @@ -53,9 +53,9 @@ z(Z) /// Operator - overload ; returns the opposite of a vector //////////////////////////////////////////////////////////// template -Vector3 operator -(const Vector3& V) +Vector3 operator -(const Vector3& left) { - return Vector3(-V.x, -V.y, -V.z); + return Vector3(-left.x, -left.y, -left.z); } @@ -63,13 +63,13 @@ Vector3 operator -(const Vector3& V) /// Operator += overload ; add two vectors and assign to the first op //////////////////////////////////////////////////////////// template -Vector3& operator +=(Vector3& V1, const Vector3& V2) +Vector3& operator +=(Vector3& left, const Vector3& right) { - V1.x += V2.x; - V1.y += V2.y; - V1.z += V2.z; + left.x += right.x; + left.y += right.y; + left.z += right.z; - return V1; + return left; } @@ -77,13 +77,13 @@ Vector3& operator +=(Vector3& V1, const Vector3& V2) /// Operator -= overload ; subtract two vectors and assign to the first op //////////////////////////////////////////////////////////// template -Vector3& operator -=(Vector3& V1, const Vector3& V2) +Vector3& operator -=(Vector3& left, const Vector3& right) { - V1.x -= V2.x; - V1.y -= V2.y; - V1.z -= V2.z; + left.x -= right.x; + left.y -= right.y; + left.z -= right.z; - return V1; + return left; } @@ -91,9 +91,9 @@ Vector3& operator -=(Vector3& V1, const Vector3& V2) /// Operator + overload ; adds two vectors //////////////////////////////////////////////////////////// template -Vector3 operator +(const Vector3& V1, const Vector3& V2) +Vector3 operator +(const Vector3& left, const Vector3& right) { - return Vector3(V1.x + V2.x, V1.y + V2.y, V1.z + V2.z); + return Vector3(left.x + right.x, left.y + right.y, left.z + right.z); } @@ -101,9 +101,9 @@ Vector3 operator +(const Vector3& V1, const Vector3& V2) /// Operator - overload ; subtracts two vectors //////////////////////////////////////////////////////////// template -Vector3 operator -(const Vector3& V1, const Vector3& V2) +Vector3 operator -(const Vector3& left, const Vector3& right) { - return Vector3(V1.x - V2.x, V1.y - V2.y, V1.z - V2.z); + return Vector3(left.x - right.x, left.y - right.y, left.z - right.z); } @@ -111,9 +111,9 @@ Vector3 operator -(const Vector3& V1, const Vector3& V2) /// Operator * overload ; multiply a vector by a scalar value //////////////////////////////////////////////////////////// template -Vector3 operator *(const Vector3& V, T X) +Vector3 operator *(const Vector3& left, T right) { - return Vector3(V.x * X, V.y * X, V.z * X); + return Vector3(left.x * right, left.y * right, left.z * right); } @@ -121,9 +121,9 @@ Vector3 operator *(const Vector3& V, T X) /// Operator * overload ; multiply a scalar value by a vector //////////////////////////////////////////////////////////// template -Vector3 operator *(T X, const Vector3& V) +Vector3 operator *(T left, const Vector3& right) { - return Vector3(V.x * X, V.y * X, V.z * X); + return Vector3(right.x * left, right.y * left, right.z * left); } @@ -131,13 +131,13 @@ Vector3 operator *(T X, const Vector3& V) /// Operator *= overload ; multiply-assign a vector by a scalar value //////////////////////////////////////////////////////////// template -Vector3& operator *=(Vector3& V, T X) +Vector3& operator *=(Vector3& left, T right) { - V.x *= X; - V.y *= X; - V.z *= X; + left.x *= right; + left.y *= right; + left.z *= right; - return V; + return left; } @@ -145,9 +145,9 @@ Vector3& operator *=(Vector3& V, T X) /// Operator / overload ; divide a vector by a scalar value //////////////////////////////////////////////////////////// template -Vector3 operator /(const Vector3& V, T X) +Vector3 operator /(const Vector3& left, T right) { - return Vector3(V.x / X, V.y / X, V.z / X); + return Vector3(left.x / right, left.y / right, left.z / right); } @@ -155,13 +155,13 @@ Vector3 operator /(const Vector3& V, T X) /// Operator /= overload ; divide-assign a vector by a scalar value //////////////////////////////////////////////////////////// template -Vector3& operator /=(Vector3& V, T X) +Vector3& operator /=(Vector3& left, T right) { - V.x /= X; - V.y /= X; - V.z /= X; + left.x /= right; + left.y /= right; + left.z /= right; - return V; + return left; } @@ -169,9 +169,9 @@ Vector3& operator /=(Vector3& V, T X) /// Operator == overload ; compares the equality of two vectors //////////////////////////////////////////////////////////// template -bool operator ==(const Vector3& V1, const Vector3& V2) +bool operator ==(const Vector3& left, const Vector3& V2) { - return (V1.x == V2.x) && (V1.y == V2.y) && (V1.z == V2.z); + return (left.x == right.x) && (left.y == right.y) && (left.z == right.z); } @@ -179,7 +179,7 @@ bool operator ==(const Vector3& V1, const Vector3& V2) /// Operator != overload ; compares the difference of two vectors //////////////////////////////////////////////////////////// template -bool operator !=(const Vector3& V1, const Vector3& V2) +bool operator !=(const Vector3& left, const Vector3& right) { - return (V1.x != V2.x) || (V1.y != V2.y) || (V1.z != V2.z); + return (left.x != right.x) || (left.y != right.y) || (left.z != right.z); } diff --git a/include/SFML/Window/Context.hpp b/include/SFML/Window/Context.hpp index aeeaa49e8..57901ead5 100644 --- a/include/SFML/Window/Context.hpp +++ b/include/SFML/Window/Context.hpp @@ -54,9 +54,9 @@ namespace priv /// by default. /// /// \code -/// void ThreadedFunc(void*) +/// void ThreadFunction(void*) /// { -/// sf::Context Ctx; +/// sf::Context context; /// // from now on, you have a valid context /// /// // you can make OpenGL calls @@ -89,10 +89,10 @@ public : //////////////////////////////////////////////////////////// /// Activate or deactivate explicitely the context /// - /// \param Active True to activate, false to deactivate + /// \param active : True to activate, false to deactivate /// //////////////////////////////////////////////////////////// - void SetActive(bool Active); + void SetActive(bool active); private : diff --git a/include/SFML/Window/ContextSettings.hpp b/include/SFML/Window/ContextSettings.hpp index 88cf97158..9f26b9c34 100644 --- a/include/SFML/Window/ContextSettings.hpp +++ b/include/SFML/Window/ContextSettings.hpp @@ -37,15 +37,15 @@ struct ContextSettings //////////////////////////////////////////////////////////// /// Default constructor /// - /// \param Depth : Depth buffer bits (24 by default) - /// \param Stencil : Stencil buffer bits (8 by default) - /// \param Antialiasing : Antialiasing level (0 by default) + /// \param depth : Depth buffer bits (24 by default) + /// \param stencil : Stencil buffer bits (8 by default) + /// \param antialiasing : Antialiasing level (0 by default) /// //////////////////////////////////////////////////////////// - explicit ContextSettings(unsigned int Depth = 24, unsigned int Stencil = 8, unsigned int Antialiasing = 0) : - DepthBits (Depth), - StencilBits (Stencil), - AntialiasingLevel(Antialiasing) + explicit ContextSettings(unsigned int depth = 24, unsigned int stencil = 8, unsigned int antialiasing = 0) : + DepthBits (depth), + StencilBits (stencil), + AntialiasingLevel(antialiasing) { } diff --git a/include/SFML/Window/Input.hpp b/include/SFML/Window/Input.hpp index fbac66a4e..247757492 100644 --- a/include/SFML/Window/Input.hpp +++ b/include/SFML/Window/Input.hpp @@ -54,33 +54,33 @@ public : //////////////////////////////////////////////////////////// /// Get the state of a key /// - /// \param KeyCode : Key to check + /// \param key : Key to check /// /// \return True if key is down, false if key is up /// //////////////////////////////////////////////////////////// - bool IsKeyDown(Key::Code KeyCode) const; + bool IsKeyDown(Key::Code key) const; //////////////////////////////////////////////////////////// /// Get the state of a mouse button /// - /// \param Button : Button to check + /// \param button : Button to check /// /// \return True if button is down, false if button is up /// //////////////////////////////////////////////////////////// - bool IsMouseButtonDown(Mouse::Button Button) const; + bool IsMouseButtonDown(Mouse::Button button) const; //////////////////////////////////////////////////////////// /// Get the state of a joystick button /// - /// \param JoyId : Identifier of the joystick to check (0 or 1) - /// \param Button : Button to check + /// \param joystick : Identifier of the joystick to check (0 or 1) + /// \param button : Button to check /// /// \return True if button is down, false if button is up /// //////////////////////////////////////////////////////////// - bool IsJoystickButtonDown(unsigned int JoyId, unsigned int Button) const; + bool IsJoystickButtonDown(unsigned int joystick, unsigned int button) const; //////////////////////////////////////////////////////////// /// Get the mouse X position @@ -101,13 +101,13 @@ public : //////////////////////////////////////////////////////////// /// Get a joystick axis position /// - /// \param JoyId : Identifier of the joystick to check (0 or 1) - /// \param Axis : Axis to get + /// \param joystick : Identifier of the joystick to check (0 or 1) + /// \param axis : Axis to get /// /// \return Current axis position, in the range [-100, 100] (except for POV, which is [0, 360]) /// //////////////////////////////////////////////////////////// - float GetJoystickAxis(unsigned int JoyId, Joy::Axis Axis) const; + float GetJoystickAxis(unsigned int joystick, Joy::Axis axis) const; private : @@ -115,7 +115,7 @@ private : /// /see WindowListener::OnEvent /// //////////////////////////////////////////////////////////// - virtual void OnEvent(const Event& EventReceived); + virtual void OnEvent(const Event& event); //////////////////////////////////////////////////////////// // Member data diff --git a/include/SFML/Window/VideoMode.hpp b/include/SFML/Window/VideoMode.hpp index b439e648b..415697113 100644 --- a/include/SFML/Window/VideoMode.hpp +++ b/include/SFML/Window/VideoMode.hpp @@ -52,12 +52,12 @@ public : //////////////////////////////////////////////////////////// /// Construct the video mode with its attributes /// - /// \param ModeWidth : Width in pixels - /// \param ModeHeight : Height in pixels - /// \param ModeBpp : Pixel depths in bits per pixel (32 by default) + /// \param width : Width in pixels + /// \param height : Height in pixels + /// \param bitsPerPixel : Pixel depths in bits per pixel (32 by default) /// //////////////////////////////////////////////////////////// - VideoMode(unsigned int ModeWidth, unsigned int ModeHeight, unsigned int ModeBpp = 32); + VideoMode(unsigned int width, unsigned int height, unsigned int bitsPerPixel = 32); //////////////////////////////////////////////////////////// /// Get the current desktop video mode @@ -72,12 +72,12 @@ public : /// Index must be in range [0, GetModesCount()[ /// Modes are sorted from best to worst /// - /// \param Index : Index of video mode to get + /// \param index : Index of video mode to get /// /// \return Corresponding video mode (invalid mode if index is out of range) /// //////////////////////////////////////////////////////////// - static VideoMode GetMode(std::size_t Index); + static VideoMode GetMode(std::size_t index); //////////////////////////////////////////////////////////// /// Get valid video modes count @@ -98,22 +98,22 @@ public : //////////////////////////////////////////////////////////// /// Comparison operator overload -- tell if two video modes are equal /// - /// \param Other : Video mode to compare + /// \param other : Video mode to compare /// /// \return True if modes are equal /// //////////////////////////////////////////////////////////// - bool operator ==(const VideoMode& Other) const; + bool operator ==(const VideoMode& other) const; //////////////////////////////////////////////////////////// /// Comparison operator overload -- tell if two video modes are different /// - /// \param Other : Video mode to compare + /// \param other : Video mode to compare /// /// \return True if modes are different /// //////////////////////////////////////////////////////////// - bool operator !=(const VideoMode& Other) const; + bool operator !=(const VideoMode& other) const; //////////////////////////////////////////////////////////// // Member data @@ -121,13 +121,6 @@ public : unsigned int Width; ///< Video mode width, in pixels unsigned int Height; ///< Video mode height, in pixels unsigned int BitsPerPixel; ///< Video mode pixel depth, in bits per pixels - -private : - - //////////////////////////////////////////////////////////// - /// Get and sort valid video modes - //////////////////////////////////////////////////////////// - static void InitializeModes(); }; } // namespace sf diff --git a/include/SFML/Window/Window.hpp b/include/SFML/Window/Window.hpp index ef34a4455..425aaa1ae 100644 --- a/include/SFML/Window/Window.hpp +++ b/include/SFML/Window/Window.hpp @@ -66,22 +66,22 @@ public : //////////////////////////////////////////////////////////// /// Construct a new window /// - /// \param Mode : Video mode to use - /// \param Title : Title of the window - /// \param WindowStyle : Window style (Resize | Close by default) - /// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values) + /// \param mode : Video mode to use + /// \param title : Title of the window + /// \param style : Window style (Resize | Close by default) + /// \param settings : Additional settings for the underlying OpenGL context (see default constructor for default values) /// //////////////////////////////////////////////////////////// - Window(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const ContextSettings& Settings = ContextSettings()); + Window(VideoMode mode, const std::string& title, unsigned long style = Style::Resize | Style::Close, const ContextSettings& settings = ContextSettings()); //////////////////////////////////////////////////////////// /// Construct the window from an existing control /// - /// \param Handle : Platform-specific handle of the control - /// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values) + /// \param handle : Platform-specific handle of the control + /// \param settings : Additional settings for the underlying OpenGL context (see default constructor for default values) /// //////////////////////////////////////////////////////////// - Window(WindowHandle Handle, const ContextSettings& Settings = ContextSettings()); + Window(WindowHandle handle, const ContextSettings& settings = ContextSettings()); //////////////////////////////////////////////////////////// /// Destructor @@ -92,22 +92,22 @@ public : //////////////////////////////////////////////////////////// /// Create (or recreate) the window /// - /// \param Mode : Video mode to use - /// \param Title : Title of the window - /// \param WindowStyle : Window style (Resize | Close by default) - /// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values) + /// \param mode : Video mode to use + /// \param title : Title of the window + /// \param style : Window style (Resize | Close by default) + /// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values) /// //////////////////////////////////////////////////////////// - void Create(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const ContextSettings& Settings = ContextSettings()); + void Create(VideoMode mode, const std::string& title, unsigned long style = Style::Resize | Style::Close, const ContextSettings& settings = ContextSettings()); //////////////////////////////////////////////////////////// /// Create (or recreate) the window from an existing control /// - /// \param Handle : Platform-specific handle of the control - /// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values) + /// \param handle : Platform-specific handle of the control + /// \param settings : Additional settings for the underlying OpenGL context (see default constructor for default values) /// //////////////////////////////////////////////////////////// - void Create(WindowHandle Handle, const ContextSettings& Settings = ContextSettings()); + void Create(WindowHandle handle, const ContextSettings& settings = ContextSettings()); //////////////////////////////////////////////////////////// /// Close (destroy) the window. @@ -154,64 +154,64 @@ public : //////////////////////////////////////////////////////////// /// Get the event on top of events stack, if any, and pop it /// - /// \param EventReceived : Event to fill, if any + /// \param event : Event to fill, if any /// /// \return True if an event was returned, false if events stack was empty /// //////////////////////////////////////////////////////////// - bool GetEvent(Event& EventReceived); + bool GetEvent(Event& event); //////////////////////////////////////////////////////////// /// Enable / disable vertical synchronization /// - /// \param Enabled : True to enable v-sync, false to deactivate + /// \param enabled : True to enable v-sync, false to deactivate /// //////////////////////////////////////////////////////////// - void UseVerticalSync(bool Enabled); + void UseVerticalSync(bool enabled); //////////////////////////////////////////////////////////// /// Show or hide the mouse cursor /// - /// \param Show : True to show, false to hide + /// \param show : True to show, false to hide /// //////////////////////////////////////////////////////////// - void ShowMouseCursor(bool Show); + void ShowMouseCursor(bool show); //////////////////////////////////////////////////////////// /// Change the position of the mouse cursor /// - /// \param Left : Left coordinate of the cursor, relative to the window - /// \param Top : Top coordinate of the cursor, relative to the window + /// \param left : Left coordinate of the cursor, relative to the window + /// \param top : Top coordinate of the cursor, relative to the window /// //////////////////////////////////////////////////////////// - void SetCursorPosition(unsigned int Left, unsigned int Top); + void SetCursorPosition(unsigned int left, unsigned int top); //////////////////////////////////////////////////////////// /// Change the position of the window on screen. /// Only works for top-level windows /// - /// \param Left : Left position - /// \param Top : Top position + /// \param left : Left position + /// \param top : Top position /// //////////////////////////////////////////////////////////// - void SetPosition(int Left, int Top); + void SetPosition(int left, int top); //////////////////////////////////////////////////////////// /// Change the size of the rendering region of the window /// - /// \param Width : New width - /// \param Height : New height + /// \param width : New width + /// \param height : New height /// //////////////////////////////////////////////////////////// - void SetSize(unsigned int Width, unsigned int Height); + void SetSize(unsigned int width, unsigned int height); //////////////////////////////////////////////////////////// /// Show or hide the window /// - /// \param State : True to show, false to hide + /// \param show : True to show, false to hide /// //////////////////////////////////////////////////////////// - void Show(bool State); + void Show(bool show); //////////////////////////////////////////////////////////// /// Enable or disable automatic key-repeat. @@ -225,23 +225,23 @@ public : //////////////////////////////////////////////////////////// /// Change the window's icon /// - /// \param Width : Icon's width, in pixels - /// \param Height : Icon's height, in pixels - /// \param Pixels : Pointer to the pixels in memory, format must be RGBA 32 bits + /// \param width : Icon's width, in pixels + /// \param height : Icon's height, in pixels + /// \param pixels : Pointer to the pixels in memory, format must be RGBA 32 bits /// //////////////////////////////////////////////////////////// - void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels); + void SetIcon(unsigned int width, unsigned int height, const Uint8* pixels); //////////////////////////////////////////////////////////// /// Activate or deactivate the window as the current target /// for rendering /// - /// \param Active : True to activate, false to deactivate (true by default) + /// \param active : True to activate, false to deactivate (true by default) /// /// \return True if operation was successful, false otherwise /// //////////////////////////////////////////////////////////// - bool SetActive(bool Active = true) const; + bool SetActive(bool active = true) const; //////////////////////////////////////////////////////////// /// Display the window on screen @@ -260,10 +260,10 @@ public : //////////////////////////////////////////////////////////// /// Limit the framerate to a maximum fixed frequency /// - /// \param Limit : Framerate limit, in frames per seconds (use 0 to disable limit) + /// \param limit : Framerate limit, in frames per seconds (use 0 to disable limit) /// //////////////////////////////////////////////////////////// - void SetFramerateLimit(unsigned int Limit); + void SetFramerateLimit(unsigned int limit); //////////////////////////////////////////////////////////// /// Get time elapsed since last frame @@ -277,10 +277,10 @@ public : /// Change the joystick threshold, ie. the value below which /// no move event will be generated /// - /// \param Threshold : New threshold, in range [0, 100] + /// \param threshold : New threshold, in range [0, 100] /// //////////////////////////////////////////////////////////// - void SetJoystickThreshold(float Threshold); + void SetJoystickThreshold(float threshold); private : @@ -293,10 +293,10 @@ private : //////////////////////////////////////////////////////////// /// /see WindowListener::OnEvent /// - /// \param EventReceived : Event received + /// \param event : Event received /// //////////////////////////////////////////////////////////// - virtual void OnEvent(const Event& EventReceived); + virtual void OnEvent(const Event& event); //////////////////////////////////////////////////////////// /// Do some common internal initializations diff --git a/include/SFML/Window/WindowListener.hpp b/include/SFML/Window/WindowListener.hpp index e085880b3..4d3059943 100644 --- a/include/SFML/Window/WindowListener.hpp +++ b/include/SFML/Window/WindowListener.hpp @@ -46,10 +46,10 @@ public : //////////////////////////////////////////////////////////// /// Called each time an event is received from attached window /// - /// \param EventReceived : Event received + /// \param event : Event received /// //////////////////////////////////////////////////////////// - virtual void OnEvent(const Event& EventReceived) = 0; + virtual void OnEvent(const Event& event) = 0; protected : diff --git a/samples/X11/X11.cpp b/samples/X11/X11.cpp index 5582abe86..554aab4fe 100644 --- a/samples/X11/X11.cpp +++ b/samples/X11/X11.cpp @@ -15,10 +15,10 @@ /// \param Window : Target window to initialize /// //////////////////////////////////////////////////////////// -void Initialize(sf::Window& Window) +void Initialize(sf::Window& window) { // Activate the window - Window.SetActive(); + window.SetActive(); // Setup OpenGL states // Set color and depth clear value @@ -43,10 +43,10 @@ void Initialize(sf::Window& Window) /// \param ElapsedTime : Time elapsed since the last draw /// //////////////////////////////////////////////////////////// -void Draw(sf::Window& Window, float ElapsedTime) +void Draw(sf::Window& window, float elapsedTime) { // Activate the window - Window.SetActive(); + window.SetActive(); // Clear color and depth buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -55,9 +55,9 @@ void Draw(sf::Window& Window, float ElapsedTime) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.f, 0.f, -200.f); - glRotatef(ElapsedTime * 50, 1.f, 0.f, 0.f); - glRotatef(ElapsedTime * 30, 0.f, 1.f, 0.f); - glRotatef(ElapsedTime * 90, 0.f, 0.f, 1.f); + glRotatef(elapsedTime * 50, 1.f, 0.f, 0.f); + glRotatef(elapsedTime * 30, 0.f, 1.f, 0.f); + glRotatef(elapsedTime * 90, 0.f, 0.f, 1.f); // Draw a cube glBegin(GL_QUADS); @@ -111,81 +111,81 @@ void Draw(sf::Window& Window, float ElapsedTime) int main() { // Open a connection with the X server - Display* Disp = XOpenDisplay(NULL); - if (!Disp) + Display* display = XOpenDisplay(NULL); + if (!display) return EXIT_FAILURE; // Get the default screen - int Screen = DefaultScreen(Disp); + int screen = DefaultScreen(display); // Let's create the main window - XSetWindowAttributes Attributes; - Attributes.background_pixel = BlackPixel(Disp, Screen); - Attributes.event_mask = KeyPressMask; - Window Win = XCreateWindow(Disp, RootWindow(Disp, Screen), + XSetWindowAttributes attributes; + attributes.background_pixel = BlackPixel(display, screen); + attributes.event_mask = KeyPressMask; + Window window = XCreateWindow(Disp, RootWindow(display, screen), 0, 0, 650, 330, 0, - DefaultDepth(Disp, Screen), + DefaultDepth(display, screen), InputOutput, - DefaultVisual(Disp, Screen), - CWBackPixel | CWEventMask, &Attributes); - if (!Win) + DefaultVisual(display, screen), + CWBackPixel | CWEventMask, &attributes); + if (!window) return EXIT_FAILURE; // Set the window's name - XStoreName(Disp, Win, "SFML Window"); + XStoreName(display, window , "SFML Window"); // Let's create the windows which will serve as containers for our SFML views - Window View1 = XCreateWindow(Disp, Win, + Window view1 = XCreateWindow(display, window, 10, 10, 310, 310, 0, - DefaultDepth(Disp, Screen), + DefaultDepth(display, screen), InputOutput, - DefaultVisual(Disp, Screen), + DefaultVisual(display, screen), 0, NULL); - Window View2 = XCreateWindow(Disp, Win, + Window view2 = XCreateWindow(display, window, 330, 10, 310, 310, 0, - DefaultDepth(Disp, Screen), + DefaultDepth(display, screen), InputOutput, - DefaultVisual(Disp, Screen), + DefaultVisual(display, screen), 0, NULL); // Show our windows - XMapWindow(Disp, Win); - XFlush(Disp); + XMapWindow(display, window); + XFlush(display); // Create our SFML views - sf::Window SFMLView1(View1); - sf::Window SFMLView2(View2); + sf::Window SFMLView1(view1); + sf::Window SFMLView2(view2); // Create a clock for measuring elapsed time - sf::Clock Clock; + sf::Clock clock; // Initialize our views Initialize(SFMLView1); Initialize(SFMLView2); // Start the event loop - bool IsRunning = true; - while (IsRunning) + bool running = true; + while (running) { - while (XPending(Disp)) + while (XPending(display)) { // Get the next pending event - XEvent Event; - XNextEvent(Disp, &Event); + XEvent event; + XNextEvent(display, &event); // Process it - switch (Event.type) + switch (event.type) { // Any key is pressed : quit case KeyPress : - IsRunning = false; + running = false; break; } } // Draw something into our views - Draw(SFMLView1, Clock.GetElapsedTime()); - Draw(SFMLView2, Clock.GetElapsedTime() * 0.3f); + Draw(SFMLView1, clock.GetElapsedTime()); + Draw(SFMLView2, clock.GetElapsedTime() * 0.3f); // Display the views on screen SFMLView1.Display(); @@ -193,7 +193,7 @@ int main() } // Close the display - XCloseDisplay(Disp); + XCloseDisplay(display); return EXIT_SUCCESS; } diff --git a/samples/ftp/Ftp.cpp b/samples/ftp/Ftp.cpp index 763454045..c66fcf6ce 100644 --- a/samples/ftp/Ftp.cpp +++ b/samples/ftp/Ftp.cpp @@ -11,9 +11,9 @@ /// Print a FTP response into a standard output stream /// //////////////////////////////////////////////////////////// -std::ostream& operator <<(std::ostream& Stream, const sf::Ftp::Response& Response) +std::ostream& operator <<(std::ostream& stream, const sf::Ftp::Response& response) { - return Stream << Response.GetStatus() << Response.GetMessage(); + return stream << response.GetStatus() << response.GetMessage(); } @@ -26,36 +26,36 @@ std::ostream& operator <<(std::ostream& Stream, const sf::Ftp::Response& Respons int main() { // Choose the server address - sf::IPAddress Address; + sf::IPAddress address; do { std::cout << "Enter the FTP server address : "; - std::cin >> Address; + std::cin >> address; } - while (!Address.IsValid()); + while (!address.IsValid()); // Connect to the server - sf::Ftp Server; - sf::Ftp::Response ConnectResponse = Server.Connect(Address); - std::cout << ConnectResponse << std::endl; - if (!ConnectResponse.IsOk()) + sf::Ftp server; + sf::Ftp::Response connectResponse = server.Connect(address); + std::cout << connectResponse << std::endl; + if (!connectResponse.IsOk()) return EXIT_FAILURE; // Ask for user name and password - std::string UserName, Password; + std::string user, password; std::cout << "User name : "; - std::cin >> UserName; + std::cin >> user; std::cout << "Password : "; - std::cin >> Password; + std::cin >> password; // Login to the server - sf::Ftp::Response LoginResponse = Server.Login(UserName, Password); - std::cout << LoginResponse << std::endl; - if (!LoginResponse.IsOk()) + sf::Ftp::Response loginResponse = server.Login(user, password); + std::cout << loginResponse << std::endl; + if (!loginResponse.IsOk()) return EXIT_FAILURE; // Main menu - int Choice = 0; + int choice = 0; do { // Main FTP menu @@ -74,10 +74,10 @@ int main() std::cout << std::endl; std::cout << "Your choice: "; - std::cin >> Choice; + std::cin >> choice; std::cout << std::endl; - switch (Choice) + switch (choice) { default : { @@ -91,95 +91,95 @@ int main() case 1 : { // Print current server directory - sf::Ftp::DirectoryResponse Response = Server.GetWorkingDirectory(); - std::cout << Response << std::endl; - std::cout << "Current directory is " << Response.GetDirectory() << std::endl; + sf::Ftp::DirectoryResponse response = server.GetWorkingDirectory(); + std::cout << response << std::endl; + std::cout << "Current directory is " << response.GetDirectory() << std::endl; break; } case 2 : { // Print content of current server directory - sf::Ftp::ListingResponse Response = Server.GetDirectoryListing(); - std::cout << Response << std::endl; - for (std::size_t i = 0; i < Response.GetCount(); ++i) - std::cout << Response.GetFilename(i) << std::endl; + sf::Ftp::ListingResponse response = server.GetDirectoryListing(); + std::cout << response << std::endl; + for (std::size_t i = 0; i < response.GetCount(); ++i) + std::cout << response.GetFilename(i) << std::endl; break; } case 3 : { // Change the current directory - std::string Directory; + std::string directory; std::cout << "Choose a directory: "; - std::cin >> Directory; - std::cout << Server.ChangeDirectory(Directory) << std::endl; + std::cin >> directory; + std::cout << server.ChangeDirectory(directory) << std::endl; break; } case 4 : { // Create a new directory - std::string Directory; + std::string directory; std::cout << "Name of the directory to create: "; - std::cin >> Directory; - std::cout << Server.MakeDirectory(Directory) << std::endl; + std::cin >> directory; + std::cout << server.MakeDirectory(directory) << std::endl; break; } case 5 : { // Remove an existing directory - std::string Directory; + std::string directory; std::cout << "Name of the directory to remove: "; - std::cin >> Directory; - std::cout << Server.DeleteDirectory(Directory) << std::endl; + std::cin >> directory; + std::cout << server.DeleteDirectory(directory) << std::endl; break; } case 6 : { // Rename a file - std::string SrcFilename, DstFilename; + std::string source, destination; std::cout << "Name of the file to rename: "; - std::cin >> SrcFilename; + std::cin >> source; std::cout << "New name: "; - std::cin >> DstFilename; - std::cout << Server.RenameFile(SrcFilename, DstFilename) << std::endl; + std::cin >> destination; + std::cout << server.RenameFile(source, destination) << std::endl; break; } case 7 : { // Remove an existing directory - std::string Filename; + std::string filename; std::cout << "Name of the file to remove: "; - std::cin >> Filename; - std::cout << Server.DeleteFile(Filename) << std::endl; + std::cin >> filename; + std::cout << server.DeleteFile(filename) << std::endl; break; } case 8 : { // Download a file from server - std::string Filename, Directory; - std::cout << "Path of the file to download (relative to current directory): "; - std::cin >> Filename; + std::string filename, directory; + std::cout << "filename of the file to download (relative to current directory): "; + std::cin >> filename; std::cout << "Directory to download the file to: "; - std::cin >> Directory; - std::cout << Server.Download(Filename, Directory) << std::endl; + std::cin >> directory; + std::cout << server.Download(filename, directory) << std::endl; break; } case 9 : { // Upload a file to server - std::string Filename, Directory; + std::string filename, directory; std::cout << "Path of the file to upload (absolute or relative to working directory): "; - std::cin >> Filename; + std::cin >> filename; std::cout << "Directory to upload the file to (relative to current directory): "; - std::cin >> Directory; - std::cout << Server.Upload(Filename, Directory) << std::endl; + std::cin >> directory; + std::cout << server.Upload(filename, directory) << std::endl; break; } @@ -190,11 +190,11 @@ int main() } } - } while (Choice != 0); + } while (choice != 0); // Disconnect from the server std::cout << "Disconnecting from server..." << std::endl; - std::cout << Server.Disconnect() << std::endl; + std::cout << server.Disconnect() << std::endl; // Wait until the user presses 'enter' key std::cout << "Press enter to exit..." << std::endl; diff --git a/samples/opengl/OpenGL.cpp b/samples/opengl/OpenGL.cpp index e11c2c1ee..5e6f8c05d 100644 --- a/samples/opengl/OpenGL.cpp +++ b/samples/opengl/OpenGL.cpp @@ -16,26 +16,26 @@ int main() { // Create main window - sf::RenderWindow App(sf::VideoMode(800, 600), "SFML OpenGL"); - App.PreserveOpenGLStates(true); + sf::RenderWindow window(sf::VideoMode(800, 600), "SFML OpenGL"); + window.PreserveOpenGLStates(true); // Create a sprite for the background - sf::Image BackgroundImage; - if (!BackgroundImage.LoadFromFile("datas/opengl/background.jpg")) + sf::Image backgroundImage; + if (!backgroundImage.LoadFromFile("datas/opengl/background.jpg")) return EXIT_FAILURE; - sf::Sprite Background(BackgroundImage); + sf::Sprite background(backgroundImage); // Load an OpenGL texture. // We could directly use a sf::Image as an OpenGL texture (with its Bind() member function), // but here we want more control on it (generate mipmaps, ...) so we create a new one from the image pixels - GLuint Texture = 0; + GLuint texture = 0; { - sf::Image Image; - if (!Image.LoadFromFile("datas/opengl/texture.jpg")) + sf::Image image; + if (!image.LoadFromFile("datas/opengl/texture.jpg")) return EXIT_FAILURE; - glGenTextures(1, &Texture); - glBindTexture(GL_TEXTURE_2D, Texture); - gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, Image.GetWidth(), Image.GetHeight(), GL_RGBA, GL_UNSIGNED_BYTE, Image.GetPixelsPtr()); + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_2D, texture); + gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, image.GetWidth(), image.GetHeight(), GL_RGBA, GL_UNSIGNED_BYTE, image.GetPixelsPtr()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); } @@ -52,98 +52,98 @@ int main() // Bind our texture glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, Texture); + glBindTexture(GL_TEXTURE_2D, texture); glColor4f(1.f, 1.f, 1.f, 1.f); // Create a clock for measuring the time elapsed - sf::Clock Clock; + sf::Clock clock; // Start game loop - while (App.IsOpened()) + while (window.IsOpened()) { // Process events - sf::Event Event; - while (App.GetEvent(Event)) + sf::Event event; + while (window.GetEvent(event)) { // Close window : exit - if (Event.Type == sf::Event::Closed) - App.Close(); + if (event.Type == sf::Event::Closed) + window.Close(); // Escape key : exit - if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)) - App.Close(); + if ((event.Type == sf::Event::KeyPressed) && (event.Key.Code == sf::Key::Escape)) + window.Close(); // Adjust the viewport when the window is resized - if (Event.Type == sf::Event::Resized) - glViewport(0, 0, Event.Size.Width, Event.Size.Height); + if (event.Type == sf::Event::Resized) + glViewport(0, 0, event.Size.Width, event.Size.Height); } // Draw background - App.Draw(Background); + window.Draw(background); // Clear depth buffer glClear(GL_DEPTH_BUFFER_BIT); // We get the position of the mouse cursor, so that we can move the box accordingly - float CursorX = App.GetInput().GetMouseX() * 200.f / App.GetWidth() - 100.f; - float CursorY = -App.GetInput().GetMouseY() * 200.f / App.GetHeight() + 100.f; + float x = window.GetInput().GetMouseX() * 200.f / window.GetWidth() - 100.f; + float y = -window.GetInput().GetMouseY() * 200.f / window.GetHeight() + 100.f; // Apply some transformations glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glTranslatef(CursorX, CursorY, -100.f); - glRotatef(Clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f); - glRotatef(Clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f); - glRotatef(Clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f); + glTranslatef(x, y, -100.f); + glRotatef(clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f); + glRotatef(clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f); + glRotatef(clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f); // Draw a cube - float Size = 20.f; + float size = 20.f; glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex3f(-Size, -Size, -Size); - glTexCoord2f(0, 1); glVertex3f(-Size, Size, -Size); - glTexCoord2f(1, 1); glVertex3f( Size, Size, -Size); - glTexCoord2f(1, 0); glVertex3f( Size, -Size, -Size); + glTexCoord2f(0, 0); glVertex3f(-size, -size, -size); + glTexCoord2f(0, 1); glVertex3f(-size, size, -size); + glTexCoord2f(1, 1); glVertex3f( size, size, -size); + glTexCoord2f(1, 0); glVertex3f( size, -size, -size); - glTexCoord2f(0, 0); glVertex3f(-Size, -Size, Size); - glTexCoord2f(0, 1); glVertex3f(-Size, Size, Size); - glTexCoord2f(1, 1); glVertex3f( Size, Size, Size); - glTexCoord2f(1, 0); glVertex3f( Size, -Size, Size); + glTexCoord2f(0, 0); glVertex3f(-size, -size, size); + glTexCoord2f(0, 1); glVertex3f(-size, size, size); + glTexCoord2f(1, 1); glVertex3f( size, size, size); + glTexCoord2f(1, 0); glVertex3f( size, -size, size); - glTexCoord2f(0, 0); glVertex3f(-Size, -Size, -Size); - glTexCoord2f(0, 1); glVertex3f(-Size, Size, -Size); - glTexCoord2f(1, 1); glVertex3f(-Size, Size, Size); - glTexCoord2f(1, 0); glVertex3f(-Size, -Size, Size); + glTexCoord2f(0, 0); glVertex3f(-size, -size, -size); + glTexCoord2f(0, 1); glVertex3f(-size, size, -size); + glTexCoord2f(1, 1); glVertex3f(-size, size, size); + glTexCoord2f(1, 0); glVertex3f(-size, -size, size); - glTexCoord2f(0, 0); glVertex3f(Size, -Size, -Size); - glTexCoord2f(0, 1); glVertex3f(Size, Size, -Size); - glTexCoord2f(1, 1); glVertex3f(Size, Size, Size); - glTexCoord2f(1, 0); glVertex3f(Size, -Size, Size); + glTexCoord2f(0, 0); glVertex3f(size, -size, -size); + glTexCoord2f(0, 1); glVertex3f(size, size, -size); + glTexCoord2f(1, 1); glVertex3f(size, size, size); + glTexCoord2f(1, 0); glVertex3f(size, -size, size); - glTexCoord2f(0, 1); glVertex3f(-Size, -Size, Size); - glTexCoord2f(0, 0); glVertex3f(-Size, -Size, -Size); - glTexCoord2f(1, 0); glVertex3f( Size, -Size, -Size); - glTexCoord2f(1, 1); glVertex3f( Size, -Size, Size); + glTexCoord2f(0, 1); glVertex3f(-size, -size, size); + glTexCoord2f(0, 0); glVertex3f(-size, -size, -size); + glTexCoord2f(1, 0); glVertex3f( size, -size, -size); + glTexCoord2f(1, 1); glVertex3f( size, -size, size); - glTexCoord2f(0, 1); glVertex3f(-Size, Size, Size); - glTexCoord2f(0, 0); glVertex3f(-Size, Size, -Size); - glTexCoord2f(1, 0); glVertex3f( Size, Size, -Size); - glTexCoord2f(1, 1); glVertex3f( Size, Size, Size); + glTexCoord2f(0, 1); glVertex3f(-size, size, size); + glTexCoord2f(0, 0); glVertex3f(-size, size, -size); + glTexCoord2f(1, 0); glVertex3f( size, size, -size); + glTexCoord2f(1, 1); glVertex3f( size, size, size); glEnd(); // Draw some text on top of our OpenGL object - sf::String Text("SFML / OpenGL demo"); - Text.SetPosition(250.f, 450.f); - Text.SetColor(sf::Color(255, 255, 255, 170)); - App.Draw(Text); + sf::String text("SFML / OpenGL demo"); + text.SetPosition(250.f, 450.f); + text.SetColor(sf::Color(255, 255, 255, 170)); + window.Draw(text); // Finally, display the rendered frame on screen - App.Display(); + window.Display(); } // Don't forget to destroy our texture - glDeleteTextures(1, &Texture); + glDeleteTextures(1, &texture); return EXIT_SUCCESS; } diff --git a/samples/pong/Pong.cpp b/samples/pong/Pong.cpp index 2ed82ccc6..3170ae1dc 100644 --- a/samples/pong/Pong.cpp +++ b/samples/pong/Pong.cpp @@ -19,171 +19,171 @@ int main() const float PI = 3.14159f; // Create the window of the application - sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Pong"); + sf::RenderWindow window(sf::VideoMode(800, 600, 32), "SFML Pong"); // Load the sounds used in the game - sf::SoundBuffer BallSoundBuffer; - if (!BallSoundBuffer.LoadFromFile("datas/pong/ball.wav")) + sf::SoundBuffer ballSoundBuffer; + if (!ballSoundBuffer.LoadFromFile("datas/pong/ball.wav")) { return EXIT_FAILURE; } - sf::Sound BallSound(BallSoundBuffer); + sf::Sound ballSound(ballSoundBuffer); // Load the images used in the game - sf::Image BackgroundImage, LeftPaddleImage, RightPaddleImage, BallImage; - if (!BackgroundImage.LoadFromFile("datas/pong/background.jpg") || - !LeftPaddleImage.LoadFromFile("datas/pong/paddle_left.png") || - !RightPaddleImage.LoadFromFile("datas/pong/paddle_right.png") || - !BallImage.LoadFromFile("datas/pong/ball.png")) + sf::Image backgroundImage, leftPaddleImage, rightPaddleImage, ballImage; + if (!backgroundImage.LoadFromFile("datas/pong/background.jpg") || + !leftPaddleImage.LoadFromFile("datas/pong/paddle_left.png") || + !rightPaddleImage.LoadFromFile("datas/pong/paddle_right.png") || + !ballImage.LoadFromFile("datas/pong/ball.png")) { return EXIT_FAILURE; } // Load the text font - sf::Font Cheeseburger; - if (!Cheeseburger.LoadFromFile("datas/post-fx/cheeseburger.ttf")) + sf::Font font; + if (!ballImage.LoadFromFile("datas/post-fx/cheeseburger.ttf")) return EXIT_FAILURE; // Initialize the end text - sf::String End; - End.SetFont(Cheeseburger); - End.SetSize(60.f); - End.Move(150.f, 200.f); - End.SetColor(sf::Color(50, 50, 250)); + sf::String end; + end.SetFont(font); + end.SetSize(60.f); + end.Move(150.f, 200.f); + end.SetColor(sf::Color(50, 50, 250)); // Create the sprites of the background, the paddles and the ball - sf::Sprite Background(BackgroundImage); - sf::Sprite LeftPaddle(LeftPaddleImage); - sf::Sprite RightPaddle(RightPaddleImage); - sf::Sprite Ball(BallImage); + sf::Sprite background(backgroundImage); + sf::Sprite leftPaddle(leftPaddleImage); + sf::Sprite rightPaddle(rightPaddleImage); + sf::Sprite ball(ballImage); - LeftPaddle.Move(10, (App.GetView().GetSize().y - LeftPaddle.GetSize().y) / 2); - RightPaddle.Move(App.GetView().GetSize().x - RightPaddle.GetSize().x - 10, (App.GetView().GetSize().y - RightPaddle.GetSize().y) / 2); - Ball.Move((App.GetView().GetSize().x - Ball.GetSize().x) / 2, (App.GetView().GetSize().y - Ball.GetSize().y) / 2); + leftPaddle.Move(10, (window.GetView().GetSize().y - leftPaddle.GetSize().y) / 2); + rightPaddle.Move(window.GetView().GetSize().x - rightPaddle.GetSize().x - 10, (window.GetView().GetSize().y - rightPaddle.GetSize().y) / 2); + ball.Move((window.GetView().GetSize().x - ball.GetSize().x) / 2, (window.GetView().GetSize().y - ball.GetSize().y) / 2); // Define the paddles properties sf::Clock AITimer; const float AITime = 0.1f; - float LeftPaddleSpeed = 400.f; - float RightPaddleSpeed = 400.f; + float leftPaddleSpeed = 400.f; + float rightPaddleSpeed = 400.f; // Define the ball properties - float BallSpeed = 400.f; - float BallAngle; + float ballSpeed = 400.f; + float ballAngle; do { // Make sure the ball initial angle is not too much vertical - BallAngle = sf::Randomizer::Random(0.f, 2 * PI); - } while (std::abs(std::cos(BallAngle)) < 0.7f); + ballAngle = sf::Randomizer::Random(0.f, 2 * PI); + } while (std::abs(std::cos(ballAngle)) < 0.7f); - bool IsPlaying = true; - while (App.IsOpened()) + bool isPlaying = true; + while (window.IsOpened()) { // Handle events - sf::Event Event; - while (App.GetEvent(Event)) + sf::Event event; + while (window.GetEvent(event)) { // Window closed or escape key pressed : exit - if ((Event.Type == sf::Event::Closed) || - ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))) + if ((event.Type == sf::Event::Closed) || + ((event.Type == sf::Event::KeyPressed) && (event.Key.Code == sf::Key::Escape))) { - App.Close(); + window.Close(); break; } } - if (IsPlaying) + if (isPlaying) { // Move the player's paddle - if (App.GetInput().IsKeyDown(sf::Key::Up) && (LeftPaddle.GetPosition().y > 5.f)) - LeftPaddle.Move(0.f, -LeftPaddleSpeed * App.GetFrameTime()); - if (App.GetInput().IsKeyDown(sf::Key::Down) && (LeftPaddle.GetPosition().y < App.GetView().GetSize().y - LeftPaddle.GetSize().y - 5.f)) - LeftPaddle.Move(0.f, LeftPaddleSpeed * App.GetFrameTime()); + if (window.GetInput().IsKeyDown(sf::Key::Up) && (leftPaddle.GetPosition().y > 5.f)) + leftPaddle.Move(0.f, -leftPaddleSpeed * window.GetFrameTime()); + if (window.GetInput().IsKeyDown(sf::Key::Down) && (leftPaddle.GetPosition().y < window.GetView().GetSize().y - leftPaddle.GetSize().y - 5.f)) + leftPaddle.Move(0.f, leftPaddleSpeed * window.GetFrameTime()); // Move the computer's paddle - if (((RightPaddleSpeed < 0.f) && (RightPaddle.GetPosition().y > 5.f)) || - ((RightPaddleSpeed > 0.f) && (RightPaddle.GetPosition().y < App.GetView().GetSize().y - RightPaddle.GetSize().y - 5.f))) + if (((rightPaddleSpeed < 0.f) && (rightPaddle.GetPosition().y > 5.f)) || + ((rightPaddleSpeed > 0.f) && (rightPaddle.GetPosition().y < window.GetView().GetSize().y - rightPaddle.GetSize().y - 5.f))) { - RightPaddle.Move(0.f, RightPaddleSpeed * App.GetFrameTime()); + rightPaddle.Move(0.f, rightPaddleSpeed * window.GetFrameTime()); } // Update the computer's paddle direction according to the ball position if (AITimer.GetElapsedTime() > AITime) { AITimer.Reset(); - if ((RightPaddleSpeed < 0) && (Ball.GetPosition().y + Ball.GetSize().y > RightPaddle.GetPosition().y + RightPaddle.GetSize().y)) - RightPaddleSpeed = -RightPaddleSpeed; - if ((RightPaddleSpeed > 0) && (Ball.GetPosition().y < RightPaddle.GetPosition().y)) - RightPaddleSpeed = -RightPaddleSpeed; + if ((rightPaddleSpeed < 0) && (ball.GetPosition().y + ball.GetSize().y > rightPaddle.GetPosition().y + rightPaddle.GetSize().y)) + rightPaddleSpeed = -rightPaddleSpeed; + if ((rightPaddleSpeed > 0) && (ball.GetPosition().y < rightPaddle.GetPosition().y)) + rightPaddleSpeed = -rightPaddleSpeed; } // Move the ball - float Factor = BallSpeed * App.GetFrameTime(); - Ball.Move(std::cos(BallAngle) * Factor, std::sin(BallAngle) * Factor); + float factor = ballSpeed * window.GetFrameTime(); + ball.Move(std::cos(ballAngle) * factor, std::sin(ballAngle) * factor); // Check collisions between the ball and the screen - if (Ball.GetPosition().x < 0.f) + if (ball.GetPosition().x < 0.f) { - IsPlaying = false; - End.SetText("You lost !\n(press escape to exit)"); + isPlaying = false; + end.SetText("You lost !\n(press escape to exit)"); } - if (Ball.GetPosition().x + Ball.GetSize().x > App.GetView().GetSize().x) + if (ball.GetPosition().x + ball.GetSize().x > window.GetView().GetSize().x) { - IsPlaying = false; - End.SetText("You won !\n(press escape to exit)"); + isPlaying = false; + end.SetText("You won !\n(press escape to exit)"); } - if (Ball.GetPosition().y < 0.f) + if (ball.GetPosition().y < 0.f) { - BallSound.Play(); - BallAngle = -BallAngle; - Ball.SetY(0.1f); + ballSound.Play(); + ballAngle = -ballAngle; + ball.SetY(0.1f); } - if (Ball.GetPosition().y + Ball.GetSize().y > App.GetView().GetSize().y) + if (ball.GetPosition().y + ball.GetSize().y > window.GetView().GetSize().y) { - BallSound.Play(); - BallAngle = -BallAngle; - Ball.SetY(App.GetView().GetSize().y - Ball.GetSize().y - 0.1f); + ballSound.Play(); + ballAngle = -ballAngle; + ball.SetY(window.GetView().GetSize().y - ball.GetSize().y - 0.1f); } // Check the collisions between the ball and the paddles // Left Paddle - if (Ball.GetPosition().x < LeftPaddle.GetPosition().x + LeftPaddle.GetSize().x && - Ball.GetPosition().x > LeftPaddle.GetPosition().x + (LeftPaddle.GetSize().x / 2.0f) && - Ball.GetPosition().y + Ball.GetSize().y >= LeftPaddle.GetPosition().y && - Ball.GetPosition().y <= LeftPaddle.GetPosition().y + LeftPaddle.GetSize().y) + if (ball.GetPosition().x < leftPaddle.GetPosition().x + leftPaddle.GetSize().x && + ball.GetPosition().x > leftPaddle.GetPosition().x + (leftPaddle.GetSize().x / 2.0f) && + ball.GetPosition().y + ball.GetSize().y >= leftPaddle.GetPosition().y && + ball.GetPosition().y <= leftPaddle.GetPosition().y + leftPaddle.GetSize().y) { - BallSound.Play(); - BallAngle = PI - BallAngle; - Ball.SetX(LeftPaddle.GetPosition().x + LeftPaddle.GetSize().x + 0.1f); + ballSound.Play(); + ballAngle = PI - ballAngle; + ball.SetX(leftPaddle.GetPosition().x + leftPaddle.GetSize().x + 0.1f); } // Right Paddle - if (Ball.GetPosition().x + Ball.GetSize().x > RightPaddle.GetPosition().x && - Ball.GetPosition().x + Ball.GetSize().x < RightPaddle.GetPosition().x + (RightPaddle.GetSize().x / 2.0f) && - Ball.GetPosition().y + Ball.GetSize().y >= RightPaddle.GetPosition().y && - Ball.GetPosition().y <= RightPaddle.GetPosition().y + RightPaddle.GetSize().y) + if (ball.GetPosition().x + ball.GetSize().x > rightPaddle.GetPosition().x && + ball.GetPosition().x + ball.GetSize().x < rightPaddle.GetPosition().x + (rightPaddle.GetSize().x / 2.0f) && + ball.GetPosition().y + ball.GetSize().y >= rightPaddle.GetPosition().y && + ball.GetPosition().y <= rightPaddle.GetPosition().y + rightPaddle.GetSize().y) { - BallSound.Play(); - BallAngle = PI - BallAngle; - Ball.SetX(RightPaddle.GetPosition().x - Ball.GetSize().x - 0.1f); + ballSound.Play(); + ballAngle = PI - ballAngle; + ball.SetX(rightPaddle.GetPosition().x - ball.GetSize().x - 0.1f); } } // Clear the window - App.Clear(); + window.Clear(); // Draw the background, paddles and ball sprites - App.Draw(Background); - App.Draw(LeftPaddle); - App.Draw(RightPaddle); - App.Draw(Ball); + window.Draw(background); + window.Draw(leftPaddle); + window.Draw(rightPaddle); + window.Draw(ball); // If the game is over, display the end message - if (!IsPlaying) - App.Draw(End); + if (!isPlaying) + window.Draw(end); // Display things on screen - App.Display(); + window.Display(); } return EXIT_SUCCESS; diff --git a/samples/post-fx/PostFX.cpp b/samples/post-fx/PostFX.cpp index 6229a3c5d..857ba1057 100644 --- a/samples/post-fx/PostFX.cpp +++ b/samples/post-fx/PostFX.cpp @@ -25,136 +25,136 @@ int main() } // Create the main window - sf::RenderWindow App(sf::VideoMode(800, 600), "SFML PostFX"); + sf::RenderWindow window(sf::VideoMode(800, 600), "SFML PostFX"); // Load a background image to display - sf::Image BackgroundImage; - if (!BackgroundImage.LoadFromFile("datas/post-fx/background.jpg")) + sf::Image backgroundImage; + if (!backgroundImage.LoadFromFile("datas/post-fx/background.jpg")) return EXIT_FAILURE; - sf::Sprite Background(BackgroundImage); + sf::Sprite background(backgroundImage); // Load a sprite which we'll move into the scene - sf::Image EntityImage; - if (!EntityImage.LoadFromFile("datas/post-fx/sprite.png")) + sf::Image entityImage; + if (!entityImage.LoadFromFile("datas/post-fx/sprite.png")) return EXIT_FAILURE; - sf::Sprite Entity(EntityImage); + sf::Sprite entity(entityImage); // Load the text font - sf::Font Cheeseburger; - if (!Cheeseburger.LoadFromFile("datas/post-fx/cheeseburger.ttf")) + sf::Font font; + if (!font.LoadFromFile("datas/post-fx/cheeseburger.ttf")) return EXIT_FAILURE; // Load the image needed for the wave effect - sf::Image WaveImage; - if (!WaveImage.LoadFromFile("datas/post-fx/wave.jpg")) + sf::Image waveImage; + if (!waveImage.LoadFromFile("datas/post-fx/wave.jpg")) return EXIT_FAILURE; // Load all effects - std::map Effects; - if (!Effects["nothing"].LoadFromFile("datas/post-fx/nothing.sfx")) return EXIT_FAILURE; - if (!Effects["blur"].LoadFromFile("datas/post-fx/blur.sfx")) return EXIT_FAILURE; - if (!Effects["colorize"].LoadFromFile("datas/post-fx/colorize.sfx")) return EXIT_FAILURE; - if (!Effects["fisheye"].LoadFromFile("datas/post-fx/fisheye.sfx")) return EXIT_FAILURE; - if (!Effects["wave"].LoadFromFile("datas/post-fx/wave.sfx")) return EXIT_FAILURE; - if (!Effects["pixelate"].LoadFromFile("datas/post-fx/pixelate.sfx")) return EXIT_FAILURE; - std::map::iterator CurrentEffect = Effects.find("nothing"); + std::map effects; + if (!effects["nothing"].LoadFromFile("datas/post-fx/nothing.sfx")) return EXIT_FAILURE; + if (!effects["blur"].LoadFromFile("datas/post-fx/blur.sfx")) return EXIT_FAILURE; + if (!effects["colorize"].LoadFromFile("datas/post-fx/colorize.sfx")) return EXIT_FAILURE; + if (!effects["fisheye"].LoadFromFile("datas/post-fx/fisheye.sfx")) return EXIT_FAILURE; + if (!effects["wave"].LoadFromFile("datas/post-fx/wave.sfx")) return EXIT_FAILURE; + if (!effects["pixelate"].LoadFromFile("datas/post-fx/pixelate.sfx")) return EXIT_FAILURE; + std::map::iterator currentEffect = effects.find("nothing"); // Do specific initializations - Effects["nothing"].SetTexture("framebuffer", NULL); - Effects["blur"].SetTexture("framebuffer", NULL); - Effects["blur"].SetParameter("offset", 0.f); - Effects["colorize"].SetTexture("framebuffer", NULL); - Effects["colorize"].SetParameter("color", 1.f, 1.f, 1.f); - Effects["fisheye"].SetTexture("framebuffer", NULL); - Effects["wave"].SetTexture("framebuffer", NULL); - Effects["wave"].SetTexture("wave", &WaveImage); - Effects["pixelate"].SetTexture("framebuffer", NULL); + effects["nothing"].SetTexture("framebuffer", NULL); + effects["blur"].SetTexture("framebuffer", NULL); + effects["blur"].SetParameter("offset", 0.f); + effects["colorize"].SetTexture("framebuffer", NULL); + effects["colorize"].SetParameter("color", 1.f, 1.f, 1.f); + effects["fisheye"].SetTexture("framebuffer", NULL); + effects["wave"].SetTexture("framebuffer", NULL); + effects["wave"].SetTexture("wave", &waveImage); + effects["pixelate"].SetTexture("framebuffer", NULL); // Define a string for displaying current effect description - sf::String CurFXStr; - CurFXStr.SetText("Current effect is \"" + CurrentEffect->first + "\""); - CurFXStr.SetFont(Cheeseburger); - CurFXStr.SetPosition(20.f, 0.f); - CurFXStr.SetColor(sf::Color(150, 70, 110)); + sf::String curFXStr; + curFXStr.SetText("Current effect is \"" + currentEffect->first + "\""); + curFXStr.SetFont(font); + curFXStr.SetPosition(20.f, 0.f); + curFXStr.SetColor(sf::Color(150, 70, 110)); // Define a string for displaying help - sf::String InfoStr; - InfoStr.SetText("Move your mouse to change the effect parameters\nPress numpad + and - to change effect\nWarning : some effects may not work\ndepending on your graphics card"); - InfoStr.SetFont(Cheeseburger); - InfoStr.SetPosition(20.f, 460.f); - InfoStr.SetColor(sf::Color(200, 100, 150)); + sf::String infoStr; + infoStr.SetText("Move your mouse to change the effect parameters\nPress numpad + and - to change effect\nWarning : some effects may not work\ndepending on your graphics card"); + infoStr.SetFont(font); + infoStr.SetPosition(20.f, 460.f); + infoStr.SetColor(sf::Color(200, 100, 150)); // Create a clock to measure the total time elapsed - sf::Clock Clock; + sf::Clock clock; // Start the game loop - while (App.IsOpened()) + while (window.IsOpened()) { // Process events - sf::Event Event; - while (App.GetEvent(Event)) + sf::Event event; + while (window.GetEvent(event)) { // Close window : exit - if (Event.Type == sf::Event::Closed) - App.Close(); + if (event.Type == sf::Event::Closed) + window.Close(); - if (Event.Type == sf::Event::KeyPressed) + if (event.Type == sf::Event::KeyPressed) { // Escape key : exit - if (Event.Key.Code == sf::Key::Escape) - App.Close(); + if (event.Key.Code == sf::Key::Escape) + window.Close(); // Add key : next effect - if (Event.Key.Code == sf::Key::Add) + if (event.Key.Code == sf::Key::Add) { - CurrentEffect++; - if (CurrentEffect == Effects.end()) - CurrentEffect = Effects.begin(); - CurFXStr.SetText("Current effect is \"" + CurrentEffect->first + "\""); + currentEffect++; + if (currentEffect == effects.end()) + currentEffect = effects.begin(); + curFXStr.SetText("Current effect is \"" + currentEffect->first + "\""); } // Subtract key : previous effect - if (Event.Key.Code == sf::Key::Subtract) + if (event.Key.Code == sf::Key::Subtract) { - if (CurrentEffect == Effects.begin()) - CurrentEffect = Effects.end(); - CurrentEffect--; - CurFXStr.SetText("Current effect is \"" + CurrentEffect->first + "\""); + if (currentEffect == effects.begin()) + currentEffect = effects.end(); + currentEffect--; + curFXStr.SetText("Current effect is \"" + currentEffect->first + "\""); } } } // Get the mouse position in the range [0, 1] - float X = App.GetInput().GetMouseX() / static_cast(App.GetWidth()); - float Y = App.GetInput().GetMouseY() / static_cast(App.GetHeight()); + float mouseX = window.GetInput().GetMouseX() / static_cast(window.GetWidth()); + float mouseY = window.GetInput().GetMouseY() / static_cast(window.GetHeight()); // Update the current effect - if (CurrentEffect->first == "blur") CurrentEffect->second.SetParameter("offset", X * Y * 0.05f); - else if (CurrentEffect->first == "colorize") CurrentEffect->second.SetParameter("color", 0.3f, X, Y); - else if (CurrentEffect->first == "fisheye") CurrentEffect->second.SetParameter("mouse", X, 1.f - Y); - else if (CurrentEffect->first == "wave") CurrentEffect->second.SetParameter("offset", X, Y); - else if (CurrentEffect->first == "pixelate") CurrentEffect->second.SetParameter("mouse", X, Y); + if (currentEffect->first == "blur") currentEffect->second.SetParameter("offset", mouseX * mouseY * 0.05f); + else if (currentEffect->first == "colorize") currentEffect->second.SetParameter("color", 0.3f, mouseX, mouseY); + else if (currentEffect->first == "fisheye") currentEffect->second.SetParameter("mouse", mouseX, 1.f - mouseY); + else if (currentEffect->first == "wave") currentEffect->second.SetParameter("offset", mouseX, mouseY); + else if (currentEffect->first == "pixelate") currentEffect->second.SetParameter("mouse", mouseX, mouseY); // Animate the sprite - float EntityX = (cos(Clock.GetElapsedTime() * 1.3f) + 1.2f) * 300; - float EntityY = (cos(Clock.GetElapsedTime() * 0.8f) + 1.2f) * 200; - Entity.SetPosition(EntityX, EntityY); - Entity.Rotate(App.GetFrameTime() * 100); + float entityX = (cos(clock.GetElapsedTime() * 1.3f) + 1.2f) * 300; + float entityY = (cos(clock.GetElapsedTime() * 0.8f) + 1.2f) * 200; + entity.SetPosition(entityX, entityY); + entity.Rotate(window.GetFrameTime() * 100); // Clear the window - App.Clear(); + window.Clear(); // Draw background, sprite and apply the post-fx - App.Draw(Background); - App.Draw(Entity); - App.Draw(CurrentEffect->second); + window.Draw(background); + window.Draw(entity); + window.Draw(currentEffect->second); // Draw interface strings - App.Draw(CurFXStr); - App.Draw(InfoStr); + window.Draw(curFXStr); + window.Draw(infoStr); // Finally, display the rendered frame on screen - App.Display(); + window.Display(); } return EXIT_SUCCESS; @@ -169,37 +169,36 @@ int main() void DisplayError() { // Create the main window - sf::RenderWindow App(sf::VideoMode(800, 600), "SFML PostFX"); + sf::RenderWindow window(sf::VideoMode(800, 600), "SFML PostFX"); // Define a string for displaying the error message - sf::String ErrorStr("Sorry, your system doesn't support post-effects"); - ErrorStr.SetPosition(100.f, 250.f); - ErrorStr.SetColor(sf::Color(200, 100, 150)); + sf::String error("Sorry, your system doesn't support post-effects"); + error.SetPosition(100.f, 250.f); + error.SetColor(sf::Color(200, 100, 150)); // Start the game loop - bool Running = true; - while (Running) + while (window.IsOpened()) { // Process events - sf::Event Event; - while (App.GetEvent(Event)) + sf::Event event; + while (window.GetEvent(event)) { // Close window : exit - if (Event.Type == sf::Event::Closed) - Running = false; + if (event.Type == sf::Event::Closed) + window.Close(); // Escape key : exit - if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)) - Running = false; + if ((event.Type == sf::Event::KeyPressed) && (event.Key.Code == sf::Key::Escape)) + window.Close(); } // Clear the window - App.Clear(); + window.Clear(); // Draw the error message - App.Draw(ErrorStr); + window.Draw(error); // Finally, display the rendered frame on screen - App.Display(); + window.Display(); } } diff --git a/samples/qt/Main.cpp b/samples/qt/Main.cpp index e8c597623..c256f1ab5 100644 --- a/samples/qt/Main.cpp +++ b/samples/qt/Main.cpp @@ -20,8 +20,8 @@ public : /// Construct the canvas /// //////////////////////////////////////////////////////////// - MyCanvas(QWidget* Parent = NULL) : - QSFMLCanvas(QSize(100, 100), 0, Parent) + MyCanvas(QWidget* parent = NULL) : + QSFMLCanvas(QSize(100, 100), 0, parent) { } @@ -48,19 +48,19 @@ private : //////////////////////////////////////////////////////////// virtual void OnUpdate() { - sf::Event Event; - while (GetEvent(Event)) + sf::Event event; + while (GetEvent(event)) { // Stick the sprite to the mouse cursor - if (Event.Type == sf::Event::MouseMoved) + if (event.Type == sf::Event::MouseMoved) { - mySprite.SetPosition(ConvertCoords(Event.MouseMove.X, Event.MouseMove.Y)); + mySprite.SetPosition(ConvertCoords(event.MouseMove.X, event.MouseMove.Y)); } // Adjust the size of the default view when the widget is resized - if (Event.Type == sf::Event::Resized) + if (event.Type == sf::Event::Resized) { - GetDefaultView().Reset(sf::FloatRect(0, 0, Event.Size.Width, Event.Size.Height)); + GetDefaultView().Reset(sf::FloatRect(0, 0, event.Size.Width, event.Size.Height)); } } @@ -90,26 +90,26 @@ private : //////////////////////////////////////////////////////////// int main(int argc, char **argv) { - QApplication App(argc, argv); + QApplication application(argc, argv); // Create the main frame - QFrame* MainFrame = new QFrame; - MainFrame->setWindowTitle("Qt SFML"); - MainFrame->resize(400, 400); - MainFrame->show(); + QFrame* mainFrame = new QFrame; + mainFrame->setWindowTitle("Qt SFML"); + mainFrame->resize(400, 400); + mainFrame->show(); // Create a label for showing some text - QLabel* Label = new QLabel("This is a SFML window\nembedded into a Qt frame :", MainFrame); - Label->setFont(QFont("courier new", 14, 1, false)); + QLabel* label = new QLabel("This is a SFML window\nembedded into a Qt frame :", mainFrame); + label->setFont(QFont("courier new", 14, 1, false)); // Create a SFML view inside the main frame - MyCanvas* SFMLView = new MyCanvas(MainFrame); + MyCanvas* SFMLView = new MyCanvas(mainFrame); // Create the main layout - QVBoxLayout* Layout = new QVBoxLayout; - Layout->addWidget(Label, 0); - Layout->addWidget(SFMLView, 1); - MainFrame->setLayout(Layout); + QVBoxLayout* layout = new QVBoxLayout; + layout->addWidget(label, 0); + layout->addWidget(SFMLView, 1); + mainFrame->setLayout(layout); - return App.exec(); + return application.exec(); } diff --git a/samples/qt/QSFMLCanvas.cpp b/samples/qt/QSFMLCanvas.cpp index 2f75566cf..32f461386 100644 --- a/samples/qt/QSFMLCanvas.cpp +++ b/samples/qt/QSFMLCanvas.cpp @@ -15,11 +15,11 @@ //////////////////////////////////////////////////////////// /// Construct the QSFMLCanvas //////////////////////////////////////////////////////////// -QSFMLCanvas::QSFMLCanvas(const QSize& Size, unsigned int FrameTime, QWidget* Parent) : -QWidget(Parent) +QSFMLCanvas::QSFMLCanvas(const QSize& size, unsigned int frameTime, QWidget* parent) : +QWidget(parent) { // Resize the widget - resize(Size); + resize(size); // Setup some states to allow direct rendering into the widget setAttribute(Qt::WA_PaintOnScreen); @@ -30,7 +30,7 @@ QWidget(Parent) setFocusPolicy(Qt::StrongFocus); // Setup the timer - myTimer.setInterval(FrameTime); + myTimer.setInterval(frameTime); } @@ -77,9 +77,9 @@ QPaintEngine* QSFMLCanvas::paintEngine() const /// we use it to catch the Polish event and initialize /// our SFML window //////////////////////////////////////////////////////////// -bool QSFMLCanvas::event(QEvent* Event) +bool QSFMLCanvas::event(QEvent* event) { - if (Event->type() == QEvent::Polish) + if (event->type() == QEvent::Polish) { // Under X11, we need to flush the commands sent to the server to ensure that // SFML will get an updated view of the windows @@ -98,7 +98,7 @@ bool QSFMLCanvas::event(QEvent* Event) myTimer.start(); } - return QWidget::event(Event); + return QWidget::event(event); } diff --git a/samples/qt/QSFMLCanvas.hpp b/samples/qt/QSFMLCanvas.hpp index 22a58ea50..2e7b03a5f 100644 --- a/samples/qt/QSFMLCanvas.hpp +++ b/samples/qt/QSFMLCanvas.hpp @@ -22,12 +22,12 @@ public : //////////////////////////////////////////////////////////// /// Construct the QSFMLCanvas /// - /// \param Size : Initial size of the widget - /// \param FrameTime : Frame duration, in milliseconds (0 by default) - /// \param Parent : Parent of the widget (NULL by default) + /// \param size : Initial size of the widget + /// \param frameTime : Frame duration, in milliseconds (0 by default) + /// \param parent : Parent of the widget (NULL by default) /// //////////////////////////////////////////////////////////// - QSFMLCanvas(const QSize& Size, unsigned int FrameTime = 0, QWidget* Parent = NULL); + QSFMLCanvas(const QSize& size, unsigned int frameTime = 0, QWidget* parent = NULL); //////////////////////////////////////////////////////////// /// Destructor @@ -62,8 +62,10 @@ private : /// we use it to catch the Polish event and initialize /// our SFML window /// + /// \param event : Event's attributes + /// //////////////////////////////////////////////////////////// - virtual bool event(QEvent* Event); + virtual bool event(QEvent* event); //////////////////////////////////////////////////////////// /// Called when the widget needs to be painted ; diff --git a/samples/sockets/Sockets.cpp b/samples/sockets/Sockets.cpp index 8c8d5c851..21cb97f1a 100644 --- a/samples/sockets/Sockets.cpp +++ b/samples/sockets/Sockets.cpp @@ -25,33 +25,33 @@ void DoServerUDP(unsigned short Port); int main() { // Choose a random port for opening sockets (ports < 1024 are reserved) - const unsigned short Port = 2435; + const unsigned short port = 2435; // TCP or UDP ? - char Protocol; + char protocol; std::cout << "Do you want to use TCP ('t') or UDP ('u') ? "; - std::cin >> Protocol; + std::cin >> protocol; // Client or server ? - char Who; + char who; std::cout << "Do you want to be a server ('s') or a client ('c') ? "; - std::cin >> Who; + std::cin >> who; - if (Who == 's') + if (who == 's') { // Run as a server - if (Protocol == 't') - DoServerTCP(Port); + if (protocol == 't') + DoServerTCP(port); else - DoServerUDP(Port); + DoServerUDP(port); } else { // Run as a client - if (Protocol == 't') - DoClientTCP(Port); + if (protocol == 't') + DoClientTCP(port); else - DoClientUDP(Port); + DoClientUDP(port); } // Wait until the user presses 'enter' key diff --git a/samples/sockets/TCP.cpp b/samples/sockets/TCP.cpp index 25fbb9a88..fa5c29e66 100644 --- a/samples/sockets/TCP.cpp +++ b/samples/sockets/TCP.cpp @@ -10,44 +10,44 @@ /// Create a client and connect it to a running server /// //////////////////////////////////////////////////////////// -void DoClientTCP(unsigned short Port) +void DoClientTCP(unsigned short port) { // Ask for server address - sf::IPAddress ServerAddress; + sf::IPAddress serverAddress; do { std::cout << "Type address or name of the server to connect to : "; - std::cin >> ServerAddress; + std::cin >> serverAddress; } - while (!ServerAddress.IsValid()); + while (!serverAddress.IsValid()); // Create a TCP socket for communicating with server - sf::SocketTCP Client; + sf::SocketTCP client; // Connect to the specified server - if (Client.Connect(Port, ServerAddress) != sf::Socket::Done) + if (client.Connect(port, serverAddress) != sf::Socket::Done) return; - std::cout << "Connected to server " << ServerAddress << std::endl; + std::cout << "Connected to server " << serverAddress << std::endl; // Receive a message from the client - char Message[128]; - std::size_t Received; - if (Client.Receive(Message, sizeof(Message), Received) != sf::Socket::Done) + char message[128]; + std::size_t received; + if (client.Receive(message, sizeof(message), received) != sf::Socket::Done) return; // Show it - std::cout << "Message received from server : \"" << Message << "\"" << std::endl; + std::cout << "Message received from server : \"" << message << "\"" << std::endl; // Define a message to send back to the server - char ToSend[] = "Hi, I'm a client !"; + char toSend[] = "Hi, I'm a client !"; // Send the message - if (Client.Send(ToSend, sizeof(ToSend)) != sf::Socket::Done) + if (client.Send(toSend, sizeof(toSend)) != sf::Socket::Done) return; - std::cout << "Message sent to server : \"" << ToSend << "\"" << std::endl; + std::cout << "Message sent to server : \"" << toSend << "\"" << std::endl; // Close the socket when we're done - Client.Close(); + client.Close(); } @@ -55,39 +55,39 @@ void DoClientTCP(unsigned short Port) /// Launch a server and wait for incoming connections /// //////////////////////////////////////////////////////////// -void DoServerTCP(unsigned short Port) +void DoServerTCP(unsigned short port) { // Create a TCP socket for communicating with clients - sf::SocketTCP Server; + sf::SocketTCP server; // Listen to a port for incoming connections - if (!Server.Listen(Port)) + if (!server.Listen(port)) return; - std::cout << "Server is listening to port " << Port << ", waiting for connections... " << std::endl; + std::cout << "Server is listening to port " << port << ", waiting for connections... " << std::endl; // Wait for a connection - sf::IPAddress ClientAddress; - sf::SocketTCP Client; - if (Server.Accept(Client, &ClientAddress) != sf::Socket::Done) + sf::IPAddress clientAddress; + sf::SocketTCP client; + if (server.Accept(client, &clientAddress) != sf::Socket::Done) return; - std::cout << "Client connected : " << ClientAddress << std::endl; + std::cout << "Client connected : " << clientAddress << std::endl; // Send a message to the client - char ToSend[] = "Hi, I'm the server"; - if (Client.Send(ToSend, sizeof(ToSend)) != sf::Socket::Done) + char toSend[] = "Hi, I'm the server"; + if (client.Send(toSend, sizeof(toSend)) != sf::Socket::Done) return; - std::cout << "Message sent to the client : \"" << ToSend << "\"" << std::endl; + std::cout << "Message sent to the client : \"" << toSend << "\"" << std::endl; // Receive a message back from the client - char Message[128]; - std::size_t Received; - if (Client.Receive(Message, sizeof(Message), Received) != sf::Socket::Done) + char message[128]; + std::size_t received; + if (client.Receive(message, sizeof(message), received) != sf::Socket::Done) return; // Show the message - std::cout << "Message received from the client : \"" << Message << "\"" << std::endl; + std::cout << "Message received from the client : \"" << message << "\"" << std::endl; // Close the sockets when we're done - Client.Close(); - Server.Close(); + client.Close(); + server.Close(); } diff --git a/samples/sound/Sound.cpp b/samples/sound/Sound.cpp index 982eb99cd..775b4b984 100644 --- a/samples/sound/Sound.cpp +++ b/samples/sound/Sound.cpp @@ -14,28 +14,28 @@ void PlaySound() { // Load a sound buffer from a wav file - sf::SoundBuffer Buffer; - if (!Buffer.LoadFromFile("datas/sound/footsteps.wav")) + sf::SoundBuffer buffer; + if (!buffer.LoadFromFile("datas/sound/footsteps.wav")) return; // Display sound informations std::cout << "footsteps.wav :" << std::endl; - std::cout << " " << Buffer.GetDuration() << " sec" << std::endl; - std::cout << " " << Buffer.GetSampleRate() << " samples / sec" << std::endl; - std::cout << " " << Buffer.GetChannelsCount() << " channels" << std::endl; + std::cout << " " << buffer.GetDuration() << " sec" << std::endl; + std::cout << " " << buffer.GetSampleRate() << " samples / sec" << std::endl; + std::cout << " " << buffer.GetChannelsCount() << " channels" << std::endl; // Create a sound instance and play it - sf::Sound Sound(Buffer); - Sound.Play(); + sf::Sound sound(buffer); + sound.Play(); // Loop while the sound is playing - while (Sound.GetStatus() == sf::Sound::Playing) + while (sound.GetStatus() == sf::Sound::Playing) { // Leave some CPU time for other processes sf::Sleep(0.1f); // Display the playing position - std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << Sound.GetPlayingOffset() << " sec "; + std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << sound.GetPlayingOffset() << " sec "; } std::cout << std::endl << std::endl; } @@ -48,27 +48,27 @@ void PlaySound() void PlayMusic() { // Load an ogg music file - sf::Music Music; - if (!Music.OpenFromFile("datas/sound/lepidoptera.ogg")) + sf::Music music; + if (!music.OpenFromFile("datas/sound/lepidoptera.ogg")) return; // Display music informations std::cout << "lepidoptera.ogg :" << std::endl; - std::cout << " " << Music.GetDuration() << " sec" << std::endl; - std::cout << " " << Music.GetSampleRate() << " samples / sec" << std::endl; - std::cout << " " << Music.GetChannelsCount() << " channels" << std::endl; + std::cout << " " << music.GetDuration() << " sec" << std::endl; + std::cout << " " << music.GetSampleRate() << " samples / sec" << std::endl; + std::cout << " " << music.GetChannelsCount() << " channels" << std::endl; // Play it - Music.Play(); + music.Play(); // Loop while the music is playing - while (Music.GetStatus() == sf::Music::Playing) + while (music.GetStatus() == sf::Music::Playing) { // Leave some CPU time for other processes sf::Sleep(0.1f); // Display the playing position - std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << Music.GetPlayingOffset() << " sec "; + std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << music.GetPlayingOffset() << " sec "; } std::cout << std::endl; } diff --git a/samples/sound_capture/SoundCapture.cpp b/samples/sound_capture/SoundCapture.cpp index 96ea4418b..be4d3f9e9 100644 --- a/samples/sound_capture/SoundCapture.cpp +++ b/samples/sound_capture/SoundCapture.cpp @@ -23,9 +23,9 @@ int main() } // Choose the sample rate - unsigned int SampleRate; + unsigned int sampleRate; std::cout << "Please choose the sample rate for sound capture (44100 is CD quality) : "; - std::cin >> SampleRate; + std::cin >> sampleRate; std::cin.ignore(10000, '\n'); // Wait for user input... @@ -33,50 +33,50 @@ int main() std::cin.ignore(10000, '\n'); // Here we'll use an integrated custom recorder, which saves the captured data into a SoundBuffer - sf::SoundBufferRecorder Recorder; + sf::SoundBufferRecorder recorder; // Audio capture is done in a separate thread, so we can block the main thread while it is capturing - Recorder.Start(SampleRate); + recorder.Start(sampleRate); std::cout << "Recording... press enter to stop"; std::cin.ignore(10000, '\n'); - Recorder.Stop(); + recorder.Stop(); // Get the buffer containing the captured data - const sf::SoundBuffer& Buffer = Recorder.GetBuffer(); + const sf::SoundBuffer& buffer = recorder.GetBuffer(); // Display captured sound informations std::cout << "Sound information :" << std::endl; - std::cout << " " << Buffer.GetDuration() << " seconds" << std::endl; - std::cout << " " << Buffer.GetSampleRate() << " samples / seconds" << std::endl; - std::cout << " " << Buffer.GetChannelsCount() << " channels" << std::endl; + std::cout << " " << buffer.GetDuration() << " seconds" << std::endl; + std::cout << " " << buffer.GetSampleRate() << " samples / seconds" << std::endl; + std::cout << " " << buffer.GetChannelsCount() << " channels" << std::endl; // Choose what to do with the recorded sound data - char Choice; + char choice; std::cout << "What do you want to do with captured sound (p = play, s = save) ? "; - std::cin >> Choice; + std::cin >> choice; std::cin.ignore(10000, '\n'); - if (Choice == 's') + if (choice == 's') { // Choose the filename - std::string Filename; + std::string filename; std::cout << "Choose the file to create : "; - std::getline(std::cin, Filename); + std::getline(std::cin, filename); // Save the buffer - Buffer.SaveToFile(Filename); + buffer.SaveToFile(filename); } else { // Create a sound instance and play it - sf::Sound Sound(Buffer); - Sound.Play(); + sf::Sound sound(buffer); + sound.Play(); // Wait until finished - while (Sound.GetStatus() == sf::Sound::Playing) + while (sound.GetStatus() == sf::Sound::Playing) { // Display the playing position - std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << Sound.GetPlayingOffset() << " sec"; + std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << sound.GetPlayingOffset() << " sec"; // Leave some CPU time for other threads sf::Sleep(0.1f); diff --git a/samples/voip/Client.cpp b/samples/voip/Client.cpp index 7f23e3b7a..552c4f602 100644 --- a/samples/voip/Client.cpp +++ b/samples/voip/Client.cpp @@ -7,8 +7,8 @@ #include -const sf::Uint8 AudioData = 1; -const sf::Uint8 EndOfStream = 2; +const sf::Uint8 audioData = 1; +const sf::Uint8 endOfStream = 2; //////////////////////////////////////////////////////////// @@ -25,8 +25,8 @@ public : /// \param Socket : Socket that holds the connection with the server /// //////////////////////////////////////////////////////////// - NetworkRecorder(sf::SocketTCP Socket) : - mySocket(Socket) + NetworkRecorder(sf::SocketTCP socket) : + mySocket(socket) { } @@ -37,15 +37,15 @@ private : /// /see SoundRecorder::ProcessSamples /// //////////////////////////////////////////////////////////// - virtual bool OnProcessSamples(const sf::Int16* Samples, std::size_t SamplesCount) + virtual bool OnProcessSamples(const sf::Int16* samples, std::size_t samplesCount) { // Pack the audio samples into a network packet - sf::Packet PacketOut; - PacketOut << AudioData; - PacketOut.Append(Samples, SamplesCount * sizeof(sf::Int16)); + sf::Packet packet; + packet << audioData; + packet.Append(samples, samplesCount * sizeof(sf::Int16)); // Send the audio packet to the server - return mySocket.Send(PacketOut) == sf::Socket::Done; + return mySocket.Send(packet) == sf::Socket::Done; } //////////////////////////////////////////////////////////// @@ -60,7 +60,7 @@ private : /// start sending him audio data /// //////////////////////////////////////////////////////////// -void DoClient(unsigned short Port) +void DoClient(unsigned short port) { // Check that the device can capture audio if (sf::SoundRecorder::CanCapture() == false) @@ -70,21 +70,21 @@ void DoClient(unsigned short Port) } // Ask for server address - sf::IPAddress ServerAddress; + sf::IPAddress serverAddress; do { std::cout << "Type address or name of the server to connect to : "; - std::cin >> ServerAddress; + std::cin >> serverAddress; } - while (!ServerAddress.IsValid()); + while (!serverAddress.IsValid()); // Create a TCP socket for communicating with server - sf::SocketTCP Socket; + sf::SocketTCP socket; // Connect to the specified server - if (Socket.Connect(Port, ServerAddress) != sf::Socket::Done) + if (socket.Connect(port, serverAddress) != sf::Socket::Done) return; - std::cout << "Connected to server " << ServerAddress << std::endl; + std::cout << "Connected to server " << serverAddress << std::endl; // Wait for user input... std::cin.ignore(10000, '\n'); @@ -92,19 +92,19 @@ void DoClient(unsigned short Port) std::cin.ignore(10000, '\n'); // Create a instance of our custom recorder - NetworkRecorder Recorder(Socket); + NetworkRecorder recorder(socket); // Start capturing audio data - Recorder.Start(44100); + recorder.Start(44100); std::cout << "Recording... press enter to stop"; std::cin.ignore(10000, '\n'); - Recorder.Stop(); + recorder.Stop(); // Send a "end-of-stream" packet - sf::Packet PacketOut; - PacketOut << EndOfStream; - Socket.Send(PacketOut); + sf::Packet packet; + packet << endOfStream; + socket.Send(packet); // Close the socket when we're done - Socket.Close(); + socket.Close(); } diff --git a/samples/voip/Server.cpp b/samples/voip/Server.cpp index 6447d8cd4..29ed6d83d 100644 --- a/samples/voip/Server.cpp +++ b/samples/voip/Server.cpp @@ -8,8 +8,8 @@ #include -const sf::Uint8 AudioData = 1; -const sf::Uint8 EndOfStream = 2; +const sf::Uint8 audioData = 1; +const sf::Uint8 endOfStream = 2; //////////////////////////////////////////////////////////// @@ -47,19 +47,19 @@ public : /// Run the server, stream audio data from the client /// //////////////////////////////////////////////////////////// - void Start(unsigned short Port) + void Start(unsigned short port) { if (!myHasFinished) { // Listen to the given port for incoming connections - if (!myListener.Listen(Port)) + if (!myListener.Listen(port)) return; - std::cout << "Server is listening to port " << Port << ", waiting for connections... " << std::endl; + std::cout << "Server is listening to port " << port << ", waiting for connections... " << std::endl; // Wait for a connection - sf::IPAddress ClientAddress; - myListener.Accept(myClient, &ClientAddress); - std::cout << "Client connected : " << ClientAddress << std::endl; + sf::IPAddress clientAddress; + myListener.Accept(myClient, &clientAddress); + std::cout << "Client connected : " << clientAddress << std::endl; // Start playback Play(); @@ -80,7 +80,7 @@ private : /// /see SoundStream::OnGetData /// //////////////////////////////////////////////////////////// - virtual bool OnGetData(sf::SoundStream::Chunk& Data) + virtual bool OnGetData(sf::SoundStream::Chunk& data) { // We have reached the end of the buffer and all audio data have been played : we can stop playback if ((myOffset >= mySamples.size()) && myHasFinished) @@ -93,13 +93,13 @@ private : // Copy samples into a local buffer to avoid synchronization problems // (don't forget that we run in two separate threads) { - sf::Lock Lock(myMutex); + sf::Lock lock(myMutex); myTempBuffer.assign(mySamples.begin() + myOffset, mySamples.end()); } // Fill audio data to pass to the stream - Data.Samples = &myTempBuffer[0]; - Data.NbSamples = myTempBuffer.size(); + data.Samples = &myTempBuffer[0]; + data.NbSamples = myTempBuffer.size(); // Update the playing offset myOffset += myTempBuffer.size(); @@ -111,9 +111,9 @@ private : /// /see SoundStream::OnSeek /// //////////////////////////////////////////////////////////// - virtual void OnSeek(float TimeOffset) + virtual void OnSeek(float timeOffset) { - myOffset = static_cast(TimeOffset * GetSampleRate() * GetChannelsCount()); + myOffset = static_cast(timeOffset * GetSampleRate() * GetChannelsCount()); } //////////////////////////////////////////////////////////// @@ -125,28 +125,28 @@ private : while (!myHasFinished) { // Get waiting audio data from the network - sf::Packet PacketIn; - if (myClient.Receive(PacketIn) != sf::Socket::Done) + sf::Packet packet; + if (myClient.Receive(packet) != sf::Socket::Done) break; // Extract the message ID - sf::Uint8 Id; - PacketIn >> Id; + sf::Uint8 id; + packet >> id; - if (Id == AudioData) + if (id == audioData) { // Extract audio samples from the packet, and append it to our samples buffer - const sf::Int16* Samples = reinterpret_cast(PacketIn.GetData() + 1); - std::size_t NbSamples = (PacketIn.GetDataSize() - 1) / sizeof(sf::Int16); + const sf::Int16* samples = reinterpret_cast(packet.GetData() + 1); + std::size_t nbSamples = (packet.GetDataSize() - 1) / sizeof(sf::Int16); // Don't forget that the other thread can access the samples array at any time // (so we protect any operation on it with the mutex) { - sf::Lock Lock(myMutex); - std::copy(Samples, Samples + NbSamples, std::back_inserter(mySamples)); + sf::Lock lock(myMutex); + std::copy(samples, samples + nbSamples, std::back_inserter(mySamples)); } } - else if (Id == EndOfStream) + else if (id == endOfStream) { // End of stream reached : we stop receiving audio data std::cout << "Audio data has been 100% received !" << std::endl; @@ -179,14 +179,14 @@ private : /// a connected client /// //////////////////////////////////////////////////////////// -void DoServer(unsigned short Port) +void DoServer(unsigned short port) { // Build an audio stream to play sound data as it is received through the network - NetworkAudioStream AudioStream; - AudioStream.Start(Port); + NetworkAudioStream audioStream; + audioStream.Start(port); // Loop until the sound playback is finished - while (AudioStream.GetStatus() != sf::SoundStream::Stopped) + while (audioStream.GetStatus() != sf::SoundStream::Stopped) { // Leave some CPU time for other threads sf::Sleep(0.1f); @@ -199,10 +199,10 @@ void DoServer(unsigned short Port) std::cin.ignore(10000, '\n'); // Replay the sound (just to make sure replaying the received data is OK) - AudioStream.Play(); + audioStream.Play(); // Loop until the sound playback is finished - while (AudioStream.GetStatus() != sf::SoundStream::Stopped) + while (audioStream.GetStatus() != sf::SoundStream::Stopped) { // Leave some CPU time for other threads sf::Sleep(0.1f); diff --git a/samples/voip/VoIP.cpp b/samples/voip/VoIP.cpp index 125bd8a52..dfc7e9d66 100644 --- a/samples/voip/VoIP.cpp +++ b/samples/voip/VoIP.cpp @@ -3,7 +3,7 @@ // Headers //////////////////////////////////////////////////////////// #include -#include +#include #include @@ -11,8 +11,8 @@ // Function prototypes // (I'm too lazy to put them into separate headers...) //////////////////////////////////////////////////////////// -void DoClient(unsigned short Port); -void DoServer(unsigned short Port); +void DoClient(unsigned short port); +void DoServer(unsigned short port); //////////////////////////////////////////////////////////// @@ -24,22 +24,22 @@ void DoServer(unsigned short Port); int main() { // Choose a random port for opening sockets (ports < 1024 are reserved) - const unsigned short Port = 2435; + const unsigned short port = 2435; // Client or server ? - char Who; + char who; std::cout << "Do you want to be a server ('s') or a client ('c') ? "; - std::cin >> Who; + std::cin >> who; - if (Who == 's') + if (who == 's') { // Run as a server - DoServer(Port); + DoServer(port); } else { // Run as a client - DoClient(Port); + DoClient(port); } // Wait until the user presses 'enter' key diff --git a/samples/win32/Win32.cpp b/samples/win32/Win32.cpp index 7ef0b28e2..3dd8df81b 100644 --- a/samples/win32/Win32.cpp +++ b/samples/win32/Win32.cpp @@ -6,16 +6,16 @@ #include #include -HWND Button; +HWND button; //////////////////////////////////////////////////////////// /// Function called whenever one of our windows receives a message /// //////////////////////////////////////////////////////////// -LRESULT CALLBACK OnEvent(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam) +LRESULT CALLBACK OnEvent(HWND handle, UINT message, WPARAM wParam, LPARAM lParam) { - switch (Message) + switch (message) { // Quit when we close the main window case WM_CLOSE : @@ -27,7 +27,7 @@ LRESULT CALLBACK OnEvent(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam // Quit when we click the "quit" button case WM_COMMAND : { - if (reinterpret_cast(LParam) == Button) + if (reinterpret_cast(lParam) == button) { PostQuitMessage(0); return 0; @@ -35,7 +35,7 @@ LRESULT CALLBACK OnEvent(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam } } - return DefWindowProc(Handle, Message, WParam, LParam); + return DefWindowProc(handle, message, wParam, lParam); } @@ -47,55 +47,55 @@ LRESULT CALLBACK OnEvent(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam /// \return Error code /// //////////////////////////////////////////////////////////// -INT WINAPI WinMain(HINSTANCE Instance, HINSTANCE, LPSTR, INT) +INT WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, INT) { // Define a class for our main window - WNDCLASS WindowClass; - WindowClass.style = 0; - WindowClass.lpfnWndProc = &OnEvent; - WindowClass.cbClsExtra = 0; - WindowClass.cbWndExtra = 0; - WindowClass.hInstance = Instance; - WindowClass.hIcon = NULL; - WindowClass.hCursor = 0; - WindowClass.hbrBackground = reinterpret_cast(COLOR_BACKGROUND); - WindowClass.lpszMenuName = NULL; - WindowClass.lpszClassName = TEXT("SFML App"); - RegisterClass(&WindowClass); + WNDCLASS windowClass; + windowClass.style = 0; + windowClass.lpfnWndProc = &OnEvent; + windowClass.cbClsExtra = 0; + windowClass.cbWndExtra = 0; + windowClass.hInstance = instance; + windowClass.hIcon = NULL; + windowClass.hCursor = 0; + windowClass.hbrBackground = reinterpret_cast(COLOR_BACKGROUND); + windowClass.lpszMenuName = NULL; + windowClass.lpszClassName = TEXT("SFML App"); + RegisterClass(&windowClass); // Let's create the main window - HWND Window = CreateWindow(TEXT("SFML App"), TEXT("SFML Win32"), WS_SYSMENU | WS_VISIBLE, 200, 200, 660, 520, NULL, NULL, Instance, NULL); + HWND window = CreateWindow(TEXT("SFML App"), TEXT("SFML Win32"), WS_SYSMENU | WS_VISIBLE, 200, 200, 660, 520, NULL, NULL, instance, NULL); // Add a button for exiting - Button = CreateWindow(TEXT("BUTTON"), TEXT("Quit"), WS_CHILD | WS_VISIBLE, 560, 440, 80, 40, Window, NULL, Instance, NULL); + button = CreateWindow(TEXT("BUTTON"), TEXT("Quit"), WS_CHILD | WS_VISIBLE, 560, 440, 80, 40, window, NULL, instance, NULL); // Let's create two SFML views - HWND View1 = CreateWindow(TEXT("STATIC"), NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, 20, 20, 300, 400, Window, NULL, Instance, NULL); - HWND View2 = CreateWindow(TEXT("STATIC"), NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, 340, 20, 300, 400, Window, NULL, Instance, NULL); - sf::RenderWindow SFMLView1(View1); - sf::RenderWindow SFMLView2(View2); + HWND view1 = CreateWindow(TEXT("STATIC"), NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, 20, 20, 300, 400, window, NULL, instance, NULL); + HWND view2 = CreateWindow(TEXT("STATIC"), NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, 340, 20, 300, 400, window, NULL, instance, NULL); + sf::RenderWindow SFMLView1(view1); + sf::RenderWindow SFMLView2(view2); // Load some images to display - sf::Image Image1, Image2; - if (!Image1.LoadFromFile("datas/win32/image1.jpg") || !Image2.LoadFromFile("datas/win32/image2.jpg")) + sf::Image image1, image2; + if (!image1.LoadFromFile("datas/win32/image1.jpg") || !image2.LoadFromFile("datas/win32/image2.jpg")) return EXIT_FAILURE; - sf::Sprite Sprite1(Image1); - sf::Sprite Sprite2(Image2); - Sprite1.SetOrigin(Sprite1.GetSize() / 2.f); + sf::Sprite sprite1(image1); + sf::Sprite sprite2(image2); + sprite1.SetOrigin(sprite1.GetSize() / 2.f); // Create a clock for measuring elapsed time - sf::Clock Clock; + sf::Clock clock; // Loop until a WM_QUIT message is received - MSG Message; - Message.message = static_cast(~WM_QUIT); - while (Message.message != WM_QUIT) + MSG message; + message.message = static_cast(~WM_QUIT); + while (message.message != WM_QUIT) { - if (PeekMessage(&Message, NULL, 0, 0, PM_REMOVE)) + if (PeekMessage(&message, NULL, 0, 0, PM_REMOVE)) { // If a message was waiting in the message queue, process it - TranslateMessage(&Message); - DispatchMessage(&Message); + TranslateMessage(&message); + DispatchMessage(&message); } else { @@ -104,12 +104,12 @@ INT WINAPI WinMain(HINSTANCE Instance, HINSTANCE, LPSTR, INT) SFMLView2.Clear(); // Draw sprite 1 on view 1 - Sprite1.SetRotation(Clock.GetElapsedTime() * 100); - SFMLView1.Draw(Sprite1); + sprite1.SetRotation(clock.GetElapsedTime() * 100); + SFMLView1.Draw(sprite1); // Draw sprite 2 on view 2 - Sprite2.SetX(cos(Clock.GetElapsedTime()) * 100); - SFMLView2.Draw(Sprite2); + sprite2.SetX(cos(clock.GetElapsedTime()) * 100); + SFMLView2.Draw(sprite2); // Display each view on screen SFMLView1.Display(); @@ -118,10 +118,10 @@ INT WINAPI WinMain(HINSTANCE Instance, HINSTANCE, LPSTR, INT) } // Destroy the main window (all its child controls will be destroyed) - DestroyWindow(Window); + DestroyWindow(window); // Don't forget to unregister the window class - UnregisterClass(TEXT("SFML App"), Instance); + UnregisterClass(TEXT("SFML App"), instance); return EXIT_SUCCESS; } diff --git a/samples/window/Window.cpp b/samples/window/Window.cpp index a2860e64a..aacd81719 100644 --- a/samples/window/Window.cpp +++ b/samples/window/Window.cpp @@ -15,10 +15,10 @@ int main() { // Create the main window - sf::Window App(sf::VideoMode(640, 480, 32), "SFML Window"); + sf::Window window(sf::VideoMode(640, 480, 32), "SFML Window"); // Create a clock for measuring the time elapsed - sf::Clock Clock; + sf::Clock clock; // Set the color and depth clear values glClearDepth(1.f); @@ -34,29 +34,29 @@ int main() gluPerspective(90.f, 1.f, 1.f, 500.f); // Start the game loop - while (App.IsOpened()) + while (window.IsOpened()) { // Process events - sf::Event Event; - while (App.GetEvent(Event)) + sf::Event event; + while (window.GetEvent(event)) { // Close window : exit - if (Event.Type == sf::Event::Closed) - App.Close(); + if (event.Type == sf::Event::Closed) + window.Close(); // Escape key : exit - if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)) - App.Close(); + if ((event.Type == sf::Event::KeyPressed) && (event.Key.Code == sf::Key::Escape)) + window.Close(); // Resize event : adjust viewport - if (Event.Type == sf::Event::Resized) - glViewport(0, 0, Event.Size.Width, Event.Size.Height); + if (event.Type == sf::Event::Resized) + glViewport(0, 0, event.Size.Width, event.Size.Height); } // Set the active window before using OpenGL commands // It's useless here because the active window is always the same, // but don't forget it if you use multiple windows - App.SetActive(); + window.SetActive(); // Clear color and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -65,9 +65,9 @@ int main() glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.f, 0.f, -200.f); - glRotatef(Clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f); - glRotatef(Clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f); - glRotatef(Clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f); + glRotatef(clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f); + glRotatef(clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f); + glRotatef(clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f); // Draw a cube glBegin(GL_QUADS); @@ -111,7 +111,7 @@ int main() glEnd(); // Finally, display the rendered frame on screen - App.Display(); + window.Display(); } return EXIT_SUCCESS; diff --git a/samples/wxwidgets/Main.cpp b/samples/wxwidgets/Main.cpp index b95654058..5f8aa75ab 100644 --- a/samples/wxwidgets/Main.cpp +++ b/samples/wxwidgets/Main.cpp @@ -17,8 +17,8 @@ public : /// Construct the canvas /// //////////////////////////////////////////////////////////// - MyCanvas(wxWindow* Parent, wxWindowID Id, const wxPoint& Position, const wxSize& Size, long Style = 0) : - wxSFMLCanvas(Parent, Id, Position, Size, Style) + MyCanvas(wxWindow* parent, wxWindowID id, const wxPoint& position, const wxSize& size, long style = 0) : + wxSFMLCanvas(parent, id, position, size, style) { // Load an image and assign it to our sprite myImage.LoadFromFile("datas/wxwidgets/sfml.png"); @@ -52,10 +52,10 @@ private : /// Function called when the mouse cursor moves /// //////////////////////////////////////////////////////////// - void OnMouseMove(wxMouseEvent& Event) + void OnMouseMove(wxMouseEvent& event) { // Make the sprite follow the mouse cursor - mySprite.SetPosition(ConvertCoords(Event.GetX(), Event.GetY())); + mySprite.SetPosition(ConvertCoords(event.GetX(), event.GetY())); } //////////////////////////////////////////////////////////// @@ -100,8 +100,8 @@ private : virtual bool OnInit() { // Create the main window - MyFrame* MainFrame = new MyFrame; - MainFrame->Show(); + MyFrame* mainFrame = new MyFrame; + mainFrame->Show(); return true; } diff --git a/samples/wxwidgets/wxSFMLCanvas.cpp b/samples/wxwidgets/wxSFMLCanvas.cpp index 915b9f153..1a62ef0a2 100644 --- a/samples/wxwidgets/wxSFMLCanvas.cpp +++ b/samples/wxwidgets/wxSFMLCanvas.cpp @@ -26,17 +26,17 @@ END_EVENT_TABLE() //////////////////////////////////////////////////////////// /// Construct the wxSFMLCanvas //////////////////////////////////////////////////////////// -wxSFMLCanvas::wxSFMLCanvas(wxWindow* Parent, wxWindowID Id, const wxPoint& Position, const wxSize& Size, long Style) : -wxControl(Parent, Id, Position, Size, Style) +wxSFMLCanvas::wxSFMLCanvas(wxWindow* parent, wxWindowID id, const wxPoint& position, const wxSize& size, long style) : +wxControl(parent, id, position, size, style) { #ifdef __WXGTK__ // GTK implementation requires to go deeper to find the low-level X11 identifier of the widget gtk_widget_realize(m_wxwindow); gtk_widget_set_double_buffered(m_wxwindow, false); - GdkWindow* Win = GTK_PIZZA(m_wxwindow)->bin_window; - XFlush(GDK_WINDOW_XDISPLAY(Win)); - sf::RenderWindow::Create(GDK_WINDOW_XWINDOW(Win)); + GdkWindow* window = GTK_PIZZA(m_wxwindow)->bin_window; + XFlush(GDK_WINDOW_XDISPLAY(window)); + sf::RenderWindow::Create(GDK_WINDOW_XWINDOW(window)); #else @@ -84,7 +84,7 @@ void wxSFMLCanvas::OnIdle(wxIdleEvent&) void wxSFMLCanvas::OnPaint(wxPaintEvent&) { // Make sure the control is able to be repainted - wxPaintDC Dc(this); + wxPaintDC dc(this); // Let the derived class do its specific stuff OnUpdate(); diff --git a/samples/wxwidgets/wxSFMLCanvas.hpp b/samples/wxwidgets/wxSFMLCanvas.hpp index d73e6145a..e17219198 100644 --- a/samples/wxwidgets/wxSFMLCanvas.hpp +++ b/samples/wxwidgets/wxSFMLCanvas.hpp @@ -19,14 +19,14 @@ public : //////////////////////////////////////////////////////////// /// Construct the wxSFMLCanvas /// - /// \param Parent : Parent of the control (NULL by default) - /// \param Id : Identifier of the control (-1 by default) - /// \param Position : Position of the control (wxDefaultPosition by default) - /// \param Size : Size of the control (wxDefaultSize by default) - /// \param Style : Style of the control (0 by default) + /// \param parent : Parent of the control (NULL by default) + /// \param id : Identifier of the control (-1 by default) + /// \param position : Position of the control (wxDefaultPosition by default) + /// \param size : Size of the control (wxDefaultSize by default) + /// \param style : Style of the control (0 by default) /// //////////////////////////////////////////////////////////// - wxSFMLCanvas(wxWindow* Parent = NULL, wxWindowID Id = -1, const wxPoint& Position = wxDefaultPosition, const wxSize& Size = wxDefaultSize, long Style = 0); + wxSFMLCanvas(wxWindow* parent = NULL, wxWindowID id = -1, const wxPoint& position = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0); //////////////////////////////////////////////////////////// /// Destructor diff --git a/src/SFML/Audio/AudioDevice.cpp b/src/SFML/Audio/AudioDevice.cpp index 096a1635a..40311aa83 100644 --- a/src/SFML/Audio/AudioDevice.cpp +++ b/src/SFML/Audio/AudioDevice.cpp @@ -32,21 +32,23 @@ #include +//////////////////////////////////////////////////////////// +// Private data +//////////////////////////////////////////////////////////// +namespace +{ + sf::priv::AudioDevice globalDevice; +} + + namespace sf { namespace priv { -//////////////////////////////////////////////////////////// -// Static member data -//////////////////////////////////////////////////////////// -AudioDevice* AudioDevice::ourInstance; - - //////////////////////////////////////////////////////////// /// Default constructor //////////////////////////////////////////////////////////// -AudioDevice::AudioDevice() : -myRefCount(0) +AudioDevice::AudioDevice() { // Create the device myDevice = alcOpenDevice(NULL); @@ -98,42 +100,7 @@ AudioDevice::~AudioDevice() //////////////////////////////////////////////////////////// AudioDevice& AudioDevice::GetInstance() { - // Create the audio device if it doesn't exist - if (!ourInstance) - ourInstance = new AudioDevice; - - return *ourInstance; -} - - -//////////////////////////////////////////////////////////// -/// Add a reference to the audio device -//////////////////////////////////////////////////////////// -void AudioDevice::AddReference() -{ - // Create the audio device if it doesn't exist - if (!ourInstance) - ourInstance = new AudioDevice; - - // Increase the references count - ourInstance->myRefCount++; -} - - -//////////////////////////////////////////////////////////// -/// Remove a reference to the audio device -//////////////////////////////////////////////////////////// -void AudioDevice::RemoveReference() -{ - // Decrease the references count - ourInstance->myRefCount--; - - // Destroy the audio device if the references count reaches 0 - if (ourInstance->myRefCount == 0) - { - delete ourInstance; - ourInstance = NULL; - } + return globalDevice; } @@ -149,10 +116,10 @@ ALCdevice* AudioDevice::GetDevice() const //////////////////////////////////////////////////////////// /// Get the OpenAL format that matches the given number of channels //////////////////////////////////////////////////////////// -ALenum AudioDevice::GetFormatFromChannelsCount(unsigned int ChannelsCount) const +ALenum AudioDevice::GetFormatFromChannelsCount(unsigned int channelsCount) const { // Find the good format according to the number of channels - switch (ChannelsCount) + switch (channelsCount) { case 1 : return AL_FORMAT_MONO16; case 2 : return AL_FORMAT_STEREO16; diff --git a/src/SFML/Audio/AudioDevice.hpp b/src/SFML/Audio/AudioDevice.hpp index 6b47177d0..d5fc7651c 100644 --- a/src/SFML/Audio/AudioDevice.hpp +++ b/src/SFML/Audio/AudioDevice.hpp @@ -35,8 +35,6 @@ namespace sf { -class AudioResource; - namespace priv { @@ -49,46 +47,6 @@ class AudioDevice { public : - //////////////////////////////////////////////////////////// - /// Get the unique instance of the class - /// - /// \return Unique instance of the class - /// - //////////////////////////////////////////////////////////// - static AudioDevice& GetInstance(); - - //////////////////////////////////////////////////////////// - /// Add a reference to the audio device - /// - //////////////////////////////////////////////////////////// - static void AddReference(); - - //////////////////////////////////////////////////////////// - /// Remove a reference to the audio device - /// - //////////////////////////////////////////////////////////// - static void RemoveReference(); - - //////////////////////////////////////////////////////////// - /// Get the OpenAL audio device - /// - /// \return OpenAL device (cannot be NULL) - /// - //////////////////////////////////////////////////////////// - ALCdevice* GetDevice() const; - - //////////////////////////////////////////////////////////// - /// Get the OpenAL format that matches the given number of channels - /// - /// \param ChannelsCount : Number of channels - /// - /// \return OpenAL device (cannot be NULL) - /// - //////////////////////////////////////////////////////////// - ALenum GetFormatFromChannelsCount(unsigned int ChannelsCount) const; - -private : - //////////////////////////////////////////////////////////// /// Default constructor /// @@ -102,16 +60,38 @@ private : ~AudioDevice(); //////////////////////////////////////////////////////////// - // Static member data + /// Get the unique instance of the class + /// + /// \return Unique instance of the class + /// //////////////////////////////////////////////////////////// - static AudioDevice* ourInstance; ///< Unique instance of the audio device + static AudioDevice& GetInstance(); + + //////////////////////////////////////////////////////////// + /// Get the OpenAL audio device + /// + /// \return OpenAL device (cannot be NULL) + /// + //////////////////////////////////////////////////////////// + ALCdevice* GetDevice() const; + + //////////////////////////////////////////////////////////// + /// Get the OpenAL format that matches the given number of channels + /// + /// \param channelsCount : Number of channels + /// + /// \return Corresponding format + /// + //////////////////////////////////////////////////////////// + ALenum GetFormatFromChannelsCount(unsigned int channelsCount) const; + +private : //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - ALCdevice* myDevice; ///< Audio device - ALCcontext* myContext; ///< Audio context - unsigned int myRefCount; ///< References count + ALCdevice* myDevice; ///< Audio device + ALCcontext* myContext; ///< Audio context }; } // namespace priv diff --git a/src/SFML/Audio/AudioResource.cpp b/src/SFML/Audio/AudioResource.cpp deleted file mode 100644 index a1a352c52..000000000 --- a/src/SFML/Audio/AudioResource.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//////////////////////////////////////////////////////////// -// -// SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) -// -// This software is provided 'as-is', without any express or implied warranty. -// In no event will the authors be held liable for any damages arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it freely, -// subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; -// you must not claim that you wrote the original software. -// If you use this software in a product, an acknowledgment -// in the product documentation would be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, -// and must not be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. -// -//////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////// -// Headers -//////////////////////////////////////////////////////////// -#include -#include - - -namespace sf -{ -//////////////////////////////////////////////////////////// -/// Default constructor -//////////////////////////////////////////////////////////// -AudioResource::AudioResource() -{ - priv::AudioDevice::AddReference(); -} - - -//////////////////////////////////////////////////////////// -/// Copy constructor -//////////////////////////////////////////////////////////// -AudioResource::AudioResource(const AudioResource&) -{ - priv::AudioDevice::AddReference(); -} - - -//////////////////////////////////////////////////////////// -/// Destructor -//////////////////////////////////////////////////////////// -AudioResource::~AudioResource() -{ - priv::AudioDevice::RemoveReference(); -} - -} // namespace sf diff --git a/src/SFML/Audio/Listener.cpp b/src/SFML/Audio/Listener.cpp index b51b3c5b3..19cacc2e8 100644 --- a/src/SFML/Audio/Listener.cpp +++ b/src/SFML/Audio/Listener.cpp @@ -34,9 +34,9 @@ namespace sf //////////////////////////////////////////////////////////// /// Change the global volume of all the sounds //////////////////////////////////////////////////////////// -void Listener::SetGlobalVolume(float Volume) +void Listener::SetGlobalVolume(float volume) { - ALCheck(alListenerf(AL_GAIN, Volume * 0.01f)); + ALCheck(alListenerf(AL_GAIN, volume * 0.01f)); } @@ -45,28 +45,28 @@ void Listener::SetGlobalVolume(float Volume) //////////////////////////////////////////////////////////// float Listener::GetGlobalVolume() { - float Volume = 0.f; - ALCheck(alGetListenerf(AL_GAIN, &Volume)); + float volume = 0.f; + ALCheck(alGetListenerf(AL_GAIN, &volume)); - return Volume; + return volume; } //////////////////////////////////////////////////////////// /// Change the position of the listener (take 3 values) //////////////////////////////////////////////////////////// -void Listener::SetPosition(float X, float Y, float Z) +void Listener::SetPosition(float x, float y, float z) { - ALCheck(alListener3f(AL_POSITION, X, Y, Z)); + ALCheck(alListener3f(AL_POSITION, x, y, z)); } //////////////////////////////////////////////////////////// /// Change the position of the listener (take a 3D vector) //////////////////////////////////////////////////////////// -void Listener::SetPosition(const Vector3f& Position) +void Listener::SetPosition(const Vector3f& position) { - SetPosition(Position.x, Position.y, Position.z); + SetPosition(position.x, position.y, position.z); } @@ -75,10 +75,10 @@ void Listener::SetPosition(const Vector3f& Position) //////////////////////////////////////////////////////////// Vector3f Listener::GetPosition() { - Vector3f Position; - ALCheck(alGetListener3f(AL_POSITION, &Position.x, &Position.y, &Position.z)); + Vector3f position; + ALCheck(alGetListener3f(AL_POSITION, &position.x, &position.y, &position.z)); - return Position; + return position; } @@ -86,10 +86,10 @@ Vector3f Listener::GetPosition() /// Change the orientation of the listener (the point /// he must look at) (take 3 values) //////////////////////////////////////////////////////////// -void Listener::SetTarget(float X, float Y, float Z) +void Listener::SetTarget(float x, float y, float z) { - float Orientation[] = {X, Y, Z, 0.f, 1.f, 0.f}; - ALCheck(alListenerfv(AL_ORIENTATION, Orientation)); + float orientation[] = {x, y, z, 0.f, 1.f, 0.f}; + ALCheck(alListenerfv(AL_ORIENTATION, orientation)); } @@ -97,9 +97,9 @@ void Listener::SetTarget(float X, float Y, float Z) /// Change the orientation of the listener (the point /// he must look at) (take a 3D vector) //////////////////////////////////////////////////////////// -void Listener::SetTarget(const Vector3f& Target) +void Listener::SetTarget(const Vector3f& target) { - SetTarget(Target.x, Target.y, Target.z); + SetTarget(target.x, target.y, target.z); } @@ -109,10 +109,10 @@ void Listener::SetTarget(const Vector3f& Target) //////////////////////////////////////////////////////////// Vector3f Listener::GetTarget() { - float Orientation[6]; - ALCheck(alGetListenerfv(AL_ORIENTATION, Orientation)); + float orientation[6]; + ALCheck(alGetListenerfv(AL_ORIENTATION, orientation)); - return Vector3f(Orientation[0], Orientation[1], Orientation[2]); + return Vector3f(orientation[0], orientation[1], orientation[2]); } } // namespace sf diff --git a/src/SFML/Audio/Music.cpp b/src/SFML/Audio/Music.cpp index ff769bdbe..42370cc1a 100644 --- a/src/SFML/Audio/Music.cpp +++ b/src/SFML/Audio/Music.cpp @@ -38,10 +38,10 @@ namespace sf //////////////////////////////////////////////////////////// /// Construct the music with a buffer size //////////////////////////////////////////////////////////// -Music::Music(std::size_t BufferSize) : +Music::Music(std::size_t bufferSize) : myFile (new priv::SoundFile), myDuration(0.f), -mySamples (BufferSize) +mySamples (bufferSize) { } @@ -62,15 +62,15 @@ Music::~Music() //////////////////////////////////////////////////////////// /// Open a music file (doesn't play it -- call Play() for that) //////////////////////////////////////////////////////////// -bool Music::OpenFromFile(const std::string& Filename) +bool Music::OpenFromFile(const std::string& filename) { // First stop the music if it was already running Stop(); // Create the sound file implementation, and open it in read mode - if (!myFile->OpenRead(Filename)) + if (!myFile->OpenRead(filename)) { - std::cerr << "Failed to open \"" << Filename << "\" for reading" << std::endl; + std::cerr << "Failed to open \"" << filename << "\" for reading" << std::endl; return false; } @@ -87,13 +87,13 @@ bool Music::OpenFromFile(const std::string& Filename) //////////////////////////////////////////////////////////// /// Open a music file from memory (doesn't play it -- call Play() for that) //////////////////////////////////////////////////////////// -bool Music::OpenFromMemory(const char* Data, std::size_t SizeInBytes) +bool Music::OpenFromMemory(const char* data, std::size_t sizeInBytes) { // First stop the music if it was already running Stop(); // Create the sound file implementation, and open it in read mode - if (!myFile->OpenRead(Data, SizeInBytes)) + if (!myFile->OpenRead(data, sizeInBytes)) { std::cerr << "Failed to open music from memory for reading" << std::endl; return false; @@ -121,27 +121,27 @@ float Music::GetDuration() const //////////////////////////////////////////////////////////// /// /see SoundStream::OnGetData //////////////////////////////////////////////////////////// -bool Music::OnGetData(SoundStream::Chunk& Data) +bool Music::OnGetData(SoundStream::Chunk& data) { - sf::Lock Lock(myMutex); + sf::Lock lock(myMutex); // Fill the chunk parameters - Data.Samples = &mySamples[0]; - Data.NbSamples = myFile->Read(&mySamples[0], mySamples.size()); + data.Samples = &mySamples[0]; + data.NbSamples = myFile->Read(&mySamples[0], mySamples.size()); // Check if we have reached the end of the audio file - return Data.NbSamples == mySamples.size(); + return data.NbSamples == mySamples.size(); } //////////////////////////////////////////////////////////// /// /see SoundStream::OnSeek //////////////////////////////////////////////////////////// -void Music::OnSeek(float TimeOffset) +void Music::OnSeek(float timeOffset) { - sf::Lock Lock(myMutex); + sf::Lock lock(myMutex); - myFile->Seek(TimeOffset); + myFile->Seek(timeOffset); } } // namespace sf diff --git a/src/SFML/Audio/OpenAL.hpp b/src/SFML/Audio/OpenAL.hpp index c1dea8cdd..913c0e24d 100644 --- a/src/SFML/Audio/OpenAL.hpp +++ b/src/SFML/Audio/OpenAL.hpp @@ -29,18 +29,17 @@ // Headers //////////////////////////////////////////////////////////// #include - -#if defined(SFML_SYSTEM_MACOS) -#include -#include -#else -#include -#include -#endif - #include #include +#if defined(SFML_SYSTEM_MACOS) + #include + #include +#else + #include + #include +#endif + namespace sf { @@ -68,58 +67,58 @@ namespace priv /// Check last OpenAL error /// //////////////////////////////////////////////////////////// -inline void ALCheckError(const std::string& File, unsigned int Line) +inline void ALCheckError(const std::string& file, unsigned int line) { // Get the last error - ALenum ErrorCode = alGetError(); + ALenum errorCode = alGetError(); - if (ErrorCode != AL_NO_ERROR) + if (errorCode != AL_NO_ERROR) { - std::string Error, Desc; + std::string error, description; // Decode the error code - switch (ErrorCode) + switch (errorCode) { case AL_INVALID_NAME : { - Error = "AL_INVALID_NAME"; - Desc = "an unacceptable name has been specified"; + error = "AL_INVALID_NAME"; + description = "an unacceptable name has been specified"; break; } case AL_INVALID_ENUM : { - Error = "AL_INVALID_ENUM"; - Desc = "an unacceptable value has been specified for an enumerated argument"; + error = "AL_INVALID_ENUM"; + description = "an unacceptable value has been specified for an enumerated argument"; break; } case AL_INVALID_VALUE : { - Error = "AL_INVALID_VALUE"; - Desc = "a numeric argument is out of range"; + error = "AL_INVALID_VALUE"; + description = "a numeric argument is out of range"; break; } case AL_INVALID_OPERATION : { - Error = "AL_INVALID_OPERATION"; - Desc = "the specified operation is not allowed in the current state"; + error = "AL_INVALID_OPERATION"; + description = "the specified operation is not allowed in the current state"; break; } case AL_OUT_OF_MEMORY : { - Error = "AL_OUT_OF_MEMORY"; - Desc = "there is not enough memory left to execute the command"; + error = "AL_OUT_OF_MEMORY"; + description = "there is not enough memory left to execute the command"; break; } } // Log the error std::cerr << "An internal OpenAL call failed in " - << File.substr(File.find_last_of("\\/") + 1) << " (" << Line << ") : " - << Error << ", " << Desc + << file.substr(file.find_last_of("\\/") + 1) << " (" << line << ") : " + << error << ", " << description << std::endl; } } diff --git a/src/SFML/Audio/Sound.cpp b/src/SFML/Audio/Sound.cpp index 51a3bd90c..80b49075a 100644 --- a/src/SFML/Audio/Sound.cpp +++ b/src/SFML/Audio/Sound.cpp @@ -45,33 +45,32 @@ Sound::Sound() //////////////////////////////////////////////////////////// /// Construct the sound from its parameters //////////////////////////////////////////////////////////// -Sound::Sound(const SoundBuffer& Buffer, bool Loop, float Pitch, float Volume, const Vector3f& Position) : -myBuffer(&Buffer) +Sound::Sound(const SoundBuffer& buffer, bool loop, float pitch, float volume, const Vector3f& position) : +myBuffer(&buffer) { ALCheck(alGenSources(1, &mySource)); - ALCheck(alSourcei (mySource, AL_BUFFER, Buffer.myBuffer)); - ALCheck(alSourcei (mySource, AL_LOOPING, Loop)); - ALCheck(alSourcef (mySource, AL_PITCH, Pitch)); - ALCheck(alSourcef (mySource, AL_GAIN, Volume * 0.01f)); - ALCheck(alSource3f(mySource, AL_POSITION, Position.x, Position.y, Position.z)); + ALCheck(alSourcei (mySource, AL_BUFFER, buffer.myBuffer)); + ALCheck(alSourcei (mySource, AL_LOOPING, loop)); + ALCheck(alSourcef (mySource, AL_PITCH, pitch)); + ALCheck(alSourcef (mySource, AL_GAIN, volume * 0.01f)); + ALCheck(alSource3f(mySource, AL_POSITION, position.x, position.y, position.z)); } //////////////////////////////////////////////////////////// /// Copy constructor //////////////////////////////////////////////////////////// -Sound::Sound(const Sound& Copy) : -AudioResource(Copy), -myBuffer (Copy.myBuffer) +Sound::Sound(const Sound& copy) : +myBuffer(copy.myBuffer) { ALCheck(alGenSources(1, &mySource)); ALCheck(alSourcei (mySource, AL_BUFFER, myBuffer ? myBuffer->myBuffer : 0)); - ALCheck(alSourcei (mySource, AL_LOOPING, Copy.GetLoop())); - ALCheck(alSourcef (mySource, AL_PITCH, Copy.GetPitch())); - ALCheck(alSourcef (mySource, AL_GAIN, Copy.GetVolume() * 0.01f)); - ALCheck(alSource3f(mySource, AL_POSITION, Copy.GetPosition().x, Copy.GetPosition().y, Copy.GetPosition().z)); + ALCheck(alSourcei (mySource, AL_LOOPING, copy.GetLoop())); + ALCheck(alSourcef (mySource, AL_PITCH, copy.GetPitch())); + ALCheck(alSourcef (mySource, AL_GAIN, copy.GetVolume() * 0.01f)); + ALCheck(alSource3f(mySource, AL_POSITION, copy.GetPosition().x, copy.GetPosition().y, copy.GetPosition().z)); } @@ -122,10 +121,10 @@ void Sound::Stop() //////////////////////////////////////////////////////////// /// Set the source buffer //////////////////////////////////////////////////////////// -void Sound::SetBuffer(const SoundBuffer& Buffer) +void Sound::SetBuffer(const SoundBuffer& buffer) { - myBuffer = &Buffer; - ALCheck(alSourcei(mySource, AL_BUFFER, myBuffer ? myBuffer->myBuffer : 0)); + myBuffer = &buffer; + ALCheck(alSourcei(mySource, AL_BUFFER, myBuffer->myBuffer)); } @@ -141,27 +140,27 @@ void Sound::SetLoop(bool Loop) //////////////////////////////////////////////////////////// /// Set the sound pitch //////////////////////////////////////////////////////////// -void Sound::SetPitch(float Pitch) +void Sound::SetPitch(float pitch) { - ALCheck(alSourcef(mySource, AL_PITCH, Pitch)); + ALCheck(alSourcef(mySource, AL_PITCH, pitch)); } //////////////////////////////////////////////////////////// /// Set the sound volume //////////////////////////////////////////////////////////// -void Sound::SetVolume(float Volume) +void Sound::SetVolume(float volume) { - ALCheck(alSourcef(mySource, AL_GAIN, Volume * 0.01f)); + ALCheck(alSourcef(mySource, AL_GAIN, volume * 0.01f)); } //////////////////////////////////////////////////////////// /// Set the sound position (take 3 values). /// The default position is (0, 0, 0) //////////////////////////////////////////////////////////// -void Sound::SetPosition(float X, float Y, float Z) +void Sound::SetPosition(float x, float y, float z) { - ALCheck(alSource3f(mySource, AL_POSITION, X, Y, Z)); + ALCheck(alSource3f(mySource, AL_POSITION, x, y, z)); } @@ -169,9 +168,9 @@ void Sound::SetPosition(float X, float Y, float Z) /// Set the sound position (take a 3D vector). /// The default position is (0, 0, 0) //////////////////////////////////////////////////////////// -void Sound::SetPosition(const Vector3f& Position) +void Sound::SetPosition(const Vector3f& position) { - SetPosition(Position.x, Position.y, Position.z); + SetPosition(position.x, position.y, position.z); } @@ -180,9 +179,9 @@ void Sound::SetPosition(const Vector3f& Position) /// position, or absolute. /// The default value is false (absolute) //////////////////////////////////////////////////////////// -void Sound::SetRelativeToListener(bool Relative) +void Sound::SetRelativeToListener(bool relative) { - ALCheck(alSourcei(mySource, AL_SOURCE_RELATIVE, Relative)); + ALCheck(alSourcei(mySource, AL_SOURCE_RELATIVE, relative)); } @@ -191,9 +190,9 @@ void Sound::SetRelativeToListener(bool Relative) /// the listener will hear the sound at its maximum volume. /// The default minimum distance is 1.0 //////////////////////////////////////////////////////////// -void Sound::SetMinDistance(float MinDistance) +void Sound::SetMinDistance(float distance) { - ALCheck(alSourcef(mySource, AL_REFERENCE_DISTANCE, MinDistance)); + ALCheck(alSourcef(mySource, AL_REFERENCE_DISTANCE, distance)); } @@ -202,18 +201,18 @@ void Sound::SetMinDistance(float MinDistance) /// more the sound will be attenuated with distance from listener. /// The default attenuation factor 1.0 //////////////////////////////////////////////////////////// -void Sound::SetAttenuation(float Attenuation) +void Sound::SetAttenuation(float attenuation) { - ALCheck(alSourcef(mySource, AL_ROLLOFF_FACTOR, Attenuation)); + ALCheck(alSourcef(mySource, AL_ROLLOFF_FACTOR, attenuation)); } //////////////////////////////////////////////////////////// /// Set the current playing position of the sound //////////////////////////////////////////////////////////// -void Sound::SetPlayingOffset(float TimeOffset) +void Sound::SetPlayingOffset(float timeOffset) { - ALCheck(alSourcef(mySource, AL_SEC_OFFSET, TimeOffset)); + ALCheck(alSourcef(mySource, AL_SEC_OFFSET, timeOffset)); } @@ -231,10 +230,10 @@ const SoundBuffer* Sound::GetBuffer() const //////////////////////////////////////////////////////////// bool Sound::GetLoop() const { - ALint Loop; - ALCheck(alGetSourcei(mySource, AL_LOOPING, &Loop)); + ALint loop; + ALCheck(alGetSourcei(mySource, AL_LOOPING, &loop)); - return Loop != 0; + return loop != 0; } @@ -243,10 +242,10 @@ bool Sound::GetLoop() const //////////////////////////////////////////////////////////// float Sound::GetPitch() const { - ALfloat Pitch; - ALCheck(alGetSourcef(mySource, AL_PITCH, &Pitch)); + ALfloat pitch; + ALCheck(alGetSourcef(mySource, AL_PITCH, &pitch)); - return Pitch; + return pitch; } @@ -255,10 +254,10 @@ float Sound::GetPitch() const //////////////////////////////////////////////////////////// float Sound::GetVolume() const { - ALfloat Gain; - ALCheck(alGetSourcef(mySource, AL_GAIN, &Gain)); + ALfloat gain; + ALCheck(alGetSourcef(mySource, AL_GAIN, &gain)); - return Gain * 100.f; + return gain * 100.f; } @@ -267,10 +266,10 @@ float Sound::GetVolume() const //////////////////////////////////////////////////////////// Vector3f Sound::GetPosition() const { - Vector3f Position; - ALCheck(alGetSource3f(mySource, AL_POSITION, &Position.x, &Position.y, &Position.z)); + Vector3f position; + ALCheck(alGetSource3f(mySource, AL_POSITION, &position.x, &position.y, &position.z)); - return Position; + return position; } @@ -280,10 +279,10 @@ Vector3f Sound::GetPosition() const //////////////////////////////////////////////////////////// bool Sound::IsRelativeToListener() const { - ALint Relative; - ALCheck(alGetSourcei(mySource, AL_SOURCE_RELATIVE, &Relative)); + ALint relative; + ALCheck(alGetSourcei(mySource, AL_SOURCE_RELATIVE, &relative)); - return Relative != 0; + return relative != 0; } @@ -292,10 +291,10 @@ bool Sound::IsRelativeToListener() const //////////////////////////////////////////////////////////// float Sound::GetMinDistance() const { - ALfloat MinDistance; - ALCheck(alGetSourcef(mySource, AL_REFERENCE_DISTANCE, &MinDistance)); + ALfloat distance; + ALCheck(alGetSourcef(mySource, AL_REFERENCE_DISTANCE, &distance)); - return MinDistance; + return distance; } @@ -304,10 +303,10 @@ float Sound::GetMinDistance() const //////////////////////////////////////////////////////////// float Sound::GetAttenuation() const { - ALfloat Attenuation; - ALCheck(alGetSourcef(mySource, AL_ROLLOFF_FACTOR, &Attenuation)); + ALfloat attenuation; + ALCheck(alGetSourcef(mySource, AL_ROLLOFF_FACTOR, &attenuation)); - return Attenuation; + return attenuation; } @@ -316,10 +315,10 @@ float Sound::GetAttenuation() const //////////////////////////////////////////////////////////// float Sound::GetPlayingOffset() const { - ALfloat Seconds = 0.f; - ALCheck(alGetSourcef(mySource, AL_SEC_OFFSET, &Seconds)); + ALfloat seconds = 0.f; + ALCheck(alGetSourcef(mySource, AL_SEC_OFFSET, &seconds)); - return Seconds; + return seconds; } @@ -328,10 +327,10 @@ float Sound::GetPlayingOffset() const //////////////////////////////////////////////////////////// Sound::Status Sound::GetStatus() const { - ALint State; - ALCheck(alGetSourcei(mySource, AL_SOURCE_STATE, &State)); + ALint status; + ALCheck(alGetSourcei(mySource, AL_SOURCE_STATE, &status)); - switch (State) + switch (status) { case AL_INITIAL : case AL_STOPPED : return Stopped; @@ -346,12 +345,12 @@ Sound::Status Sound::GetStatus() const //////////////////////////////////////////////////////////// /// Assignment operator //////////////////////////////////////////////////////////// -Sound& Sound::operator =(const Sound& Other) +Sound& Sound::operator =(const Sound& other) { - Sound Temp(Other); + Sound temp(other); - std::swap(mySource, Temp.mySource); - std::swap(myBuffer, Temp.myBuffer); + std::swap(mySource, temp.mySource); + std::swap(myBuffer, temp.myBuffer); return *this; } diff --git a/src/SFML/Audio/SoundBuffer.cpp b/src/SFML/Audio/SoundBuffer.cpp index 7294e0acb..12bc4406f 100644 --- a/src/SFML/Audio/SoundBuffer.cpp +++ b/src/SFML/Audio/SoundBuffer.cpp @@ -50,18 +50,17 @@ myDuration(0.f) //////////////////////////////////////////////////////////// /// Copy constructor //////////////////////////////////////////////////////////// -SoundBuffer::SoundBuffer(const SoundBuffer& Copy) : -AudioResource (Copy), -Resource(Copy), +SoundBuffer::SoundBuffer(const SoundBuffer& copy) : +Resource(copy), myBuffer (0), -mySamples (Copy.mySamples), -myDuration (Copy.myDuration) +mySamples (copy.mySamples), +myDuration (copy.myDuration) { // Create the buffer ALCheck(alGenBuffers(1, &myBuffer)); // Update the internal buffer with the new samples - Update(Copy.GetChannelsCount(), Copy.GetSampleRate()); + Update(copy.GetChannelsCount(), copy.GetSampleRate()); } @@ -78,23 +77,23 @@ SoundBuffer::~SoundBuffer() //////////////////////////////////////////////////////////// /// Load the sound buffer from a file //////////////////////////////////////////////////////////// -bool SoundBuffer::LoadFromFile(const std::string& Filename) +bool SoundBuffer::LoadFromFile(const std::string& filename) { // Open the sound file - priv::SoundFile File; - if (File.OpenRead(Filename)) + priv::SoundFile file; + if (file.OpenRead(filename)) { // Get the sound parameters - std::size_t NbSamples = File.GetSamplesCount(); - unsigned int ChannelsCount = File.GetChannelsCount(); - unsigned int SampleRate = File.GetSampleRate(); + std::size_t nbSamples = file.GetSamplesCount(); + unsigned int channelsCount = file.GetChannelsCount(); + unsigned int sampleRate = file.GetSampleRate(); // Read the samples from the opened file - mySamples.resize(NbSamples); - if (File.Read(&mySamples[0], NbSamples) == NbSamples) + mySamples.resize(nbSamples); + if (file.Read(&mySamples[0], nbSamples) == nbSamples) { // Update the internal buffer with the new samples - return Update(ChannelsCount, SampleRate); + return Update(channelsCount, sampleRate); } else { @@ -111,23 +110,23 @@ bool SoundBuffer::LoadFromFile(const std::string& Filename) //////////////////////////////////////////////////////////// /// Load the sound buffer from a file in memory //////////////////////////////////////////////////////////// -bool SoundBuffer::LoadFromMemory(const char* Data, std::size_t SizeInBytes) +bool SoundBuffer::LoadFromMemory(const char* data, std::size_t sizeInBytes) { // Open the sound file - priv::SoundFile File; - if (File.OpenRead(Data, SizeInBytes)) + priv::SoundFile file; + if (file.OpenRead(data, sizeInBytes)) { // Get the sound parameters - std::size_t NbSamples = File.GetSamplesCount(); - unsigned int ChannelsCount = File.GetChannelsCount(); - unsigned int SampleRate = File.GetSampleRate(); + std::size_t nbSamples = file.GetSamplesCount(); + unsigned int channelsCount = file.GetChannelsCount(); + unsigned int sampleRate = file.GetSampleRate(); // Read the samples from the opened file - mySamples.resize(NbSamples); - if (File.Read(&mySamples[0], NbSamples) == NbSamples) + mySamples.resize(nbSamples); + if (file.Read(&mySamples[0], nbSamples) == nbSamples) { // Update the internal buffer with the new samples - return Update(ChannelsCount, SampleRate); + return Update(channelsCount, sampleRate); } else { @@ -145,24 +144,24 @@ bool SoundBuffer::LoadFromMemory(const char* Data, std::size_t SizeInBytes) /// Load the sound buffer from an array of samples - assumed format for /// samples is 16 bits signed integer //////////////////////////////////////////////////////////// -bool SoundBuffer::LoadFromSamples(const Int16* Samples, std::size_t SamplesCount, unsigned int ChannelsCount, unsigned int SampleRate) +bool SoundBuffer::LoadFromSamples(const Int16* samples, std::size_t samplesCount, unsigned int channelsCount, unsigned int sampleRate) { - if (Samples && SamplesCount && ChannelsCount && SampleRate) + if (samples && samplesCount && channelsCount && sampleRate) { // Copy the new audio samples - mySamples.assign(Samples, Samples + SamplesCount); + mySamples.assign(samples, samples + samplesCount); // Update the internal buffer with the new samples - return Update(ChannelsCount, SampleRate); + return Update(channelsCount, sampleRate); } else { // Error... std::cerr << "Failed to load sound buffer from memory (" - << "Samples : " << Samples << ", " - << "Samples count : " << SamplesCount << ", " - << "Channels count : " << ChannelsCount << ", " - << "Sample rate : " << SampleRate << ")" + << "Samples : " << samples << ", " + << "Samples count : " << samplesCount << ", " + << "Channels count : " << channelsCount << ", " + << "Sample rate : " << sampleRate << ")" << std::endl; return false; @@ -173,14 +172,14 @@ bool SoundBuffer::LoadFromSamples(const Int16* Samples, std::size_t SamplesCount //////////////////////////////////////////////////////////// /// Save the sound buffer to a file //////////////////////////////////////////////////////////// -bool SoundBuffer::SaveToFile(const std::string& Filename) const +bool SoundBuffer::SaveToFile(const std::string& filename) const { // Create the sound file in write mode - priv::SoundFile File; - if (File.OpenWrite(Filename, GetChannelsCount(), GetSampleRate())) + priv::SoundFile file; + if (file.OpenWrite(filename, GetChannelsCount(), GetSampleRate())) { // Write the samples to the opened file - File.Write(&mySamples[0], mySamples.size()); + file.Write(&mySamples[0], mySamples.size()); return true; } @@ -214,10 +213,10 @@ std::size_t SoundBuffer::GetSamplesCount() const //////////////////////////////////////////////////////////// unsigned int SoundBuffer::GetSampleRate() const { - ALint SampleRate; - ALCheck(alGetBufferi(myBuffer, AL_FREQUENCY, &SampleRate)); + ALint sampleRate; + ALCheck(alGetBufferi(myBuffer, AL_FREQUENCY, &sampleRate)); - return SampleRate; + return sampleRate; } @@ -226,10 +225,10 @@ unsigned int SoundBuffer::GetSampleRate() const //////////////////////////////////////////////////////////// unsigned int SoundBuffer::GetChannelsCount() const { - ALint ChannelsCount; - ALCheck(alGetBufferi(myBuffer, AL_CHANNELS, &ChannelsCount)); + ALint channelsCount; + ALCheck(alGetBufferi(myBuffer, AL_CHANNELS, &channelsCount)); - return ChannelsCount; + return channelsCount; } @@ -245,13 +244,13 @@ float SoundBuffer::GetDuration() const //////////////////////////////////////////////////////////// /// Assignment operator //////////////////////////////////////////////////////////// -SoundBuffer& SoundBuffer::operator =(const SoundBuffer& Other) +SoundBuffer& SoundBuffer::operator =(const SoundBuffer& other) { - SoundBuffer Temp(Other); + SoundBuffer temp(other); - mySamples.swap(Temp.mySamples); - std::swap(myBuffer, Temp.myBuffer); - std::swap(myDuration, Temp.myDuration); + mySamples.swap(temp.mySamples); + std::swap(myBuffer, temp.myBuffer); + std::swap(myDuration, temp.myDuration); return *this; } @@ -260,28 +259,28 @@ SoundBuffer& SoundBuffer::operator =(const SoundBuffer& Other) //////////////////////////////////////////////////////////// /// Update the internal buffer with the audio samples //////////////////////////////////////////////////////////// -bool SoundBuffer::Update(unsigned int ChannelsCount, unsigned int SampleRate) +bool SoundBuffer::Update(unsigned int channelsCount, unsigned int sampleRate) { // Check parameters - if (!SampleRate || !ChannelsCount || mySamples.empty()) + if (!channelsCount || !sampleRate || mySamples.empty()) return false; // Find the good format according to the number of channels - ALenum Format = priv::AudioDevice::GetInstance().GetFormatFromChannelsCount(ChannelsCount); + ALenum format = priv::AudioDevice::GetInstance().GetFormatFromChannelsCount(channelsCount); // Check if the format is valid - if (Format == 0) + if (format == 0) { - std::cerr << "Unsupported number of channels (" << ChannelsCount << ")" << std::endl; + std::cerr << "Unsupported number of channels (" << channelsCount << ")" << std::endl; return false; } // Fill the buffer - ALsizei Size = static_cast(mySamples.size()) * sizeof(Int16); - ALCheck(alBufferData(myBuffer, Format, &mySamples[0], Size, SampleRate)); + ALsizei size = static_cast(mySamples.size()) * sizeof(Int16); + ALCheck(alBufferData(myBuffer, format, &mySamples[0], size, sampleRate)); // Compute the duration - myDuration = static_cast(mySamples.size()) / SampleRate / ChannelsCount; + myDuration = static_cast(mySamples.size()) / sampleRate / channelsCount; return true; } diff --git a/src/SFML/Audio/SoundBufferRecorder.cpp b/src/SFML/Audio/SoundBufferRecorder.cpp index c0af7bfcf..aefa1664f 100644 --- a/src/SFML/Audio/SoundBufferRecorder.cpp +++ b/src/SFML/Audio/SoundBufferRecorder.cpp @@ -46,9 +46,9 @@ bool SoundBufferRecorder::OnStart() //////////////////////////////////////////////////////////// /// /see SoundBuffer::OnProcessSamples //////////////////////////////////////////////////////////// -bool SoundBufferRecorder::OnProcessSamples(const Int16* Samples, std::size_t SamplesCount) +bool SoundBufferRecorder::OnProcessSamples(const Int16* samples, std::size_t samplesCount) { - std::copy(Samples, Samples + SamplesCount, std::back_inserter(mySamples)); + std::copy(samples, samples + samplesCount, std::back_inserter(mySamples)); return true; } diff --git a/src/SFML/Audio/SoundFile.cpp b/src/SFML/Audio/SoundFile.cpp index 7432ae932..c907808a2 100644 --- a/src/SFML/Audio/SoundFile.cpp +++ b/src/SFML/Audio/SoundFile.cpp @@ -87,25 +87,25 @@ unsigned int SoundFile::GetSampleRate() const //////////////////////////////////////////////////////////// /// Open the sound file for reading //////////////////////////////////////////////////////////// -bool SoundFile::OpenRead(const std::string& Filename) +bool SoundFile::OpenRead(const std::string& filename) { // If the file is already opened, first close it if (myFile) sf_close(myFile); // Open the sound file - SF_INFO FileInfos; - myFile = sf_open(Filename.c_str(), SFM_READ, &FileInfos); + SF_INFO fileInfos; + myFile = sf_open(filename.c_str(), SFM_READ, &fileInfos); if (!myFile) { - std::cerr << "Failed to read sound file \"" << Filename << "\" (" << sf_strerror(myFile) << ")" << std::endl; + std::cerr << "Failed to read sound file \"" << filename << "\" (" << sf_strerror(myFile) << ")" << std::endl; return false; } // Set the sound parameters - myChannelsCount = FileInfos.channels; - mySampleRate = FileInfos.samplerate; - myNbSamples = static_cast(FileInfos.frames) * myChannelsCount; + myChannelsCount = fileInfos.channels; + mySampleRate = fileInfos.samplerate; + myNbSamples = static_cast(fileInfos.frames) * myChannelsCount; return true; } @@ -114,28 +114,28 @@ bool SoundFile::OpenRead(const std::string& Filename) //////////////////////////////////////////////////////////// /// Open the sound file in memory for reading //////////////////////////////////////////////////////////// -bool SoundFile::OpenRead(const char* Data, std::size_t SizeInBytes) +bool SoundFile::OpenRead(const char* data, std::size_t sizeInBytes) { // If the file is already opened, first close it if (myFile) sf_close(myFile); // Define the I/O custom functions for reading from memory - SF_VIRTUAL_IO VirtualIO; - VirtualIO.get_filelen = &SoundFile::MemoryGetLength; - VirtualIO.read = &SoundFile::MemoryRead; - VirtualIO.seek = &SoundFile::MemorySeek; - VirtualIO.tell = &SoundFile::MemoryTell; - VirtualIO.write = &SoundFile::MemoryWrite; + SF_VIRTUAL_IO io; + io.get_filelen = &SoundFile::MemoryGetLength; + io.read = &SoundFile::MemoryRead; + io.seek = &SoundFile::MemorySeek; + io.tell = &SoundFile::MemoryTell; + io.write = &SoundFile::MemoryWrite; // Initialize the memory data - myMemory.DataStart = Data; - myMemory.DataPtr = Data; - myMemory.TotalSize = SizeInBytes; + myMemory.DataStart = data; + myMemory.DataPtr = data; + myMemory.TotalSize = sizeInBytes; // Open the sound file - SF_INFO FileInfos; - myFile = sf_open_virtual(&VirtualIO, SFM_READ, &FileInfos, &myMemory); + SF_INFO fileInfos; + myFile = sf_open_virtual(&io, SFM_READ, &fileInfos, &myMemory); if (!myFile) { std::cerr << "Failed to read sound file from memory (" << sf_strerror(myFile) << ")" << std::endl; @@ -143,9 +143,9 @@ bool SoundFile::OpenRead(const char* Data, std::size_t SizeInBytes) } // Set the sound parameters - myChannelsCount = FileInfos.channels; - mySampleRate = FileInfos.samplerate; - myNbSamples = static_cast(FileInfos.frames) * myChannelsCount; + myChannelsCount = fileInfos.channels; + mySampleRate = fileInfos.samplerate; + myNbSamples = static_cast(fileInfos.frames) * myChannelsCount; return true; } @@ -154,38 +154,38 @@ bool SoundFile::OpenRead(const char* Data, std::size_t SizeInBytes) //////////////////////////////////////////////////////////// /// Open the sound file for writing //////////////////////////////////////////////////////////// -bool SoundFile::OpenWrite(const std::string& Filename, unsigned int ChannelsCount, unsigned int SampleRate) +bool SoundFile::OpenWrite(const std::string& filename, unsigned int channelsCount, unsigned int sampleRate) { // If the file is already opened, first close it if (myFile) sf_close(myFile); // Find the right format according to the file extension - int Format = GetFormatFromFilename(Filename); - if (Format == -1) + int format = GetFormatFromFilename(filename); + if (format == -1) { // Error : unrecognized extension - std::cerr << "Failed to create sound file \"" << Filename << "\" (unknown format)" << std::endl; + std::cerr << "Failed to create sound file \"" << filename << "\" (unknown format)" << std::endl; return false; } // Fill the sound infos with parameters - SF_INFO FileInfos; - FileInfos.channels = ChannelsCount; - FileInfos.samplerate = SampleRate; - FileInfos.format = Format | (Format == SF_FORMAT_OGG ? SF_FORMAT_VORBIS : SF_FORMAT_PCM_16); + SF_INFO fileInfos; + fileInfos.channels = channelsCount; + fileInfos.samplerate = sampleRate; + fileInfos.format = format | (format == SF_FORMAT_OGG ? SF_FORMAT_VORBIS : SF_FORMAT_PCM_16); // Open the sound file for writing - myFile = sf_open(Filename.c_str(), SFM_WRITE, &FileInfos); + myFile = sf_open(filename.c_str(), SFM_WRITE, &fileInfos); if (!myFile) { - std::cerr << "Failed to create sound file \"" << Filename << "\" (" << sf_strerror(myFile) << ")" << std::endl; + std::cerr << "Failed to create sound file \"" << filename << "\" (" << sf_strerror(myFile) << ")" << std::endl; return false; } // Set the sound parameters - myChannelsCount = ChannelsCount; - mySampleRate = SampleRate; + myChannelsCount = channelsCount; + mySampleRate = sampleRate; myNbSamples = 0; return true; @@ -195,10 +195,10 @@ bool SoundFile::OpenWrite(const std::string& Filename, unsigned int ChannelsCoun //////////////////////////////////////////////////////////// /// Read samples from the loaded sound //////////////////////////////////////////////////////////// -std::size_t SoundFile::Read(Int16* Data, std::size_t NbSamples) +std::size_t SoundFile::Read(Int16* data, std::size_t nbSamples) { - if (myFile && Data && NbSamples) - return static_cast(sf_read_short(myFile, Data, NbSamples)); + if (myFile && data && nbSamples) + return static_cast(sf_read_short(myFile, data, nbSamples)); else return 0; } @@ -207,18 +207,18 @@ std::size_t SoundFile::Read(Int16* Data, std::size_t NbSamples) //////////////////////////////////////////////////////////// /// Write samples to the file //////////////////////////////////////////////////////////// -void SoundFile::Write(const Int16* Data, std::size_t NbSamples) +void SoundFile::Write(const Int16* data, std::size_t nbSamples) { - if (myFile && Data && NbSamples) + if (myFile && data && nbSamples) { // Write small chunks instead of everything at once, // to avoid a stack overflow in libsndfile (happens only with OGG format) - while (NbSamples > 0) + while (nbSamples > 0) { - std::size_t Count = NbSamples > 10000 ? 10000 : NbSamples; - sf_write_short(myFile, Data, Count); - Data += Count; - NbSamples -= Count; + std::size_t count = nbSamples > 10000 ? 10000 : nbSamples; + sf_write_short(myFile, data, count); + data += count; + nbSamples -= count; } } } @@ -227,12 +227,12 @@ void SoundFile::Write(const Int16* Data, std::size_t NbSamples) //////////////////////////////////////////////////////////// /// Move the current reading position in the file //////////////////////////////////////////////////////////// -void SoundFile::Seek(float TimeOffset) +void SoundFile::Seek(float timeOffset) { if (myFile) { - sf_count_t FrameOffset = static_cast(TimeOffset * mySampleRate); - sf_seek(myFile, FrameOffset, SEEK_SET); + sf_count_t frameOffset = static_cast(timeOffset * mySampleRate); + sf_seek(myFile, frameOffset, SEEK_SET); } } @@ -241,40 +241,40 @@ void SoundFile::Seek(float TimeOffset) /// Get the internal format of an audio file according to /// its filename extension //////////////////////////////////////////////////////////// -int SoundFile::GetFormatFromFilename(const std::string& Filename) +int SoundFile::GetFormatFromFilename(const std::string& filename) { // Extract the extension - std::string Ext = "wav"; - std::string::size_type Pos = Filename.find_last_of("."); - if (Pos != std::string::npos) - Ext = Filename.substr(Pos + 1); + std::string ext = "wav"; + std::string::size_type pos = filename.find_last_of("."); + if (pos != std::string::npos) + ext = filename.substr(pos + 1); // Match every supported extension with its format constant - if (Ext == "wav" || Ext == "WAV" ) return SF_FORMAT_WAV; - if (Ext == "aif" || Ext == "AIF" ) return SF_FORMAT_AIFF; - if (Ext == "aiff" || Ext == "AIFF") return SF_FORMAT_AIFF; - if (Ext == "au" || Ext == "AU" ) return SF_FORMAT_AU; - if (Ext == "raw" || Ext == "RAW" ) return SF_FORMAT_RAW; - if (Ext == "paf" || Ext == "PAF" ) return SF_FORMAT_PAF; - if (Ext == "svx" || Ext == "SVX" ) return SF_FORMAT_SVX; - if (Ext == "nist" || Ext == "NIST") return SF_FORMAT_NIST; - if (Ext == "voc" || Ext == "VOC" ) return SF_FORMAT_VOC; - if (Ext == "sf" || Ext == "SF" ) return SF_FORMAT_IRCAM; - if (Ext == "w64" || Ext == "W64" ) return SF_FORMAT_W64; - if (Ext == "mat4" || Ext == "MAT4") return SF_FORMAT_MAT4; - if (Ext == "mat5" || Ext == "MAT5") return SF_FORMAT_MAT5; - if (Ext == "pvf" || Ext == "PVF" ) return SF_FORMAT_PVF; - if (Ext == "xi" || Ext == "XI" ) return SF_FORMAT_XI; - if (Ext == "htk" || Ext == "HTK" ) return SF_FORMAT_HTK; - if (Ext == "sds" || Ext == "SDS" ) return SF_FORMAT_SDS; - if (Ext == "avr" || Ext == "AVR" ) return SF_FORMAT_AVR; - if (Ext == "sd2" || Ext == "SD2" ) return SF_FORMAT_SD2; - if (Ext == "flac" || Ext == "FLAC") return SF_FORMAT_FLAC; - if (Ext == "caf" || Ext == "CAF" ) return SF_FORMAT_CAF; - if (Ext == "wve" || Ext == "WVE" ) return SF_FORMAT_WVE; - if (Ext == "ogg" || Ext == "OGG") return SF_FORMAT_OGG; - if (Ext == "mpc2k" || Ext == "MPC2K") return SF_FORMAT_MPC2K; - if (Ext == "rf64" || Ext == "RF64") return SF_FORMAT_RF64; + if (ext == "wav" || ext == "WAV" ) return SF_FORMAT_WAV; + if (ext == "aif" || ext == "AIF" ) return SF_FORMAT_AIFF; + if (ext == "aiff" || ext == "AIFF") return SF_FORMAT_AIFF; + if (ext == "au" || ext == "AU" ) return SF_FORMAT_AU; + if (ext == "raw" || ext == "RAW" ) return SF_FORMAT_RAW; + if (ext == "paf" || ext == "PAF" ) return SF_FORMAT_PAF; + if (ext == "svx" || ext == "SVX" ) return SF_FORMAT_SVX; + if (ext == "nist" || ext == "NIST") return SF_FORMAT_NIST; + if (ext == "voc" || ext == "VOC" ) return SF_FORMAT_VOC; + if (ext == "sf" || ext == "SF" ) return SF_FORMAT_IRCAM; + if (ext == "w64" || ext == "W64" ) return SF_FORMAT_W64; + if (ext == "mat4" || ext == "MAT4") return SF_FORMAT_MAT4; + if (ext == "mat5" || ext == "MAT5") return SF_FORMAT_MAT5; + if (ext == "pvf" || ext == "PVF" ) return SF_FORMAT_PVF; + if (ext == "xi" || ext == "XI" ) return SF_FORMAT_XI; + if (ext == "htk" || ext == "HTK" ) return SF_FORMAT_HTK; + if (ext == "sds" || ext == "SDS" ) return SF_FORMAT_SDS; + if (ext == "avr" || ext == "AVR" ) return SF_FORMAT_AVR; + if (ext == "sd2" || ext == "SD2" ) return SF_FORMAT_SD2; + if (ext == "flac" || ext == "FLAC") return SF_FORMAT_FLAC; + if (ext == "caf" || ext == "CAF" ) return SF_FORMAT_CAF; + if (ext == "wve" || ext == "WVE" ) return SF_FORMAT_WVE; + if (ext == "ogg" || ext == "OGG") return SF_FORMAT_OGG; + if (ext == "mpc2k" || ext == "MPC2K") return SF_FORMAT_MPC2K; + if (ext == "rf64" || ext == "RF64") return SF_FORMAT_RF64; return -1; } @@ -283,61 +283,61 @@ int SoundFile::GetFormatFromFilename(const std::string& Filename) //////////////////////////////////////////////////////////// /// Functions for implementing custom read and write to memory files //////////////////////////////////////////////////////////// -sf_count_t SoundFile::MemoryGetLength(void* UserData) +sf_count_t SoundFile::MemoryGetLength(void* userData) { - MemoryInfos* Memory = static_cast(UserData); + MemoryInfos* memory = static_cast(userData); - return Memory->TotalSize; + return memory->TotalSize; } -sf_count_t SoundFile::MemoryRead(void* Ptr, sf_count_t Count, void* UserData) +sf_count_t SoundFile::MemoryRead(void* ptr, sf_count_t count, void* userData) { - MemoryInfos* Memory = static_cast(UserData); + MemoryInfos* memory = static_cast(userData); - sf_count_t Position = Memory->DataPtr - Memory->DataStart; - if (Position + Count >= Memory->TotalSize) - Count = Memory->TotalSize - Position; + sf_count_t position = memory->DataPtr - memory->DataStart; + if (position + count >= memory->TotalSize) + count = memory->TotalSize - position; - memcpy(Ptr, Memory->DataPtr, static_cast(Count)); + memcpy(ptr, memory->DataPtr, static_cast(count)); - Memory->DataPtr += Count; + memory->DataPtr += count; - return Count; + return count; } -sf_count_t SoundFile::MemorySeek(sf_count_t Offset, int Whence, void* UserData) +sf_count_t SoundFile::MemorySeek(sf_count_t offset, int whence, void* userData) { - MemoryInfos* Memory = static_cast(UserData); + MemoryInfos* memory = static_cast(userData); - sf_count_t Position = 0; - switch (Whence) + sf_count_t position = 0; + switch (whence) { case SEEK_SET : - Position = Offset; + position = offset; break; case SEEK_CUR : - Position = Memory->DataPtr - Memory->DataStart + Offset; + position = memory->DataPtr - memory->DataStart + offset; break; case SEEK_END : - Position = Memory->TotalSize - Offset; + position = memory->TotalSize - offset; break; default : - Position = 0; + position = 0; break; } - if (Position >= Memory->TotalSize) - Position = Memory->TotalSize - 1; - else if (Position < 0) - Position = 0; + if (position >= memory->TotalSize) + position = memory->TotalSize - 1; + else if (position < 0) + position = 0; - Memory->DataPtr = Memory->DataStart + Position; + memory->DataPtr = memory->DataStart + position; - return Position; + return position; } -sf_count_t SoundFile::MemoryTell(void* UserData) +sf_count_t SoundFile::MemoryTell(void* userData) { - MemoryInfos* Memory = static_cast(UserData); + MemoryInfos* memory = static_cast(userData); - return Memory->DataPtr - Memory->DataStart; + return memory->DataPtr - memory->DataStart; } sf_count_t SoundFile::MemoryWrite(const void*, sf_count_t, void*) { diff --git a/src/SFML/Audio/SoundFile.hpp b/src/SFML/Audio/SoundFile.hpp index 3d61fabe7..dd7d9f99f 100644 --- a/src/SFML/Audio/SoundFile.hpp +++ b/src/SFML/Audio/SoundFile.hpp @@ -84,63 +84,63 @@ public : //////////////////////////////////////////////////////////// /// Open the sound file for reading /// - /// \param Filename : Path of sound file to load + /// \param filename : Path of sound file to load /// /// \return True if the file was successfully opened /// //////////////////////////////////////////////////////////// - bool OpenRead(const std::string& Filename); + bool OpenRead(const std::string& filename); //////////////////////////////////////////////////////////// /// Open the sound file in memory for reading /// - /// \param Data : Pointer to the file data in memory - /// \param SizeInBytes : Size of the data to load, in bytes + /// \param data : Pointer to the file data in memory + /// \param sizeInBytes : Size of the data to load, in bytes /// /// \return True if the file was successfully opened /// //////////////////////////////////////////////////////////// - bool OpenRead(const char* Data, std::size_t SizeInBytes); + bool OpenRead(const char* data, std::size_t sizeInBytes); //////////////////////////////////////////////////////////// /// Open the sound file for writing /// - /// \param Filename : Path of sound file to write - /// \param ChannelsCount : Number of channels in the sound - /// \param SampleRate : Sample rate of the sound + /// \param filename : Path of sound file to write + /// \param channelsCount : Number of channels in the sound + /// \param sampleRate : Sample rate of the sound /// /// \return True if the file was successfully opened /// //////////////////////////////////////////////////////////// - bool OpenWrite(const std::string& Filename, unsigned int ChannelsCount, unsigned int SampleRate); + bool OpenWrite(const std::string& filename, unsigned int channelsCount, unsigned int sampleRate); //////////////////////////////////////////////////////////// /// Read samples from the loaded sound /// - /// \param Data : Pointer to the samples array to fill - /// \param NbSamples : Number of samples to read + /// \param data : Pointer to the samples array to fill + /// \param nbSamples : Number of samples to read /// /// \return Number of samples read /// //////////////////////////////////////////////////////////// - std::size_t Read(Int16* Data, std::size_t NbSamples); + std::size_t Read(Int16* data, std::size_t nbSamples); //////////////////////////////////////////////////////////// /// Write samples to the file /// - /// \param Data : Pointer to the samples array to write - /// \param NbSamples : Number of samples to write + /// \param data : Pointer to the samples array to write + /// \param nbSamples : Number of samples to write /// //////////////////////////////////////////////////////////// - void Write(const Int16* Data, std::size_t NbSamples); + void Write(const Int16* data, std::size_t nbSamples); //////////////////////////////////////////////////////////// /// Move the current reading position in the file /// - /// \param TimeOffset : New position, expressed in seconds + /// \param timeOffset : New position, expressed in seconds /// //////////////////////////////////////////////////////////// - void Seek(float TimeOffset); + void Seek(float timeOffset); private : @@ -148,12 +148,12 @@ private : /// Get the internal format of an audio file according to /// its filename extension /// - /// \param Filename : Filename to check + /// \param filename : Filename to check /// /// \return Internal format matching the filename (-1 if no match) /// //////////////////////////////////////////////////////////// - static int GetFormatFromFilename(const std::string& Filename); + static int GetFormatFromFilename(const std::string& filename); //////////////////////////////////////////////////////////// /// Functions for implementing custom read and write to memory files diff --git a/src/SFML/Audio/SoundRecorder.cpp b/src/SFML/Audio/SoundRecorder.cpp index ac787b2aa..5389ec1ac 100644 --- a/src/SFML/Audio/SoundRecorder.cpp +++ b/src/SFML/Audio/SoundRecorder.cpp @@ -37,7 +37,7 @@ //////////////////////////////////////////////////////////// namespace { - ALCdevice* CaptureDevice = NULL; + ALCdevice* captureDevice = NULL; } namespace sf @@ -66,7 +66,7 @@ SoundRecorder::~SoundRecorder() /// Start the capture. /// Warning : only one capture can happen at the same time //////////////////////////////////////////////////////////// -void SoundRecorder::Start(unsigned int SampleRate) +void SoundRecorder::Start(unsigned int sampleRate) { // Check if the device can do audio capture if (!CanCapture()) @@ -76,15 +76,15 @@ void SoundRecorder::Start(unsigned int SampleRate) } // Check that another capture is not already running - if (CaptureDevice) + if (captureDevice) { std::cerr << "Trying to start audio capture, but another capture is already running" << std::endl; return; } // Open the capture device for capturing 16 bits mono samples - CaptureDevice = alcCaptureOpenDevice(NULL, SampleRate, AL_FORMAT_MONO16, SampleRate); - if (!CaptureDevice) + captureDevice = alcCaptureOpenDevice(NULL, sampleRate, AL_FORMAT_MONO16, sampleRate); + if (!captureDevice) { std::cerr << "Failed to open the audio capture device" << std::endl; return; @@ -94,13 +94,13 @@ void SoundRecorder::Start(unsigned int SampleRate) mySamples.clear(); // Store the sample rate - mySampleRate = SampleRate; + mySampleRate = sampleRate; // Notify derived class if (OnStart()) { // Start the capture - alcCaptureStart(CaptureDevice); + alcCaptureStart(captureDevice); // Start the capture in a new thread, to avoid blocking the main thread myIsCapturing = true; @@ -135,9 +135,9 @@ unsigned int SoundRecorder::GetSampleRate() const //////////////////////////////////////////////////////////// bool SoundRecorder::CanCapture() { - ALCdevice* Device = priv::AudioDevice::GetInstance().GetDevice(); + ALCdevice* device = priv::AudioDevice::GetInstance().GetDevice(); - return alcIsExtensionPresent(Device, "ALC_EXT_CAPTURE") != AL_FALSE; + return alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") != AL_FALSE; } @@ -188,14 +188,14 @@ void SoundRecorder::Run() void SoundRecorder::ProcessCapturedSamples() { // Get the number of samples available - ALCint SamplesAvailable; - alcGetIntegerv(CaptureDevice, ALC_CAPTURE_SAMPLES, 1, &SamplesAvailable); + ALCint samplesAvailable; + alcGetIntegerv(captureDevice, ALC_CAPTURE_SAMPLES, 1, &samplesAvailable); - if (SamplesAvailable > 0) + if (samplesAvailable > 0) { // Get the recorded samples - mySamples.resize(SamplesAvailable); - alcCaptureSamples(CaptureDevice, &mySamples[0], SamplesAvailable); + mySamples.resize(samplesAvailable); + alcCaptureSamples(captureDevice, &mySamples[0], samplesAvailable); // Forward them to the derived class if (!OnProcessSamples(&mySamples[0], mySamples.size())) @@ -213,14 +213,14 @@ void SoundRecorder::ProcessCapturedSamples() void SoundRecorder::CleanUp() { // Stop the capture - alcCaptureStop(CaptureDevice); + alcCaptureStop(captureDevice); // Get the samples left in the buffer ProcessCapturedSamples(); // Close the device - alcCaptureCloseDevice(CaptureDevice); - CaptureDevice = NULL; + alcCaptureCloseDevice(captureDevice); + captureDevice = NULL; } } // namespace sf diff --git a/src/SFML/Audio/SoundStream.cpp b/src/SFML/Audio/SoundStream.cpp index 8642de86a..a7300ff5c 100644 --- a/src/SFML/Audio/SoundStream.cpp +++ b/src/SFML/Audio/SoundStream.cpp @@ -61,13 +61,13 @@ SoundStream::~SoundStream() //////////////////////////////////////////////////////////// /// Set the audio stream parameters, you must call it before Play() //////////////////////////////////////////////////////////// -void SoundStream::Initialize(unsigned int ChannelsCount, unsigned int SampleRate) +void SoundStream::Initialize(unsigned int channelsCount, unsigned int sampleRate) { - myChannelsCount = ChannelsCount; - mySampleRate = SampleRate; + myChannelsCount = channelsCount; + mySampleRate = sampleRate; // Deduce the format from the number of channels - myFormat = priv::AudioDevice::GetInstance().GetFormatFromChannelsCount(ChannelsCount); + myFormat = priv::AudioDevice::GetInstance().GetFormatFromChannelsCount(channelsCount); // Check if the format is valid if (myFormat == 0) @@ -142,29 +142,29 @@ unsigned int SoundStream::GetSampleRate() const //////////////////////////////////////////////////////////// Sound::Status SoundStream::GetStatus() const { - Status Status = Sound::GetStatus(); + Status status = Sound::GetStatus(); // To compensate for the lag between Play() and alSourcePlay() - if ((Status == Stopped) && myIsStreaming) - Status = Playing; + if ((status == Stopped) && myIsStreaming) + status = Playing; - return Status; + return status; } //////////////////////////////////////////////////////////// /// Set the current playing position of the stream //////////////////////////////////////////////////////////// -void SoundStream::SetPlayingOffset(float TimeOffset) +void SoundStream::SetPlayingOffset(float timeOffset) { // Stop the stream Stop(); // Let the derived class update the current position - OnSeek(TimeOffset); + OnSeek(timeOffset); // Restart streaming - mySamplesProcessed = static_cast(TimeOffset * mySampleRate * myChannelsCount); + mySamplesProcessed = static_cast(timeOffset * mySampleRate * myChannelsCount); myIsStreaming = true; Launch(); } @@ -185,9 +185,9 @@ float SoundStream::GetPlayingOffset() const //////////////////////////////////////////////////////////// /// Set the music loop state //////////////////////////////////////////////////////////// -void SoundStream::SetLoop(bool Loop) +void SoundStream::SetLoop(bool loop) { - myLoop = Loop; + myLoop = loop; } @@ -207,10 +207,10 @@ void SoundStream::Run() { // Create buffers ALCheck(alGenBuffers(BuffersCount, myBuffers)); - unsigned int EndBuffer = 0xFFFF; + unsigned int endBuffer = 0xFFFF; // Fill the queue - bool RequestStop = FillQueue(); + bool requestStop = FillQueue(); // Play the sound Sound::Play(); @@ -220,7 +220,7 @@ void SoundStream::Run() // The stream has been interrupted ! if (Sound::GetStatus() == Stopped) { - if (!RequestStop) + if (!requestStop) { // Just continue Sound::Play(); @@ -233,33 +233,33 @@ void SoundStream::Run() } // Get the number of buffers that have been processed (ie. ready for reuse) - ALint NbProcessed; - ALCheck(alGetSourcei(Sound::mySource, AL_BUFFERS_PROCESSED, &NbProcessed)); + ALint nbProcessed; + ALCheck(alGetSourcei(Sound::mySource, AL_BUFFERS_PROCESSED, &nbProcessed)); - while (NbProcessed--) + while (nbProcessed--) { // Pop the first unused buffer from the queue - ALuint Buffer; - ALCheck(alSourceUnqueueBuffers(Sound::mySource, 1, &Buffer)); + ALuint buffer; + ALCheck(alSourceUnqueueBuffers(Sound::mySource, 1, &buffer)); // Retrieve its size and add it to the samples count - if (Buffer == EndBuffer) + if (buffer == endBuffer) { // This was the last buffer: reset the sample count mySamplesProcessed = 0; - EndBuffer = 0xFFFF; + endBuffer = 0xFFFF; } else { - ALint Size; - ALCheck(alGetBufferi(Buffer, AL_SIZE, &Size)); - mySamplesProcessed += Size / sizeof(Int16); + ALint size; + ALCheck(alGetBufferi(buffer, AL_SIZE, &size)); + mySamplesProcessed += size / sizeof(Int16); } // Fill it and push it back into the playing queue - if (!RequestStop) + if (!requestStop) { - if (FillAndPushBuffer(Buffer)) + if (FillAndPushBuffer(buffer)) { // User requested to stop: check if we must loop or really stop if (myLoop) @@ -267,12 +267,12 @@ void SoundStream::Run() // Looping: restart and mark the current buffer as the last one // (to know when to reset the sample count) OnSeek(0); - EndBuffer = Buffer; + endBuffer = buffer; } else { // Not looping: request stop - RequestStop = true; + requestStop = true; } } } @@ -299,27 +299,27 @@ void SoundStream::Run() /// Fill a new buffer with audio data, and push it to the /// playing queue //////////////////////////////////////////////////////////// -bool SoundStream::FillAndPushBuffer(unsigned int Buffer) +bool SoundStream::FillAndPushBuffer(unsigned int buffer) { - bool RequestStop = false; + bool requestStop = false; // Acquire audio data - Chunk Data = {NULL, 0}; - if (!OnGetData(Data)) - RequestStop = true; + Chunk data = {NULL, 0}; + if (!OnGetData(data)) + requestStop = true; // Create and fill the buffer, and push it to the queue - if (Data.Samples && Data.NbSamples) + if (data.Samples && data.NbSamples) { // Fill the buffer - ALsizei Size = static_cast(Data.NbSamples) * sizeof(Int16); - ALCheck(alBufferData(Buffer, myFormat, Data.Samples, Size, mySampleRate)); + ALsizei size = static_cast(data.NbSamples) * sizeof(Int16); + ALCheck(alBufferData(buffer, myFormat, data.Samples, size, mySampleRate)); // Push it into the sound queue - ALCheck(alSourceQueueBuffers(Sound::mySource, 1, &Buffer)); + ALCheck(alSourceQueueBuffers(Sound::mySource, 1, &buffer)); } - return RequestStop; + return requestStop; } @@ -329,14 +329,14 @@ bool SoundStream::FillAndPushBuffer(unsigned int Buffer) bool SoundStream::FillQueue() { // Fill and enqueue all the available buffers - bool RequestStop = false; - for (int i = 0; (i < BuffersCount) && !RequestStop; ++i) + bool requestStop = false; + for (int i = 0; (i < BuffersCount) && !requestStop; ++i) { if (FillAndPushBuffer(myBuffers[i])) - RequestStop = true; + requestStop = true; } - return RequestStop; + return requestStop; } @@ -346,13 +346,13 @@ bool SoundStream::FillQueue() void SoundStream::ClearQueue() { // Get the number of buffers still in the queue - ALint NbQueued; - ALCheck(alGetSourcei(Sound::mySource, AL_BUFFERS_QUEUED, &NbQueued)); + ALint nbQueued; + ALCheck(alGetSourcei(Sound::mySource, AL_BUFFERS_QUEUED, &nbQueued)); // Unqueue them all - ALuint Buffer; - for (ALint i = 0; i < NbQueued; ++i) - ALCheck(alSourceUnqueueBuffers(Sound::mySource, 1, &Buffer)); + ALuint buffer; + for (ALint i = 0; i < nbQueued; ++i) + ALCheck(alSourceUnqueueBuffers(Sound::mySource, 1, &buffer)); } } // namespace sf diff --git a/src/SFML/Graphics/Color.cpp b/src/SFML/Graphics/Color.cpp index 48b043da4..2cb5ec2dd 100644 --- a/src/SFML/Graphics/Color.cpp +++ b/src/SFML/Graphics/Color.cpp @@ -60,83 +60,76 @@ a(255) //////////////////////////////////////////////////////////// /// Construct the color from its 4 RGBA components //////////////////////////////////////////////////////////// -Color::Color(Uint8 R, Uint8 G, Uint8 B, Uint8 A) : -r(R), -g(G), -b(B), -a(A) +Color::Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha) : +r(red), +g(green), +b(blue), +a(alpha) { } -//////////////////////////////////////////////////////////// -/// Operator += overload to add a color -//////////////////////////////////////////////////////////// -Color& Color::operator +=(const Color& Other) -{ - r = static_cast(std::min(r + Other.r, 255)); - g = static_cast(std::min(g + Other.g, 255)); - b = static_cast(std::min(b + Other.b, 255)); - a = static_cast(std::min(a + Other.a, 255)); - - return *this; -} - - -//////////////////////////////////////////////////////////// -/// Operator *= overload to modulate a color -//////////////////////////////////////////////////////////// -Color& Color::operator *=(const Color& Other) -{ - r = static_cast(r * Other.r / 255); - g = static_cast(g * Other.g / 255); - b = static_cast(b * Other.b / 255); - a = static_cast(a * Other.a / 255); - - return *this; -} - - //////////////////////////////////////////////////////////// /// Compare two colors (for equality) //////////////////////////////////////////////////////////// -bool Color::operator ==(const Color& Other) const +bool operator ==(const Color& left, const Color& right) { - return (r == Other.r) && (g == Other.g) && (b == Other.b) && (a == Other.a); + return (left.r == right.r) && + (left.g == right.g) && + (left.b == right.b) && + (left.a == right.a); } //////////////////////////////////////////////////////////// /// Compare two colors (for difference) //////////////////////////////////////////////////////////// -bool Color::operator !=(const Color& Other) const +bool operator !=(const Color& left, const Color& right) { - return (r != Other.r) || (g != Other.g) || (b != Other.b) || (a != Other.a); + return !(left == right); } //////////////////////////////////////////////////////////// /// Operator + overload to add two colors //////////////////////////////////////////////////////////// -Color operator +(const Color& Color1, const Color& Color2) +Color operator +(const Color& left, const Color& right) { - Color c = Color1; - c += Color2; - - return c; + return Color(static_cast(std::min(left.r + right.r, 255)), + static_cast(std::min(left.g + right.g, 255)), + static_cast(std::min(left.b + right.b, 255)), + static_cast(std::min(left.a + right.a, 255))); } //////////////////////////////////////////////////////////// /// Operator * overload to modulate two colors //////////////////////////////////////////////////////////// -Color operator *(const Color& Color1, const Color& Color2) +Color operator *(const Color& left, const Color& right) { - Color c = Color1; - c *= Color2; + return Color(static_cast(left.r * right.r / 255), + static_cast(left.g * right.g / 255), + static_cast(left.b * right.b / 255), + static_cast(left.a * right.a / 255)); +} - return c; + +//////////////////////////////////////////////////////////// +/// Operator += overload to add a color +//////////////////////////////////////////////////////////// +Color& operator +=(Color& left, const Color& right) +{ + return left = left + right; +} + + +//////////////////////////////////////////////////////////// +/// Operator *= overload to modulate a color +//////////////////////////////////////////////////////////// +Color& operator *=(Color& left, const Color& right) +{ + return left = left * right; } } // namespace sf diff --git a/src/SFML/Graphics/Drawable.cpp b/src/SFML/Graphics/Drawable.cpp index 4a6c49da1..41c5206ee 100644 --- a/src/SFML/Graphics/Drawable.cpp +++ b/src/SFML/Graphics/Drawable.cpp @@ -36,12 +36,12 @@ namespace sf //////////////////////////////////////////////////////////// /// Default constructor //////////////////////////////////////////////////////////// -Drawable::Drawable(const Vector2f& Position, const Vector2f& Scale, float Rotation, const Color& Col) : -myPosition (Position), -myScale (Scale), +Drawable::Drawable(const Vector2f& position, const Vector2f& scale, float rotation, const Color& color) : +myPosition (position), +myScale (scale), myOrigin (0, 0), -myRotation (Rotation), -myColor (Col), +myRotation (rotation), +myColor (color), myBlendMode (Blend::Alpha), myNeedUpdate (true), myInvNeedUpdate(true) @@ -63,29 +63,29 @@ Drawable::~Drawable() //////////////////////////////////////////////////////////// /// Set the position of the object (take 2 values) //////////////////////////////////////////////////////////// -void Drawable::SetPosition(float X, float Y) +void Drawable::SetPosition(float x, float y) { - SetX(X); - SetY(Y); + SetX(x); + SetY(y); } //////////////////////////////////////////////////////////// /// Set the position of the object (take a 2D vector) //////////////////////////////////////////////////////////// -void Drawable::SetPosition(const Vector2f& Position) +void Drawable::SetPosition(const Vector2f& position) { - SetX(Position.x); - SetY(Position.y); + SetX(position.x); + SetY(position.y); } //////////////////////////////////////////////////////////// /// Set the X position of the object //////////////////////////////////////////////////////////// -void Drawable::SetX(float X) +void Drawable::SetX(float x) { - myPosition.x = X; + myPosition.x = x; myNeedUpdate = true; myInvNeedUpdate = true; } @@ -94,9 +94,9 @@ void Drawable::SetX(float X) //////////////////////////////////////////////////////////// /// Set the Y position of the object //////////////////////////////////////////////////////////// -void Drawable::SetY(float Y) +void Drawable::SetY(float y) { - myPosition.y = Y; + myPosition.y = y; myNeedUpdate = true; myInvNeedUpdate = true; } @@ -105,31 +105,31 @@ void Drawable::SetY(float Y) //////////////////////////////////////////////////////////// /// Set the scale of the object (take 2 values) //////////////////////////////////////////////////////////// -void Drawable::SetScale(float ScaleX, float ScaleY) +void Drawable::SetScale(float factorX, float factorY) { - SetScaleX(ScaleX); - SetScaleY(ScaleY); + SetScaleX(factorX); + SetScaleY(factorY); } //////////////////////////////////////////////////////////// /// Set the scale of the object (take a 2D vector) //////////////////////////////////////////////////////////// -void Drawable::SetScale(const Vector2f& Scale) +void Drawable::SetScale(const Vector2f& scale) { - SetScaleX(Scale.x); - SetScaleY(Scale.y); + SetScaleX(scale.x); + SetScaleY(scale.y); } //////////////////////////////////////////////////////////// /// Set the X scale factor of the object //////////////////////////////////////////////////////////// -void Drawable::SetScaleX(float FactorX) +void Drawable::SetScaleX(float factor) { - if (FactorX > 0) + if (factor > 0) { - myScale.x = FactorX; + myScale.x = factor; myNeedUpdate = true; myInvNeedUpdate = true; } @@ -139,11 +139,11 @@ void Drawable::SetScaleX(float FactorX) //////////////////////////////////////////////////////////// /// Set the Y scale factor of the object //////////////////////////////////////////////////////////// -void Drawable::SetScaleY(float FactorY) +void Drawable::SetScaleY(float factor) { - if (FactorY > 0) + if (factor > 0) { - myScale.y = FactorY; + myScale.y = factor; myNeedUpdate = true; myInvNeedUpdate = true; } @@ -155,10 +155,10 @@ void Drawable::SetScaleY(float FactorY) /// top-left of the object (take 2 values). /// The default origin is (0, 0) //////////////////////////////////////////////////////////// -void Drawable::SetOrigin(float OriginX, float OriginY) +void Drawable::SetOrigin(float x, float y) { - myOrigin.x = OriginX; - myOrigin.y = OriginY; + myOrigin.x = x; + myOrigin.y = y; myNeedUpdate = true; myInvNeedUpdate = true; } @@ -169,18 +169,18 @@ void Drawable::SetOrigin(float OriginX, float OriginY) /// top-left of the object (take a 2D vector). /// The default origin is (0, 0) //////////////////////////////////////////////////////////// -void Drawable::SetOrigin(const Vector2f& Origin) +void Drawable::SetOrigin(const Vector2f& origin) { - SetOrigin(Origin.x, Origin.y); + SetOrigin(origin.x, origin.y); } //////////////////////////////////////////////////////////// /// Set the orientation of the object //////////////////////////////////////////////////////////// -void Drawable::SetRotation(float Rotation) +void Drawable::SetRotation(float angle) { - myRotation = static_cast(fmod(Rotation, 360)); + myRotation = static_cast(fmod(angle, 360)); if (myRotation < 0) myRotation += 360.f; myNeedUpdate = true; @@ -192,9 +192,9 @@ void Drawable::SetRotation(float Rotation) /// Set the color of the object. /// The default color is white //////////////////////////////////////////////////////////// -void Drawable::SetColor(const Color& Col) +void Drawable::SetColor(const Color& color) { - myColor = Col; + myColor = color; } @@ -202,9 +202,9 @@ void Drawable::SetColor(const Color& Col) /// Set the blending mode for the object. /// The default blend mode is Blend::Alpha //////////////////////////////////////////////////////////// -void Drawable::SetBlendMode(Blend::Mode Mode) +void Drawable::SetBlendMode(Blend::Mode mode) { - myBlendMode = Mode; + myBlendMode = mode; } @@ -266,47 +266,45 @@ Blend::Mode Drawable::GetBlendMode() const /// Move the object of a given offset (take 2 values) /// //////////////////////////////////////////////////////////// -void Drawable::Move(float OffsetX, float OffsetY) +void Drawable::Move(float offsetX, float offsetY) { - SetX(myPosition.x + OffsetX); - SetY(myPosition.y + OffsetY); + SetPosition(myPosition.x + offsetX, myPosition.y + offsetY); } //////////////////////////////////////////////////////////// /// Move the object of a given offset (take a 2D vector) //////////////////////////////////////////////////////////// -void Drawable::Move(const Vector2f& Offset) +void Drawable::Move(const Vector2f& offset) { - Move(Offset.x, Offset.y); + SetPosition(myPosition + offset); } //////////////////////////////////////////////////////////// /// Scale the object (take 2 values) //////////////////////////////////////////////////////////// -void Drawable::Scale(float FactorX, float FactorY) +void Drawable::Scale(float factorX, float factorY) { - SetScaleX(myScale.x * FactorX); - SetScaleY(myScale.y * FactorY); + SetScale(myScale.x * factorX, myScale.y * factorY); } //////////////////////////////////////////////////////////// /// Scale the object (take a 2D vector) //////////////////////////////////////////////////////////// -void Drawable::Scale(const Vector2f& Factor) +void Drawable::Scale(const Vector2f& factor) { - Scale(Factor.x, Factor.y); + SetScale(myScale.x * factor.x, myScale.y * factor.y); } //////////////////////////////////////////////////////////// /// Rotate the object //////////////////////////////////////////////////////////// -void Drawable::Rotate(float Angle) +void Drawable::Rotate(float angle) { - SetRotation(myRotation + Angle); + SetRotation(myRotation + angle); } @@ -314,18 +312,18 @@ void Drawable::Rotate(float Angle) /// Transform a point from global coordinates into local coordinates /// (ie it applies the inverse of object's origin, translation, rotation and scale to the point) //////////////////////////////////////////////////////////// -sf::Vector2f Drawable::TransformToLocal(const sf::Vector2f& Point) const +sf::Vector2f Drawable::TransformToLocal(const sf::Vector2f& point) const { - return GetInverseMatrix().Transform(Point); + return GetInverseMatrix().Transform(point); } //////////////////////////////////////////////////////////// /// Transform a point from local coordinates into global coordinates /// (ie it applies the object's origin, translation, rotation and scale to the point) //////////////////////////////////////////////////////////// -sf::Vector2f Drawable::TransformToGlobal(const sf::Vector2f& Point) const +sf::Vector2f Drawable::TransformToGlobal(const sf::Vector2f& point) const { - return GetMatrix().Transform(Point); + return GetMatrix().Transform(point); } @@ -364,7 +362,7 @@ const Matrix3& Drawable::GetInverseMatrix() const //////////////////////////////////////////////////////////// /// Draw the object into the specified window //////////////////////////////////////////////////////////// -void Drawable::Draw(RenderTarget& Target) const +void Drawable::Draw(RenderTarget& target) const { // Save the current modelview matrix and set the new one GLCheck(glMatrixMode(GL_MODELVIEW)); @@ -382,7 +380,7 @@ void Drawable::Draw(RenderTarget& Target) const // We have to use glBlendFuncSeparate so that the resulting alpha is // not alpha², which is incorrect and would cause problems when rendering - // alpha pixels to a RenderImage that would be in turn be rendered to another render target + // alpha pixels to a RenderImage that would be in turn rendered to another render target switch (myBlendMode) { case Blend::Alpha : @@ -403,7 +401,7 @@ void Drawable::Draw(RenderTarget& Target) const GLCheck(glColor4f(myColor.r / 255.f, myColor.g / 255.f, myColor.b / 255.f, myColor.a / 255.f)); // Let the derived class render the object geometry - Render(Target); + Render(target); // Restore the previous modelview matrix GLCheck(glMatrixMode(GL_MODELVIEW)); diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index df2e5633e..84bcb6b05 100644 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp @@ -71,45 +71,45 @@ myCharSize(0) //////////////////////////////////////////////////////////// /// Load the font from a file //////////////////////////////////////////////////////////// -bool Font::LoadFromFile(const std::string& Filename, unsigned int CharSize, const Unicode::Text& Charset) +bool Font::LoadFromFile(const std::string& filename, unsigned int charSize, const Unicode::Text& charset) { // Clear the previous character map myGlyphs.clear(); // Always add these special characters - Unicode::UTF32String UTFCharset = Charset; + Unicode::UTF32String UTFCharset = charset; if (UTFCharset.find(L' ') != Unicode::UTF32String::npos) UTFCharset += L' '; if (UTFCharset.find(L'\n') != Unicode::UTF32String::npos) UTFCharset += L'\n'; if (UTFCharset.find(L'\v') != Unicode::UTF32String::npos) UTFCharset += L'\v'; if (UTFCharset.find(L'\t') != Unicode::UTF32String::npos) UTFCharset += L'\t'; - return priv::FontLoader::GetInstance().LoadFontFromFile(Filename, CharSize, UTFCharset, *this); + return priv::FontLoader::GetInstance().LoadFontFromFile(filename, charSize, UTFCharset, *this); } //////////////////////////////////////////////////////////// /// Load the font from a file in memory //////////////////////////////////////////////////////////// -bool Font::LoadFromMemory(const char* Data, std::size_t SizeInBytes, unsigned int CharSize, const Unicode::Text& Charset) +bool Font::LoadFromMemory(const char* data, std::size_t sizeInBytes, unsigned int charSize, const Unicode::Text& charset) { // Clear the previous character map myGlyphs.clear(); // Check parameters - if (!Data || (SizeInBytes == 0)) + if (!data || (sizeInBytes == 0)) { std::cerr << "Failed to load font from memory, no data provided" << std::endl; return false; } // Always add these special characters - Unicode::UTF32String UTFCharset = Charset; + Unicode::UTF32String UTFCharset = charset; if (UTFCharset.find(L' ') != Unicode::UTF32String::npos) UTFCharset += L' '; if (UTFCharset.find(L'\n') != Unicode::UTF32String::npos) UTFCharset += L'\n'; if (UTFCharset.find(L'\v') != Unicode::UTF32String::npos) UTFCharset += L'\v'; if (UTFCharset.find(L'\t') != Unicode::UTF32String::npos) UTFCharset += L'\t'; - return priv::FontLoader::GetInstance().LoadFontFromMemory(Data, SizeInBytes, CharSize, UTFCharset, *this); + return priv::FontLoader::GetInstance().LoadFontFromMemory(data, sizeInBytes, charSize, UTFCharset, *this); } @@ -127,19 +127,19 @@ unsigned int Font::GetCharacterSize() const /// Get the description of a glyph (character) /// given by its unicode value //////////////////////////////////////////////////////////// -const Glyph& Font::GetGlyph(Uint32 CodePoint) const +const Glyph& Font::GetGlyph(Uint32 codePoint) const { - std::map::const_iterator It = myGlyphs.find(CodePoint); - if (It != myGlyphs.end()) + std::map::const_iterator it = myGlyphs.find(codePoint); + if (it != myGlyphs.end()) { // Valid glyph - return It->second; + return it->second; } else { // Invalid glyph -- return an invalid glyph - static const Glyph InvalidGlyph; - return InvalidGlyph; + static const Glyph invalid; + return invalid; } } @@ -158,21 +158,21 @@ const Image& Font::GetImage() const //////////////////////////////////////////////////////////// const Font& Font::GetDefaultFont() { - static Font DefaultFont; - static bool DefaultFontLoaded = false; - static const char DefaultFontData[] = + static Font defaultFont; + static bool defaultFontLoaded = false; + static const char defaultFontData[] = { #include }; // Load the default font on first call - if (!DefaultFontLoaded) + if (!defaultFontLoaded) { - DefaultFont.LoadFromMemory(DefaultFontData, sizeof(DefaultFontData), 30); - DefaultFontLoaded = true; + defaultFont.LoadFromMemory(defaultFontData, sizeof(defaultFontData), 30); + defaultFontLoaded = true; } - return DefaultFont; + return defaultFont; } } // namespace sf diff --git a/src/SFML/Graphics/FontLoader.cpp b/src/SFML/Graphics/FontLoader.cpp index cf3345672..fb0454771 100644 --- a/src/SFML/Graphics/FontLoader.cpp +++ b/src/SFML/Graphics/FontLoader.cpp @@ -44,9 +44,9 @@ namespace //////////////////////////////////////////////////////////// struct SizeCompare { - bool operator ()(FT_BitmapGlyph Glyph1, FT_BitmapGlyph Glyph2) const + bool operator ()(FT_BitmapGlyph left, FT_BitmapGlyph right) const { - return Glyph2->bitmap.rows < Glyph1->bitmap.rows; + return left->bitmap.rows < right->bitmap.rows; } }; } @@ -60,9 +60,9 @@ namespace priv //////////////////////////////////////////////////////////// FontLoader& FontLoader::GetInstance() { - static FontLoader Instance; + static FontLoader instance; - return Instance; + return instance; } @@ -72,10 +72,10 @@ FontLoader& FontLoader::GetInstance() FontLoader::FontLoader() { // Initialize FreeType library - FT_Error Error = FT_Init_FreeType(&myLibrary); - if (Error) + FT_Error error = FT_Init_FreeType(&myLibrary); + if (error) { - std::cerr << "Failed to initialize FreeType library (error code : " << Error << ")" << std::endl; + std::cerr << "Failed to initialize FreeType library (error code : " << error << ")" << std::endl; return; } } @@ -95,40 +95,40 @@ FontLoader::~FontLoader() //////////////////////////////////////////////////////////// /// Load a font from a file //////////////////////////////////////////////////////////// -bool FontLoader::LoadFontFromFile(const std::string& Filename, unsigned int CharSize, const Unicode::UTF32String& Charset, Font& LoadedFont) +bool FontLoader::LoadFontFromFile(const std::string& filename, unsigned int charSize, const Unicode::UTF32String& charset, Font& font) { // Check if Freetype is correctly initialized if (!myLibrary) { - std::cerr << "Failed to load font \"" << Filename << "\", FreeType has not been initialized" << std::endl; + std::cerr << "Failed to load font \"" << filename << "\", FreeType has not been initialized" << std::endl; return false; } // Create a new font face from the specified file - FT_Face FontFace; - FT_Error Error = FT_New_Face(myLibrary, Filename.c_str(), 0, &FontFace); - if (Error) + FT_Face face; + FT_Error error = FT_New_Face(myLibrary, filename.c_str(), 0, &face); + if (error) { - std::cerr << "Failed to load font \"" << Filename << "\" (" << GetErrorDesc(Error) << ")" << std::endl; + std::cerr << "Failed to load font \"" << filename << "\" (" << GetErrorDesc(error) << ")" << std::endl; return false; } // Create the bitmap font - Error = CreateBitmapFont(FontFace, CharSize, Charset, LoadedFont); - if (Error) - std::cerr << "Failed to load font \"" << Filename << "\" (" << GetErrorDesc(Error) << ")" << std::endl; + error = CreateBitmapFont(face, charSize, charset, font); + if (error) + std::cerr << "Failed to load font \"" << filename << "\" (" << GetErrorDesc(error) << ")" << std::endl; // Delete the font - FT_Done_Face(FontFace); + FT_Done_Face(face); - return Error == 0; + return error == 0; } //////////////////////////////////////////////////////////// /// Load the font from a file in memory //////////////////////////////////////////////////////////// -bool FontLoader::LoadFontFromMemory(const char* Data, std::size_t SizeInBytes, unsigned int CharSize, const Unicode::UTF32String& Charset, Font& LoadedFont) +bool FontLoader::LoadFontFromMemory(const char* data, std::size_t sizeInBytes, unsigned int charSize, const Unicode::UTF32String& charset, Font& font) { // Check if Freetype is correctly initialized if (!myLibrary) @@ -138,163 +138,163 @@ bool FontLoader::LoadFontFromMemory(const char* Data, std::size_t SizeInBytes, u } // Create a new font face from the specified memory data - FT_Face FontFace; - FT_Error Error = FT_New_Memory_Face(myLibrary, reinterpret_cast(Data), static_cast(SizeInBytes), 0, &FontFace); - if (Error) + FT_Face face; + FT_Error error = FT_New_Memory_Face(myLibrary, reinterpret_cast(data), static_cast(sizeInBytes), 0, &face); + if (error) { - std::cerr << "Failed to load font from memory (" << GetErrorDesc(Error) << ")" << std::endl; + std::cerr << "Failed to load font from memory (" << GetErrorDesc(error) << ")" << std::endl; return false; } // Create the bitmap font - Error = CreateBitmapFont(FontFace, CharSize, Charset, LoadedFont); - if (Error) - std::cerr << "Failed to load font from memory (" << GetErrorDesc(Error) << ")" << std::endl; + error = CreateBitmapFont(face, charSize, charset, font); + if (error) + std::cerr << "Failed to load font from memory (" << GetErrorDesc(error) << ")" << std::endl; // Delete the font - FT_Done_Face(FontFace); + FT_Done_Face(face); - return Error == 0; + return error == 0; } //////////////////////////////////////////////////////////// /// Create a bitmap font from a font face and a characters set //////////////////////////////////////////////////////////// -FT_Error FontLoader::CreateBitmapFont(FT_Face FontFace, unsigned int CharSize, const Unicode::UTF32String& Charset, Font& LoadedFont) +FT_Error FontLoader::CreateBitmapFont(FT_Face face, unsigned int charSize, const Unicode::UTF32String& charset, Font& font) { // Let's find how many characters to put in each row to make them fit into a squared texture - GLint MaxSize; - GLCheck(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &MaxSize)); - int NbChars = static_cast(sqrt(static_cast(Charset.length())) * 0.75); + GLint maxSize; + GLCheck(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxSize)); + int nbChars = static_cast(sqrt(static_cast(charset.length())) * 0.75); // Clamp the character size to make sure we won't create a texture too big - if (NbChars * CharSize >= static_cast(MaxSize)) - CharSize = MaxSize / NbChars; + if (nbChars * charSize >= static_cast(maxSize)) + charSize = maxSize / nbChars; // Initialize the dimensions - unsigned int Left = 0; - unsigned int Top = 0; - unsigned int TexWidth = Image::GetValidTextureSize(CharSize * NbChars); - unsigned int TexHeight = CharSize * NbChars; - std::vector Tops(TexWidth, 0); + unsigned int left = 0; + unsigned int top = 0; + unsigned int texWidth = Image::GetValidTextureSize(charSize * nbChars); + unsigned int texHeight = charSize * nbChars; + std::vector tops(texWidth, 0); // Create a pixel buffer for rendering every glyph - std::vector GlyphsBuffer(TexWidth * TexHeight * 4); + std::vector glyphsBuffer(texWidth * texHeight * 4); // Setup the font size - FT_Error Error = FT_Set_Pixel_Sizes(FontFace, CharSize, CharSize); - if (Error) - return Error; + FT_Error error = FT_Set_Pixel_Sizes(face, charSize, charSize); + if (error) + return error; // Select the unicode character map - Error = FT_Select_Charmap(FontFace, FT_ENCODING_UNICODE); - if (Error) - return Error; + error = FT_Select_Charmap(face, FT_ENCODING_UNICODE); + if (error) + return error; // Render all glyphs and sort them by size to optimize texture space typedef std::multimap GlyphTable; - GlyphTable Glyphs; - for (std::size_t i = 0; i < Charset.length(); ++i) + GlyphTable glyphs; + for (std::size_t i = 0; i < charset.length(); ++i) { // Load the glyph corresponding to the current character - Error = FT_Load_Char(FontFace, Charset[i], FT_LOAD_TARGET_NORMAL); - if (Error) - return Error; + error = FT_Load_Char(face, charset[i], FT_LOAD_TARGET_NORMAL); + if (error) + return error; // Convert the glyph to a bitmap (ie. rasterize it) - FT_Glyph Glyph; - Error = FT_Get_Glyph(FontFace->glyph, &Glyph); - if (Error) - return Error; - FT_Glyph_To_Bitmap(&Glyph, FT_RENDER_MODE_NORMAL, 0, 1); - FT_BitmapGlyph BitmapGlyph = (FT_BitmapGlyph)Glyph; + FT_Glyph glyph; + error = FT_Get_Glyph(face->glyph, &glyph); + if (error) + return error; + FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, 0, 1); + FT_BitmapGlyph bitmapGlyph = (FT_BitmapGlyph)glyph; // Should we handle other pixel modes ? - if (BitmapGlyph->bitmap.pixel_mode != FT_PIXEL_MODE_GRAY) + if (bitmapGlyph->bitmap.pixel_mode != FT_PIXEL_MODE_GRAY) return FT_Err_Cannot_Render_Glyph; // Add it to the sorted table of glyphs - Glyphs.insert(std::make_pair(BitmapGlyph, Charset[i])); + glyphs.insert(std::make_pair(bitmapGlyph, charset[i])); } // Copy the rendered glyphs into the texture - unsigned int MaxHeight = 0; - std::map Coords; - for (GlyphTable::const_iterator i = Glyphs.begin(); i != Glyphs.end(); ++i) + unsigned int maxHeight = 0; + std::map coords; + for (GlyphTable::const_iterator i = glyphs.begin(); i != glyphs.end(); ++i) { // Get the bitmap of the current glyph - Glyph& CurGlyph = LoadedFont.myGlyphs[i->second]; - FT_BitmapGlyph BitmapGlyph = i->first; - FT_Bitmap& Bitmap = BitmapGlyph->bitmap; + Glyph& curGlyph = font.myGlyphs[i->second]; + FT_BitmapGlyph bitmapGlyph = i->first; + FT_Bitmap& bitmap = bitmapGlyph->bitmap; // Make sure we don't go over the texture width - if (Left + Bitmap.width + 1 >= TexWidth) - Left = 0; + if (left + bitmap.width + 1 >= texWidth) + left = 0; // Compute the top coordinate - Top = Tops[Left]; - for (int x = 0; x < Bitmap.width + 1; ++x) - Top = std::max(Top, Tops[Left + x]); - Top++; + top = tops[left]; + for (int x = 0; x < bitmap.width + 1; ++x) + top = std::max(top, tops[left + x]); + top++; // Make sure we don't go over the texture height -- resize it if we need more space - if (Top + Bitmap.rows + 1 >= TexHeight) + if (top + bitmap.rows + 1 >= texHeight) { - TexHeight *= 2; - GlyphsBuffer.resize(TexWidth * TexHeight * 4); + texHeight *= 2; + glyphsBuffer.resize(texWidth * texHeight * 4); } // Store the character's position and size - CurGlyph.Rectangle.Left = BitmapGlyph->left; - CurGlyph.Rectangle.Top = -BitmapGlyph->top; - CurGlyph.Rectangle.Right = CurGlyph.Rectangle.Left + Bitmap.width; - CurGlyph.Rectangle.Bottom = Bitmap.rows - BitmapGlyph->top; - CurGlyph.Advance = BitmapGlyph->root.advance.x >> 16; + curGlyph.Rectangle.Left = bitmapGlyph->left; + curGlyph.Rectangle.Top = -bitmapGlyph->top; + curGlyph.Rectangle.Right = curGlyph.Rectangle.Left + bitmap.width; + curGlyph.Rectangle.Bottom = bitmap.rows - bitmapGlyph->top; + curGlyph.Advance = bitmapGlyph->root.advance.x >> 16; // Texture size may change, so let the texture coordinates be calculated later - Coords[i->second] = IntRect(Left + 1, Top + 1, Left + Bitmap.width + 1, Top + Bitmap.rows + 1); + coords[i->second] = IntRect(left + 1, top + 1, left + bitmap.width + 1, top + bitmap.rows + 1); // Draw the glyph into our bitmap font - const Uint8* Pixels = Bitmap.buffer; - for (int y = 0; y < Bitmap.rows; ++y) + const Uint8* pixels = bitmap.buffer; + for (int y = 0; y < bitmap.rows; ++y) { - for (int x = 0; x < Bitmap.width; ++x) + for (int x = 0; x < bitmap.width; ++x) { - std::size_t Index = x + Left + 1 + (y + Top + 1) * TexWidth; - GlyphsBuffer[Index * 4 + 0] = 255; - GlyphsBuffer[Index * 4 + 1] = 255; - GlyphsBuffer[Index * 4 + 2] = 255; - GlyphsBuffer[Index * 4 + 3] = Pixels[x]; + std::size_t index = x + left + 1 + (y + top + 1) * texWidth; + glyphsBuffer[index * 4 + 0] = 255; + glyphsBuffer[index * 4 + 1] = 255; + glyphsBuffer[index * 4 + 2] = 255; + glyphsBuffer[index * 4 + 3] = pixels[x]; } - Pixels += Bitmap.pitch; + pixels += bitmap.pitch; } // Update the rendering coordinates - for (int x = 0; x < Bitmap.width + 1; ++x) - Tops[Left + x] = Top + Bitmap.rows; - Left += Bitmap.width + 1; - if (Top + Bitmap.rows > MaxHeight) - MaxHeight = Top + Bitmap.rows; + for (int x = 0; x < bitmap.width + 1; ++x) + tops[left + x] = top + bitmap.rows; + left += bitmap.width + 1; + if (top + bitmap.rows > maxHeight) + maxHeight = top + bitmap.rows; // Delete the glyph - FT_Done_Glyph((FT_Glyph)BitmapGlyph); + FT_Done_Glyph((FT_Glyph)bitmapGlyph); } // Create the font's texture - TexHeight = MaxHeight + 1; - GlyphsBuffer.resize(TexWidth * TexHeight * 4); - LoadedFont.myTexture.LoadFromPixels(TexWidth, TexHeight, &GlyphsBuffer[0]); + texHeight = maxHeight + 1; + glyphsBuffer.resize(texWidth * texHeight * 4); + font.myTexture.LoadFromPixels(texWidth, texHeight, &glyphsBuffer[0]); // Now that the texture is created, we can precompute texture coordinates - for (std::size_t i = 0; i < Charset.size(); ++i) + for (std::size_t i = 0; i < charset.size(); ++i) { - Uint32 CurChar = Charset[i]; - LoadedFont.myGlyphs[CurChar].TexCoords = LoadedFont.myTexture.GetTexCoords(Coords[CurChar], false); + Uint32 curChar = charset[i]; + font.myGlyphs[curChar].TexCoords = font.myTexture.GetTexCoords(coords[curChar], false); } // Update the character size (it may have been changed by the function) - LoadedFont.myCharSize = CharSize; + font.myCharSize = charSize; return 0; } @@ -303,9 +303,9 @@ FT_Error FontLoader::CreateBitmapFont(FT_Face FontFace, unsigned int CharSize, c //////////////////////////////////////////////////////////// /// Get a description from a FT error code //////////////////////////////////////////////////////////// -std::string FontLoader::GetErrorDesc(FT_Error Error) +std::string FontLoader::GetErrorDesc(FT_Error error) { - switch (Error) + switch (error) { // Generic errors case FT_Err_Cannot_Open_Resource : return "cannot open resource"; diff --git a/src/SFML/Graphics/FontLoader.hpp b/src/SFML/Graphics/FontLoader.hpp index e52d147a9..28704b54e 100644 --- a/src/SFML/Graphics/FontLoader.hpp +++ b/src/SFML/Graphics/FontLoader.hpp @@ -59,29 +59,29 @@ public : //////////////////////////////////////////////////////////// /// Load a font from a file /// - /// \param Filename : Path of the font file to load - /// \param CharSize : Size of characters in bitmap - the bigger, the higher quality - /// \param Charset : Characters set to generate - /// \param LoadedFont : Font object to fill up + /// \param filename : Path of the font file to load + /// \param charSize : Size of characters in bitmap - the bigger, the higher quality + /// \param charset : Characters set to generate + /// \param font : Font object to fill up /// /// \return True if loading was successful /// //////////////////////////////////////////////////////////// - bool LoadFontFromFile(const std::string& Filename, unsigned int CharSize, const Unicode::UTF32String& Charset, Font& LoadedFont); + bool LoadFontFromFile(const std::string& filename, unsigned int charSize, const Unicode::UTF32String& charset, Font& font); //////////////////////////////////////////////////////////// /// Load the font from a file in memory /// - /// \param Data : Pointer to the data to load - /// \param SizeInBytes : Size of the data, in bytes - /// \param CharSize : Size of characters in bitmap - the bigger, the higher quality - /// \param Charset : Characters set to generate - /// \param LoadedFont : Font object to fill up + /// \param data : Pointer to the data to load + /// \param sizeInBytes : Size of the data, in bytes + /// \param charSize : Size of characters in bitmap - the bigger, the higher quality + /// \param charset : Characters set to generate + /// \param font : Font object to fill up /// /// \return True if loading was successful /// //////////////////////////////////////////////////////////// - bool LoadFontFromMemory(const char* Data, std::size_t SizeInBytes, unsigned int CharSize, const Unicode::UTF32String& Charset, Font& LoadedFont); + bool LoadFontFromMemory(const char* data, std::size_t sizeInBytes, unsigned int charSize, const Unicode::UTF32String& charset, Font& font); private : @@ -100,23 +100,23 @@ private : //////////////////////////////////////////////////////////// /// Create a bitmap font from a font face and a characters set /// - /// \param FontFace : Font face containing the loaded font - /// \param CharSize : Size of characters in bitmap - /// \param Charset : Characters set to generate - /// \param LoadedFont : Font object to fill up + /// \param face : Font face containing the loaded font + /// \param charSize : Size of characters in bitmap + /// \param charset : Characters set to generate + /// \param font : Font object to fill up /// //////////////////////////////////////////////////////////// - FT_Error CreateBitmapFont(FT_Face FontFace, unsigned int CharSize, const Unicode::UTF32String& Charset, Font& LoadedFont); + FT_Error CreateBitmapFont(FT_Face face, unsigned int charSize, const Unicode::UTF32String& charset, Font& font); //////////////////////////////////////////////////////////// /// Get a description from a FT error code /// - /// \param Error : FreeType error code + /// \param error : FreeType error code /// /// \return Error description /// //////////////////////////////////////////////////////////// - static std::string GetErrorDesc(FT_Error Error); + static std::string GetErrorDesc(FT_Error error); //////////////////////////////////////////////////////////// // Member data diff --git a/src/SFML/Graphics/GLCheck.cpp b/src/SFML/Graphics/GLCheck.cpp index b626b3d42..96fb56547 100644 --- a/src/SFML/Graphics/GLCheck.cpp +++ b/src/SFML/Graphics/GLCheck.cpp @@ -34,73 +34,73 @@ namespace sf //////////////////////////////////////////////////////////// /// Check the last OpenGL error //////////////////////////////////////////////////////////// -void GLCheckError(const std::string& File, unsigned int Line) +void GLCheckError(const std::string& file, unsigned int line) { // Get the last error - GLenum ErrorCode = glGetError(); + GLenum errorCode = glGetError(); - if (ErrorCode != GL_NO_ERROR) + if (errorCode != GL_NO_ERROR) { - std::string Error = "unknown error"; - std::string Desc = "no description"; + std::string error = "unknown error"; + std::string description = "no description"; // Decode the error code - switch (ErrorCode) + switch (errorCode) { case GL_INVALID_ENUM : { - Error = "GL_INVALID_ENUM"; - Desc = "an unacceptable value has been specified for an enumerated argument"; + error = "GL_INVALID_ENUM"; + description = "an unacceptable value has been specified for an enumerated argument"; break; } case GL_INVALID_VALUE : { - Error = "GL_INVALID_VALUE"; - Desc = "a numeric argument is out of range"; + error = "GL_INVALID_VALUE"; + description = "a numeric argument is out of range"; break; } case GL_INVALID_OPERATION : { - Error = "GL_INVALID_OPERATION"; - Desc = "the specified operation is not allowed in the current state"; + error = "GL_INVALID_OPERATION"; + description = "the specified operation is not allowed in the current state"; break; } case GL_STACK_OVERFLOW : { - Error = "GL_STACK_OVERFLOW"; - Desc = "this command would cause a stack overflow"; + error = "GL_STACK_OVERFLOW"; + description = "this command would cause a stack overflow"; break; } case GL_STACK_UNDERFLOW : { - Error = "GL_STACK_UNDERFLOW"; - Desc = "this command would cause a stack underflow"; + error = "GL_STACK_UNDERFLOW"; + description = "this command would cause a stack underflow"; break; } case GL_OUT_OF_MEMORY : { - Error = "GL_OUT_OF_MEMORY"; - Desc = "there is not enough memory left to execute the command"; + error = "GL_OUT_OF_MEMORY"; + description = "there is not enough memory left to execute the command"; break; } case GL_INVALID_FRAMEBUFFER_OPERATION_EXT : { - Error = "GL_INVALID_FRAMEBUFFER_OPERATION_EXT"; - Desc = "the object bound to FRAMEBUFFER_BINDING_EXT is not \"framebuffer complete\""; + error = "GL_INVALID_FRAMEBUFFER_OPERATION_EXT"; + description = "the object bound to FRAMEBUFFER_BINDING_EXT is not \"framebuffer complete\""; break; } } // Log the error std::cerr << "An internal OpenGL call failed in " - << File.substr(File.find_last_of("\\/") + 1) << " (" << Line << ") : " - << Error << ", " << Desc + << file.substr(file.find_last_of("\\/") + 1) << " (" << line << ") : " + << error << ", " << description << std::endl; } } @@ -111,11 +111,11 @@ void GLCheckError(const std::string& File, unsigned int Line) //////////////////////////////////////////////////////////// void EnsureGlewInit() { - static bool Initialized = false; - if (!Initialized) + static bool initialized = false; + if (!initialized) { glewInit(); - Initialized = true; + initialized = true; } } diff --git a/src/SFML/Graphics/GLCheck.hpp b/src/SFML/Graphics/GLCheck.hpp index fff945bfc..16142d41e 100644 --- a/src/SFML/Graphics/GLCheck.hpp +++ b/src/SFML/Graphics/GLCheck.hpp @@ -42,12 +42,12 @@ namespace sf #ifdef SFML_DEBUG // In debug mode, perform a test on every OpenGL call - #define GLCheck(Func) ((Func), GLCheckError(__FILE__, __LINE__)) + #define GLCheck(call) ((call), GLCheckError(__FILE__, __LINE__)) #else // Else, we don't add any overhead - #define GLCheck(Func) (Func) + #define GLCheck(call) (call) #endif @@ -55,11 +55,11 @@ namespace sf //////////////////////////////////////////////////////////// /// Check the last OpenGL error /// -/// \param File Source file where the call is located -/// \param Line Line number of the source file where the call is located +/// \param file : Source file where the call is located +/// \param line : Line number of the source file where the call is located /// //////////////////////////////////////////////////////////// -void GLCheckError(const std::string& File, unsigned int Line); +void GLCheckError(const std::string& file, unsigned int line); //////////////////////////////////////////////////////////// /// Make sure that GLEW is initialized diff --git a/src/SFML/Graphics/Image.cpp b/src/SFML/Graphics/Image.cpp index 538fa3e44..033eb637b 100644 --- a/src/SFML/Graphics/Image.cpp +++ b/src/SFML/Graphics/Image.cpp @@ -60,19 +60,19 @@ myPixelsFlipped (false) //////////////////////////////////////////////////////////// /// Copy constructor //////////////////////////////////////////////////////////// -Image::Image(const Image& Copy) : -Resource (Copy), -myWidth (Copy.myWidth), -myHeight (Copy.myHeight), -myTextureWidth (Copy.myTextureWidth), -myTextureHeight (Copy.myTextureHeight), +Image::Image(const Image& copy) : +Resource (copy), +myWidth (copy.myWidth), +myHeight (copy.myHeight), +myTextureWidth (copy.myTextureWidth), +myTextureHeight (copy.myTextureHeight), myTexture (0), -myIsSmooth (Copy.myIsSmooth), -myPixels (Copy.myPixels), +myIsSmooth (copy.myIsSmooth), +myPixels (copy.myPixels), myNeedTextureUpdate(false), myNeedArrayUpdate (false), -myUpdateSource (Copy.myUpdateSource), -myPixelsFlipped (Copy.myPixelsFlipped) +myUpdateSource (copy.myUpdateSource), +myPixelsFlipped (copy.myPixelsFlipped) { CreateTexture(); } @@ -81,7 +81,7 @@ myPixelsFlipped (Copy.myPixelsFlipped) //////////////////////////////////////////////////////////// /// Construct an empty image //////////////////////////////////////////////////////////// -Image::Image(unsigned int Width, unsigned int Height, const Color& Col) : +Image::Image(unsigned int width, unsigned int height, const Color& color) : myWidth (0), myHeight (0), myTextureWidth (0), @@ -93,14 +93,14 @@ myNeedArrayUpdate (false), myUpdateSource (NULL), myPixelsFlipped (false) { - Create(Width, Height, Col); + Create(width, height, color); } //////////////////////////////////////////////////////////// /// Construct the image from pixels in memory //////////////////////////////////////////////////////////// -Image::Image(unsigned int Width, unsigned int Height, const Uint8* Data) : +Image::Image(unsigned int width, unsigned int height, const Uint8* data) : myWidth (0), myHeight (0), myTextureWidth (0), @@ -112,7 +112,7 @@ myNeedArrayUpdate (false), myUpdateSource (NULL), myPixelsFlipped (false) { - LoadFromPixels(Width, Height, Data); + LoadFromPixels(width, height, data); } @@ -129,12 +129,12 @@ Image::~Image() //////////////////////////////////////////////////////////// /// Load the image from a file //////////////////////////////////////////////////////////// -bool Image::LoadFromFile(const std::string& Filename) +bool Image::LoadFromFile(const std::string& filename) { // Let the image loader load the image into our pixel array - bool Success = priv::ImageLoader::GetInstance().LoadImageFromFile(Filename, myPixels, myWidth, myHeight); + bool success = priv::ImageLoader::GetInstance().LoadImageFromFile(filename, myPixels, myWidth, myHeight); - if (Success) + if (success) { // Loading succeeded : we can create the texture if (CreateTexture()) @@ -151,19 +151,19 @@ bool Image::LoadFromFile(const std::string& Filename) //////////////////////////////////////////////////////////// /// Load the image from a file in memory //////////////////////////////////////////////////////////// -bool Image::LoadFromMemory(const char* Data, std::size_t SizeInBytes) +bool Image::LoadFromMemory(const char* data, std::size_t sizeInBytes) { // Check parameters - if (!Data || (SizeInBytes == 0)) + if (!data || (sizeInBytes == 0)) { std::cerr << "Failed to image font from memory, no data provided" << std::endl; return false; } // Let the image loader load the image into our pixel array - bool Success = priv::ImageLoader::GetInstance().LoadImageFromMemory(Data, SizeInBytes, myPixels, myWidth, myHeight); + bool success = priv::ImageLoader::GetInstance().LoadImageFromMemory(data, sizeInBytes, myPixels, myWidth, myHeight); - if (Success) + if (success) { // Loading succeeded : we can create the texture if (CreateTexture()) @@ -180,17 +180,17 @@ bool Image::LoadFromMemory(const char* Data, std::size_t SizeInBytes) //////////////////////////////////////////////////////////// /// Load the image directly from an array of pixels //////////////////////////////////////////////////////////// -bool Image::LoadFromPixels(unsigned int Width, unsigned int Height, const Uint8* Data) +bool Image::LoadFromPixels(unsigned int width, unsigned int height, const Uint8* data) { - if (Data) + if (data) { // Store the texture dimensions - myWidth = Width; - myHeight = Height; + myWidth = width; + myHeight = height; // Fill the pixel buffer with the specified raw data - const Color* Ptr = reinterpret_cast(Data); - myPixels.assign(Ptr, Ptr + Width * Height); + const Color* ptr = reinterpret_cast(data); + myPixels.assign(ptr, ptr + width * height); // We can create the texture if (CreateTexture()) @@ -207,7 +207,7 @@ bool Image::LoadFromPixels(unsigned int Width, unsigned int Height, const Uint8* else { // No data provided : create a white image - return Create(Width, Height, Color(255, 255, 255, 255)); + return Create(width, height, Color(255, 255, 255)); } } @@ -215,28 +215,28 @@ bool Image::LoadFromPixels(unsigned int Width, unsigned int Height, const Uint8* //////////////////////////////////////////////////////////// /// Save the content of the image to a file //////////////////////////////////////////////////////////// -bool Image::SaveToFile(const std::string& Filename) const +bool Image::SaveToFile(const std::string& filename) const { // Check if the array of pixels needs to be updated const_cast(this)->EnsureArrayUpdate(); // Let the image loader save our pixel array into the image - return priv::ImageLoader::GetInstance().SaveImageToFile(Filename, myPixels, myWidth, myHeight); + return priv::ImageLoader::GetInstance().SaveImageToFile(filename, myPixels, myWidth, myHeight); } //////////////////////////////////////////////////////////// /// Create an empty image //////////////////////////////////////////////////////////// -bool Image::Create(unsigned int Width, unsigned int Height, Color Col) +bool Image::Create(unsigned int width, unsigned int height, const Color& color) { // Store the texture dimensions - myWidth = Width; - myHeight = Height; + myWidth = width; + myHeight = height; // Recreate the pixel buffer and fill it with the specified color myPixels.clear(); - myPixels.resize(Width * Height, Col); + myPixels.resize(width * height, color); // We can create the texture if (CreateTexture()) @@ -255,16 +255,16 @@ bool Image::Create(unsigned int Width, unsigned int Height, Color Col) //////////////////////////////////////////////////////////// /// Create transparency mask from a specified colorkey //////////////////////////////////////////////////////////// -void Image::CreateMaskFromColor(Color ColorKey, Uint8 Alpha) +void Image::CreateMaskFromColor(const Color& transparentColor, Uint8 alpha) { // Check if the array of pixels needs to be updated EnsureArrayUpdate(); // Calculate the new color (old color with no alpha) - Color NewColor(ColorKey.r, ColorKey.g, ColorKey.b, Alpha); + Color newColor(transparentColor.r, transparentColor.g, transparentColor.b, alpha); - // Replace the old color by the new one - std::replace(myPixels.begin(), myPixels.end(), ColorKey, NewColor); + // Replace the old color with the new one + std::replace(myPixels.begin(), myPixels.end(), transparentColor, newColor); // The texture will need to be updated myNeedTextureUpdate = true; @@ -276,82 +276,82 @@ void Image::CreateMaskFromColor(Color ColorKey, Uint8 Alpha) /// This function does a slow pixel copy and should only /// be used at initialization time //////////////////////////////////////////////////////////// -void Image::Copy(const Image& Source, unsigned int DestX, unsigned int DestY, const IntRect& SourceRect, bool ApplyAlpha) +void Image::Copy(const Image& source, unsigned int destX, unsigned int destY, const IntRect& sourceRect, bool applyAlpha) { // Make sure both images are valid - if ((Source.myWidth == 0) || (Source.myHeight == 0) || (myWidth == 0) || (myHeight == 0)) + if ((source.myWidth == 0) || (source.myHeight == 0) || (myWidth == 0) || (myHeight == 0)) return; // Make sure both images have up-to-date arrays EnsureArrayUpdate(); - const_cast(Source).EnsureArrayUpdate(); + const_cast(source).EnsureArrayUpdate(); // Adjust the source rectangle - IntRect SrcRect = SourceRect; - if (SrcRect.GetSize().x == 0 || (SrcRect.GetSize().y == 0)) + IntRect srcRect = sourceRect; + if (srcRect.GetSize().x == 0 || (srcRect.GetSize().y == 0)) { - SrcRect.Left = 0; - SrcRect.Top = 0; - SrcRect.Right = Source.myWidth; - SrcRect.Bottom = Source.myHeight; + srcRect.Left = 0; + srcRect.Top = 0; + srcRect.Right = source.myWidth; + srcRect.Bottom = source.myHeight; } else { - if (SrcRect.Left < 0) SrcRect.Left = 0; - if (SrcRect.Top < 0) SrcRect.Top = 0; - if (SrcRect.Right > static_cast(Source.myWidth)) SrcRect.Right = Source.myWidth; - if (SrcRect.Bottom > static_cast(Source.myHeight)) SrcRect.Bottom = Source.myHeight; + if (srcRect.Left < 0) srcRect.Left = 0; + if (srcRect.Top < 0) srcRect.Top = 0; + if (srcRect.Right > static_cast(source.myWidth)) srcRect.Right = source.myWidth; + if (srcRect.Bottom > static_cast(source.myHeight)) srcRect.Bottom = source.myHeight; } // Then find the valid bounds of the destination rectangle - int Width = SrcRect.GetSize().x; - int Height = SrcRect.GetSize().y; - if (DestX + Width > myWidth) Width = myWidth - DestX; - if (DestY + Height > myHeight) Height = myHeight - DestY; + int width = srcRect.GetSize().x; + int height = srcRect.GetSize().y; + if (destX + width > myWidth) width = myWidth - destX; + if (destY + height > myHeight) height = myHeight - destY; // Make sure the destination area is valid - if ((Width <= 0) || (Height <= 0)) + if ((width <= 0) || (height <= 0)) return; // Precompute as much as possible - int Pitch = Width * 4; - int Rows = Height; - int SrcStride = Source.myWidth * 4; - int DstStride = myWidth * 4; - const Uint8* SrcPixels = Source.GetPixelsPtr() + (SrcRect.Left + SrcRect.Top * Source.myWidth) * 4; - Uint8* DstPixels = reinterpret_cast(&myPixels[0]) + (DestX + DestY * myWidth) * 4; + int pitch = width * 4; + int rows = height; + int srcStride = source.myWidth * 4; + int dstStride = myWidth * 4; + const Uint8* srcPixels = source.GetPixelsPtr() + (srcRect.Left + srcRect.Top * source.myWidth) * 4; + Uint8* dstPixels = reinterpret_cast(&myPixels[0]) + (destX + destY * myWidth) * 4; // Copy the pixels - if (ApplyAlpha) + if (applyAlpha) { // Interpolation using alpha values, pixel by pixel (slower) - for (int i = 0; i < Rows; ++i) + for (int i = 0; i < rows; ++i) { - for (int j = 0; j < Width; ++j) + for (int j = 0; j < width; ++j) { // Get a direct pointer to the components of the current pixel - const Uint8* Src = SrcPixels + j * 4; - Uint8* Dst = DstPixels + j * 4; + const Uint8* src = srcPixels + j * 4; + Uint8* dst = dstPixels + j * 4; // Interpolate RGB components using the alpha value of the source pixel - Uint8 Alpha = Src[3]; - Dst[0] = (Src[0] * Alpha + Dst[0] * (255 - Alpha)) / 255; - Dst[1] = (Src[1] * Alpha + Dst[1] * (255 - Alpha)) / 255; - Dst[2] = (Src[2] * Alpha + Dst[2] * (255 - Alpha)) / 255; + Uint8 alpha = src[3]; + dst[0] = (src[0] * alpha + dst[0] * (255 - alpha)) / 255; + dst[1] = (src[1] * alpha + dst[1] * (255 - alpha)) / 255; + dst[2] = (src[2] * alpha + dst[2] * (255 - alpha)) / 255; } - SrcPixels += SrcStride; - DstPixels += DstStride; + srcPixels += srcStride; + dstPixels += dstStride; } } else { // Optimized copy ignoring alpha values, row by row (faster) - for (int i = 0; i < Rows; ++i) + for (int i = 0; i < rows; ++i) { - memcpy(DstPixels, SrcPixels, Pitch); - SrcPixels += SrcStride; - DstPixels += DstStride; + memcpy(dstPixels, srcPixels, pitch); + srcPixels += srcStride; + dstPixels += dstStride; } } @@ -364,39 +364,39 @@ void Image::Copy(const Image& Source, unsigned int DestX, unsigned int DestY, co /// Create the image from the current contents of the /// given window //////////////////////////////////////////////////////////// -bool Image::CopyScreen(RenderWindow& Window, const IntRect& SourceRect) +bool Image::CopyScreen(RenderWindow& window, const IntRect& sourceRect) { // Adjust the source rectangle - IntRect SrcRect = SourceRect; - if (SrcRect.GetSize().x == 0 || (SrcRect.GetSize().y == 0)) + IntRect srcRect = sourceRect; + if (srcRect.GetSize().x == 0 || (srcRect.GetSize().y == 0)) { - SrcRect.Left = 0; - SrcRect.Top = 0; - SrcRect.Right = Window.GetWidth(); - SrcRect.Bottom = Window.GetHeight(); + srcRect.Left = 0; + srcRect.Top = 0; + srcRect.Right = window.GetWidth(); + srcRect.Bottom = window.GetHeight(); } else { - if (SrcRect.Left < 0) SrcRect.Left = 0; - if (SrcRect.Top < 0) SrcRect.Top = 0; - if (SrcRect.Right > static_cast(Window.GetWidth())) SrcRect.Right = Window.GetWidth(); - if (SrcRect.Bottom > static_cast(Window.GetHeight())) SrcRect.Bottom = Window.GetHeight(); + if (srcRect.Left < 0) srcRect.Left = 0; + if (srcRect.Top < 0) srcRect.Top = 0; + if (srcRect.Right > static_cast(window.GetWidth())) srcRect.Right = window.GetWidth(); + if (srcRect.Bottom > static_cast(window.GetHeight())) srcRect.Bottom = window.GetHeight(); } // Store the texture dimensions - myWidth = SrcRect.GetSize().x; - myHeight = SrcRect.GetSize().y; + myWidth = srcRect.GetSize().x; + myHeight = srcRect.GetSize().y; // We can then create the texture - if (Window.SetActive() && CreateTexture()) + if (window.SetActive() && CreateTexture()) { - GLint PreviousTexture; - GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &PreviousTexture)); + GLint previous; + GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &previous)); GLCheck(glBindTexture(GL_TEXTURE_2D, myTexture)); - GLCheck(glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, SrcRect.Left, SrcRect.Top, myWidth, myHeight)); + GLCheck(glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, srcRect.Left, srcRect.Top, myWidth, myHeight)); - GLCheck(glBindTexture(GL_TEXTURE_2D, PreviousTexture)); + GLCheck(glBindTexture(GL_TEXTURE_2D, previous)); myNeedTextureUpdate = false; myNeedArrayUpdate = true; @@ -415,20 +415,20 @@ bool Image::CopyScreen(RenderWindow& Window, const IntRect& SourceRect) //////////////////////////////////////////////////////////// /// Change the color of a pixel //////////////////////////////////////////////////////////// -void Image::SetPixel(unsigned int X, unsigned int Y, const Color& Col) +void Image::SetPixel(unsigned int x, unsigned int y, const Color& color) { // First check if the array of pixels needs to be updated EnsureArrayUpdate(); // Check if pixel is whithin the image bounds - if ((X >= myWidth) || (Y >= myHeight)) + if ((x >= myWidth) || (y >= myHeight)) { - std::cerr << "Cannot set pixel (" << X << "," << Y << ") for image " + std::cerr << "Cannot set pixel (" << x << "," << y << ") for image " << "(width = " << myWidth << ", height = " << myHeight << ")" << std::endl; return; } - myPixels[X + Y * myWidth] = Col; + myPixels[x + y * myWidth] = color; // The texture will need to be updated myNeedTextureUpdate = true; @@ -438,20 +438,20 @@ void Image::SetPixel(unsigned int X, unsigned int Y, const Color& Col) //////////////////////////////////////////////////////////// /// Get a pixel from the image //////////////////////////////////////////////////////////// -const Color& Image::GetPixel(unsigned int X, unsigned int Y) const +const Color& Image::GetPixel(unsigned int x, unsigned int y) const { // First check if the array of pixels needs to be updated const_cast(this)->EnsureArrayUpdate(); // Check if pixel is whithin the image bounds - if ((X >= myWidth) || (Y >= myHeight)) + if ((x >= myWidth) || (y >= myHeight)) { - std::cerr << "Cannot get pixel (" << X << "," << Y << ") for image " + std::cerr << "Cannot get pixel (" << x << "," << y << ") for image " << "(width = " << myWidth << ", height = " << myHeight << ")" << std::endl; return Color::Black; } - return myPixels[X + Y * myWidth]; + return myPixels[x + y * myWidth]; } @@ -497,22 +497,22 @@ void Image::Bind() const //////////////////////////////////////////////////////////// /// Enable or disable image smoothing filter //////////////////////////////////////////////////////////// -void Image::SetSmooth(bool Smooth) +void Image::SetSmooth(bool smooth) { - if (Smooth != myIsSmooth) + if (smooth != myIsSmooth) { - myIsSmooth = Smooth; + myIsSmooth = smooth; if (myTexture) { - GLint PreviousTexture; - GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &PreviousTexture)); + GLint previous; + GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &previous)); GLCheck(glBindTexture(GL_TEXTURE_2D, myTexture)); GLCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, myIsSmooth ? GL_LINEAR : GL_NEAREST)); GLCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, myIsSmooth ? GL_LINEAR : GL_NEAREST)); - GLCheck(glBindTexture(GL_TEXTURE_2D, PreviousTexture)); + GLCheck(glBindTexture(GL_TEXTURE_2D, previous)); } } } @@ -549,38 +549,38 @@ bool Image::IsSmooth() const /// Convert a subrect expressed in pixels, into float /// texture coordinates //////////////////////////////////////////////////////////// -FloatRect Image::GetTexCoords(const IntRect& Rect, bool Adjust) const +FloatRect Image::GetTexCoords(const IntRect& rect, bool adjust) const { - float Width = static_cast(myTextureWidth); - float Height = static_cast(myTextureHeight); + float width = static_cast(myTextureWidth); + float height = static_cast(myTextureHeight); - FloatRect Coords; - if (Adjust && myIsSmooth) + FloatRect coords; + if (adjust && myIsSmooth) { - Coords.Left = (Rect.Left + 0.5f) / Width; - Coords.Top = (Rect.Top + 0.5f) / Height; - Coords.Right = (Rect.Right - 0.5f) / Width; - Coords.Bottom = (Rect.Bottom - 0.5f) / Height; + coords.Left = (rect.Left + 0.5f) / width; + coords.Top = (rect.Top + 0.5f) / height; + coords.Right = (rect.Right - 0.5f) / width; + coords.Bottom = (rect.Bottom - 0.5f) / height; } else { - Coords.Left = Rect.Left / Width; - Coords.Top = Rect.Top / Height; - Coords.Right = Rect.Right / Width; - Coords.Bottom = Rect.Bottom / Height; + coords.Left = rect.Left / width; + coords.Top = rect.Top / height; + coords.Right = rect.Right / width; + coords.Bottom = rect.Bottom / height; } if (myPixelsFlipped) - std::swap(Coords.Top, Coords.Bottom); + std::swap(coords.Top, coords.Bottom); - return Coords; + return coords; } //////////////////////////////////////////////////////////// /// Get a valid texture size according to hardware support //////////////////////////////////////////////////////////// -unsigned int Image::GetValidTextureSize(unsigned int Size) +unsigned int Image::GetValidTextureSize(unsigned int size) { // Make sure that GLEW is initialized EnsureGlewInit(); @@ -588,16 +588,16 @@ unsigned int Image::GetValidTextureSize(unsigned int Size) if (glewIsSupported("GL_ARB_texture_non_power_of_two") != 0) { // If hardware supports NPOT textures, then just return the unmodified size - return Size; + return size; } else { // If hardware doesn't support NPOT textures, we calculate the nearest power of two - unsigned int PowerOfTwo = 1; - while (PowerOfTwo < Size) - PowerOfTwo *= 2; + unsigned int powerOfTwo = 1; + while (powerOfTwo < size) + powerOfTwo *= 2; - return PowerOfTwo; + return powerOfTwo; } } @@ -605,21 +605,21 @@ unsigned int Image::GetValidTextureSize(unsigned int Size) //////////////////////////////////////////////////////////// /// Assignment operator //////////////////////////////////////////////////////////// -Image& Image::operator =(const Image& Other) +Image& Image::operator =(const Image& other) { - Image Temp(Other); + Image temp(other); - std::swap(myWidth, Temp.myWidth); - std::swap(myHeight, Temp.myHeight); - std::swap(myTextureWidth, Temp.myTextureWidth); - std::swap(myTextureHeight, Temp.myTextureHeight); - std::swap(myTexture, Temp.myTexture); - std::swap(myIsSmooth, Temp.myIsSmooth); - std::swap(myNeedArrayUpdate, Temp.myNeedArrayUpdate); - std::swap(myNeedTextureUpdate, Temp.myNeedTextureUpdate); - std::swap(myUpdateSource, Temp.myUpdateSource); - std::swap(myPixelsFlipped, Temp.myPixelsFlipped); - myPixels.swap(Temp.myPixels); + std::swap(myWidth, temp.myWidth); + std::swap(myHeight, temp.myHeight); + std::swap(myTextureWidth, temp.myTextureWidth); + std::swap(myTextureHeight, temp.myTextureHeight); + std::swap(myTexture, temp.myTexture); + std::swap(myIsSmooth, temp.myIsSmooth); + std::swap(myNeedArrayUpdate, temp.myNeedArrayUpdate); + std::swap(myNeedTextureUpdate, temp.myNeedTextureUpdate); + std::swap(myUpdateSource, temp.myUpdateSource); + std::swap(myPixelsFlipped, temp.myPixelsFlipped); + myPixels.swap(temp.myPixels); return *this; } @@ -635,43 +635,43 @@ bool Image::CreateTexture() return false; // Adjust internal texture dimensions depending on NPOT textures support - unsigned int TextureWidth = GetValidTextureSize(myWidth); - unsigned int TextureHeight = GetValidTextureSize(myHeight); + unsigned int textureWidth = GetValidTextureSize(myWidth); + unsigned int textureHeight = GetValidTextureSize(myHeight); // Check the maximum texture size - GLint MaxSize; - GLCheck(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &MaxSize)); - if ((TextureWidth > static_cast(MaxSize)) || (TextureHeight > static_cast(MaxSize))) + GLint maxSize; + GLCheck(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxSize)); + if ((textureWidth > static_cast(maxSize)) || (textureHeight > static_cast(maxSize))) { - std::cerr << "Failed to create image, its internal size is too high (" << TextureWidth << "x" << TextureHeight << ")" << std::endl; + std::cerr << "Failed to create image, its internal size is too high (" << textureWidth << "x" << textureHeight << ")" << std::endl; return false; } // Destroy the previous OpenGL texture if it already exists with another size - if ((TextureWidth != myTextureWidth) || (TextureHeight != myTextureHeight)) + if ((textureWidth != myTextureWidth) || (textureHeight != myTextureHeight)) { DestroyTexture(); - myTextureWidth = TextureWidth; - myTextureHeight = TextureHeight; + myTextureWidth = textureWidth; + myTextureHeight = textureHeight; } // Create the OpenGL texture if (!myTexture) { - GLint PreviousTexture; - GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &PreviousTexture)); + GLint previous; + GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &previous)); - GLuint Texture = 0; - GLCheck(glGenTextures(1, &Texture)); - GLCheck(glBindTexture(GL_TEXTURE_2D, Texture)); + GLuint texture = 0; + GLCheck(glGenTextures(1, &texture)); + GLCheck(glBindTexture(GL_TEXTURE_2D, texture)); GLCheck(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, myTextureWidth, myTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL)); GLCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP)); GLCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP)); GLCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, myIsSmooth ? GL_LINEAR : GL_NEAREST)); GLCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, myIsSmooth ? GL_LINEAR : GL_NEAREST)); - myTexture = static_cast(Texture); + myTexture = static_cast(texture); - GLCheck(glBindTexture(GL_TEXTURE_2D, PreviousTexture)); + GLCheck(glBindTexture(GL_TEXTURE_2D, previous)); } myNeedTextureUpdate = true; @@ -690,8 +690,8 @@ void Image::EnsureTextureUpdate() { if (myTexture) { - GLint PreviousTexture; - GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &PreviousTexture)); + GLint previous; + GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &previous)); if (myUpdateSource) { @@ -707,7 +707,7 @@ void Image::EnsureTextureUpdate() myPixelsFlipped = false; } - GLCheck(glBindTexture(GL_TEXTURE_2D, PreviousTexture)); + GLCheck(glBindTexture(GL_TEXTURE_2D, previous)); } myNeedTextureUpdate = false; @@ -728,8 +728,8 @@ void Image::EnsureArrayUpdate() EnsureTextureUpdate(); // Save the previous texture - GLint PreviousTexture; - GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &PreviousTexture)); + GLint previous; + GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &previous)); // Resize the destination array of pixels myPixels.resize(myWidth * myHeight); @@ -747,32 +747,32 @@ void Image::EnsureArrayUpdate() // Texture and array don't have the same size, we have to use a slower algorithm // All the pixels will first be copied to a temporary array - std::vector AllPixels(myTextureWidth * myTextureHeight); + std::vector allPixels(myTextureWidth * myTextureHeight); GLCheck(glBindTexture(GL_TEXTURE_2D, myTexture)); - GLCheck(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, &AllPixels[0])); + GLCheck(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, &allPixels[0])); // The we copy the useful pixels from the temporary array to the final one - const Color* Src = &AllPixels[0]; - Color* Dst = &myPixels[0]; - int SrcPitch = myTextureWidth; + const Color* src = &allPixels[0]; + Color* dst = &myPixels[0]; + int srcPitch = myTextureWidth; // Handle the case where source pixels are flipped vertically if (myPixelsFlipped) { - Src += myTextureWidth * (myHeight - 1); - SrcPitch = -SrcPitch; + src += myTextureWidth * (myHeight - 1); + srcPitch = -srcPitch; } for (unsigned int i = 0; i < myHeight; ++i) { - std::copy(Src, Src + myWidth, Dst); - Src += SrcPitch; - Dst += myWidth; + std::copy(src, src + myWidth, dst); + src += srcPitch; + dst += myWidth; } } // Restore the previous texture - GLCheck(glBindTexture(GL_TEXTURE_2D, PreviousTexture)); + GLCheck(glBindTexture(GL_TEXTURE_2D, previous)); myNeedArrayUpdate = false; } @@ -784,11 +784,11 @@ void Image::EnsureArrayUpdate() /// its content. /// For internal use only (see RenderImage class). //////////////////////////////////////////////////////////// -void Image::ExternalUpdate(RenderImage& Source) +void Image::ExternalUpdate(RenderImage& source) { myNeedTextureUpdate = true; myNeedArrayUpdate = true; - myUpdateSource = &Source; + myUpdateSource = &source; } diff --git a/src/SFML/Graphics/ImageLoader.cpp b/src/SFML/Graphics/ImageLoader.cpp index a3f83bf42..07adac30c 100644 --- a/src/SFML/Graphics/ImageLoader.cpp +++ b/src/SFML/Graphics/ImageLoader.cpp @@ -41,10 +41,10 @@ namespace //////////////////////////////////////////////////////////// /// Error callback for PNG writing //////////////////////////////////////////////////////////// - void PngErrorHandler(png_structp Png, png_const_charp Message) + void PngErrorHandler(png_structp png, png_const_charp message) { - std::cerr << "Failed to write PNG image. Reason : " << Message << std::endl; - longjmp(Png->jmpbuf, 1); + std::cerr << "Failed to write PNG image. Reason : " << message << std::endl; + longjmp(png->jmpbuf, 1); } } @@ -85,34 +85,34 @@ ImageLoader::~ImageLoader() //////////////////////////////////////////////////////////// /// Load pixels from an image file //////////////////////////////////////////////////////////// -bool ImageLoader::LoadImageFromFile(const std::string& Filename, std::vector& Pixels, unsigned int& Width, unsigned int& Height) +bool ImageLoader::LoadImageFromFile(const std::string& filename, std::vector& pixels, unsigned int& width, unsigned int& height) { // Clear the array (just in case) - Pixels.clear(); + pixels.clear(); // Load the image and get a pointer to the pixels in memory - int ImgWidth, ImgHeight, ImgChannels; - unsigned char* PixelsPtr = SOIL_load_image(Filename.c_str(), &ImgWidth, &ImgHeight, &ImgChannels, SOIL_LOAD_RGBA); + int imgWidth, imgHeight, imgChannels; + unsigned char* ptr = SOIL_load_image(filename.c_str(), &imgWidth, &imgHeight, &imgChannels, SOIL_LOAD_RGBA); - if (PixelsPtr) + if (ptr) { // Assign the image properties - Width = ImgWidth; - Height = ImgHeight; + width = imgWidth; + height = imgHeight; // Copy the loaded pixels to the pixel buffer - Pixels.resize(Width * Height); - memcpy(&Pixels[0], PixelsPtr, Width * Height * 4); + pixels.resize(width * height); + memcpy(&pixels[0], ptr, width * height * 4); // Free the loaded pixels (they are now in our own pixel buffer) - SOIL_free_image_data(PixelsPtr); + SOIL_free_image_data(ptr); return true; } else { // Error, failed to load the image - std::cerr << "Failed to load image \"" << Filename << "\". Reason : " << SOIL_last_result() << std::endl; + std::cerr << "Failed to load image \"" << filename << "\". Reason : " << SOIL_last_result() << std::endl; return false; } @@ -122,29 +122,29 @@ bool ImageLoader::LoadImageFromFile(const std::string& Filename, std::vector& Pixels, unsigned int& Width, unsigned int& Height) +bool ImageLoader::LoadImageFromMemory(const char* data, std::size_t sizeInBytes, std::vector& pixels, unsigned int& width, unsigned int& height) { // Clear the array (just in case) - Pixels.clear(); + pixels.clear(); // Load the image and get a pointer to the pixels in memory - const unsigned char* Buffer = reinterpret_cast(Data); - int Size = static_cast(SizeInBytes); - int ImgWidth, ImgHeight, ImgChannels; - unsigned char* PixelsPtr = SOIL_load_image_from_memory(Buffer, Size, &ImgWidth, &ImgHeight, &ImgChannels, SOIL_LOAD_RGBA); + const unsigned char* buffer = reinterpret_cast(data); + int size = static_cast(sizeInBytes); + int imgWidth, imgHeight, imgChannels; + unsigned char* ptr = SOIL_load_image_from_memory(buffer, size, &imgWidth, &imgHeight, &imgChannels, SOIL_LOAD_RGBA); - if (PixelsPtr) + if (ptr) { // Assign the image properties - Width = ImgWidth; - Height = ImgHeight; + width = imgWidth; + height = imgHeight; // Copy the loaded pixels to the pixel buffer - Pixels.resize(Width * Height); - memcpy(&Pixels[0], PixelsPtr, Width * Height * 4); + pixels.resize(width * height); + memcpy(&pixels[0], ptr, width * height * 4); // Free the loaded pixels (they are now in our own pixel buffer) - SOIL_free_image_data(PixelsPtr); + SOIL_free_image_data(ptr); return true; } @@ -161,35 +161,35 @@ bool ImageLoader::LoadImageFromMemory(const char* Data, std::size_t SizeInBytes, //////////////////////////////////////////////////////////// /// Save pixels to an image file //////////////////////////////////////////////////////////// -bool ImageLoader::SaveImageToFile(const std::string& Filename, const std::vector& Pixels, unsigned int Width, unsigned int Height) +bool ImageLoader::SaveImageToFile(const std::string& filename, const std::vector& pixels, unsigned int width, unsigned int height) { // Deduce the image type from its extension - int Type = -1; - if (Filename.size() > 3) + int type = -1; + if (filename.size() > 3) { - std::string Extension = Filename.substr(Filename.size() - 3); - if (Extension == "bmp" || Extension == "BMP") Type = SOIL_SAVE_TYPE_BMP; - else if (Extension == "tga" || Extension == "TGA") Type = SOIL_SAVE_TYPE_TGA; - else if (Extension == "dds" || Extension == "DDS") Type = SOIL_SAVE_TYPE_DDS; + std::string extension = filename.substr(filename.size() - 3); + if (extension == "bmp" || extension == "BMP") type = SOIL_SAVE_TYPE_BMP; + else if (extension == "tga" || extension == "TGA") type = SOIL_SAVE_TYPE_TGA; + else if (extension == "dds" || extension == "DDS") type = SOIL_SAVE_TYPE_DDS; // Special handling for PNG and JPG -- not handled by SOIL - else if (Extension == "png" || Extension == "PNG") return WritePng(Filename, Pixels, Width, Height); - else if (Extension == "jpg" || Extension == "JPG") return WriteJpg(Filename, Pixels, Width, Height); + else if (extension == "png" || extension == "PNG") return WritePng(filename, pixels, width, height); + else if (extension == "jpg" || extension == "JPG") return WriteJpg(filename, pixels, width, height); } - if (Type == -1) + if (type == -1) { // Error, incompatible type - std::cerr << "Failed to save image \"" << Filename << "\". Reason : this image format is not supported" << std::endl; + std::cerr << "Failed to save image \"" << filename << "\". Reason: this image format is not supported" << std::endl; return false; } // Finally save the image - const unsigned char* PixelsPtr = reinterpret_cast(&Pixels[0]); - if (!SOIL_save_image(Filename.c_str(), Type, static_cast(Width), static_cast(Height), 4, PixelsPtr)) + const unsigned char* ptr = reinterpret_cast(&pixels[0]); + if (!SOIL_save_image(filename.c_str(), type, static_cast(width), static_cast(height), 4, ptr)) { // Error, failed to save the image - std::cerr << "Failed to save image \"" << Filename << "\". Reason : " << SOIL_last_result() << std::endl; + std::cerr << "Failed to save image \"" << filename << "\". Reason: " << SOIL_last_result() << std::endl; return false; } @@ -200,57 +200,57 @@ bool ImageLoader::SaveImageToFile(const std::string& Filename, const std::vector //////////////////////////////////////////////////////////// /// Save a JPG image file //////////////////////////////////////////////////////////// -bool ImageLoader::WriteJpg(const std::string& Filename, const std::vector& Pixels, unsigned int Width, unsigned int Height) +bool ImageLoader::WriteJpg(const std::string& filename, const std::vector& pixels, unsigned int width, unsigned int height) { // Open the file to write in - FILE* File = fopen(Filename.c_str(), "wb"); - if (!File) + FILE* file = fopen(filename.c_str(), "wb"); + if (!file) { - std::cerr << "Failed to save image file \"" << Filename << "\". Reason : cannot open file" << std::endl; + std::cerr << "Failed to save image file \"" << filename << "\". Reason : cannot open file" << std::endl; return false; } // Initialize the error handler - jpeg_compress_struct CompressInfo; - jpeg_error_mgr ErrorManager; - CompressInfo.err = jpeg_std_error(&ErrorManager); + jpeg_compress_struct compressInfos; + jpeg_error_mgr errorManager; + compressInfos.err = jpeg_std_error(&errorManager); // Initialize all the writing and compression infos - jpeg_create_compress(&CompressInfo); - CompressInfo.image_width = Width; - CompressInfo.image_height = Height; - CompressInfo.input_components = 3; - CompressInfo.in_color_space = JCS_RGB; - jpeg_stdio_dest(&CompressInfo, File); - jpeg_set_defaults(&CompressInfo); - jpeg_set_quality(&CompressInfo, 90, TRUE); + jpeg_create_compress(&compressInfos); + compressInfos.image_width = width; + compressInfos.image_height = height; + compressInfos.input_components = 3; + compressInfos.in_color_space = JCS_RGB; + jpeg_stdio_dest(&compressInfos, file); + jpeg_set_defaults(&compressInfos); + jpeg_set_quality(&compressInfos, 90, TRUE); // Get rid of the aplha channel - std::vector PixelsBuffer(Width * Height * 3); - for (std::size_t i = 0; i < Pixels.size(); ++i) + std::vector buffer(width * height * 3); + for (std::size_t i = 0; i < pixels.size(); ++i) { - PixelsBuffer[i * 3 + 0] = Pixels[i].r; - PixelsBuffer[i * 3 + 1] = Pixels[i].g; - PixelsBuffer[i * 3 + 2] = Pixels[i].b; + buffer[i * 3 + 0] = pixels[i].r; + buffer[i * 3 + 1] = pixels[i].g; + buffer[i * 3 + 2] = pixels[i].b; } - Uint8* PixelsPtr = &PixelsBuffer[0]; + Uint8* ptr = &buffer[0]; // Start compression - jpeg_start_compress(&CompressInfo, TRUE); + jpeg_start_compress(&compressInfos, TRUE); // Write each row of the image - while (CompressInfo.next_scanline < CompressInfo.image_height) + while (compressInfos.next_scanline < compressInfos.image_height) { - JSAMPROW RowPointer = PixelsPtr + (CompressInfo.next_scanline * Width * 3); - jpeg_write_scanlines(&CompressInfo, &RowPointer, 1); + JSAMPROW rawPointer = ptr + (compressInfos.next_scanline * width * 3); + jpeg_write_scanlines(&compressInfos, &rawPointer, 1); } // Finish compression - jpeg_finish_compress(&CompressInfo); - jpeg_destroy_compress(&CompressInfo); + jpeg_finish_compress(&compressInfos); + jpeg_destroy_compress(&compressInfos); // Close the file - fclose(File); + fclose(file); return true; } @@ -259,70 +259,70 @@ bool ImageLoader::WriteJpg(const std::string& Filename, const std::vector //////////////////////////////////////////////////////////// /// Save a PNG image file //////////////////////////////////////////////////////////// -bool ImageLoader::WritePng(const std::string& Filename, const std::vector& Pixels, unsigned int Width, unsigned int Height) +bool ImageLoader::WritePng(const std::string& filename, const std::vector& pixels, unsigned int width, unsigned int height) { // Open the file to write in - FILE* File = fopen(Filename.c_str(), "wb"); - if (!File) + FILE* file = fopen(filename.c_str(), "wb"); + if (!file) { - std::cerr << "Failed to save image file \"" << Filename << "\". Reason : cannot open file" << std::endl; + std::cerr << "Failed to save image file \"" << filename << "\". Reason : cannot open file" << std::endl; return false; } // Create the main PNG structure - png_structp Png = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, &PngErrorHandler, NULL); - if (!Png) + png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, &PngErrorHandler, NULL); + if (!png) { - fclose(File); - std::cerr << "Failed to save image file \"" << Filename << "\". Reason : cannot allocate PNG write structure" << std::endl; + fclose(file); + std::cerr << "Failed to save image file \"" << filename << "\". Reason : cannot allocate PNG write structure" << std::endl; return false; } // Initialize the image informations - png_infop PngInfo = png_create_info_struct(Png); - if (!PngInfo) + png_infop pngInfos = png_create_info_struct(png); + if (!pngInfos) { - fclose(File); - png_destroy_write_struct(&Png, NULL); - std::cerr << "Failed to save image file \"" << Filename << "\". Reason : cannot allocate PNG info structure" << std::endl; + fclose(file); + png_destroy_write_struct(&png, NULL); + std::cerr << "Failed to save image file \"" << filename << "\". Reason : cannot allocate PNG info structure" << std::endl; return false; } // For proper error handling... - if (setjmp(Png->jmpbuf)) + if (setjmp(png->jmpbuf)) { - png_destroy_write_struct(&Png, &PngInfo); + png_destroy_write_struct(&png, &pngInfos); return false; } // Link the file to the PNG structure - png_init_io(Png, File); + png_init_io(png, file); // Set the image informations - png_set_IHDR(Png, PngInfo, Width, Height, 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + png_set_IHDR(png, pngInfos, width, height, 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); // Write the header - png_write_info(Png, PngInfo); + png_write_info(png, pngInfos); // Get the pointers to the pixels rows into an array - png_byte* PixelsPtr = (png_byte*)&Pixels[0]; - std::vector RowPointers(Height); - for (unsigned int i = 0; i < Height; ++i) + png_byte* ptr = (png_byte*)&pixels[0]; + std::vector rawPointers(height); + for (unsigned int i = 0; i < height; ++i) { - RowPointers[i] = PixelsPtr; - PixelsPtr += Width * 4; + rawPointers[i] = ptr; + ptr += width * 4; } // Write pixels row by row - png_set_rows(Png, PngInfo, &RowPointers[0]); - png_write_png(Png, PngInfo, PNG_TRANSFORM_IDENTITY, NULL); + png_set_rows(png, pngInfos, &rawPointers[0]); + png_write_png(png, pngInfos, PNG_TRANSFORM_IDENTITY, NULL); // Finish writing the file - png_write_end(Png, PngInfo); + png_write_end(png, pngInfos); // Cleanup resources - png_destroy_write_struct(&Png, &PngInfo); - fclose(File); + png_destroy_write_struct(&png, &pngInfos); + fclose(file); return true; } diff --git a/src/SFML/Graphics/ImageLoader.hpp b/src/SFML/Graphics/ImageLoader.hpp index d3a6242b3..dc08a7714 100644 --- a/src/SFML/Graphics/ImageLoader.hpp +++ b/src/SFML/Graphics/ImageLoader.hpp @@ -57,42 +57,42 @@ public : //////////////////////////////////////////////////////////// /// Load pixels from an image file /// - /// \param Filename : Path of image file to load - /// \param Pixels : Array of pixels to fill with loaded image - /// \param Width : Width of loaded image, in pixels - /// \param Height : Height of loaded image, in pixels + /// \param filename : Path of image file to load + /// \param pixels : Array of pixels to fill with loaded image + /// \param width : Width of loaded image, in pixels + /// \param height : Height of loaded image, in pixels /// /// \return True if loading was successful /// //////////////////////////////////////////////////////////// - bool LoadImageFromFile(const std::string& Filename, std::vector& Pixels, unsigned int& Width, unsigned int& Height); + bool LoadImageFromFile(const std::string& filename, std::vector& pixels, unsigned int& width, unsigned int& height); //////////////////////////////////////////////////////////// /// Load pixels from an image file in memory /// - /// \param Data : Pointer to the file data in memory - /// \param SizeInBytes : Size of the data to load, in bytes - /// \param Pixels : Array of pixels to fill with loaded image - /// \param Width : Width of loaded image, in pixels - /// \param Height : Height of loaded image, in pixels + /// \param data : Pointer to the file data in memory + /// \param sizeInBytes : Size of the data to load, in bytes + /// \param pixels : Array of pixels to fill with loaded image + /// \param width : Width of loaded image, in pixels + /// \param height : Height of loaded image, in pixels /// /// \return True if loading was successful /// //////////////////////////////////////////////////////////// - bool LoadImageFromMemory(const char* Data, std::size_t SizeInBytes, std::vector& Pixels, unsigned int& Width, unsigned int& Height); + bool LoadImageFromMemory(const char* data, std::size_t sizeInBytes, std::vector& pixels, unsigned int& width, unsigned int& height); //////////////////////////////////////////////////////////// /// Save pixels to an image file /// - /// \param Filename : Path of image file to save - /// \param Pixels : Array of pixels to save to image - /// \param Width : Width of image to save, in pixels - /// \param Height : Height of image to save, in pixels + /// \param filename : Path of image file to save + /// \param pixels : Array of pixels to save to image + /// \param width : Width of image to save, in pixels + /// \param height : Height of image to save, in pixels /// /// \return True if saving was successful /// //////////////////////////////////////////////////////////// - bool SaveImageToFile(const std::string& Filename, const std::vector& Pixels, unsigned int Width, unsigned int Height); + bool SaveImageToFile(const std::string& filename, const std::vector& pixels, unsigned int width, unsigned int height); private : @@ -111,28 +111,28 @@ private : //////////////////////////////////////////////////////////// /// Save a JPG image file /// - /// \param Filename : Path of image file to save - /// \param Pixels : Array of pixels to save to image - /// \param Width : Width of image to save, in pixels - /// \param Height : Height of image to save, in pixels + /// \param filename : Path of image file to save + /// \param pixels : Array of pixels to save to image + /// \param width : Width of image to save, in pixels + /// \param height : Height of image to save, in pixels /// /// \return True if saving was successful /// //////////////////////////////////////////////////////////// - bool WriteJpg(const std::string& Filename, const std::vector& Pixels, unsigned int Width, unsigned int Height); + bool WriteJpg(const std::string& filename, const std::vector& pixels, unsigned int width, unsigned int height); //////////////////////////////////////////////////////////// /// Save a PNG image file /// - /// \param Filename : Path of image file to save - /// \param Pixels : Array of pixels to save to image - /// \param Width : Width of image to save, in pixels - /// \param Height : Height of image to save, in pixels + /// \param filename : Path of image file to save + /// \param pixels : Array of pixels to save to image + /// \param width : Width of image to save, in pixels + /// \param height : Height of image to save, in pixels /// /// \return True if saving was successful /// //////////////////////////////////////////////////////////// - bool WritePng(const std::string& Filename, const std::vector& Pixels, unsigned int Width, unsigned int Height); + bool WritePng(const std::string& filename, const std::vector& pixels, unsigned int width, unsigned int height); }; } // namespace priv diff --git a/src/SFML/Graphics/Linux/RenderImageImplPBuffer.cpp b/src/SFML/Graphics/Linux/RenderImageImplPBuffer.cpp index 0c9bac7ea..c12fbaa07 100644 --- a/src/SFML/Graphics/Linux/RenderImageImplPBuffer.cpp +++ b/src/SFML/Graphics/Linux/RenderImageImplPBuffer.cpp @@ -63,7 +63,7 @@ RenderImageImplPBuffer::~RenderImageImplPBuffer() // This is to make sure that another valid context is made // active after we destroy the P-Buffer's one - Context Ctx; + Context context; } @@ -82,14 +82,14 @@ bool RenderImageImplPBuffer::IsSupported() //////////////////////////////////////////////////////////// /// /see RenderImageImpl::Create //////////////////////////////////////////////////////////// -bool RenderImageImplPBuffer::Create(unsigned int Width, unsigned int Height, unsigned int /*TextureId*/, bool DepthBuffer) +bool RenderImageImplPBuffer::Create(unsigned int width, unsigned int height, unsigned int, bool depthBuffer) { // Store the dimensions - myWidth = Width; - myHeight = Height; + myWidth = width; + myHeight = height; // Define the PBuffer attributes - int VisualAttributes[] = + int visualAttributes[] = { GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT, @@ -97,72 +97,72 @@ bool RenderImageImplPBuffer::Create(unsigned int Width, unsigned int Height, uns GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_ALPHA_SIZE, 8, - GLX_DEPTH_SIZE, (DepthBuffer ? 24 : 0), + GLX_DEPTH_SIZE, (depthBuffer ? 24 : 0), 0 }; int PBufferAttributes[] = { - GLX_PBUFFER_WIDTH, Width, - GLX_PBUFFER_HEIGHT, Height, + GLX_PBUFFER_WIDTH, width, + GLX_PBUFFER_HEIGHT, height, 0 }; // Get the available FB configurations - int NbConfigs = 0; - GLXFBConfig* Configs = glXChooseFBConfigSGIX(myDisplay, DefaultScreen(myDisplay), VisualAttributes, &NbConfigs); - if (!Configs || !NbConfigs) + int nbConfigs = 0; + GLXFBConfig* configs = glXChooseFBConfigSGIX(myDisplay, DefaultScreen(myDisplay), visualAttributes, &nbConfigs); + if (!configs || !nbConfigs) { std::cerr << "Impossible to create render image (failed to find a suitable pixel format for PBuffer)" << std::endl; return false; } // Create the P-Buffer - myPBuffer = glXCreateGLXPbufferSGIX(myDisplay, Configs[0], Width, Height, PBufferAttributes); + myPBuffer = glXCreateGLXPbufferSGIX(myDisplay, configs[0], width, height, PBufferAttributes); if (!myPBuffer) { std::cerr << "Impossible to create render image (failed to create the OpenGL PBuffer)" << std::endl; - XFree(Configs); + XFree(configs); return false; } // Check the actual size of the P-Buffer - unsigned int ActualWidth, ActualHeight; - glXQueryGLXPbufferSGIX(myDisplay, myPBuffer, GLX_WIDTH_SGIX, &ActualWidth); - glXQueryGLXPbufferSGIX(myDisplay, myPBuffer, GLX_HEIGHT_SGIX, &ActualHeight); - if ((ActualWidth != Width) || (ActualHeight != Height)) + unsigned int actualWidth, actualHeight; + glXQueryGLXPbufferSGIX(myDisplay, myPBuffer, GLX_WIDTH_SGIX, &actualWidth); + glXQueryGLXPbufferSGIX(myDisplay, myPBuffer, GLX_HEIGHT_SGIX, &actualHeight); + if ((actualWidth != width) || (actualHeight != height)) { std::cerr << "Impossible to create render image (failed to match the requested size). " - << "Size: " << ActualWidth << "x" << ActualHeight << " - " - << "Requested: " << Width << "x" << Height + << "Size: " << actualWidth << "x" << actualHeight << " - " + << "Requested: " << width << "x" << height << std::endl; - XFree(Configs); + XFree(configs); return false; } // We'll have to share the P-Buffer context with the current context - GLXDrawable CurrentDrawable = glXGetCurrentDrawable(); - GLXContext CurrentContext = glXGetCurrentContext(); - if (CurrentContext) + GLXDrawable currentDrawable = glXGetCurrentDrawable(); + GLXContext currentContext = glXGetCurrentContext(); + if (currentContext) glXMakeCurrent(myDisplay, NULL, NULL); // Create the context - XVisualInfo* Visual = glXGetVisualFromFBConfig(myDisplay, Configs[0]); - myContext = glXCreateContext(myDisplay, Visual, CurrentContext, true); + XVisualInfo* Visual = glXGetVisualFromFBConfig(myDisplay, configs[0]); + myContext = glXCreateContext(myDisplay, visual, currentContext, true); if (!myContext) { std::cerr << "Impossible to create render image (failed to create the OpenGL context)" << std::endl; - XFree(Configs); - XFree(Visual); + XFree(configs); + XFree(visual); return false; } // Restore the previous active context - if (CurrentContext) - glXMakeCurrent(myDisplay, CurrentDrawable, CurrentContext); + if (currentContext) + glXMakeCurrent(myDisplay, currentDrawable, currentContext); // Cleanup resources - XFree(Configs); - XFree(Visual); + XFree(configs); + XFree(visual); return true; } @@ -171,7 +171,7 @@ bool RenderImageImplPBuffer::Create(unsigned int Width, unsigned int Height, uns //////////////////////////////////////////////////////////// /// /see RenderImageImpl::Activate //////////////////////////////////////////////////////////// -bool RenderImageImplPBuffer::Activate(bool Active) +bool RenderImageImplPBuffer::Activate(bool active) { if (Active) { @@ -197,23 +197,23 @@ bool RenderImageImplPBuffer::Activate(bool Active) //////////////////////////////////////////////////////////// /// /see RenderImageImpl::UpdateTexture //////////////////////////////////////////////////////////// -bool RenderImageImplPBuffer::UpdateTexture(unsigned int TextureId) +bool RenderImageImplPBuffer::UpdateTexture(unsigned int textureId) { // Store the current active context - GLXDrawable CurrentDrawable = glXGetCurrentDrawable(); - GLXContext CurrentContext = glXGetCurrentContext(); + GLXDrawable currentDrawable = glXGetCurrentDrawable(); + GLXContext currentContext = glXGetCurrentContext(); if (Activate(true)) { // Bind the texture GLCheck(glEnable(GL_TEXTURE_2D)); - GLCheck(glBindTexture(GL_TEXTURE_2D, TextureId)); + GLCheck(glBindTexture(GL_TEXTURE_2D, textureId)); // Copy the rendered pixels to the image GLCheck(glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, myWidth, myHeight)); // Restore the previous context - glXMakeCurrent(myDisplay, CurrentDrawable, CurrentContext); + glXMakeCurrent(myDisplay, currentDrawable, currentContext); return true; } diff --git a/src/SFML/Graphics/Linux/RenderImageImplPBuffer.hpp b/src/SFML/Graphics/Linux/RenderImageImplPBuffer.hpp index 96dbfa15b..338259fcb 100644 --- a/src/SFML/Graphics/Linux/RenderImageImplPBuffer.hpp +++ b/src/SFML/Graphics/Linux/RenderImageImplPBuffer.hpp @@ -71,19 +71,19 @@ private : /// /see RenderImageImpl::Create /// //////////////////////////////////////////////////////////// - virtual bool Create(unsigned int Width, unsigned int Height, unsigned int TextureId, bool DepthBuffer); + virtual bool Create(unsigned int width, unsigned int height, unsigned int textureId, bool depthBuffer); //////////////////////////////////////////////////////////// /// /see RenderImageImpl::Activate /// //////////////////////////////////////////////////////////// - virtual bool Activate(bool Active); + virtual bool Activate(bool active); //////////////////////////////////////////////////////////// /// /see RenderImageImpl::UpdateTexture /// //////////////////////////////////////////////////////////// - virtual bool UpdateTexture(unsigned TextureId); + virtual bool UpdateTexture(unsigned textureId); //////////////////////////////////////////////////////////// // Member data diff --git a/src/SFML/Graphics/PostFX.cpp b/src/SFML/Graphics/PostFX.cpp index c9902d1bd..41193a2f6 100644 --- a/src/SFML/Graphics/PostFX.cpp +++ b/src/SFML/Graphics/PostFX.cpp @@ -54,18 +54,18 @@ myShaderProgram(0) //////////////////////////////////////////////////////////// /// Copy constructor //////////////////////////////////////////////////////////// -PostFX::PostFX(const PostFX& Copy) : -Drawable (Copy), +PostFX::PostFX(const PostFX& copy) : +Drawable (copy), myShaderProgram (0), -myTextures (Copy.myTextures), -myFragmentShader(Copy.myFragmentShader), -myFrameBuffer (Copy.myFrameBuffer) +myTextures (copy.myTextures), +myFragmentShader(copy.myFragmentShader), +myFrameBuffer (copy.myFrameBuffer) { // No filtering on frame buffer myFrameBuffer.SetSmooth(false); // Create the shaders and the program - if (Copy.myShaderProgram) + if (copy.myShaderProgram) CreateProgram(); } @@ -84,18 +84,18 @@ PostFX::~PostFX() //////////////////////////////////////////////////////////// /// Load the effect from a file //////////////////////////////////////////////////////////// -bool PostFX::LoadFromFile(const std::string& Filename) +bool PostFX::LoadFromFile(const std::string& filename) { // Open the file - std::ifstream File(Filename.c_str()); - if (!File) + std::ifstream file(filename.c_str()); + if (!file) { - std::cerr << "Failed to open effect file \"" << Filename << "\"" << std::endl; + std::cerr << "Failed to open effect file \"" << filename << "\"" << std::endl; return false; } // Apply the preprocessing pass to the fragment shader code - myFragmentShader = PreprocessEffect(File); + myFragmentShader = PreprocessEffect(file); // Create the shaders and the program CreateProgram(); @@ -107,13 +107,13 @@ bool PostFX::LoadFromFile(const std::string& Filename) //////////////////////////////////////////////////////////// /// Load the effect from a text in memory //////////////////////////////////////////////////////////// -bool PostFX::LoadFromMemory(const std::string& Effect) +bool PostFX::LoadFromMemory(const std::string& effect) { // Open a stream and copy the effect code - std::istringstream Stream(Effect.c_str()); + std::istringstream stream(effect.c_str()); // Apply the preprocessing pass to the fragment shader code - myFragmentShader = PreprocessEffect(Stream); + myFragmentShader = PreprocessEffect(stream); // Create the shaders and the program CreateProgram(); @@ -125,7 +125,7 @@ bool PostFX::LoadFromMemory(const std::string& Effect) //////////////////////////////////////////////////////////// /// Change a parameter of the effect (1 float) //////////////////////////////////////////////////////////// -void PostFX::SetParameter(const std::string& Name, float X) +void PostFX::SetParameter(const std::string& name, float x) { if (myShaderProgram) { @@ -133,11 +133,11 @@ void PostFX::SetParameter(const std::string& Name, float X) GLCheck(glUseProgramObjectARB(myShaderProgram)); // Get parameter location and assign it new values - GLint Location = glGetUniformLocationARB(myShaderProgram, Name.c_str()); - if (Location != -1) - GLCheck(glUniform1fARB(Location, X)); + GLint location = glGetUniformLocationARB(myShaderProgram, name.c_str()); + if (location != -1) + GLCheck(glUniform1fARB(location, x)); else - std::cerr << "Parameter \"" << Name << "\" not found in post-effect" << std::endl; + std::cerr << "Parameter \"" << name << "\" not found in post-effect" << std::endl; // Disable program GLCheck(glUseProgramObjectARB(0)); @@ -148,7 +148,7 @@ void PostFX::SetParameter(const std::string& Name, float X) //////////////////////////////////////////////////////////// /// Change a parameter of the effect (2 floats) //////////////////////////////////////////////////////////// -void PostFX::SetParameter(const std::string& Name, float X, float Y) +void PostFX::SetParameter(const std::string& name, float x, float y) { if (myShaderProgram) { @@ -156,11 +156,11 @@ void PostFX::SetParameter(const std::string& Name, float X, float Y) GLCheck(glUseProgramObjectARB(myShaderProgram)); // Get parameter location and assign it new values - GLint Location = glGetUniformLocationARB(myShaderProgram, Name.c_str()); - if (Location != -1) - GLCheck(glUniform2fARB(Location, X, Y)); + GLint location = glGetUniformLocationARB(myShaderProgram, name.c_str()); + if (location != -1) + GLCheck(glUniform2fARB(location, x, y)); else - std::cerr << "Parameter \"" << Name << "\" not found in post-effect" << std::endl; + std::cerr << "Parameter \"" << name << "\" not found in post-effect" << std::endl; // Disable program GLCheck(glUseProgramObjectARB(0)); @@ -171,7 +171,7 @@ void PostFX::SetParameter(const std::string& Name, float X, float Y) //////////////////////////////////////////////////////////// /// Change a parameter of the effect (3 floats) //////////////////////////////////////////////////////////// -void PostFX::SetParameter(const std::string& Name, float X, float Y, float Z) +void PostFX::SetParameter(const std::string& name, float x, float y, float z) { if (myShaderProgram) { @@ -179,11 +179,11 @@ void PostFX::SetParameter(const std::string& Name, float X, float Y, float Z) GLCheck(glUseProgramObjectARB(myShaderProgram)); // Get parameter location and assign it new values - GLint Location = glGetUniformLocationARB(myShaderProgram, Name.c_str()); - if (Location != -1) - GLCheck(glUniform3fARB(Location, X, Y, Z)); + GLint location = glGetUniformLocationARB(myShaderProgram, name.c_str()); + if (location != -1) + GLCheck(glUniform3fARB(location, x, y, z)); else - std::cerr << "Parameter \"" << Name << "\" not found in post-effect" << std::endl; + std::cerr << "Parameter \"" << name << "\" not found in post-effect" << std::endl; // Disable program GLCheck(glUseProgramObjectARB(0)); @@ -194,7 +194,7 @@ void PostFX::SetParameter(const std::string& Name, float X, float Y, float Z) //////////////////////////////////////////////////////////// /// Change a parameter of the effect (4 floats) //////////////////////////////////////////////////////////// -void PostFX::SetParameter(const std::string& Name, float X, float Y, float Z, float W) +void PostFX::SetParameter(const std::string& name, float x, float y, float z, float w) { if (myShaderProgram) { @@ -202,11 +202,11 @@ void PostFX::SetParameter(const std::string& Name, float X, float Y, float Z, fl GLCheck(glUseProgramObjectARB(myShaderProgram)); // Get parameter location and assign it new values - GLint Location = glGetUniformLocationARB(myShaderProgram, Name.c_str()); - if (Location != -1) - GLCheck(glUniform4fARB(Location, X, Y, Z, W)); + GLint location = glGetUniformLocationARB(myShaderProgram, name.c_str()); + if (location != -1) + GLCheck(glUniform4fARB(location, x, y, z, w)); else - std::cerr << "Parameter \"" << Name << "\" not found in post-effect" << std::endl; + std::cerr << "Parameter \"" << name << "\" not found in post-effect" << std::endl; // Disable program GLCheck(glUseProgramObjectARB(0)); @@ -217,41 +217,41 @@ void PostFX::SetParameter(const std::string& Name, float X, float Y, float Z, fl //////////////////////////////////////////////////////////// /// Set a texture parameter //////////////////////////////////////////////////////////// -void PostFX::SetTexture(const std::string& Name, const Image* Texture) +void PostFX::SetTexture(const std::string& name, const Image* texture) { // Check that the current texture unit is available - GLint MaxUnits; - GLCheck(glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, &MaxUnits)); - if (myTextures.size() >= static_cast(MaxUnits)) + GLint maxUnits; + GLCheck(glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, &maxUnits)); + if (myTextures.size() >= static_cast(maxUnits)) { - std::cerr << "Impossible to use texture \"" << Name << "\" for post-effect : all available texture units are used" << std::endl; + std::cerr << "Impossible to use texture \"" << name << "\" for post-effect : all available texture units are used" << std::endl; return; } // Make sure the given name is a valid variable in the effect - int Location = glGetUniformLocationARB(myShaderProgram, Name.c_str()); - if (Location == -1) + int location = glGetUniformLocationARB(myShaderProgram, name.c_str()); + if (location == -1) { - std::cerr << "Texture \"" << Name << "\" not found in post-effect" << std::endl; + std::cerr << "Texture \"" << name << "\" not found in post-effect" << std::endl; return; } // Store the texture for later use - myTextures[Name] = Texture ? Texture : &myFrameBuffer; + myTextures[name] = texture ? texture : &myFrameBuffer; } //////////////////////////////////////////////////////////// /// Assignment operator //////////////////////////////////////////////////////////// -PostFX& PostFX::operator =(const PostFX& Other) +PostFX& PostFX::operator =(const PostFX& other) { - PostFX Temp(Other); + PostFX temp(other); - std::swap(myShaderProgram, Temp.myShaderProgram); - std::swap(myTextures, Temp.myTextures); - std::swap(myFragmentShader, Temp.myFragmentShader); - std::swap(myFrameBuffer, Temp.myFrameBuffer); + std::swap(myShaderProgram, temp.myShaderProgram); + std::swap(myTextures, temp.myTextures); + std::swap(myFragmentShader, temp.myFragmentShader); + std::swap(myFrameBuffer, temp.myFrameBuffer); return *this; } @@ -275,7 +275,7 @@ bool PostFX::CanUsePostFX() //////////////////////////////////////////////////////////// /// /see Drawable::Render //////////////////////////////////////////////////////////// -void PostFX::Render(RenderTarget& Target) const +void PostFX::Render(RenderTarget& target) const { // Check that we have a valid program if (!myShaderProgram) @@ -283,25 +283,25 @@ void PostFX::Render(RenderTarget& Target) const // Copy the current framebuffer pixels to our frame buffer texture // The ugly cast is temporary until PostFx are rewritten :) - myFrameBuffer.CopyScreen((RenderWindow&)Target); + myFrameBuffer.CopyScreen((RenderWindow&)target); // Enable program GLCheck(glUseProgramObjectARB(myShaderProgram)); // Bind textures - TextureTable::const_iterator ItTex = myTextures.begin(); + TextureTable::const_iterator it = myTextures.begin(); for (std::size_t i = 0; i < myTextures.size(); ++i) { - int Location = glGetUniformLocationARB(myShaderProgram, ItTex->first.c_str()); - GLCheck(glUniform1iARB(Location, static_cast(i))); + int location = glGetUniformLocationARB(myShaderProgram, it->first.c_str()); + GLCheck(glUniform1iARB(location, static_cast(i))); GLCheck(glActiveTextureARB(static_cast(GL_TEXTURE0_ARB + i))); - ItTex->second->Bind(); - ItTex++; + it->second->Bind(); + it++; } // Compute the texture coordinates (in case the texture is larger than the screen, or flipped) - IntRect FrameBufferRect(0, 0, myFrameBuffer.GetWidth(), myFrameBuffer.GetHeight()); - FloatRect TexCoords = myFrameBuffer.GetTexCoords(FrameBufferRect); + IntRect frameBufferRect(0, 0, myFrameBuffer.GetWidth(), myFrameBuffer.GetHeight()); + FloatRect texCoords = myFrameBuffer.GetTexCoords(frameBufferRect); // Set the projection matrix to the identity so that the screen coordinates are in the range [-1, 1] GLCheck(glMatrixMode(GL_PROJECTION)); @@ -309,10 +309,10 @@ void PostFX::Render(RenderTarget& Target) const // Render a fullscreen quad using the effect on our framebuffer glBegin(GL_QUADS); - glTexCoord2f(TexCoords.Left, TexCoords.Top); glVertex2f(-1, 1); - glTexCoord2f(TexCoords.Right, TexCoords.Top); glVertex2f( 1, 1); - glTexCoord2f(TexCoords.Right, TexCoords.Bottom); glVertex2f( 1, -1); - glTexCoord2f(TexCoords.Left, TexCoords.Bottom); glVertex2f(-1, -1); + glTexCoord2f(texCoords.Left, texCoords.Top); glVertex2f(-1, 1); + glTexCoord2f(texCoords.Right, texCoords.Top); glVertex2f( 1, 1); + glTexCoord2f(texCoords.Right, texCoords.Bottom); glVertex2f( 1, -1); + glTexCoord2f(texCoords.Left, texCoords.Bottom); glVertex2f(-1, -1); glEnd(); // Disable program @@ -332,78 +332,78 @@ void PostFX::Render(RenderTarget& Target) const /// Preprocess a SFML effect file /// to convert it to a valid GLSL fragment shader //////////////////////////////////////////////////////////// -std::string PostFX::PreprocessEffect(std::istream& File) +std::string PostFX::PreprocessEffect(std::istream& file) { // Initialize output string - std::set myTextures; - std::string Out = ""; + std::set textures; + std::string out = ""; // Variable declarations - std::string Line; - while (std::getline(File, Line) && (Line.substr(0, 6) != "effect")) + std::string line; + while (std::getline(file, line) && (line.substr(0, 6) != "effect")) { // Remove the ending '\r', if any - if (!Line.empty() && (Line[Line.size() - 1] == '\r')) - Line.erase(Line.size() - 1); + if (!line.empty() && (line[line.size() - 1] == '\r')) + line.erase(line.size() - 1); // Skip empty lines - if (Line == "") + if (line == "") continue; // Extract variables type and name and convert them - std::string Type, Name; - std::istringstream iss(Line); - if (!(iss >> Type >> Name)) + std::string type, name; + std::istringstream iss(line); + if (!(iss >> type >> name)) { std::cerr << "Post-effect error : invalid declaration (should be \"[type][name]\")" << std::endl - << "> " << Line << std::endl; + << "> " << line << std::endl; return ""; } - if (Type == "texture") + if (type == "texture") { // Textures need some checking and conversion - if (myTextures.find(Name) != myTextures.end()) + if (textures.find(name) != textures.end()) { - std::cerr << "Post-effect error : texture \"" << Name << "\" already exists" << std::endl; + std::cerr << "Post-effect error : texture \"" << name << "\" already exists" << std::endl; return ""; } - Out += "uniform sampler2D " + Name + ";\n"; - myTextures.insert(Name); + out += "uniform sampler2D " + name + ";\n"; + textures.insert(name); } else { // Other types are just copied to output with "uniform" prefix - Out += "uniform " + Type + " " + Name + ";\n"; + out += "uniform " + type + " " + name + ";\n"; } } // Effect code - Out += "void main()\n"; - while (std::getline(File, Line)) + out += "void main()\n"; + while (std::getline(file, line)) { // Replace any texture lookup "T(" by "texture2D(T, " - for (std::set::const_iterator i = myTextures.begin(); i != myTextures.end(); ++i) + for (std::set::const_iterator it = textures.begin(); it != textures.end(); ++it) { - std::string::size_type Pos = Line.find(*i); - if (Pos != std::string::npos) - Line.replace(Pos, i->size() + 1, "texture2D(" + *i + ", "); + std::string::size_type pos = line.find(*it); + if (pos != std::string::npos) + line.replace(pos, it->size() + 1, "texture2D(" + *it + ", "); } // Replace "_in" by "gl_TexCoord[0].xy" - for (std::string::size_type Pos = Line.find("_in"); Pos != std::string::npos; Pos = Line.find("_in")) - Line.replace(Pos, 3, "gl_TexCoord[0].xy"); + for (std::string::size_type pos = line.find("_in"); pos != std::string::npos; pos = line.find("_in")) + line.replace(pos, 3, "gl_TexCoord[0].xy"); // Replace "_out" by "gl_FragColor" - for (std::string::size_type Pos = Line.find("_out"); Pos != std::string::npos; Pos = Line.find("_out")) - Line.replace(Pos, 4, "gl_FragColor"); + for (std::string::size_type pos = line.find("_out"); pos != std::string::npos; pos = line.find("_out")) + line.replace(pos, 4, "gl_FragColor"); // Write modified line to output string - Out += Line + "\n"; + out += line + "\n"; } - return Out; + return out; } @@ -424,7 +424,7 @@ void PostFX::CreateProgram() GLCheck(glDeleteObjectARB(myShaderProgram)); // Define vertex shader source (we provide it directly as it doesn't have to change) - static const std::string VertexShaderSrc = + static const std::string vertexShaderSrc = "void main()" "{" " gl_TexCoord[0] = gl_MultiTexCoord0;" @@ -435,66 +435,66 @@ void PostFX::CreateProgram() myShaderProgram = glCreateProgramObjectARB(); // Create the shaders - GLhandleARB VertexShader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); - GLhandleARB FragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); + GLhandleARB vertexShader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); + GLhandleARB fragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); // Compile them - const char* VertexSrc = VertexShaderSrc.c_str(); - const char* FragmentSrc = myFragmentShader.c_str(); - GLCheck(glShaderSourceARB(VertexShader, 1, &VertexSrc, NULL)); - GLCheck(glShaderSourceARB(FragmentShader, 1, &FragmentSrc, NULL)); - GLCheck(glCompileShaderARB(VertexShader)); - GLCheck(glCompileShaderARB(FragmentShader)); + const char* vertexSrc = vertexShaderSrc.c_str(); + const char* fragmentSrc = myFragmentShader.c_str(); + GLCheck(glShaderSourceARB(vertexShader, 1, &vertexSrc, NULL)); + GLCheck(glShaderSourceARB(fragmentShader, 1, &fragmentSrc, NULL)); + GLCheck(glCompileShaderARB(vertexShader)); + GLCheck(glCompileShaderARB(fragmentShader)); // Check the compile logs - GLint Success; - GLCheck(glGetObjectParameterivARB(VertexShader, GL_OBJECT_COMPILE_STATUS_ARB, &Success)); - if (Success == GL_FALSE) + GLint success; + GLCheck(glGetObjectParameterivARB(vertexShader, GL_OBJECT_COMPILE_STATUS_ARB, &success)); + if (success == GL_FALSE) { - char CompileLog[1024]; - GLCheck(glGetInfoLogARB(VertexShader, sizeof(CompileLog), 0, CompileLog)); + char log[1024]; + GLCheck(glGetInfoLogARB(vertexShader, sizeof(log), 0, log)); std::cerr << "Failed to compile post-effect :" << std::endl - << CompileLog << std::endl; - GLCheck(glDeleteObjectARB(VertexShader)); - GLCheck(glDeleteObjectARB(FragmentShader)); + << log << std::endl; + GLCheck(glDeleteObjectARB(vertexShader)); + GLCheck(glDeleteObjectARB(fragmentShader)); GLCheck(glDeleteObjectARB(myShaderProgram)); myShaderProgram = 0; return; } - GLCheck(glGetObjectParameterivARB(FragmentShader, GL_OBJECT_COMPILE_STATUS_ARB, &Success)); - if (Success == GL_FALSE) + GLCheck(glGetObjectParameterivARB(fragmentShader, GL_OBJECT_COMPILE_STATUS_ARB, &success)); + if (success == GL_FALSE) { - char CompileLog[1024]; - GLCheck(glGetInfoLogARB(FragmentShader, sizeof(CompileLog), 0, CompileLog)); + char log[1024]; + GLCheck(glGetInfoLogARB(fragmentShader, sizeof(log), 0, log)); std::cerr << "Failed to compile post-effect :" << std::endl - << CompileLog << std::endl; - GLCheck(glDeleteObjectARB(VertexShader)); - GLCheck(glDeleteObjectARB(FragmentShader)); + << log << std::endl; + GLCheck(glDeleteObjectARB(vertexShader)); + GLCheck(glDeleteObjectARB(fragmentShader)); GLCheck(glDeleteObjectARB(myShaderProgram)); myShaderProgram = 0; return; } // Attach the shaders to the program - GLCheck(glAttachObjectARB(myShaderProgram, VertexShader)); - GLCheck(glAttachObjectARB(myShaderProgram, FragmentShader)); + GLCheck(glAttachObjectARB(myShaderProgram, vertexShader)); + GLCheck(glAttachObjectARB(myShaderProgram, fragmentShader)); // We can now delete the shaders - GLCheck(glDeleteObjectARB(VertexShader)); - GLCheck(glDeleteObjectARB(FragmentShader)); + GLCheck(glDeleteObjectARB(vertexShader)); + GLCheck(glDeleteObjectARB(fragmentShader)); // Link the program GLCheck(glLinkProgramARB(myShaderProgram)); // Get link log - GLCheck(glGetObjectParameterivARB(myShaderProgram, GL_OBJECT_LINK_STATUS_ARB, &Success)); - if (Success == GL_FALSE) + GLCheck(glGetObjectParameterivARB(myShaderProgram, GL_OBJECT_LINK_STATUS_ARB, &success)); + if (success == GL_FALSE) { // Oops... link errors - char LinkLog[1024]; - GLCheck(glGetInfoLogARB(myShaderProgram, sizeof(LinkLog), 0, LinkLog)); + char log[1024]; + GLCheck(glGetInfoLogARB(myShaderProgram, sizeof(log), 0, log)); std::cerr << "Failed to link post-effect :" << std::endl - << LinkLog << std::endl; + << log << std::endl; GLCheck(glDeleteObjectARB(myShaderProgram)); myShaderProgram = 0; return; diff --git a/src/SFML/Graphics/RenderImage.cpp b/src/SFML/Graphics/RenderImage.cpp index 2e4d7a186..4839ec1f5 100644 --- a/src/SFML/Graphics/RenderImage.cpp +++ b/src/SFML/Graphics/RenderImage.cpp @@ -56,7 +56,7 @@ RenderImage::~RenderImage() //////////////////////////////////////////////////////////// /// Create the render image from its dimensions //////////////////////////////////////////////////////////// -bool RenderImage::Create(unsigned int Width, unsigned int Height, bool DepthBuffer) +bool RenderImage::Create(unsigned int width, unsigned int height, bool depthBuffer) { // Make sure that render-images are supported if (!CanUseRenderImage()) @@ -66,7 +66,7 @@ bool RenderImage::Create(unsigned int Width, unsigned int Height, bool DepthBuff } // Create the image - if (!myImage.Create(Width, Height)) + if (!myImage.Create(width, height)) { std::cerr << "Impossible to create render image (failed to create the target image)" << std::endl; return false; @@ -89,7 +89,7 @@ bool RenderImage::Create(unsigned int Width, unsigned int Height, bool DepthBuff } // Initialize the render image - if (!myRenderImage->Create(Width, Height, myImage.myTexture, DepthBuffer)) + if (!myRenderImage->Create(width, height, myImage.myTexture, depthBuffer)) return false; // We can now initialize the render target part @@ -103,13 +103,13 @@ bool RenderImage::Create(unsigned int Width, unsigned int Height, bool DepthBuff /// Activate of deactivate the render-image as the current target /// for rendering //////////////////////////////////////////////////////////// -bool RenderImage::SetActive(bool Active) +bool RenderImage::SetActive(bool active) { - if (myRenderImage && myRenderImage->Activate(Active)) + if (myRenderImage && myRenderImage->Activate(active)) { // After the RenderImage has been modified, we have to notify // the underlying image that its pixels have changed - if (!Active) + if (!active) myImage.ExternalUpdate(*this); return true; @@ -163,18 +163,18 @@ bool RenderImage::CanUseRenderImage() /// This function is called automatically by the image when it /// needs to update its pixels, and is only meant for internal use. //////////////////////////////////////////////////////////// -bool RenderImage::UpdateImage(Image& Target) +bool RenderImage::UpdateImage(Image& target) { - return myRenderImage && myRenderImage->UpdateTexture(Target.myTexture); + return myRenderImage && myRenderImage->UpdateTexture(target.myTexture); } //////////////////////////////////////////////////////////// /// Activate / deactivate the render image for rendering //////////////////////////////////////////////////////////// -bool RenderImage::Activate(bool Active) +bool RenderImage::Activate(bool active) { - return SetActive(Active); + return SetActive(active); } } // namespace sf diff --git a/src/SFML/Graphics/RenderImageImpl.hpp b/src/SFML/Graphics/RenderImageImpl.hpp index 6cf8ce960..bf1a15f8f 100644 --- a/src/SFML/Graphics/RenderImageImpl.hpp +++ b/src/SFML/Graphics/RenderImageImpl.hpp @@ -51,33 +51,33 @@ public : //////////////////////////////////////////////////////////// /// Create the render image /// - /// \param Width : Width of the image to render to - /// \param Height : Height of the image to render to - /// \param TextureId : OpenGL texture identifier of the target image - /// \param DepthBuffer : Do you want a depth buffer attached ? + /// \param width : Width of the image to render to + /// \param height : Height of the image to render to + /// \param textureId : OpenGL texture identifier of the target image + /// \param depthBuffer : Do you want a depth buffer attached ? /// /// \return True if creation has been successful /// //////////////////////////////////////////////////////////// - virtual bool Create(unsigned int Width, unsigned int Height, unsigned int TextureId, bool DepthBuffer) = 0; + virtual bool Create(unsigned int width, unsigned int height, unsigned int textureId, bool depthBuffer) = 0; //////////////////////////////////////////////////////////// /// Activate / deactivate the render image for rendering /// - /// \param Active : True to activate, false to deactivate + /// \param active : True to activate, false to deactivate /// //////////////////////////////////////////////////////////// - virtual bool Activate(bool Active) = 0; + virtual bool Activate(bool active) = 0; //////////////////////////////////////////////////////////// /// Update the pixels of the target texture /// - /// \param TextureId : OpenGL identifier of the target texture + /// \param textureId : OpenGL identifier of the target texture /// /// \return True if the new pixels are flipped vertically /// //////////////////////////////////////////////////////////// - virtual bool UpdateTexture(unsigned int TextureId) = 0; + virtual bool UpdateTexture(unsigned int textureId) = 0; }; } // namespace priv diff --git a/src/SFML/Graphics/RenderImageImplFBO.cpp b/src/SFML/Graphics/RenderImageImplFBO.cpp index fcbf48ae2..07af9a7e5 100644 --- a/src/SFML/Graphics/RenderImageImplFBO.cpp +++ b/src/SFML/Graphics/RenderImageImplFBO.cpp @@ -54,15 +54,15 @@ RenderImageImplFBO::~RenderImageImplFBO() // Destroy the depth buffer if (myDepthBuffer) { - GLuint DepthBuffer = static_cast(myDepthBuffer); - GLCheck(glDeleteFramebuffersEXT(1, &DepthBuffer)); + GLuint depthBuffer = static_cast(myDepthBuffer); + GLCheck(glDeleteFramebuffersEXT(1, &depthBuffer)); } // Destroy the frame buffer if (myFrameBuffer) { - GLuint FrameBuffer = static_cast(myFrameBuffer); - GLCheck(glDeleteFramebuffersEXT(1, &FrameBuffer)); + GLuint frameBuffer = static_cast(myFrameBuffer); + GLCheck(glDeleteFramebuffersEXT(1, &frameBuffer)); } } @@ -82,14 +82,14 @@ bool RenderImageImplFBO::IsSupported() //////////////////////////////////////////////////////////// /// /see RenderImageImpl::Create //////////////////////////////////////////////////////////// -bool RenderImageImplFBO::Create(unsigned int Width, unsigned int Height, unsigned int TextureId, bool DepthBuffer) +bool RenderImageImplFBO::Create(unsigned int width, unsigned int height, unsigned int textureId, bool depthBuffer) { // Create the framebuffer object if not already done if (!myFrameBuffer) { - GLuint FrameBuffer = 0; - GLCheck(glGenFramebuffersEXT(1, &FrameBuffer)); - myFrameBuffer = static_cast(FrameBuffer); + GLuint frameBuffer = 0; + GLCheck(glGenFramebuffersEXT(1, &frameBuffer)); + myFrameBuffer = static_cast(frameBuffer); if (!myFrameBuffer) { std::cerr << "Impossible to create render image (failed to create the frame buffer object)" << std::endl; @@ -103,26 +103,26 @@ bool RenderImageImplFBO::Create(unsigned int Width, unsigned int Height, unsigne // Create the depth buffer if (myDepthBuffer) { - GLuint DepthBuffer = static_cast(myDepthBuffer); - GLCheck(glDeleteRenderbuffersEXT(1, &DepthBuffer)); + GLuint depth = static_cast(myDepthBuffer); + GLCheck(glDeleteRenderbuffersEXT(1, &depth)); } - if (DepthBuffer) + if (depthBuffer) { - GLuint DepthBuffer = 0; - GLCheck(glGenRenderbuffersEXT(1, &DepthBuffer)); - myDepthBuffer = static_cast(DepthBuffer); + GLuint depth = 0; + GLCheck(glGenRenderbuffersEXT(1, &depth)); + myDepthBuffer = static_cast(depth); if (!myDepthBuffer) { std::cerr << "Impossible to create render image (failed to create the attached depth buffer)" << std::endl; return false; } GLCheck(glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, myDepthBuffer)); - GLCheck(glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, Width, Height)); + GLCheck(glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width, height)); GLCheck(glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, myDepthBuffer)); } // Link the image to the frame buffer - GLCheck(glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, TextureId, 0)); + GLCheck(glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, textureId, 0)); // A final check, just to be sure... if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) @@ -142,9 +142,9 @@ bool RenderImageImplFBO::Create(unsigned int Width, unsigned int Height, unsigne //////////////////////////////////////////////////////////// /// /see RenderImageImpl::Activate //////////////////////////////////////////////////////////// -bool RenderImageImplFBO::Activate(bool Active) +bool RenderImageImplFBO::Activate(bool active) { - if (Active) + if (active) { // Bind the buffers GLCheck(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, myFrameBuffer)); @@ -164,7 +164,7 @@ bool RenderImageImplFBO::Activate(bool Active) //////////////////////////////////////////////////////////// /// /see RenderImageImpl::UpdateTexture //////////////////////////////////////////////////////////// -bool RenderImageImplFBO::UpdateTexture(unsigned int /*TextureId*/) +bool RenderImageImplFBO::UpdateTexture(unsigned int) { // Nothing to do: the FBO draws directly into the target image return true; diff --git a/src/SFML/Graphics/RenderImageImplFBO.hpp b/src/SFML/Graphics/RenderImageImplFBO.hpp index 0d08fae16..9ad3b1e09 100644 --- a/src/SFML/Graphics/RenderImageImplFBO.hpp +++ b/src/SFML/Graphics/RenderImageImplFBO.hpp @@ -69,19 +69,19 @@ private : /// /see RenderImageImpl::Create /// //////////////////////////////////////////////////////////// - virtual bool Create(unsigned int Width, unsigned int Height, unsigned int TextureId, bool DepthBuffer); + virtual bool Create(unsigned int width, unsigned int height, unsigned int textureId, bool depthBuffer); //////////////////////////////////////////////////////////// /// /see RenderImageImpl::Activate /// //////////////////////////////////////////////////////////// - virtual bool Activate(bool Active); + virtual bool Activate(bool active); //////////////////////////////////////////////////////////// /// /see RenderImageImpl::UpdateTexture /// //////////////////////////////////////////////////////////// - virtual bool UpdateTexture(unsigned TextureId); + virtual bool UpdateTexture(unsigned textureId); //////////////////////////////////////////////////////////// // Member data diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp index 17a251878..2f181509e 100644 --- a/src/SFML/Graphics/RenderTarget.cpp +++ b/src/SFML/Graphics/RenderTarget.cpp @@ -57,12 +57,12 @@ RenderTarget::~RenderTarget() //////////////////////////////////////////////////////////// /// Clear the entire target with a single color //////////////////////////////////////////////////////////// -void RenderTarget::Clear(const Color& FillColor) +void RenderTarget::Clear(const Color& color) { if (Activate(true)) { // Clear the frame buffer - GLCheck(glClearColor(FillColor.r / 255.f, FillColor.g / 255.f, FillColor.b / 255.f, FillColor.a / 255.f)); + GLCheck(glClearColor(color.r / 255.f, color.g / 255.f, color.b / 255.f, color.a / 255.f)); GLCheck(glClear(GL_COLOR_BUFFER_BIT)); Activate(false); @@ -73,7 +73,7 @@ void RenderTarget::Clear(const Color& FillColor) //////////////////////////////////////////////////////////// /// Draw something on the window //////////////////////////////////////////////////////////// -void RenderTarget::Draw(const Drawable& Object) +void RenderTarget::Draw(const Drawable& object) { // Check whether we are called from the outside or from a previous call to Draw if (!myIsDrawing) @@ -94,12 +94,12 @@ void RenderTarget::Draw(const Drawable& Object) } // Setup the viewport - const FloatRect& Viewport = myCurrentView->GetViewport(); - int Left = static_cast(0.5f + GetWidth() * Viewport.Left); - int Top = static_cast(0.5f + GetHeight() * (1.f - Viewport.Bottom)); - int Width = static_cast(0.5f + GetWidth() * Viewport.GetSize().x); - int Height = static_cast(0.5f + GetHeight() * Viewport.GetSize().y); - GLCheck(glViewport(Left, Top, Width, Height)); + const FloatRect& viewport = myCurrentView->GetViewport(); + int left = static_cast(0.5f + GetWidth() * viewport.Left); + int top = static_cast(0.5f + GetHeight() * (1.f - viewport.Bottom)); + int width = static_cast(0.5f + GetWidth() * viewport.GetSize().x); + int height = static_cast(0.5f + GetHeight() * viewport.GetSize().y); + GLCheck(glViewport(left, top, width, height)); // Setup the transform matrices GLCheck(glMatrixMode(GL_PROJECTION)); @@ -108,7 +108,7 @@ void RenderTarget::Draw(const Drawable& Object) GLCheck(glLoadIdentity()); // Let the object draw itself - Object.Draw(*this); + object.Draw(*this); // Restore render states if (myPreserveStates) @@ -127,7 +127,7 @@ void RenderTarget::Draw(const Drawable& Object) else { // We are already called from a previous Draw : we don't need to set the states again, just draw the object - Object.Draw(*this); + object.Draw(*this); } } @@ -135,9 +135,9 @@ void RenderTarget::Draw(const Drawable& Object) //////////////////////////////////////////////////////////// /// Change the current active view //////////////////////////////////////////////////////////// -void RenderTarget::SetView(const View& NewView) +void RenderTarget::SetView(const View& view) { - myCurrentView = &NewView; + myCurrentView = &view; } @@ -167,9 +167,9 @@ View& RenderTarget::GetDefaultView() /// SFML to do internal optimizations and improve performances. /// This parameter is false by default //////////////////////////////////////////////////////////// -void RenderTarget::PreserveOpenGLStates(bool Preserve) +void RenderTarget::PreserveOpenGLStates(bool preserve) { - myPreserveStates = Preserve; + myPreserveStates = preserve; } diff --git a/src/SFML/Graphics/RenderWindow.cpp b/src/SFML/Graphics/RenderWindow.cpp index 5280521fb..a4179277e 100644 --- a/src/SFML/Graphics/RenderWindow.cpp +++ b/src/SFML/Graphics/RenderWindow.cpp @@ -46,18 +46,18 @@ RenderWindow::RenderWindow() //////////////////////////////////////////////////////////// /// Construct the window //////////////////////////////////////////////////////////// -RenderWindow::RenderWindow(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, const ContextSettings& Settings) +RenderWindow::RenderWindow(VideoMode mode, const std::string& title, unsigned long style, const ContextSettings& settings) { - Create(Mode, Title, WindowStyle, Settings); + Create(mode, title, style, settings); } //////////////////////////////////////////////////////////// /// Construct the window from an existing control //////////////////////////////////////////////////////////// -RenderWindow::RenderWindow(WindowHandle Handle, const ContextSettings& Settings) +RenderWindow::RenderWindow(WindowHandle handle, const ContextSettings& settings) { - Create(Handle, Settings); + Create(handle, settings); } @@ -73,10 +73,10 @@ RenderWindow::~RenderWindow() //////////////////////////////////////////////////////////// /// /see RenderTarget::Activate //////////////////////////////////////////////////////////// -bool RenderWindow::Activate(bool Active) +bool RenderWindow::Activate(bool active) { // For performances and consistency reasons, we only handle activation - if (Active) + if (active) return SetActive(); else return true; @@ -107,28 +107,28 @@ unsigned int RenderWindow::GetHeight() const Image RenderWindow::Capture() const { // Get the window dimensions - const unsigned int Width = GetWidth(); - const unsigned int Height = GetHeight(); + const unsigned int width = GetWidth(); + const unsigned int height = GetHeight(); // Set our window as the current target for rendering if (SetActive()) { // Get pixels from the backbuffer - std::vector Pixels(Width * Height * 4); - Uint8* PixelsPtr = &Pixels[0]; - GLCheck(glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, PixelsPtr)); + std::vector pixels(width * height * 4); + Uint8* ptr = &pixels[0]; + GLCheck(glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, ptr)); // Flip the pixels - unsigned int Pitch = Width * 4; - for (unsigned int y = 0; y < Height / 2; ++y) - std::swap_ranges(PixelsPtr + y * Pitch, PixelsPtr + (y + 1) * Pitch, PixelsPtr + (Height - y - 1) * Pitch); + unsigned int pitch = width * 4; + for (unsigned int y = 0; y < height / 2; ++y) + std::swap_ranges(ptr + y * pitch, ptr + (y + 1) * pitch, ptr + (height - y - 1) * pitch); // Create an image from the pixel buffer and return it - return Image(Width, Height, PixelsPtr); + return Image(width, height, ptr); } else { - return Image(Width, Height, Color::White); + return Image(width, height, Color::White); } } @@ -137,9 +137,9 @@ Image RenderWindow::Capture() const /// Convert a point in window coordinates into view coordinates /// This version uses the current view of the window //////////////////////////////////////////////////////////// -sf::Vector2f RenderWindow::ConvertCoords(unsigned int WindowX, unsigned int WindowY) const +sf::Vector2f RenderWindow::ConvertCoords(unsigned int x, unsigned int y) const { - return ConvertCoords(WindowX, WindowY, GetView()); + return ConvertCoords(x, y, GetView()); } @@ -147,21 +147,21 @@ sf::Vector2f RenderWindow::ConvertCoords(unsigned int WindowX, unsigned int Wind /// Convert a point in window coordinates into view coordinates /// This version uses the given view //////////////////////////////////////////////////////////// -sf::Vector2f RenderWindow::ConvertCoords(unsigned int WindowX, unsigned int WindowY, const View& TargetView) const +sf::Vector2f RenderWindow::ConvertCoords(unsigned int x, unsigned int y, const View& view) const { // First, convert from viewport coordinates to homogeneous coordinates - const FloatRect& Viewport = TargetView.GetViewport(); - int Left = static_cast(0.5f + GetWidth() * Viewport.Left); - int Top = static_cast(0.5f + GetHeight() * Viewport.Top); - int Width = static_cast(0.5f + GetWidth() * Viewport.GetSize().x); - int Height = static_cast(0.5f + GetHeight() * Viewport.GetSize().y); + const FloatRect& viewport = view.GetViewport(); + int left = static_cast(0.5f + GetWidth() * viewport.Left); + int top = static_cast(0.5f + GetHeight() * viewport.Top); + int width = static_cast(0.5f + GetWidth() * viewport.GetSize().x); + int height = static_cast(0.5f + GetHeight() * viewport.GetSize().y); - Vector2f Coords; - Coords.x = -1.f + 2.f * (static_cast(WindowX) - Left) / Width; - Coords.y = 1.f - 2.f * (static_cast(WindowY) - Top) / Height; + Vector2f coords; + coords.x = -1.f + 2.f * (static_cast(x) - left) / width; + coords.y = 1.f - 2.f * (static_cast(y) - top) / height; // Then transform by the inverse of the view matrix - return TargetView.GetInverseMatrix().Transform(Coords); + return view.GetInverseMatrix().Transform(coords); } diff --git a/src/SFML/Graphics/Shape.cpp b/src/SFML/Graphics/Shape.cpp index 7dbb88546..dc21f977f 100644 --- a/src/SFML/Graphics/Shape.cpp +++ b/src/SFML/Graphics/Shape.cpp @@ -49,18 +49,18 @@ myIsCompiled (false) //////////////////////////////////////////////////////////// /// Add a point to the shape //////////////////////////////////////////////////////////// -void Shape::AddPoint(float X, float Y, const Color& Col, const Color& OutlineCol) +void Shape::AddPoint(float x, float y, const Color& color, const Color& outlineColor) { - AddPoint(Vector2f(X, Y), Col, OutlineCol); + AddPoint(Vector2f(x, y), color, outlineColor); } //////////////////////////////////////////////////////////// /// Add a point to the shape //////////////////////////////////////////////////////////// -void Shape::AddPoint(const Vector2f& Position, const Color& Col, const Color& OutlineCol) +void Shape::AddPoint(const Vector2f& position, const Color& color, const Color& outlineColor) { - myPoints.push_back(Point(Position, Col, OutlineCol)); + myPoints.push_back(Point(position, color, outlineColor)); myIsCompiled = false; } @@ -78,9 +78,9 @@ unsigned int Shape::GetNbPoints() const /// Enable or disable filling the shape. /// Fill is enabled by default //////////////////////////////////////////////////////////// -void Shape::EnableFill(bool Enable) +void Shape::EnableFill(bool enable) { - myIsFillEnabled = Enable; + myIsFillEnabled = enable; } @@ -88,18 +88,18 @@ void Shape::EnableFill(bool Enable) /// Enable or disable drawing the shape outline. /// Outline is enabled by default //////////////////////////////////////////////////////////// -void Shape::EnableOutline(bool Enable) +void Shape::EnableOutline(bool enable) { - myIsOutlineEnabled = Enable; + myIsOutlineEnabled = enable; } //////////////////////////////////////////////////////////// /// Set the position of a point //////////////////////////////////////////////////////////// -void Shape::SetPointPosition(unsigned int Index, const Vector2f& Position) +void Shape::SetPointPosition(unsigned int index, const Vector2f& position) { - myPoints[Index + 1].Position = Position; + myPoints[index + 1].Position = position; myIsCompiled = false; } @@ -107,18 +107,18 @@ void Shape::SetPointPosition(unsigned int Index, const Vector2f& Position) //////////////////////////////////////////////////////////// /// Set the position of a point //////////////////////////////////////////////////////////// -void Shape::SetPointPosition(unsigned int Index, float X, float Y) +void Shape::SetPointPosition(unsigned int index, float x, float y) { - SetPointPosition(Index, Vector2f(X, Y)); + SetPointPosition(index, Vector2f(x, y)); } //////////////////////////////////////////////////////////// /// Set the color of a point //////////////////////////////////////////////////////////// -void Shape::SetPointColor(unsigned int Index, const Color& Col) +void Shape::SetPointColor(unsigned int index, const Color& color) { - myPoints[Index + 1].Col = Col; + myPoints[index + 1].Col = color; myIsCompiled = false; } @@ -126,9 +126,9 @@ void Shape::SetPointColor(unsigned int Index, const Color& Col) //////////////////////////////////////////////////////////// /// Set the outline color of a point //////////////////////////////////////////////////////////// -void Shape::SetPointOutlineColor(unsigned int Index, const Color& OutlineCol) +void Shape::SetPointOutlineColor(unsigned int index, const Color& outlineColor) { - myPoints[Index + 1].OutlineCol = OutlineCol; + myPoints[index + 1].OutlineCol = outlineColor; myIsCompiled = false; } @@ -136,36 +136,36 @@ void Shape::SetPointOutlineColor(unsigned int Index, const Color& OutlineCol) //////////////////////////////////////////////////////////// /// Change the width of the shape outline //////////////////////////////////////////////////////////// -void Shape::SetOutlineWidth(float Width) +void Shape::SetOutlineWidth(float width) { - myOutline = Width; + myOutline = width; } //////////////////////////////////////////////////////////// /// Get the position of a point //////////////////////////////////////////////////////////// -const Vector2f& Shape::GetPointPosition(unsigned int Index) const +const Vector2f& Shape::GetPointPosition(unsigned int index) const { - return myPoints[Index + 1].Position; + return myPoints[index + 1].Position; } //////////////////////////////////////////////////////////// /// Get the color of a point //////////////////////////////////////////////////////////// -const Color& Shape::GetPointColor(unsigned int Index) const +const Color& Shape::GetPointColor(unsigned int index) const { - return myPoints[Index + 1].Col; + return myPoints[index + 1].Col; } //////////////////////////////////////////////////////////// /// Get the outline color of a point //////////////////////////////////////////////////////////// -const Color& Shape::GetPointOutlineColor(unsigned int Index) const +const Color& Shape::GetPointOutlineColor(unsigned int index) const { - return myPoints[Index + 1].OutlineCol; + return myPoints[index + 1].OutlineCol; } @@ -181,101 +181,100 @@ float Shape::GetOutlineWidth() const //////////////////////////////////////////////////////////// /// Create a shape made of a single line //////////////////////////////////////////////////////////// -Shape Shape::Line(float P1X, float P1Y, float P2X, float P2Y, float Thickness, const Color& Col, float Outline, const Color& OutlineCol) +Shape Shape::Line(float p1x, float p1y, float p2x, float p2y, float thickness, const Color& color, float outline, const Color& outlineColor) { - Vector2f P1(P1X, P1Y); - Vector2f P2(P2X, P2Y); + Vector2f p1(p1x, p1y); + Vector2f p2(p2x, p2y); - // Compute the extrusion direction - Vector2f Normal; - ComputeNormal(P1, P2, Normal); - Normal *= Thickness / 2; - - // Create the shape's points - Shape S; - S.AddPoint(P1 - Normal, Col, OutlineCol); - S.AddPoint(P2 - Normal, Col, OutlineCol); - S.AddPoint(P2 + Normal, Col, OutlineCol); - S.AddPoint(P1 + Normal, Col, OutlineCol); - S.SetOutlineWidth(Outline); - - // Compile it - S.Compile(); - - return S; + return Shape::Line(p1, p2, thickness, color, outline, outlineColor); } //////////////////////////////////////////////////////////// /// Create a shape made of a single line (use vectors) //////////////////////////////////////////////////////////// -Shape Shape::Line(const Vector2f& P1, const Vector2f& P2, float Thickness, const Color& Col, float Outline, const Color& OutlineCol) +Shape Shape::Line(const Vector2f& p1, const Vector2f& p2, float thickness, const Color& color, float outline, const Color& outlineColor) { - return Shape::Line(P1.x, P1.y, P2.x, P2.y, Thickness, Col, Outline, OutlineCol); + // Compute the extrusion direction + Vector2f normal; + ComputeNormal(p1, p2, normal); + normal *= thickness / 2; + + // Create the shape's points + Shape shape; + shape.AddPoint(p1 - normal, color, outlineColor); + shape.AddPoint(p2 - normal, color, outlineColor); + shape.AddPoint(p2 + normal, color, outlineColor); + shape.AddPoint(p1 + normal, color, outlineColor); + shape.SetOutlineWidth(outline); + + // Compile it + shape.Compile(); + + return shape; } //////////////////////////////////////////////////////////// /// Create a shape made of a single rectangle //////////////////////////////////////////////////////////// -Shape Shape::Rectangle(float P1X, float P1Y, float P2X, float P2Y, const Color& Col, float Outline, const Color& OutlineCol) +Shape Shape::Rectangle(float p1x, float p1y, float p2x, float p2y, const Color& color, float outline, const Color& outlineColor) { // Create the shape's points - Shape S; - S.AddPoint(Vector2f(P1X, P1Y), Col, OutlineCol); - S.AddPoint(Vector2f(P2X, P1Y), Col, OutlineCol); - S.AddPoint(Vector2f(P2X, P2Y), Col, OutlineCol); - S.AddPoint(Vector2f(P1X, P2Y), Col, OutlineCol); - S.SetOutlineWidth(Outline); + Shape shape; + shape.AddPoint(Vector2f(p1x, p1y), color, outlineColor); + shape.AddPoint(Vector2f(p2x, p1y), color, outlineColor); + shape.AddPoint(Vector2f(p2x, p2y), color, outlineColor); + shape.AddPoint(Vector2f(p1x, p2y), color, outlineColor); + shape.SetOutlineWidth(outline); // Compile it - S.Compile(); + shape.Compile(); - return S; + return shape; } //////////////////////////////////////////////////////////// /// Create a shape made of a single rectangle (use vectors) //////////////////////////////////////////////////////////// -Shape Shape::Rectangle(const Vector2f& P1, const Vector2f& P2, const Color& Col, float Outline, const Color& OutlineCol) +Shape Shape::Rectangle(const Vector2f& p1, const Vector2f& p2, const Color& color, float outline, const Color& outlineColor) { - return Shape::Rectangle(P1.x, P1.y, P2.x, P2.y, Col, Outline, OutlineCol); + return Shape::Rectangle(p1.x, p1.y, p2.x, p2.y, color, outline, outlineColor); } //////////////////////////////////////////////////////////// /// Create a shape made of a single circle //////////////////////////////////////////////////////////// -Shape Shape::Circle(float X, float Y, float Radius, const Color& Col, float Outline, const Color& OutlineCol) +Shape Shape::Circle(float x, float y, float radius, const Color& color, float outline, const Color& outlineColor) { - static const int NbSegments = 40; - - // Create the points set - Shape S; - Vector2f Center(X, Y); - for (int i = 0; i < NbSegments; ++i) - { - float Angle = i * 2 * 3.141592654f / NbSegments; - Vector2f Offset(cos(Angle), sin(Angle)); - - S.AddPoint(Center + Offset * Radius, Col, OutlineCol); - } - - // Compile it - S.SetOutlineWidth(Outline); - S.Compile(); - - return S; + return Shape::Circle(Vector2f(x, y), radius, color, outline, outlineColor); } //////////////////////////////////////////////////////////// /// Create a shape made of a single circle (use vectors) //////////////////////////////////////////////////////////// -Shape Shape::Circle(const Vector2f& Center, float Radius, const Color& Col, float Outline, const Color& OutlineCol) +Shape Shape::Circle(const Vector2f& center, float radius, const Color& color, float outline, const Color& outlineColor) { - return Shape::Circle(Center.x, Center.y, Radius, Col, Outline, OutlineCol); + static const int nbSegments = 40; + + // Create the points set + Shape shape; + for (int i = 0; i < nbSegments; ++i) + { + float angle = i * 2 * 3.141592654f / nbSegments; + Vector2f offset(cos(angle), sin(angle)); + + shape.AddPoint(center + offset * radius, color, outlineColor); + } + + // Compile it + shape.SetOutlineWidth(outline); + shape.Compile(); + + return shape; } @@ -302,14 +301,14 @@ void Shape::Render(RenderTarget&) const { for (std::vector::const_iterator i = myPoints.begin(); i != myPoints.end(); ++i) { - Color PointColor = i->Col * GetColor(); - glColor4f(PointColor.r / 255.f, PointColor.g / 255.f, PointColor.b / 255.f, PointColor.a / 255.f); + Color color = i->Col * GetColor(); + glColor4f(color.r / 255.f, color.g / 255.f, color.b / 255.f, color.a / 255.f); glVertex2f(i->Position.x, i->Position.y); } // Close the shape by duplicating the first point at the end - Color PointColor = myPoints[1].Col * GetColor(); - glColor4f(PointColor.r / 255.f, PointColor.g / 255.f, PointColor.b / 255.f, PointColor.a / 255.f); + Color color = myPoints[1].Col * GetColor(); + glColor4f(color.r / 255.f, color.g / 255.f, color.b / 255.f, color.a / 255.f); glVertex2f(myPoints[1].Position.x, myPoints[1].Position.y); } glEnd(); @@ -322,18 +321,18 @@ void Shape::Render(RenderTarget&) const { for (std::size_t i = 1; i < myPoints.size(); ++i) { - Color PointColor = myPoints[i].OutlineCol * GetColor(); - glColor4f(PointColor.r / 255.f, PointColor.g / 255.f, PointColor.b / 255.f, PointColor.a / 255.f); + Color color = myPoints[i].OutlineCol * GetColor(); + glColor4f(color.r / 255.f, color.g / 255.f, color.b / 255.f, color.a / 255.f); glVertex2f(myPoints[i].Position.x, myPoints[i].Position.y); - glColor4f(PointColor.r / 255.f, PointColor.g / 255.f, PointColor.b / 255.f, PointColor.a / 255.f); + glColor4f(color.r / 255.f, color.g / 255.f, color.b / 255.f, color.a / 255.f); glVertex2f(myPoints[i].Position.x + myPoints[i].Normal.x * myOutline, myPoints[i].Position.y + myPoints[i].Normal.y * myOutline); } // Close the shape by duplicating the first point at the end - Color PointColor = myPoints[1].OutlineCol * GetColor(); - glColor4f(PointColor.r / 255.f, PointColor.g / 255.f, PointColor.b / 255.f, PointColor.a / 255.f); + Color color = myPoints[1].OutlineCol * GetColor(); + glColor4f(color.r / 255.f, color.g / 255.f, color.b / 255.f, color.a / 255.f); glVertex2f(myPoints[1].Position.x, myPoints[1].Position.y); - glColor4f(PointColor.r / 255.f, PointColor.g / 255.f, PointColor.b / 255.f, PointColor.a / 255.f); + glColor4f(color.r / 255.f, color.g / 255.f, color.b / 255.f, color.a / 255.f); glVertex2f(myPoints[1].Position.x + myPoints[1].Normal.x * myOutline, myPoints[1].Position.y + myPoints[1].Normal.y * myOutline); } glEnd(); @@ -347,44 +346,44 @@ void Shape::Render(RenderTarget&) const void Shape::Compile() { // Compute the center - float NbPoints = static_cast(myPoints.size() - 1); - float R = 0, G = 0, B = 0, A = 0; - Point Center(Vector2f(0, 0), Color(0, 0, 0, 0)); + float nbPoints = static_cast(myPoints.size() - 1); + float r = 0, g = 0, b = 0, a = 0; + Point center(Vector2f(0, 0), Color(0, 0, 0, 0)); for (std::size_t i = 1; i < myPoints.size(); ++i) { - Center.Position += myPoints[i].Position / NbPoints; - R += myPoints[i].Col.r / NbPoints; - G += myPoints[i].Col.g / NbPoints; - B += myPoints[i].Col.b / NbPoints; - A += myPoints[i].Col.a / NbPoints; + center.Position += myPoints[i].Position / nbPoints; + r += myPoints[i].Col.r / nbPoints; + g += myPoints[i].Col.g / nbPoints; + b += myPoints[i].Col.b / nbPoints; + a += myPoints[i].Col.a / nbPoints; } - Center.Col.r = static_cast(R); - Center.Col.g = static_cast(G); - Center.Col.b = static_cast(B); - Center.Col.a = static_cast(A); - myPoints[0] = Center; + center.Col.r = static_cast(r); + center.Col.g = static_cast(g); + center.Col.b = static_cast(b); + center.Col.a = static_cast(a); + myPoints[0] = center; // Compute the outline for (std::size_t i = 1; i < myPoints.size(); ++i) { // Get the two segments shared by the current point - Point& P0 = (i == 1) ? myPoints[myPoints.size() - 1] : myPoints[i - 1]; - Point& P1 = myPoints[i]; - Point& P2 = (i == myPoints.size() - 1) ? myPoints[1] : myPoints[i + 1]; + Point& p0 = (i == 1) ? myPoints[myPoints.size() - 1] : myPoints[i - 1]; + Point& p1 = myPoints[i]; + Point& p2 = (i == myPoints.size() - 1) ? myPoints[1] : myPoints[i + 1]; // Compute their normal - Vector2f Normal1, Normal2; - if (!ComputeNormal(P0.Position, P1.Position, Normal1) || !ComputeNormal(P1.Position, P2.Position, Normal2)) + Vector2f normal1, normal2; + if (!ComputeNormal(p0.Position, p1.Position, normal1) || !ComputeNormal(p1.Position, p2.Position, normal2)) continue; // Add them to get the extrusion direction - float Factor = 1.f + (Normal1.x * Normal2.x + Normal1.y * Normal2.y); - P1.Normal = (Normal1 + Normal2) / Factor; + float factor = 1.f + (normal1.x * normal2.x + normal1.y * normal2.y); + p1.Normal = (normal1 + normal2) / factor; // Make sure it points towards the outside of the shape - float Dot = (P1.Position.x - Center.Position.x) * P1.Normal.x + (P1.Position.y - Center.Position.y) * P1.Normal.y; - if (Dot < 0) - P1.Normal = -P1.Normal; + float dot = (p1.Position.x - center.Position.x) * p1.Normal.x + (p1.Position.y - center.Position.y) * p1.Normal.y; + if (dot < 0) + p1.Normal = -p1.Normal; } myIsCompiled = true; @@ -394,17 +393,17 @@ void Shape::Compile() //////////////////////////////////////////////////////////// /// Compute the normal of a given 2D segment //////////////////////////////////////////////////////////// -bool Shape::ComputeNormal(const Vector2f& P1, const Vector2f& P2, Vector2f& Normal) +bool Shape::ComputeNormal(const Vector2f& p1, const Vector2f& p2, Vector2f& normal) { - Normal.x = P1.y - P2.y; - Normal.y = P2.x - P1.x; + normal.x = p1.y - p2.y; + normal.y = p2.x - p1.x; - float Len = sqrt(Normal.x * Normal.x + Normal.y * Normal.y); - if (Len == 0.f) + float len = sqrt(normal.x * normal.x + normal.y * normal.y); + if (len == 0.f) return false; - Normal.x /= Len; - Normal.y /= Len; + normal.x /= len; + normal.y /= len; return true; } @@ -413,11 +412,11 @@ bool Shape::ComputeNormal(const Vector2f& P1, const Vector2f& P2, Vector2f& Norm //////////////////////////////////////////////////////////// /// Default constructor for Point //////////////////////////////////////////////////////////// -Shape::Point::Point(const Vector2f& Pos, const Color& C, const Color& OutlineC) : -Position (Pos), +Shape::Point::Point(const Vector2f& position, const Color& color, const Color& outlineColor) : +Position (position), Normal (0.f, 0.f), -Col (C), -OutlineCol(OutlineC) +Col (color), +OutlineCol(outlineColor) { } diff --git a/src/SFML/Graphics/Sprite.cpp b/src/SFML/Graphics/Sprite.cpp index 2b969a301..8946d78e3 100644 --- a/src/SFML/Graphics/Sprite.cpp +++ b/src/SFML/Graphics/Sprite.cpp @@ -47,38 +47,38 @@ myIsFlippedY(false) //////////////////////////////////////////////////////////// /// Construct the sprite from a source image //////////////////////////////////////////////////////////// -Sprite::Sprite(const Image& Img, const Vector2f& Position, const Vector2f& Scale, float Rotation, const Color& Col) : -Drawable (Position, Scale, Rotation, Col), +Sprite::Sprite(const Image& image, const Vector2f& position, const Vector2f& scale, float rotation, const Color& color) : +Drawable (position, scale, rotation, color), mySubRect (0, 0, 1, 1), myIsFlippedX(false), myIsFlippedY(false) { - SetImage(Img); + SetImage(image); } //////////////////////////////////////////////////////////// /// Set the image of the sprite //////////////////////////////////////////////////////////// -void Sprite::SetImage(const Image& Img) +void Sprite::SetImage(const Image& image) { // If there was no source image before and the new image is valid, adjust the source rectangle - if (!myImage && (Img.GetWidth() > 0) && (Img.GetHeight() > 0)) + if (!myImage && (image.GetWidth() > 0) && (image.GetHeight() > 0)) { - SetSubRect(IntRect(0, 0, Img.GetWidth(), Img.GetHeight())); + SetSubRect(IntRect(0, 0, image.GetWidth(), image.GetHeight())); } // Assign the new image - myImage = &Img; + myImage = ℑ } //////////////////////////////////////////////////////////// /// Set the sub-rectangle of the sprite inside the source image //////////////////////////////////////////////////////////// -void Sprite::SetSubRect(const IntRect& SubRect) +void Sprite::SetSubRect(const IntRect& rectangle) { - mySubRect = SubRect; + mySubRect = rectangle; } @@ -86,13 +86,13 @@ void Sprite::SetSubRect(const IntRect& SubRect) /// Resize the sprite (by changing its scale factors) (take 2 values). /// The default size is defined by the subrect //////////////////////////////////////////////////////////// -void Sprite::Resize(float Width, float Height) +void Sprite::Resize(float width, float height) { - int LocalWidth = mySubRect.GetSize().x; - int LocalHeight = mySubRect.GetSize().y; + int localWidth = mySubRect.GetSize().x; + int localHeight = mySubRect.GetSize().y; - if ((LocalWidth > 0) && (LocalHeight > 0)) - SetScale(Width / LocalWidth, Height / LocalHeight); + if ((localWidth > 0) && (localHeight > 0)) + SetScale(width / localWidth, height / localHeight); } @@ -100,27 +100,27 @@ void Sprite::Resize(float Width, float Height) /// Resize the object (by changing its scale factors) (take a 2D vector) /// The default size is defined by the subrect //////////////////////////////////////////////////////////// -void Sprite::Resize(const Vector2f& Size) +void Sprite::Resize(const Vector2f& size) { - Resize(Size.x, Size.y); + Resize(size.x, size.y); } //////////////////////////////////////////////////////////// /// Flip the sprite horizontally //////////////////////////////////////////////////////////// -void Sprite::FlipX(bool Flipped) +void Sprite::FlipX(bool flipped) { - myIsFlippedX = Flipped; + myIsFlippedX = flipped; } //////////////////////////////////////////////////////////// /// Flip the sprite vertically //////////////////////////////////////////////////////////// -void Sprite::FlipY(bool Flipped) +void Sprite::FlipY(bool flipped) { - myIsFlippedY = Flipped; + myIsFlippedY = flipped; } @@ -155,17 +155,17 @@ Vector2f Sprite::GetSize() const /// Get the color of a given pixel in the sprite /// (point is in local coordinates) //////////////////////////////////////////////////////////// -Color Sprite::GetPixel(unsigned int X, unsigned int Y) const +Color Sprite::GetPixel(unsigned int x, unsigned int y) const { if (myImage) { - unsigned int ImageX = mySubRect.Left + X; - unsigned int ImageY = mySubRect.Top + Y; + unsigned int imageX = mySubRect.Left + x; + unsigned int imageY = mySubRect.Top + y; - if (myIsFlippedX) ImageX = mySubRect.GetSize().x - ImageX - 1; - if (myIsFlippedY) ImageY = mySubRect.GetSize().y - ImageY - 1; + if (myIsFlippedX) imageX = mySubRect.GetSize().x - imageX - 1; + if (myIsFlippedY) imageY = mySubRect.GetSize().y - imageY - 1; - return myImage->GetPixel(ImageX, ImageY) * GetColor(); + return myImage->GetPixel(imageX, imageY) * GetColor(); } else { @@ -180,8 +180,8 @@ Color Sprite::GetPixel(unsigned int X, unsigned int Y) const void Sprite::Render(RenderTarget&) const { // Get the sprite size - float Width = static_cast(mySubRect.GetSize().x); - float Height = static_cast(mySubRect.GetSize().y); + float width = static_cast(mySubRect.GetSize().x); + float height = static_cast(mySubRect.GetSize().y); // Check if the image is valid if (myImage && (myImage->GetWidth() > 0) && (myImage->GetHeight() > 0)) @@ -190,18 +190,18 @@ void Sprite::Render(RenderTarget&) const myImage->Bind(); // Calculate the texture coordinates - FloatRect TexCoords = myImage->GetTexCoords(mySubRect); - FloatRect Rect(myIsFlippedX ? TexCoords.Right : TexCoords.Left, - myIsFlippedY ? TexCoords.Bottom : TexCoords.Top, - myIsFlippedX ? TexCoords.Left : TexCoords.Right, - myIsFlippedY ? TexCoords.Top : TexCoords.Bottom); + FloatRect texCoords = myImage->GetTexCoords(mySubRect); + FloatRect rect(myIsFlippedX ? texCoords.Right : texCoords.Left, + myIsFlippedY ? texCoords.Bottom : texCoords.Top, + myIsFlippedX ? texCoords.Left : texCoords.Right, + myIsFlippedY ? texCoords.Top : texCoords.Bottom); // Draw the sprite's triangles glBegin(GL_QUADS); - glTexCoord2f(Rect.Left, Rect.Top); glVertex2f(0, 0); - glTexCoord2f(Rect.Left, Rect.Bottom); glVertex2f(0, Height); - glTexCoord2f(Rect.Right, Rect.Bottom); glVertex2f(Width, Height); - glTexCoord2f(Rect.Right, Rect.Top); glVertex2f(Width, 0) ; + glTexCoord2f(rect.Left, rect.Top); glVertex2f(0, 0); + glTexCoord2f(rect.Left, rect.Bottom); glVertex2f(0, height); + glTexCoord2f(rect.Right, rect.Bottom); glVertex2f(width, height); + glTexCoord2f(rect.Right, rect.Top); glVertex2f(width, 0) ; glEnd(); } else @@ -212,9 +212,9 @@ void Sprite::Render(RenderTarget&) const // Draw the sprite's triangles glBegin(GL_QUADS); glVertex2f(0, 0); - glVertex2f(0, Height); - glVertex2f(Width, Height); - glVertex2f(Width, 0); + glVertex2f(0, height); + glVertex2f(width, height); + glVertex2f(width, 0); glEnd(); } } diff --git a/src/SFML/Graphics/String.cpp b/src/SFML/Graphics/String.cpp index 7e7e5f4db..d07d0f580 100644 --- a/src/SFML/Graphics/String.cpp +++ b/src/SFML/Graphics/String.cpp @@ -49,35 +49,35 @@ myNeedRectUpdate(true) //////////////////////////////////////////////////////////// /// Construct the string from any kind of text //////////////////////////////////////////////////////////// -String::String(const Unicode::Text& Text, const Font& CharFont, float Size) : -myFont (&CharFont), -mySize (Size), +String::String(const Unicode::Text& text, const Font& font, float size) : +myFont (&font), +mySize (size), myStyle (Regular), myNeedRectUpdate(true) { - SetText(Text); + SetText(text); } //////////////////////////////////////////////////////////// /// Set the text (from any kind of string) //////////////////////////////////////////////////////////// -void String::SetText(const Unicode::Text& Text) +void String::SetText(const Unicode::Text& text) { myNeedRectUpdate = true; - myText = Text; + myText = text; } //////////////////////////////////////////////////////////// /// Set the font of the string //////////////////////////////////////////////////////////// -void String::SetFont(const Font& CharFont) +void String::SetFont(const Font& font) { - if (myFont != &CharFont) + if (myFont != &font) { myNeedRectUpdate = true; - myFont = &CharFont; + myFont = &font; } } @@ -85,12 +85,12 @@ void String::SetFont(const Font& CharFont) //////////////////////////////////////////////////////////// /// Set the size of the string //////////////////////////////////////////////////////////// -void String::SetSize(float Size) +void String::SetSize(float size) { - if (mySize != Size) + if (mySize != size) { myNeedRectUpdate = true; - mySize = Size; + mySize = size; } } @@ -99,12 +99,12 @@ void String::SetSize(float Size) /// Set the style of the text /// The default style is Regular //////////////////////////////////////////////////////////// -void String::SetStyle(unsigned long TextStyle) +void String::SetStyle(unsigned long style) { - if (myStyle != TextStyle) + if (myStyle != style) { myNeedRectUpdate = true; - myStyle = TextStyle; + myStyle = style; } } @@ -150,42 +150,42 @@ unsigned long String::GetStyle() const /// in coordinates relative to the string /// (note : translation, center, rotation and scale are not applied) //////////////////////////////////////////////////////////// -sf::Vector2f String::GetCharacterPos(std::size_t Index) const +sf::Vector2f String::GetCharacterPos(std::size_t index) const { // First get the UTF32 representation of the text - const Unicode::UTF32String& Text = myText; + const Unicode::UTF32String& text = myText; // Adjust the index if it's out of range - if (Index > Text.length()) - Index = Text.length(); + if (index > text.length()) + index = text.length(); // The final size is based on the text size - float FactorX = mySize / myFont->GetCharacterSize(); - float AdvanceY = mySize; + float factor = mySize / myFont->GetCharacterSize(); + float advanceY = mySize; // Compute the position - sf::Vector2f Position; - for (std::size_t i = 0; i < Index; ++i) + sf::Vector2f position; + for (std::size_t i = 0; i < index; ++i) { // Get the current character and its corresponding glyph - Uint32 CurChar = Text[i]; - const Glyph& CurGlyph = myFont->GetGlyph(CurChar); - float AdvanceX = CurGlyph.Advance * FactorX; + Uint32 curChar = text[i]; + const Glyph& curGlyph = myFont->GetGlyph(curChar); + float advanceX = curGlyph.Advance * factor; - switch (CurChar) + switch (curChar) { // Handle special characters - case L' ' : Position.x += AdvanceX; break; - case L'\t' : Position.x += AdvanceX * 4; break; - case L'\v' : Position.y += AdvanceY * 4; break; - case L'\n' : Position.y += AdvanceY; Position.x = 0; break; + case L' ' : position.x += advanceX; break; + case L'\t' : position.x += advanceX * 4; break; + case L'\v' : position.y += advanceY * 4; break; + case L'\n' : position.y += advanceY; position.x = 0; break; // Regular character : just add its advance value - default : Position.x += AdvanceX; break; + default : position.x += advanceX; break; } } - return Position; + return position; } @@ -197,13 +197,13 @@ FloatRect String::GetRect() const if (myNeedRectUpdate) const_cast(this)->RecomputeRect(); - FloatRect Rect; - Rect.Left = (myBaseRect.Left - GetOrigin().x) * GetScale().x + GetPosition().x; - Rect.Top = (myBaseRect.Top - GetOrigin().y) * GetScale().y + GetPosition().y; - Rect.Right = (myBaseRect.Right - GetOrigin().x) * GetScale().x + GetPosition().x; - Rect.Bottom = (myBaseRect.Bottom - GetOrigin().y) * GetScale().y + GetPosition().y; + FloatRect rect; + rect.Left = (myBaseRect.Left - GetOrigin().x) * GetScale().x + GetPosition().x; + rect.Top = (myBaseRect.Top - GetOrigin().y) * GetScale().y + GetPosition().y; + rect.Right = (myBaseRect.Right - GetOrigin().x) * GetScale().x + GetPosition().x; + rect.Bottom = (myBaseRect.Bottom - GetOrigin().y) * GetScale().y + GetPosition().y; - return Rect; + return rect; } @@ -213,83 +213,83 @@ FloatRect String::GetRect() const void String::Render(RenderTarget&) const { // First get the internal UTF-32 string of the text - const Unicode::UTF32String& Text = myText; + const Unicode::UTF32String& text = myText; // No text, no rendering :) - if (Text.empty()) + if (text.empty()) return; // Set the scaling factor to get the actual size - float CharSize = static_cast(myFont->GetCharacterSize()); - float Factor = mySize / CharSize; - GLCheck(glScalef(Factor, Factor, 1.f)); + float charSize = static_cast(myFont->GetCharacterSize()); + float factor = mySize / charSize; + GLCheck(glScalef(factor, factor, 1.f)); // Bind the font texture myFont->GetImage().Bind(); // Initialize the rendering coordinates - float X = 0.f; - float Y = CharSize; + float x = 0.f; + float y = charSize; // Holds the lines to draw later, for underlined style - std::vector UnderlineCoords; - UnderlineCoords.reserve(16); + std::vector underlineCoords; + underlineCoords.reserve(16); // Compute the shearing to apply if we're using the italic style - float ItalicCoeff = (myStyle & Italic) ? 0.208f : 0.f; // 12 degrees + float italicCoeff = (myStyle & Italic) ? 0.208f : 0.f; // 12 degrees // Draw one quad for each character glBegin(GL_QUADS); - for (std::size_t i = 0; i < Text.size(); ++i) + for (std::size_t i = 0; i < text.size(); ++i) { // Get the current character and its corresponding glyph - Uint32 CurChar = Text[i]; - const Glyph& CurGlyph = myFont->GetGlyph(CurChar); - int Advance = CurGlyph.Advance; - const IntRect& Rect = CurGlyph.Rectangle; - const FloatRect& Coord = CurGlyph.TexCoords; + Uint32 curChar = text[i]; + const Glyph& curGlyph = myFont->GetGlyph(curChar); + int advance = curGlyph.Advance; + const IntRect& rect = curGlyph.Rectangle; + const FloatRect& coord = curGlyph.TexCoords; // If we're using the underlined style and there's a new line, // we keep track of the previous line to draw it later - if ((CurChar == L'\n') && (myStyle & Underlined)) + if ((curChar == L'\n') && (myStyle & Underlined)) { - UnderlineCoords.push_back(X); - UnderlineCoords.push_back(Y + 2); + underlineCoords.push_back(x); + underlineCoords.push_back(y + 2); } // Handle special characters - switch (CurChar) + switch (curChar) { - case L' ' : X += Advance; continue; - case L'\n' : Y += CharSize; X = 0; continue; - case L'\t' : X += Advance * 4; continue; - case L'\v' : Y += CharSize * 4; continue; + case L' ' : x += advance; continue; + case L'\n' : y += charSize; x = 0; continue; + case L'\t' : x += advance * 4; continue; + case L'\v' : y += charSize * 4; continue; } // Draw a textured quad for the current character - glTexCoord2f(Coord.Left, Coord.Top); glVertex2f(X + Rect.Left - ItalicCoeff * Rect.Top, Y + Rect.Top); - glTexCoord2f(Coord.Left, Coord.Bottom); glVertex2f(X + Rect.Left - ItalicCoeff * Rect.Bottom, Y + Rect.Bottom); - glTexCoord2f(Coord.Right, Coord.Bottom); glVertex2f(X + Rect.Right - ItalicCoeff * Rect.Bottom, Y + Rect.Bottom); - glTexCoord2f(Coord.Right, Coord.Top); glVertex2f(X + Rect.Right - ItalicCoeff * Rect.Top, Y + Rect.Top); + glTexCoord2f(coord.Left, coord.Top); glVertex2f(x + rect.Left - italicCoeff * rect.Top, y + rect.Top); + glTexCoord2f(coord.Left, coord.Bottom); glVertex2f(x + rect.Left - italicCoeff * rect.Bottom, y + rect.Bottom); + glTexCoord2f(coord.Right, coord.Bottom); glVertex2f(x + rect.Right - italicCoeff * rect.Bottom, y + rect.Bottom); + glTexCoord2f(coord.Right, coord.Top); glVertex2f(x + rect.Right - italicCoeff * rect.Top, y + rect.Top); // If we're using the bold style, we must render the character 4 more times, // slightly offseted, to simulate a higher weight if (myStyle & Bold) { - static const float OffsetsX[] = {-0.5f, 0.5f, 0.f, 0.f}; - static const float OffsetsY[] = {0.f, 0.f, -0.5f, 0.5f}; + static const float offsetsX[] = {-0.5f, 0.5f, 0.f, 0.f}; + static const float offsetsY[] = {0.f, 0.f, -0.5f, 0.5f}; for (int j = 0; j < 4; ++j) { - glTexCoord2f(Coord.Left, Coord.Top); glVertex2f(X + OffsetsX[j] + Rect.Left - ItalicCoeff * Rect.Top, Y + OffsetsY[j] + Rect.Top); - glTexCoord2f(Coord.Left, Coord.Bottom); glVertex2f(X + OffsetsX[j] + Rect.Left - ItalicCoeff * Rect.Bottom, Y + OffsetsY[j] + Rect.Bottom); - glTexCoord2f(Coord.Right, Coord.Bottom); glVertex2f(X + OffsetsX[j] + Rect.Right - ItalicCoeff * Rect.Bottom, Y + OffsetsY[j] + Rect.Bottom); - glTexCoord2f(Coord.Right, Coord.Top); glVertex2f(X + OffsetsX[j] + Rect.Right - ItalicCoeff * Rect.Top, Y + OffsetsY[j] + Rect.Top); + glTexCoord2f(coord.Left, coord.Top); glVertex2f(x + offsetsX[j] + rect.Left - italicCoeff * rect.Top, y + offsetsY[j] + rect.Top); + glTexCoord2f(coord.Left, coord.Bottom); glVertex2f(x + offsetsX[j] + rect.Left - italicCoeff * rect.Bottom, y + offsetsY[j] + rect.Bottom); + glTexCoord2f(coord.Right, coord.Bottom); glVertex2f(x + offsetsX[j] + rect.Right - italicCoeff * rect.Bottom, y + offsetsY[j] + rect.Bottom); + glTexCoord2f(coord.Right, coord.Top); glVertex2f(x + offsetsX[j] + rect.Right - italicCoeff * rect.Top, y + offsetsY[j] + rect.Top); } } // Advance to the next character - X += Advance; + x += advance; } glEnd(); @@ -297,21 +297,21 @@ void String::Render(RenderTarget&) const if (myStyle & Underlined) { // Compute the line thickness - float Thickness = (myStyle & Bold) ? 3.f : 2.f; + float thickness = (myStyle & Bold) ? 3.f : 2.f; // Add the last line (which was not finished with a \n) - UnderlineCoords.push_back(X); - UnderlineCoords.push_back(Y + 2); + underlineCoords.push_back(x); + underlineCoords.push_back(y + 2); // Draw the underlines as quads GLCheck(glDisable(GL_TEXTURE_2D)); glBegin(GL_QUADS); - for (std::size_t i = 0; i < UnderlineCoords.size(); i += 2) + for (std::size_t i = 0; i < underlineCoords.size(); i += 2) { - glVertex2f(0, UnderlineCoords[i + 1]); - glVertex2f(0, UnderlineCoords[i + 1] + Thickness); - glVertex2f(UnderlineCoords[i], UnderlineCoords[i + 1] + Thickness); - glVertex2f(UnderlineCoords[i], UnderlineCoords[i + 1]); + glVertex2f(0, underlineCoords[i + 1]); + glVertex2f(0, underlineCoords[i + 1] + thickness); + glVertex2f(underlineCoords[i], underlineCoords[i + 1] + thickness); + glVertex2f(underlineCoords[i], underlineCoords[i + 1]); } glEnd(); } @@ -324,89 +324,89 @@ void String::Render(RenderTarget&) const void String::RecomputeRect() { // First get the internal UTF-32 string of the text - const Unicode::UTF32String& Text = myText; + const Unicode::UTF32String& text = myText; // Reset the "need update" state myNeedRectUpdate = false; // No text, empty box :) - if (Text.empty()) + if (text.empty()) { myBaseRect = FloatRect(0, 0, 0, 0); return; } // Initial values - float CurWidth = 0; - float CurHeight = 0; - float Width = 0; - float Height = 0; - float Factor = mySize / myFont->GetCharacterSize(); + float curWidth = 0; + float curHeight = 0; + float width = 0; + float height = 0; + float factor = mySize / myFont->GetCharacterSize(); // Go through each character - for (std::size_t i = 0; i < Text.size(); ++i) + for (std::size_t i = 0; i < text.size(); ++i) { // Get the current character and its corresponding glyph - Uint32 CurChar = Text[i]; - const Glyph& CurGlyph = myFont->GetGlyph(CurChar); - float Advance = CurGlyph.Advance * Factor; - const IntRect& Rect = CurGlyph.Rectangle; + Uint32 curChar = text[i]; + const Glyph& curGlyph = myFont->GetGlyph(curChar); + float advance = curGlyph.Advance * factor; + const IntRect& rect = curGlyph.Rectangle; // Handle special characters - switch (CurChar) + switch (curChar) { - case L' ' : CurWidth += Advance; continue; - case L'\t' : CurWidth += Advance * 4; continue; - case L'\v' : Height += mySize * 4; CurHeight = 0; continue; + case L' ' : curWidth += advance; continue; + case L'\t' : curWidth += advance * 4; continue; + case L'\v' : height += mySize * 4; curHeight = 0; continue; case L'\n' : - Height += mySize; - CurHeight = 0; - if (CurWidth > Width) - Width = CurWidth; - CurWidth = 0; + height += mySize; + curHeight = 0; + if (curWidth > width) + width = curWidth; + curWidth = 0; continue; } // Advance to the next character - CurWidth += Advance; + curWidth += advance; // Update the maximum height - float CharHeight = (myFont->GetCharacterSize() + Rect.Bottom) * Factor; - if (CharHeight > CurHeight) - CurHeight = CharHeight; + float charHeight = (myFont->GetCharacterSize() + rect.Bottom) * factor; + if (charHeight > curHeight) + curHeight = charHeight; } // Update the last line - if (CurWidth > Width) - Width = CurWidth; - Height += CurHeight; + if (curWidth > width) + width = curWidth; + height += curHeight; // Add a slight width / height if we're using the bold style if (myStyle & Bold) { - Width += 1 * Factor; - Height += 1 * Factor; + width += 1 * factor; + height += 1 * factor; } // Add a slight width if we're using the italic style if (myStyle & Italic) { - Width += 0.208f * mySize; + width += 0.208f * mySize; } // Add a slight height if we're using the underlined style if (myStyle & Underlined) { - if (CurHeight < mySize + 4 * Factor) - Height += 4 * Factor; + if (curHeight < mySize + 4 * factor) + height += 4 * factor; } // Finally update the rectangle myBaseRect.Left = 0; myBaseRect.Top = 0; - myBaseRect.Right = Width; - myBaseRect.Bottom = Height; + myBaseRect.Right = width; + myBaseRect.Bottom = height; } } // namespace sf diff --git a/src/SFML/Graphics/View.cpp b/src/SFML/Graphics/View.cpp index fc3006cc8..25211a48e 100644 --- a/src/SFML/Graphics/View.cpp +++ b/src/SFML/Graphics/View.cpp @@ -49,7 +49,7 @@ myNeedInvUpdate(true) //////////////////////////////////////////////////////////// /// Construct the view from a rectangle //////////////////////////////////////////////////////////// -View::View(const FloatRect& Rectangle) : +View::View(const FloatRect& rectangle) : myCenter (), mySize (), myRotation (0), @@ -57,16 +57,16 @@ myViewport (0, 0, 1, 1), myNeedUpdate (true), myNeedInvUpdate(true) { - Reset(Rectangle); + Reset(rectangle); } //////////////////////////////////////////////////////////// /// Construct the view from its center and size //////////////////////////////////////////////////////////// -View::View(const Vector2f& Center, const Vector2f& Size) : -myCenter (Center), -mySize (Size), +View::View(const Vector2f& center, const Vector2f& size) : +myCenter (center), +mySize (size), myRotation (0), myViewport (0, 0, 1, 1), myNeedUpdate (true), @@ -78,10 +78,10 @@ myNeedInvUpdate(true) //////////////////////////////////////////////////////////// /// Change the center of the view //////////////////////////////////////////////////////////// -void View::SetCenter(float X, float Y) +void View::SetCenter(float x, float y) { - myCenter.x = X; - myCenter.y = Y; + myCenter.x = x; + myCenter.y = y; myNeedUpdate = true; myNeedInvUpdate = true; } @@ -90,19 +90,19 @@ void View::SetCenter(float X, float Y) //////////////////////////////////////////////////////////// /// Change the center of the view //////////////////////////////////////////////////////////// -void View::SetCenter(const Vector2f& Center) +void View::SetCenter(const Vector2f& center) { - SetCenter(Center.x, Center.y); + SetCenter(center.x, center.y); } //////////////////////////////////////////////////////////// /// Change the size of the view //////////////////////////////////////////////////////////// -void View::SetSize(float Width, float Height) +void View::SetSize(float width, float height) { - mySize.x = Width; - mySize.y = Height; + mySize.x = width; + mySize.y = height; myNeedUpdate = true; myNeedInvUpdate = true; } @@ -111,18 +111,20 @@ void View::SetSize(float Width, float Height) //////////////////////////////////////////////////////////// /// Change the size of the view //////////////////////////////////////////////////////////// -void View::SetSize(const Vector2f& Size) +void View::SetSize(const Vector2f& size) { - SetSize(Size.x, Size.y); + SetSize(size.x, size.y); } //////////////////////////////////////////////////////////// /// Set the angle of rotation of the view //////////////////////////////////////////////////////////// -void View::SetRotation(float Angle) +void View::SetRotation(float angle) { - myRotation = Angle; + myRotation = static_cast(fmod(angle, 360)); + if (myRotation < 0) + myRotation += 360.f; myNeedUpdate = true; myNeedInvUpdate = true; } @@ -131,19 +133,19 @@ void View::SetRotation(float Angle) //////////////////////////////////////////////////////////// /// Set the target viewport //////////////////////////////////////////////////////////// -void View::SetViewport(const FloatRect& Viewport) +void View::SetViewport(const FloatRect& viewport) { - myViewport = Viewport; + myViewport = viewport; } //////////////////////////////////////////////////////////// /// Reset the view to the given rectangle //////////////////////////////////////////////////////////// -void View::Reset(const FloatRect& Rectangle) +void View::Reset(const FloatRect& rectangle) { - myCenter = Rectangle.GetCenter(); - mySize = Rectangle.GetSize(); + myCenter = rectangle.GetCenter(); + mySize = rectangle.GetSize(); myNeedUpdate = true; myNeedInvUpdate = true; } @@ -188,44 +190,36 @@ const FloatRect& View::GetViewport() const //////////////////////////////////////////////////////////// /// Move the view //////////////////////////////////////////////////////////// -void View::Move(float OffsetX, float OffsetY) +void View::Move(float offsetX, float offsetY) { - myCenter.x += OffsetX; - myCenter.y += OffsetY; - myNeedUpdate = true; - myNeedInvUpdate = true; + SetCenter(myCenter.x + offsetX, myCenter.y + offsetY); } //////////////////////////////////////////////////////////// /// Move the view //////////////////////////////////////////////////////////// -void View::Move(const Vector2f& Offset) +void View::Move(const Vector2f& offset) { - Move(Offset.x, Offset.y); + SetCenter(myCenter + offset); } //////////////////////////////////////////////////////////// /// Rotate the view //////////////////////////////////////////////////////////// -void View::Rotate(float Angle) +void View::Rotate(float angle) { - myRotation += Angle; - myNeedUpdate = true; - myNeedInvUpdate = true; + SetRotation(myRotation + angle); } //////////////////////////////////////////////////////////// /// Resize the view rectangle to simulate a zoom / unzoom effect //////////////////////////////////////////////////////////// -void View::Zoom(float Factor) +void View::Zoom(float factor) { - mySize.x *= Factor; - mySize.y *= Factor; - myNeedUpdate = true; - myNeedInvUpdate = true; + SetSize(mySize.x * factor, mySize.y * factor); } diff --git a/src/SFML/Graphics/Win32/RenderImageImplPBuffer.cpp b/src/SFML/Graphics/Win32/RenderImageImplPBuffer.cpp index 9eb9e5513..c1d914f56 100644 --- a/src/SFML/Graphics/Win32/RenderImageImplPBuffer.cpp +++ b/src/SFML/Graphics/Win32/RenderImageImplPBuffer.cpp @@ -67,7 +67,7 @@ RenderImageImplPBuffer::~RenderImageImplPBuffer() // This is to make sure that another valid context is made // active after we destroy the P-Buffer's one - Context Ctx; + Context context; } @@ -87,17 +87,17 @@ bool RenderImageImplPBuffer::IsSupported() //////////////////////////////////////////////////////////// /// /see RenderImageImpl::Create //////////////////////////////////////////////////////////// -bool RenderImageImplPBuffer::Create(unsigned int Width, unsigned int Height, unsigned int /*TextureId*/, bool DepthBuffer) +bool RenderImageImplPBuffer::Create(unsigned int width, unsigned int height, unsigned int, bool depthBuffer) { // Store the dimensions - myWidth = Width; - myHeight = Height; + myWidth = width; + myHeight = height; // Get the current HDC - HDC CurrentDeviceContext = wglGetCurrentDC(); + HDC currentDC = wglGetCurrentDC(); // Define the minimum PBuffer attributes - int Attributes[] = + int attributes[] = { WGL_SUPPORT_OPENGL_ARB, GL_TRUE, WGL_DRAW_TO_PBUFFER_ARB, GL_TRUE, @@ -105,25 +105,25 @@ bool RenderImageImplPBuffer::Create(unsigned int Width, unsigned int Height, uns WGL_GREEN_BITS_ARB, 8, WGL_BLUE_BITS_ARB, 8, WGL_ALPHA_BITS_ARB, 8, - WGL_DEPTH_BITS_ARB, (DepthBuffer ? 24 : 0), + WGL_DEPTH_BITS_ARB, (depthBuffer ? 24 : 0), WGL_DOUBLE_BUFFER_ARB, GL_FALSE, 0 }; // Select the best pixel format for our attributes - unsigned int NbFormats = 0; - int PixelFormat = -1; - wglChoosePixelFormatARB(CurrentDeviceContext, Attributes, NULL, 1, &PixelFormat, &NbFormats); + unsigned int nbFormats = 0; + int pixelFormat = -1; + wglChoosePixelFormatARB(currentDC, attributes, NULL, 1, &pixelFormat, &nbFormats); // Make sure that one pixel format has been found - if (NbFormats == 0) + if (nbFormats == 0) { std::cerr << "Impossible to create render image (failed to find a suitable pixel format for PBuffer)" << std::endl; return false; } // Create the P-Buffer and its OpenGL context - myPBuffer = wglCreatePbufferARB(CurrentDeviceContext, PixelFormat, Width, Height, NULL); + myPBuffer = wglCreatePbufferARB(currentDC, pixelFormat, width, height, NULL); myDeviceContext = wglGetPbufferDCARB(myPBuffer); myContext = wglCreateContext(myDeviceContext); @@ -135,25 +135,25 @@ bool RenderImageImplPBuffer::Create(unsigned int Width, unsigned int Height, uns } // Check the actual size of the P-Buffer - int ActualWidth, ActualHeight; - wglQueryPbufferARB(myPBuffer, WGL_PBUFFER_WIDTH_ARB, &ActualWidth); - wglQueryPbufferARB(myPBuffer, WGL_PBUFFER_HEIGHT_ARB, &ActualHeight); - if ((ActualWidth != static_cast(Width)) || (ActualHeight != static_cast(Height))) + int actualWidth, actualHeight; + wglQueryPbufferARB(myPBuffer, WGL_PBUFFER_WIDTH_ARB, &actualWidth); + wglQueryPbufferARB(myPBuffer, WGL_PBUFFER_HEIGHT_ARB, &actualHeight); + if ((actualWidth != static_cast(width)) || (actualHeight != static_cast(height))) { std::cerr << "Impossible to create render image (failed to match the requested size). " - << "Size: " << ActualWidth << "x" << ActualHeight << " - " - << "Requested: " << Width << "x" << Height + << "Size: " << actualWidth << "x" << actualHeight << " - " + << "Requested: " << width << "x" << height << std::endl; return false; } // Share the P-Buffer context with the current context - HGLRC CurrentContext = wglGetCurrentContext(); - if (CurrentContext) + HGLRC currentContext = wglGetCurrentContext(); + if (currentContext) { wglMakeCurrent(NULL, NULL); - wglShareLists(CurrentContext, myContext); - wglMakeCurrent(CurrentDeviceContext, CurrentContext); + wglShareLists(currentContext, myContext); + wglMakeCurrent(currentDC, currentContext); } return true; @@ -163,9 +163,9 @@ bool RenderImageImplPBuffer::Create(unsigned int Width, unsigned int Height, uns //////////////////////////////////////////////////////////// /// /see RenderImageImpl::Activate //////////////////////////////////////////////////////////// -bool RenderImageImplPBuffer::Activate(bool Active) +bool RenderImageImplPBuffer::Activate(bool active) { - if (Active) + if (active) { if (myDeviceContext && myContext && (wglGetCurrentContext() != myContext)) { @@ -189,23 +189,23 @@ bool RenderImageImplPBuffer::Activate(bool Active) //////////////////////////////////////////////////////////// /// /see RenderImageImpl::UpdateTexture //////////////////////////////////////////////////////////// -bool RenderImageImplPBuffer::UpdateTexture(unsigned int TextureId) +bool RenderImageImplPBuffer::UpdateTexture(unsigned int textureId) { // Store the current active context - HDC CurrentDeviceContext = wglGetCurrentDC(); - HGLRC CurrentContext = wglGetCurrentContext(); + HDC currentDC = wglGetCurrentDC(); + HGLRC currentContext = wglGetCurrentContext(); if (Activate(true)) { // Bind the texture GLCheck(glEnable(GL_TEXTURE_2D)); - GLCheck(glBindTexture(GL_TEXTURE_2D, TextureId)); + GLCheck(glBindTexture(GL_TEXTURE_2D, textureId)); // Copy the rendered pixels to the image GLCheck(glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, myWidth, myHeight)); // Restore the previous context - wglMakeCurrent(CurrentDeviceContext, CurrentContext); + wglMakeCurrent(currentDC, currentContext); return true; } diff --git a/src/SFML/Graphics/Win32/RenderImageImplPBuffer.hpp b/src/SFML/Graphics/Win32/RenderImageImplPBuffer.hpp index 911d9fc12..c6b1b6c6b 100644 --- a/src/SFML/Graphics/Win32/RenderImageImplPBuffer.hpp +++ b/src/SFML/Graphics/Win32/RenderImageImplPBuffer.hpp @@ -70,19 +70,19 @@ private : /// /see RenderImageImpl::Create /// //////////////////////////////////////////////////////////// - virtual bool Create(unsigned int Width, unsigned int Height, unsigned int TextureId, bool DepthBuffer); + virtual bool Create(unsigned int width, unsigned int height, unsigned int textureId, bool depthBuffer); //////////////////////////////////////////////////////////// /// /see RenderImageImpl::Activate /// //////////////////////////////////////////////////////////// - virtual bool Activate(bool Active); + virtual bool Activate(bool active); //////////////////////////////////////////////////////////// /// /see RenderImageImpl::UpdateTexture /// //////////////////////////////////////////////////////////// - virtual bool UpdateTexture(unsigned TextureId); + virtual bool UpdateTexture(unsigned textureId); //////////////////////////////////////////////////////////// // Member data diff --git a/src/SFML/Network/Ftp.cpp b/src/SFML/Network/Ftp.cpp index 85146d4ed..6975621a8 100644 --- a/src/SFML/Network/Ftp.cpp +++ b/src/SFML/Network/Ftp.cpp @@ -46,7 +46,7 @@ public : //////////////////////////////////////////////////////////// // Constructor //////////////////////////////////////////////////////////// - DataChannel(Ftp& Owner); + DataChannel(Ftp& owner); //////////////////////////////////////////////////////////// // Destructor @@ -56,17 +56,17 @@ public : //////////////////////////////////////////////////////////// // Open the data channel using the specified mode and port //////////////////////////////////////////////////////////// - Ftp::Response Open(Ftp::TransferMode Mode); + Ftp::Response Open(Ftp::TransferMode mode); //////////////////////////////////////////////////////////// // Send data on the data channel //////////////////////////////////////////////////////////// - void Send(const std::vector& Data); + void Send(const std::vector& data); //////////////////////////////////////////////////////////// // Receive data on the data channel until it is closed //////////////////////////////////////////////////////////// - void Receive(std::vector& Data); + void Receive(std::vector& data); private : @@ -81,9 +81,9 @@ private : //////////////////////////////////////////////////////////// /// Default constructor //////////////////////////////////////////////////////////// -Ftp::Response::Response(Status Code, const std::string& Message) : -myStatus (Code), -myMessage(Message) +Ftp::Response::Response(Status code, const std::string& message) : +myStatus (code), +myMessage(message) { } @@ -120,15 +120,15 @@ const std::string& Ftp::Response::GetMessage() const //////////////////////////////////////////////////////////// /// Default constructor //////////////////////////////////////////////////////////// -Ftp::DirectoryResponse::DirectoryResponse(Ftp::Response Resp) : -Ftp::Response(Resp) +Ftp::DirectoryResponse::DirectoryResponse(Ftp::Response response) : +Ftp::Response(response) { if (IsOk()) { // Extract the directory from the server response - std::string::size_type Begin = Resp.GetMessage().find('"', 0); - std::string::size_type End = Resp.GetMessage().find('"', Begin + 1); - myDirectory = Resp.GetMessage().substr(Begin + 1, End - Begin - 1); + std::string::size_type begin = response.GetMessage().find('"', 0); + std::string::size_type end = response.GetMessage().find('"', begin + 1); + myDirectory = response.GetMessage().substr(begin + 1, end - begin - 1); } } @@ -145,18 +145,18 @@ const std::string& Ftp::DirectoryResponse::GetDirectory() const //////////////////////////////////////////////////////////// /// Default constructor //////////////////////////////////////////////////////////// -Ftp::ListingResponse::ListingResponse(Ftp::Response Resp, const std::vector& Data) : -Ftp::Response(Resp) +Ftp::ListingResponse::ListingResponse(Ftp::Response response, const std::vector& data) : +Ftp::Response(response) { if (IsOk()) { // Fill the array of strings - std::string Paths(Data.begin(), Data.end()); - std::string::size_type LastPos = 0; - for (std::string::size_type Pos = Paths.find("\r\n"); Pos != std::string::npos; Pos = Paths.find("\r\n", LastPos)) + std::string paths(data.begin(), data.end()); + std::string::size_type lastPos = 0; + for (std::string::size_type pos = paths.find("\r\n"); pos != std::string::npos; pos = paths.find("\r\n", lastPos)) { - myFilenames.push_back(Paths.substr(LastPos, Pos - LastPos)); - LastPos = Pos + 2; + myFilenames.push_back(paths.substr(lastPos, pos - lastPos)); + lastPos = pos + 2; } } } @@ -174,9 +174,9 @@ std::size_t Ftp::ListingResponse::GetCount() const //////////////////////////////////////////////////////////// /// Get the Index-th filename in the directory //////////////////////////////////////////////////////////// -const std::string& Ftp::ListingResponse::GetFilename(std::size_t Index) const +const std::string& Ftp::ListingResponse::GetFilename(std::size_t index) const { - return myFilenames[Index]; + return myFilenames[index]; } @@ -192,10 +192,10 @@ Ftp::~Ftp() //////////////////////////////////////////////////////////// /// Connect to the specified FTP server //////////////////////////////////////////////////////////// -Ftp::Response Ftp::Connect(const IPAddress& Server, unsigned short Port, float Timeout) +Ftp::Response Ftp::Connect(const IPAddress& server, unsigned short port, float timeout) { // Connect to the server - if (myCommandSocket.Connect(Port, Server, Timeout) != Socket::Done) + if (myCommandSocket.Connect(port, server, timeout) != Socket::Done) return Response(Response::ConnectionFailed); // Get the response to the connection @@ -215,13 +215,13 @@ Ftp::Response Ftp::Login() //////////////////////////////////////////////////////////// /// Log in using a username and a password //////////////////////////////////////////////////////////// -Ftp::Response Ftp::Login(const std::string& UserName, const std::string& Password) +Ftp::Response Ftp::Login(const std::string& name, const std::string& password) { - Response Resp = SendCommand("USER", UserName); - if (Resp.IsOk()) - Resp = SendCommand("PASS", Password); + Response response = SendCommand("USER", name); + if (response.IsOk()) + response = SendCommand("PASS", password); - return Resp; + return response; } @@ -231,11 +231,11 @@ Ftp::Response Ftp::Login(const std::string& UserName, const std::string& Passwor Ftp::Response Ftp::Disconnect() { // Send the exit command - Response Resp = SendCommand("QUIT"); - if (Resp.IsOk()) + Response response = SendCommand("QUIT"); + if (response.IsOk()) myCommandSocket.Close(); - return Resp; + return response; } @@ -261,36 +261,36 @@ Ftp::DirectoryResponse Ftp::GetWorkingDirectory() /// Get the contents of the given directory /// (subdirectories and files) //////////////////////////////////////////////////////////// -Ftp::ListingResponse Ftp::GetDirectoryListing(const std::string& Directory) +Ftp::ListingResponse Ftp::GetDirectoryListing(const std::string& directory) { // Open a data channel on default port (20) using ASCII transfer mode - std::vector DirData; - DataChannel Data(*this); - Response Resp = Data.Open(Ascii); - if (Resp.IsOk()) + std::vector directoryData; + DataChannel data(*this); + Response response = data.Open(Ascii); + if (response.IsOk()) { // Tell the server to send us the listing - Resp = SendCommand("NLST", Directory); - if (Resp.IsOk()) + response = SendCommand("NLST", directory); + if (response.IsOk()) { // Receive the listing - Data.Receive(DirData); + data.Receive(directoryData); // Get the response from the server - Resp = GetResponse(); + response = GetResponse(); } } - return ListingResponse(Resp, DirData); + return ListingResponse(response, directoryData); } //////////////////////////////////////////////////////////// /// Change the current working directory //////////////////////////////////////////////////////////// -Ftp::Response Ftp::ChangeDirectory(const std::string& Directory) +Ftp::Response Ftp::ChangeDirectory(const std::string& directory) { - return SendCommand("CWD", Directory); + return SendCommand("CWD", directory); } @@ -306,150 +306,150 @@ Ftp::Response Ftp::ParentDirectory() //////////////////////////////////////////////////////////// /// Create a new directory //////////////////////////////////////////////////////////// -Ftp::Response Ftp::MakeDirectory(const std::string& Name) +Ftp::Response Ftp::MakeDirectory(const std::string& name) { - return SendCommand("MKD", Name); + return SendCommand("MKD", name); } //////////////////////////////////////////////////////////// /// Remove an existing directory //////////////////////////////////////////////////////////// -Ftp::Response Ftp::DeleteDirectory(const std::string& Name) +Ftp::Response Ftp::DeleteDirectory(const std::string& name) { - return SendCommand("RMD", Name); + return SendCommand("RMD", name); } //////////////////////////////////////////////////////////// /// Rename a file //////////////////////////////////////////////////////////// -Ftp::Response Ftp::RenameFile(const std::string& File, const std::string& NewName) +Ftp::Response Ftp::RenameFile(const std::string& file, const std::string& newName) { - Response Resp = SendCommand("RNFR", File); - if (Resp.IsOk()) - Resp = SendCommand("RNTO", NewName); + Response response = SendCommand("RNFR", file); + if (response.IsOk()) + response = SendCommand("RNTO", newName); - return Resp; + return response; } //////////////////////////////////////////////////////////// /// Remove an existing file //////////////////////////////////////////////////////////// -Ftp::Response Ftp::DeleteFile(const std::string& Name) +Ftp::Response Ftp::DeleteFile(const std::string& name) { - return SendCommand("DELE", Name); + return SendCommand("DELE", name); } //////////////////////////////////////////////////////////// /// Download a file from the server //////////////////////////////////////////////////////////// -Ftp::Response Ftp::Download(const std::string& DistantFile, const std::string& DestPath, TransferMode Mode) +Ftp::Response Ftp::Download(const std::string& distantFile, const std::string& destPath, TransferMode mode) { // Open a data channel using the given transfer mode - DataChannel Data(*this); - Response Resp = Data.Open(Mode); - if (Resp.IsOk()) + DataChannel data(*this); + Response response = data.Open(mode); + if (response.IsOk()) { // Tell the server to start the transfer - Resp = SendCommand("RETR", DistantFile); - if (Resp.IsOk()) + response = SendCommand("RETR", distantFile); + if (response.IsOk()) { // Receive the file data - std::vector FileData; - Data.Receive(FileData); + std::vector fileData; + data.Receive(fileData); // Get the response from the server - Resp = GetResponse(); - if (Resp.IsOk()) + response = GetResponse(); + if (response.IsOk()) { // Extract the filename from the file path - std::string Filename = DistantFile; - std::string::size_type Pos = Filename.find_last_of("/\\"); - if (Pos != std::string::npos) - Filename = Filename.substr(Pos + 1); + std::string filename = distantFile; + std::string::size_type pos = filename.find_last_of("/\\"); + if (pos != std::string::npos) + filename = filename.substr(pos + 1); // Make sure the destination path ends with a slash - std::string Path = DestPath; - if (!Path.empty() && (Path[Path.size() - 1] != '\\') && (Path[Path.size() - 1] != '/')) - Path += "/"; + std::string path = destPath; + if (!path.empty() && (path[path.size() - 1] != '\\') && (path[path.size() - 1] != '/')) + path += "/"; // Create the file and copy the received data into it - std::ofstream File((Path + Filename).c_str(), std::ios_base::binary); - if (!File) + std::ofstream file((path + filename).c_str(), std::ios_base::binary); + if (!file) return Response(Response::InvalidFile); - File.write(&FileData[0], static_cast(FileData.size())); + file.write(&fileData[0], static_cast(fileData.size())); } } } - return Resp; + return response; } //////////////////////////////////////////////////////////// /// Upload a file to the server //////////////////////////////////////////////////////////// -Ftp::Response Ftp::Upload(const std::string& LocalFile, const std::string& DestPath, TransferMode Mode) +Ftp::Response Ftp::Upload(const std::string& localFile, const std::string& destPath, TransferMode mode) { // Get the contents of the file to send - std::ifstream File(LocalFile.c_str(), std::ios_base::binary); - if (!File) + std::ifstream file(localFile.c_str(), std::ios_base::binary); + if (!file) return Response(Response::InvalidFile); - File.seekg(0, std::ios::end); - std::size_t Length = File.tellg(); - File.seekg(0, std::ios::beg); - std::vector FileData(Length); - File.read(&FileData[0], static_cast(Length)); + file.seekg(0, std::ios::end); + std::size_t length = file.tellg(); + file.seekg(0, std::ios::beg); + std::vector fileData(length); + file.read(&fileData[0], static_cast(length)); // Extract the filename from the file path - std::string Filename = LocalFile; - std::string::size_type Pos = Filename.find_last_of("/\\"); - if (Pos != std::string::npos) - Filename = Filename.substr(Pos + 1); + std::string filename = localFile; + std::string::size_type pos = filename.find_last_of("/\\"); + if (pos != std::string::npos) + filename = filename.substr(pos + 1); // Make sure the destination path ends with a slash - std::string Path = DestPath; - if (!Path.empty() && (Path[Path.size() - 1] != '\\') && (Path[Path.size() - 1] != '/')) - Path += "/"; + std::string path = destPath; + if (!path.empty() && (path[path.size() - 1] != '\\') && (path[path.size() - 1] != '/')) + path += "/"; // Open a data channel using the given transfer mode - DataChannel Data(*this); - Response Resp = Data.Open(Mode); - if (Resp.IsOk()) + DataChannel data(*this); + Response response = data.Open(mode); + if (response.IsOk()) { // Tell the server to start the transfer - Resp = SendCommand("STOR", Path + Filename); - if (Resp.IsOk()) + response = SendCommand("STOR", path + filename); + if (response.IsOk()) { // Send the file data - Data.Send(FileData); + data.Send(fileData); // Get the response from the server - Resp = GetResponse(); + response = GetResponse(); } } - return Resp; + return response; } //////////////////////////////////////////////////////////// /// Send a command to the FTP server //////////////////////////////////////////////////////////// -Ftp::Response Ftp::SendCommand(const std::string& Command, const std::string& Parameter) +Ftp::Response Ftp::SendCommand(const std::string& command, const std::string& parameter) { // Build the command string - std::string CommandStr; - if (Parameter != "") - CommandStr = Command + " " + Parameter + "\r\n"; + std::string commandStr; + if (parameter != "") + commandStr = command + " " + parameter + "\r\n"; else - CommandStr = Command + "\r\n"; + commandStr = command + "\r\n"; // Send it to the server - if (myCommandSocket.Send(CommandStr.c_str(), CommandStr.length()) != sf::Socket::Done) + if (myCommandSocket.Send(commandStr.c_str(), commandStr.length()) != sf::Socket::Done) return Response(Response::ConnectionClosed); // Get the response @@ -466,77 +466,77 @@ Ftp::Response Ftp::GetResponse() // We'll use a variable to keep track of the last valid code. // It is useful in case of multi-lines responses, because the end of such a response // will start by the same code - unsigned int LastCode = 0; - bool IsInsideMultiline = false; - std::string Message; + unsigned int lastCode = 0; + bool isInsideMultiline = false; + std::string message; for (;;) { // Receive the response from the server - char Buffer[1024]; - std::size_t Length; - if (myCommandSocket.Receive(Buffer, sizeof(Buffer), Length) != sf::Socket::Done) + char buffer[1024]; + std::size_t length; + if (myCommandSocket.Receive(buffer, sizeof(buffer), length) != sf::Socket::Done) return Response(Response::ConnectionClosed); // There can be several lines inside the received buffer, extract them all - std::istringstream In(std::string(Buffer, Length), std::ios_base::binary); - while (In) + std::istringstream in(std::string(buffer, length), std::ios_base::binary); + while (in) { // Try to extract the code - unsigned int Code; - if (In >> Code) + unsigned int code; + if (in >> code) { // Extract the separator - char Sep; - In.get(Sep); + char separator; + in.get(separator); // The '-' character means a multiline response - if ((Sep == '-') && !IsInsideMultiline) + if ((separator == '-') && !isInsideMultiline) { // Set the multiline flag - IsInsideMultiline = true; + isInsideMultiline = true; // Keep track of the code - if (LastCode == 0) - LastCode = Code; + if (lastCode == 0) + lastCode = code; // Extract the line - std::getline(In, Message); + std::getline(in, message); // Remove the ending '\r' (all lines are terminated by "\r\n") - Message.erase(Message.length() - 1); - Message = Sep + Message + "\n"; + message.erase(message.length() - 1); + message = separator + message + "\n"; } else { // We must make sure that the code is the same, otherwise it means // we haven't reached the end of the multiline response - if ((Sep != '-') && ((Code == LastCode) || (LastCode == 0))) + if ((separator != '-') && ((code == lastCode) || (lastCode == 0))) { // Clear the multiline flag - IsInsideMultiline = false; + isInsideMultiline = false; // Extract the line - std::string Line; - std::getline(In, Line); + std::string line; + std::getline(in, line); // Remove the ending '\r' (all lines are terminated by "\r\n") - Line.erase(Line.length() - 1); + line.erase(line.length() - 1); // Append it to the message - if (Code == LastCode) + if (code == lastCode) { - std::ostringstream Out; - Out << Code << Sep << Line; - Message += Out.str(); + std::ostringstream out; + out << code << separator << line; + message += out.str(); } else { - Message = Sep + Line; + message = separator + line; } // Return the response code and message - return Response(static_cast(Code), Message); + return Response(static_cast(code), message); } else { @@ -544,40 +544,40 @@ Ftp::Response Ftp::GetResponse() // only a new part of the current multiline response // Extract the line - std::string Line; - std::getline(In, Line); + std::string line; + std::getline(in, line); - if (!Line.empty()) + if (!line.empty()) { // Remove the ending '\r' (all lines are terminated by "\r\n") - Line.erase(Line.length() - 1); + line.erase(line.length() - 1); // Append it to the current message - std::ostringstream Out; - Out << Code << Sep << Line << "\n"; - Message += Out.str(); + std::ostringstream out; + out << code << separator << line << "\n"; + message += out.str(); } } } } - else if (LastCode != 0) + else if (lastCode != 0) { // It seems we are in the middle of a multiline response // Clear the error bits of the stream - In.clear(); + in.clear(); // Extract the line - std::string Line; - std::getline(In, Line); + std::string line; + std::getline(in, line); - if (!Line.empty()) + if (!line.empty()) { // Remove the ending '\r' (all lines are terminated by "\r\n") - Line.erase(Line.length() - 1); + line.erase(line.length() - 1); // Append it to the current message - Message += Line + "\n"; + message += line + "\n"; } } else @@ -595,8 +595,8 @@ Ftp::Response Ftp::GetResponse() //////////////////////////////////////////////////////////// /// Constructor //////////////////////////////////////////////////////////// -Ftp::DataChannel::DataChannel(Ftp& Owner) : -myFtp(Owner) +Ftp::DataChannel::DataChannel(Ftp& owner) : +myFtp(owner) { } @@ -615,78 +615,78 @@ Ftp::DataChannel::~DataChannel() //////////////////////////////////////////////////////////// /// Open the data channel using the specified mode and port //////////////////////////////////////////////////////////// -Ftp::Response Ftp::DataChannel::Open(Ftp::TransferMode Mode) +Ftp::Response Ftp::DataChannel::Open(Ftp::TransferMode mode) { // Open a data connection in active mode (we connect to the server) - Ftp::Response Resp = myFtp.SendCommand("PASV"); - if (Resp.IsOk()) + Ftp::Response response = myFtp.SendCommand("PASV"); + if (response.IsOk()) { // Extract the connection address and port from the response - std::string::size_type begin = Resp.GetMessage().find_first_of("0123456789"); + std::string::size_type begin = response.GetMessage().find_first_of("0123456789"); if (begin != std::string::npos) { - sf::Uint8 Data[6] = {0, 0, 0, 0, 0, 0}; - std::string Str = Resp.GetMessage().substr(begin); - std::size_t Index = 0; + sf::Uint8 data[6] = {0, 0, 0, 0, 0, 0}; + std::string str = response.GetMessage().substr(begin); + std::size_t index = 0; for (int i = 0; i < 6; ++i) { // Extract the current number - while (isdigit(Str[Index])) + while (isdigit(str[index])) { - Data[i] = Data[i] * 10 + (Str[Index] - '0'); - Index++; + data[i] = data[i] * 10 + (str[index] - '0'); + index++; } // Skip separator - Index++; + index++; } // Reconstruct connection port and address - unsigned short Port = Data[4] * 256 + Data[5]; - sf::IPAddress Address(static_cast(Data[0]), - static_cast(Data[1]), - static_cast(Data[2]), - static_cast(Data[3])); + unsigned short port = data[4] * 256 + data[5]; + sf::IPAddress address(static_cast(data[0]), + static_cast(data[1]), + static_cast(data[2]), + static_cast(data[3])); // Connect the data channel to the server - if (myDataSocket.Connect(Port, Address) == Socket::Done) + if (myDataSocket.Connect(port, address) == Socket::Done) { // Translate the transfer mode to the corresponding FTP parameter - std::string ModeStr; - switch (Mode) + std::string modeStr; + switch (mode) { - case Ftp::Binary : ModeStr = "I"; break; - case Ftp::Ascii : ModeStr = "A"; break; - case Ftp::Ebcdic : ModeStr = "E"; break; + case Ftp::Binary : modeStr = "I"; break; + case Ftp::Ascii : modeStr = "A"; break; + case Ftp::Ebcdic : modeStr = "E"; break; } // Set the transfer mode - Resp = myFtp.SendCommand("TYPE", ModeStr); + response = myFtp.SendCommand("TYPE", modeStr); } else { // Failed to connect to the server - Resp = Ftp::Response(Ftp::Response::ConnectionFailed); + response = Ftp::Response(Ftp::Response::ConnectionFailed); } } } - return Resp; + return response; } //////////////////////////////////////////////////////////// /// Receive data on the data channel until it is closed //////////////////////////////////////////////////////////// -void Ftp::DataChannel::Receive(std::vector& Data) +void Ftp::DataChannel::Receive(std::vector& data) { // Receive data - Data.clear(); - char Buffer[1024]; - std::size_t Received; - while (myDataSocket.Receive(Buffer, sizeof(Buffer), Received) == sf::Socket::Done) + data.clear(); + char buffer[1024]; + std::size_t received; + while (myDataSocket.Receive(buffer, sizeof(buffer), received) == sf::Socket::Done) { - std::copy(Buffer, Buffer + Received, std::back_inserter(Data)); + std::copy(buffer, buffer + received, std::back_inserter(data)); } // Close the data socket @@ -697,10 +697,10 @@ void Ftp::DataChannel::Receive(std::vector& Data) //////////////////////////////////////////////////////////// /// Send data on the data channel //////////////////////////////////////////////////////////// -void Ftp::DataChannel::Send(const std::vector& Data) +void Ftp::DataChannel::Send(const std::vector& data) { // Send data - myDataSocket.Send(&Data[0], Data.size()); + myDataSocket.Send(&data[0], data.size()); // Close the data socket myDataSocket.Close(); diff --git a/src/SFML/Network/Http.cpp b/src/SFML/Network/Http.cpp index 64793406d..b450705d1 100644 --- a/src/SFML/Network/Http.cpp +++ b/src/SFML/Network/Http.cpp @@ -35,13 +35,12 @@ namespace //////////////////////////////////////////////////////////// // Convenience function to convert a string to lower case //////////////////////////////////////////////////////////// - std::string ToLower(const std::string& Str) + std::string ToLower(std::string str) { - std::string Ret = Str; - for (std::string::iterator i = Ret.begin(); i != Ret.end(); ++i) + for (std::string::iterator i = str.begin(); i != str.end(); ++i) *i = static_cast(tolower(*i)); - return Ret; + return str; } } @@ -51,12 +50,12 @@ namespace sf //////////////////////////////////////////////////////////// /// Default constructor //////////////////////////////////////////////////////////// -Http::Request::Request(Method RequestMethod, const std::string& URI, const std::string& Body) : -myMethod (RequestMethod), +Http::Request::Request(Method method, const std::string& URI, const std::string& body) : +myMethod (method), myURI (URI), myMajorVersion(1), myMinorVersion(0), -myBody (Body) +myBody (body) { } @@ -65,9 +64,9 @@ myBody (Body) //////////////////////////////////////////////////////////// /// Set the value of a field; the field is added if it doesn't exist //////////////////////////////////////////////////////////// -void Http::Request::SetField(const std::string& Field, const std::string& Value) +void Http::Request::SetField(const std::string& field, const std::string& value) { - myFields[ToLower(Field)] = Value; + myFields[ToLower(field)] = value; } @@ -75,9 +74,9 @@ void Http::Request::SetField(const std::string& Field, const std::string& Value) /// Set the request method. /// This parameter is Get by default //////////////////////////////////////////////////////////// -void Http::Request::SetMethod(Http::Request::Method RequestMethod) +void Http::Request::SetMethod(Http::Request::Method method) { - myMethod = RequestMethod; + myMethod = method; } @@ -99,10 +98,10 @@ void Http::Request::SetURI(const std::string& URI) /// Set the HTTP version of the request. /// This parameter is 1.0 by default //////////////////////////////////////////////////////////// -void Http::Request::SetHttpVersion(unsigned int Major, unsigned int Minor) +void Http::Request::SetHttpVersion(unsigned int major, unsigned int minor) { - myMajorVersion = Major; - myMinorVersion = Minor; + myMajorVersion = major; + myMinorVersion = minor; } @@ -111,9 +110,9 @@ void Http::Request::SetHttpVersion(unsigned int Major, unsigned int Minor) /// makes sense only for POST requests. /// This parameter is empty by default //////////////////////////////////////////////////////////// -void Http::Request::SetBody(const std::string& Body) +void Http::Request::SetBody(const std::string& body) { - myBody = Body; + myBody = body; } @@ -122,44 +121,44 @@ void Http::Request::SetBody(const std::string& Body) //////////////////////////////////////////////////////////// std::string Http::Request::ToString() const { - std::ostringstream Out; + std::ostringstream out; // Convert the method to its string representation - std::string RequestMethod; + std::string method; switch (myMethod) { default : - case Get : RequestMethod = "GET"; break; - case Post : RequestMethod = "POST"; break; - case Head : RequestMethod = "HEAD"; break; + case Get : method = "GET"; break; + case Post : method = "POST"; break; + case Head : method = "HEAD"; break; } // Write the first line containing the request type - Out << RequestMethod << " " << myURI << " "; - Out << "HTTP/" << myMajorVersion << "." << myMinorVersion << "\r\n"; + out << method << " " << myURI << " "; + out << "HTTP/" << myMajorVersion << "." << myMinorVersion << "\r\n"; // Write fields for (FieldTable::const_iterator i = myFields.begin(); i != myFields.end(); ++i) { - Out << i->first << ": " << i->second << "\r\n"; + out << i->first << ": " << i->second << "\r\n"; } // Use an extra \r\n to separate the header from the body - Out << "\r\n"; + out << "\r\n"; // Add the body - Out << myBody; + out << myBody; - return Out.str(); + return out.str(); } //////////////////////////////////////////////////////////// /// Check if the given field has been defined //////////////////////////////////////////////////////////// -bool Http::Request::HasField(const std::string& Field) const +bool Http::Request::HasField(const std::string& field) const { - return myFields.find(Field) != myFields.end(); + return myFields.find(field) != myFields.end(); } @@ -178,17 +177,17 @@ myMinorVersion(0) //////////////////////////////////////////////////////////// /// Get the value of a field //////////////////////////////////////////////////////////// -const std::string& Http::Response::GetField(const std::string& Field) const +const std::string& Http::Response::GetField(const std::string& field) const { - FieldTable::const_iterator It = myFields.find(Field); - if (It != myFields.end()) + FieldTable::const_iterator it = myFields.find(field); + if (it != myFields.end()) { - return It->second; + return it->second; } else { - static const std::string Empty = ""; - return Empty; + static const std::string empty = ""; + return empty; } } @@ -236,20 +235,20 @@ const std::string& Http::Response::GetBody() const //////////////////////////////////////////////////////////// /// Construct the header from a response string //////////////////////////////////////////////////////////// -void Http::Response::FromString(const std::string& Data) +void Http::Response::FromString(const std::string& data) { - std::istringstream In(Data); + std::istringstream in(data); // Extract the HTTP version from the first line - std::string Version; - if (In >> Version) + std::string version; + if (in >> version) { - if ((Version.size() >= 8) && (Version[6] == '.') && - (ToLower(Version.substr(0, 5)) == "http/") && - isdigit(Version[5]) && isdigit(Version[7])) + if ((version.size() >= 8) && (version[6] == '.') && + (ToLower(version.substr(0, 5)) == "http/") && + isdigit(version[5]) && isdigit(version[7])) { - myMajorVersion = Version[5] - '0'; - myMinorVersion = Version[7] - '0'; + myMajorVersion = version[5] - '0'; + myMinorVersion = version[7] - '0'; } else { @@ -260,10 +259,10 @@ void Http::Response::FromString(const std::string& Data) } // Extract the status code from the first line - int StatusCode; - if (In >> StatusCode) + int status; + if (in >> status) { - myStatus = static_cast(StatusCode); + myStatus = static_cast(status); } else { @@ -273,32 +272,32 @@ void Http::Response::FromString(const std::string& Data) } // Ignore the end of the first line - In.ignore(10000, '\n'); + in.ignore(10000, '\n'); // Parse the other lines, which contain fields, one by one - std::string Line; - while (std::getline(In, Line) && (Line.size() > 2)) + std::string line; + while (std::getline(in, line) && (line.size() > 2)) { - std::string::size_type Pos = Line.find(": "); - if (Pos != std::string::npos) + std::string::size_type pos = line.find(": "); + if (pos != std::string::npos) { // Extract the field name and its value - std::string Field = Line.substr(0, Pos); - std::string Value = Line.substr(Pos + 2); + std::string field = line.substr(0, pos); + std::string value = line.substr(pos + 2); // Remove any trailing \r - if (!Value.empty() && (*Value.rbegin() == '\r')) - Value.erase(Value.size() - 1); + if (!value.empty() && (*value.rbegin() == '\r')) + value.erase(value.size() - 1); // Add the field - myFields[ToLower(Field)] = Value; + myFields[ToLower(field)] = value; } } // Finally extract the body myBody.clear(); - while (std::getline(In, Line)) - myBody += Line + "\n"; + while (std::getline(in, line)) + myBody += line + "\n"; } diff --git a/src/SFML/Network/IPAddress.cpp b/src/SFML/Network/IPAddress.cpp index 9d51f240a..cc01b05f2 100644 --- a/src/SFML/Network/IPAddress.cpp +++ b/src/SFML/Network/IPAddress.cpp @@ -52,19 +52,19 @@ myAddress(INADDR_NONE) //////////////////////////////////////////////////////////// /// Construct the address from a string //////////////////////////////////////////////////////////// -IPAddress::IPAddress(const std::string& Address) +IPAddress::IPAddress(const std::string& address) { // First try to convert it as a byte representation ("xxx.xxx.xxx.xxx") - myAddress = inet_addr(Address.c_str()); + myAddress = inet_addr(address.c_str()); // If not successful, try to convert it as a host name if (!IsValid()) { - hostent* Host = gethostbyname(Address.c_str()); - if (Host) + hostent* host = gethostbyname(address.c_str()); + if (host) { // Host found, extract its IP address - myAddress = reinterpret_cast(Host->h_addr)->s_addr; + myAddress = reinterpret_cast(host->h_addr)->s_addr; } else { @@ -79,19 +79,19 @@ IPAddress::IPAddress(const std::string& Address) /// Construct the address from a C-style string ; /// Needed for implicit conversions from literal strings to IPAddress to work //////////////////////////////////////////////////////////// -IPAddress::IPAddress(const char* Address) +IPAddress::IPAddress(const char* address) { // First try to convert it as a byte representation ("xxx.xxx.xxx.xxx") - myAddress = inet_addr(Address); + myAddress = inet_addr(address); // If not successful, try to convert it as a host name if (!IsValid()) { - hostent* Host = gethostbyname(Address); - if (Host) + hostent* host = gethostbyname(address); + if (host) { // Host found, extract its IP address - myAddress = reinterpret_cast(Host->h_addr)->s_addr; + myAddress = reinterpret_cast(host->h_addr)->s_addr; } else { @@ -105,18 +105,18 @@ IPAddress::IPAddress(const char* Address) //////////////////////////////////////////////////////////// /// Construct the address from 4 bytes //////////////////////////////////////////////////////////// -IPAddress::IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3) +IPAddress::IPAddress(Uint8 byte0, Uint8 byte1, Uint8 byte2, Uint8 byte3) { - myAddress = htonl((Byte0 << 24) | (Byte1 << 16) | (Byte2 << 8) | Byte3); + myAddress = htonl((byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3); } //////////////////////////////////////////////////////////// /// Construct the address from a 32-bits integer //////////////////////////////////////////////////////////// -IPAddress::IPAddress(Uint32 Address) +IPAddress::IPAddress(Uint32 address) { - myAddress = htonl(Address); + myAddress = htonl(address); } @@ -134,10 +134,10 @@ bool IPAddress::IsValid() const //////////////////////////////////////////////////////////// std::string IPAddress::ToString() const { - in_addr InAddr; - InAddr.s_addr = myAddress; + in_addr address; + address.s_addr = myAddress; - return inet_ntoa(InAddr); + return inet_ntoa(address); } @@ -159,49 +159,49 @@ IPAddress IPAddress::GetLocalAddress() // and get the local socket address with the getsockname function. // UDP connection will not send anything to the network, so this function won't cause any overhead. - IPAddress LocalAddress; + IPAddress localAddress; // Create the socket - SocketHelper::SocketType Socket = socket(PF_INET, SOCK_DGRAM, 0); - if (Socket == SocketHelper::InvalidSocket()) - return LocalAddress; + SocketHelper::SocketType sock = socket(PF_INET, SOCK_DGRAM, 0); + if (sock == SocketHelper::InvalidSocket()) + return localAddress; // Build the host address (use a random port) - sockaddr_in SockAddr; - memset(SockAddr.sin_zero, 0, sizeof(SockAddr.sin_zero)); - SockAddr.sin_addr.s_addr = INADDR_LOOPBACK; - SockAddr.sin_family = AF_INET; - SockAddr.sin_port = htons(4567); + sockaddr_in sockAddr; + memset(sockAddr.sin_zero, 0, sizeof(sockAddr.sin_zero)); + sockAddr.sin_addr.s_addr = INADDR_LOOPBACK; + sockAddr.sin_family = AF_INET; + sockAddr.sin_port = htons(4567); // Connect the socket - if (connect(Socket, reinterpret_cast(&SockAddr), sizeof(SockAddr)) == -1) + if (connect(sock, reinterpret_cast(&sockAddr), sizeof(sockAddr)) == -1) { - SocketHelper::Close(Socket); - return LocalAddress; + SocketHelper::Close(sock); + return localAddress; } // Get the local address of the socket connection - SocketHelper::LengthType Size = sizeof(SockAddr); - if (getsockname(Socket, reinterpret_cast(&SockAddr), &Size) == -1) + SocketHelper::LengthType size = sizeof(sockAddr); + if (getsockname(sock, reinterpret_cast(&sockAddr), &size) == -1) { - SocketHelper::Close(Socket); - return LocalAddress; + SocketHelper::Close(sock); + return localAddress; } // Close the socket - SocketHelper::Close(Socket); + SocketHelper::Close(sock); // Finally build the IP address - LocalAddress.myAddress = SockAddr.sin_addr.s_addr; + localAddress.myAddress = sockAddr.sin_addr.s_addr; - return LocalAddress; + return localAddress; } //////////////////////////////////////////////////////////// /// Get the computer's public IP address (from the web point of view) //////////////////////////////////////////////////////////// -IPAddress IPAddress::GetPublicAddress(float Timeout) +IPAddress IPAddress::GetPublicAddress(float timeout) { // The trick here is more complicated, because the only way // to get our public IP address is to get it from a distant computer. @@ -209,11 +209,11 @@ IPAddress IPAddress::GetPublicAddress(float Timeout) // and parse the result to extract our IP address // (not very hard : the web page contains only our IP address). - Http Server("www.sfml-dev.org"); - Http::Request Request(Http::Request::Get, "/ip-provider.php"); - Http::Response Page = Server.SendRequest(Request, Timeout); - if (Page.GetStatus() == Http::Response::Ok) - return IPAddress(Page.GetBody()); + Http server("www.sfml-dev.org"); + Http::Request request(Http::Request::Get, "/ip-provider.php"); + Http::Response page = server.SendRequest(request, timeout); + if (page.GetStatus() == Http::Response::Ok) + return IPAddress(page.GetBody()); // Something failed: return an invalid address return IPAddress(); @@ -223,76 +223,76 @@ IPAddress IPAddress::GetPublicAddress(float Timeout) //////////////////////////////////////////////////////////// /// Comparison operator == //////////////////////////////////////////////////////////// -bool IPAddress::operator ==(const IPAddress& Other) const +bool IPAddress::operator ==(const IPAddress& other) const { - return myAddress == Other.myAddress; + return myAddress == other.myAddress; } //////////////////////////////////////////////////////////// /// Comparison operator != //////////////////////////////////////////////////////////// -bool IPAddress::operator !=(const IPAddress& Other) const +bool IPAddress::operator !=(const IPAddress& other) const { - return myAddress != Other.myAddress; + return myAddress != other.myAddress; } //////////////////////////////////////////////////////////// /// Comparison operator < //////////////////////////////////////////////////////////// -bool IPAddress::operator <(const IPAddress& Other) const +bool IPAddress::operator <(const IPAddress& other) const { - return myAddress < Other.myAddress; + return myAddress < other.myAddress; } //////////////////////////////////////////////////////////// /// Comparison operator > //////////////////////////////////////////////////////////// -bool IPAddress::operator >(const IPAddress& Other) const +bool IPAddress::operator >(const IPAddress& other) const { - return myAddress > Other.myAddress; + return myAddress > other.myAddress; } //////////////////////////////////////////////////////////// /// Comparison operator <= //////////////////////////////////////////////////////////// -bool IPAddress::operator <=(const IPAddress& Other) const +bool IPAddress::operator <=(const IPAddress& other) const { - return myAddress <= Other.myAddress; + return myAddress <= other.myAddress; } //////////////////////////////////////////////////////////// /// Comparison operator >= //////////////////////////////////////////////////////////// -bool IPAddress::operator >=(const IPAddress& Other) const +bool IPAddress::operator >=(const IPAddress& other) const { - return myAddress >= Other.myAddress; + return myAddress >= other.myAddress; } //////////////////////////////////////////////////////////// /// Operator >> overload to extract an address from an input stream //////////////////////////////////////////////////////////// -std::istream& operator >>(std::istream& Stream, IPAddress& Address) +std::istream& operator >>(std::istream& stream, IPAddress& address) { - std::string Str; - Stream >> Str; - Address = IPAddress(Str); + std::string str; + stream >> str; + address = IPAddress(str); - return Stream; + return stream; } //////////////////////////////////////////////////////////// /// Operator << overload to print an address to an output stream //////////////////////////////////////////////////////////// -std::ostream& operator <<(std::ostream& Stream, const IPAddress& Address) +std::ostream& operator <<(std::ostream& stream, const IPAddress& address) { - return Stream << Address.ToString(); + return stream << address.ToString(); } } // namespace sf diff --git a/src/SFML/Network/Packet.cpp b/src/SFML/Network/Packet.cpp index 7eaea501d..df370f223 100644 --- a/src/SFML/Network/Packet.cpp +++ b/src/SFML/Network/Packet.cpp @@ -55,13 +55,13 @@ Packet::~Packet() //////////////////////////////////////////////////////////// /// Append data to the end of the packet //////////////////////////////////////////////////////////// -void Packet::Append(const void* Data, std::size_t SizeInBytes) +void Packet::Append(const void* data, std::size_t sizeInBytes) { - if (Data && (SizeInBytes > 0)) + if (data && (sizeInBytes > 0)) { - std::size_t Start = myData.size(); - myData.resize(Start + SizeInBytes); - memcpy(&myData[Start], Data, SizeInBytes); + std::size_t start = myData.size(); + myData.resize(start + sizeInBytes); + memcpy(&myData[start], data, sizeInBytes); } } @@ -118,165 +118,165 @@ Packet::operator bool() const //////////////////////////////////////////////////////////// /// Operator >> overloads to extract data from the packet //////////////////////////////////////////////////////////// -Packet& Packet::operator >>(bool& Data) +Packet& Packet::operator >>(bool& data) { - Uint8 Value; - if (*this >> Value) - Data = (Value != 0); + Uint8 value; + if (*this >> value) + data = (value != 0); return *this; } -Packet& Packet::operator >>(Int8& Data) +Packet& Packet::operator >>(Int8& data) { - if (CheckSize(sizeof(Data))) + if (CheckSize(sizeof(data))) { - Data = *reinterpret_cast(GetData() + myReadPos); - myReadPos += sizeof(Data); + data = *reinterpret_cast(GetData() + myReadPos); + myReadPos += sizeof(data); } return *this; } -Packet& Packet::operator >>(Uint8& Data) +Packet& Packet::operator >>(Uint8& data) { - if (CheckSize(sizeof(Data))) + if (CheckSize(sizeof(data))) { - Data = *reinterpret_cast(GetData() + myReadPos); - myReadPos += sizeof(Data); + data = *reinterpret_cast(GetData() + myReadPos); + myReadPos += sizeof(data); } return *this; } -Packet& Packet::operator >>(Int16& Data) +Packet& Packet::operator >>(Int16& data) { - if (CheckSize(sizeof(Data))) + if (CheckSize(sizeof(data))) { - Data = ntohs(*reinterpret_cast(GetData() + myReadPos)); - myReadPos += sizeof(Data); + data = ntohs(*reinterpret_cast(GetData() + myReadPos)); + myReadPos += sizeof(data); } return *this; } -Packet& Packet::operator >>(Uint16& Data) +Packet& Packet::operator >>(Uint16& data) { - if (CheckSize(sizeof(Data))) + if (CheckSize(sizeof(data))) { - Data = ntohs(*reinterpret_cast(GetData() + myReadPos)); - myReadPos += sizeof(Data); + data = ntohs(*reinterpret_cast(GetData() + myReadPos)); + myReadPos += sizeof(data); } return *this; } -Packet& Packet::operator >>(Int32& Data) +Packet& Packet::operator >>(Int32& data) { - if (CheckSize(sizeof(Data))) + if (CheckSize(sizeof(data))) { - Data = ntohl(*reinterpret_cast(GetData() + myReadPos)); - myReadPos += sizeof(Data); + data = ntohl(*reinterpret_cast(GetData() + myReadPos)); + myReadPos += sizeof(data); } return *this; } -Packet& Packet::operator >>(Uint32& Data) +Packet& Packet::operator >>(Uint32& data) { - if (CheckSize(sizeof(Data))) + if (CheckSize(sizeof(data))) { - Data = ntohl(*reinterpret_cast(GetData() + myReadPos)); - myReadPos += sizeof(Data); + data = ntohl(*reinterpret_cast(GetData() + myReadPos)); + myReadPos += sizeof(data); } return *this; } -Packet& Packet::operator >>(float& Data) +Packet& Packet::operator >>(float& data) { - if (CheckSize(sizeof(Data))) + if (CheckSize(sizeof(data))) { - Data = *reinterpret_cast(GetData() + myReadPos); - myReadPos += sizeof(Data); + data = *reinterpret_cast(GetData() + myReadPos); + myReadPos += sizeof(data); } return *this; } -Packet& Packet::operator >>(double& Data) +Packet& Packet::operator >>(double& data) { - if (CheckSize(sizeof(Data))) + if (CheckSize(sizeof(data))) { - Data = *reinterpret_cast(GetData() + myReadPos); - myReadPos += sizeof(Data); + data = *reinterpret_cast(GetData() + myReadPos); + myReadPos += sizeof(data); } return *this; } -Packet& Packet::operator >>(char* Data) +Packet& Packet::operator >>(char* data) { // First extract string length - Uint32 Length; - *this >> Length; + Uint32 length; + *this >> length; - if ((Length > 0) && CheckSize(Length)) + if ((length > 0) && CheckSize(length)) { // Then extract characters - memcpy(Data, GetData() + myReadPos, Length); - Data[Length] = '\0'; + memcpy(data, GetData() + myReadPos, length); + data[length] = '\0'; // Update reading position - myReadPos += Length; + myReadPos += length; } return *this; } -Packet& Packet::operator >>(std::string& Data) +Packet& Packet::operator >>(std::string& data) { // First extract string length - Uint32 Length; - *this >> Length; + Uint32 length; + *this >> length; - Data.clear(); - if ((Length > 0) && CheckSize(Length)) + data.clear(); + if ((length > 0) && CheckSize(length)) { // Then extract characters - Data.assign(GetData() + myReadPos, Length); + data.assign(GetData() + myReadPos, length); // Update reading position - myReadPos += Length; + myReadPos += length; } return *this; } -Packet& Packet::operator >>(wchar_t* Data) +Packet& Packet::operator >>(wchar_t* data) { // First extract string length - Uint32 Length; - *this >> Length; + Uint32 length; + *this >> length; - if ((Length > 0) && CheckSize(Length * sizeof(Int32))) + if ((length > 0) && CheckSize(length * sizeof(Int32))) { // Then extract characters - for (Uint32 i = 0; i < Length; ++i) + for (Uint32 i = 0; i < length; ++i) { - Uint32 c; - *this >> c; - Data[i] = static_cast(c); + Uint32 character; + *this >> character; + data[i] = static_cast(character); } - Data[Length] = L'\0'; + data[length] = L'\0'; } return *this; } -Packet& Packet::operator >>(std::wstring& Data) +Packet& Packet::operator >>(std::wstring& data) { // First extract string length - Uint32 Length; - *this >> Length; + Uint32 length; + *this >> length; - Data.clear(); - if ((Length > 0) && CheckSize(Length * sizeof(Int32))) + data.clear(); + if ((length > 0) && CheckSize(length * sizeof(Int32))) { // Then extract characters - for (Uint32 i = 0; i < Length; ++i) + for (Uint32 i = 0; i < length; ++i) { - Uint32 c; - *this >> c; - Data += static_cast(c); + Uint32 character; + *this >> character; + data += static_cast(character); } } @@ -287,106 +287,106 @@ Packet& Packet::operator >>(std::wstring& Data) //////////////////////////////////////////////////////////// /// Operator << overloads to put data into the packet //////////////////////////////////////////////////////////// -Packet& Packet::operator <<(bool Data) +Packet& Packet::operator <<(bool data) { - *this << static_cast(Data); + *this << static_cast(data); return *this; } -Packet& Packet::operator <<(Int8 Data) +Packet& Packet::operator <<(Int8 data) { - Append(&Data, sizeof(Data)); + Append(&data, sizeof(data)); return *this; } -Packet& Packet::operator <<(Uint8 Data) +Packet& Packet::operator <<(Uint8 data) { - Append(&Data, sizeof(Data)); + Append(&data, sizeof(data)); return *this; } -Packet& Packet::operator <<(Int16 Data) +Packet& Packet::operator <<(Int16 data) { - Int16 ToWrite = htons(Data); - Append(&ToWrite, sizeof(ToWrite)); + Int16 toWrite = htons(data); + Append(&toWrite, sizeof(toWrite)); return *this; } -Packet& Packet::operator <<(Uint16 Data) +Packet& Packet::operator <<(Uint16 data) { - Uint16 ToWrite = htons(Data); - Append(&ToWrite, sizeof(ToWrite)); + Uint16 toWrite = htons(data); + Append(&toWrite, sizeof(toWrite)); return *this; } -Packet& Packet::operator <<(Int32 Data) +Packet& Packet::operator <<(Int32 data) { - Int32 ToWrite = htonl(Data); - Append(&ToWrite, sizeof(ToWrite)); + Int32 toWrite = htonl(data); + Append(&toWrite, sizeof(toWrite)); return *this; } -Packet& Packet::operator <<(Uint32 Data) +Packet& Packet::operator <<(Uint32 data) { - Uint32 ToWrite = htonl(Data); - Append(&ToWrite, sizeof(ToWrite)); + Uint32 toWrite = htonl(data); + Append(&toWrite, sizeof(toWrite)); return *this; } -Packet& Packet::operator <<(float Data) +Packet& Packet::operator <<(float data) { - Append(&Data, sizeof(Data)); + Append(&data, sizeof(data)); return *this; } -Packet& Packet::operator <<(double Data) +Packet& Packet::operator <<(double data) { - Append(&Data, sizeof(Data)); + Append(&data, sizeof(data)); return *this; } -Packet& Packet::operator <<(const char* Data) +Packet& Packet::operator <<(const char* data) { // First insert string length - Uint32 Length = 0; - for (const char* c = Data; *c != '\0'; ++c) - ++Length; - *this << Length; + Uint32 length = 0; + for (const char* c = data; *c != '\0'; ++c) + ++length; + *this << length; // Then insert characters - Append(Data, Length * sizeof(char)); + Append(data, length * sizeof(char)); return *this; } -Packet& Packet::operator <<(const std::string& Data) +Packet& Packet::operator <<(const std::string& data) { // First insert string length - Uint32 Length = static_cast(Data.size()); - *this << Length; + Uint32 length = static_cast(data.size()); + *this << length; // Then insert characters - if (Length > 0) + if (length > 0) { - Append(Data.c_str(), Length * sizeof(std::string::value_type)); + Append(data.c_str(), length * sizeof(std::string::value_type)); } return *this; } -Packet& Packet::operator <<(const wchar_t* Data) +Packet& Packet::operator <<(const wchar_t* data) { // First insert string length - Uint32 Length = 0; - for (const wchar_t* c = Data; *c != L'\0'; ++c) - ++Length; - *this << Length; + Uint32 length = 0; + for (const wchar_t* c = data; *c != L'\0'; ++c) + ++length; + *this << length; // Then insert characters - for (const wchar_t* c = Data; *c != L'\0'; ++c) + for (const wchar_t* c = data; *c != L'\0'; ++c) *this << static_cast(*c); return *this; } -Packet& Packet::operator <<(const std::wstring& Data) +Packet& Packet::operator <<(const std::wstring& data) { // First insert string length - Uint32 Length = static_cast(Data.size()); - *this << Length; + Uint32 length = static_cast(data.size()); + *this << length; // Then insert characters - if (Length > 0) + if (length > 0) { - for (std::wstring::const_iterator c = Data.begin(); c != Data.end(); ++c) + for (std::wstring::const_iterator c = data.begin(); c != data.end(); ++c) *this << static_cast(*c); } @@ -397,9 +397,9 @@ Packet& Packet::operator <<(const std::wstring& Data) //////////////////////////////////////////////////////////// /// Check if the packet can extract a given size of bytes //////////////////////////////////////////////////////////// -bool Packet::CheckSize(std::size_t Size) +bool Packet::CheckSize(std::size_t size) { - myIsValid = myIsValid && (myReadPos + Size <= myData.size()); + myIsValid = myIsValid && (myReadPos + size <= myData.size()); return myIsValid; } @@ -408,9 +408,9 @@ bool Packet::CheckSize(std::size_t Size) //////////////////////////////////////////////////////////// /// Called before the packet is sent to the network //////////////////////////////////////////////////////////// -const char* Packet::OnSend(std::size_t& DataSize) +const char* Packet::OnSend(std::size_t& dataSize) { - DataSize = GetDataSize(); + dataSize = GetDataSize(); return GetData(); } @@ -418,9 +418,9 @@ const char* Packet::OnSend(std::size_t& DataSize) //////////////////////////////////////////////////////////// /// Called after the packet has been received from the network //////////////////////////////////////////////////////////// -void Packet::OnReceive(const char* Data, std::size_t DataSize) +void Packet::OnReceive(const char* data, std::size_t dataSize) { - Append(Data, DataSize); + Append(data, dataSize); } } // namespace sf diff --git a/src/SFML/Network/SelectorBase.cpp b/src/SFML/Network/SelectorBase.cpp index eeca707d2..9e7b2f4e2 100644 --- a/src/SFML/Network/SelectorBase.cpp +++ b/src/SFML/Network/SelectorBase.cpp @@ -47,22 +47,22 @@ myMaxSocket(0) //////////////////////////////////////////////////////////// /// Add a socket to watch //////////////////////////////////////////////////////////// -void SelectorBase::Add(SocketHelper::SocketType Socket) +void SelectorBase::Add(SocketHelper::SocketType socket) { - FD_SET(Socket, &mySet); + FD_SET(socket, &mySet); - int Size = static_cast(Socket); - if (Size > myMaxSocket) - myMaxSocket = Size; + int size = static_cast(socket); + if (size > myMaxSocket) + myMaxSocket = size; } //////////////////////////////////////////////////////////// /// Remove a socket //////////////////////////////////////////////////////////// -void SelectorBase::Remove(SocketHelper::SocketType Socket) +void SelectorBase::Remove(SocketHelper::SocketType socket) { - FD_CLR(Socket, &mySet); + FD_CLR(socket, &mySet); } @@ -83,20 +83,20 @@ void SelectorBase::Clear() /// This functions will return either when at least one socket /// is ready, or when the given time is out //////////////////////////////////////////////////////////// -unsigned int SelectorBase::Wait(float Timeout) +unsigned int SelectorBase::Wait(float timeout) { // Setup the timeout structure - timeval Time; - Time.tv_sec = static_cast(Timeout); - Time.tv_usec = (static_cast(Timeout * 1000) % 1000) * 1000; + timeval time; + time.tv_sec = static_cast(timeout); + time.tv_usec = (static_cast(timeout * 1000) % 1000) * 1000; // Prepare the set of sockets to return mySetReady = mySet; // Wait until one of the sockets is ready for reading, or timeout is reached - int NbSockets = select(myMaxSocket + 1, &mySetReady, NULL, NULL, Timeout > 0 ? &Time : NULL); + int nbSockets = select(myMaxSocket + 1, &mySetReady, NULL, NULL, timeout > 0 ? &time : NULL); - return NbSockets >= 0 ? static_cast(NbSockets) : 0; + return nbSockets >= 0 ? static_cast(nbSockets) : 0; } @@ -105,7 +105,7 @@ unsigned int SelectorBase::Wait(float Timeout) /// ready for reading. The total number of sockets ready /// is the integer returned by the previous call to Wait() //////////////////////////////////////////////////////////// -SocketHelper::SocketType SelectorBase::GetSocketReady(unsigned int Index) +SocketHelper::SocketType SelectorBase::GetSocketReady(unsigned int index) { // The standard FD_xxx interface doesn't define a direct access, // so we must go through the whole set to find the socket we're looking for @@ -113,10 +113,10 @@ SocketHelper::SocketType SelectorBase::GetSocketReady(unsigned int Index) { if (FD_ISSET(i, &mySetReady)) { - // Current socket is ready, but is it the Index-th one ? - if (Index > 0) + // Current socket is ready, but is it the index-th one ? + if (index > 0) { - Index--; + index--; } else { diff --git a/src/SFML/Network/SocketTCP.cpp b/src/SFML/Network/SocketTCP.cpp index 03d96d3bc..e5f24989f 100644 --- a/src/SFML/Network/SocketTCP.cpp +++ b/src/SFML/Network/SocketTCP.cpp @@ -53,38 +53,38 @@ SocketTCP::SocketTCP() //////////////////////////////////////////////////////////// /// Change the blocking state of the socket //////////////////////////////////////////////////////////// -void SocketTCP::SetBlocking(bool Blocking) +void SocketTCP::SetBlocking(bool blocking) { // Make sure our socket is valid if (!IsValid()) Create(); - SocketHelper::SetBlocking(mySocket, Blocking); - myIsBlocking = Blocking; + SocketHelper::SetBlocking(mySocket, blocking); + myIsBlocking = blocking; } //////////////////////////////////////////////////////////// /// Connect to another computer on a specified port //////////////////////////////////////////////////////////// -Socket::Status SocketTCP::Connect(unsigned short Port, const IPAddress& HostAddress, float Timeout) +Socket::Status SocketTCP::Connect(unsigned short port, const IPAddress& host, float timeout) { // Make sure our socket is valid if (!IsValid()) Create(); // Build the host address - sockaddr_in SockAddr; - memset(SockAddr.sin_zero, 0, sizeof(SockAddr.sin_zero)); - SockAddr.sin_addr.s_addr = inet_addr(HostAddress.ToString().c_str()); - SockAddr.sin_family = AF_INET; - SockAddr.sin_port = htons(Port); + sockaddr_in sockAddr; + memset(sockAddr.sin_zero, 0, sizeof(sockAddr.sin_zero)); + sockAddr.sin_addr.s_addr = inet_addr(host.ToString().c_str()); + sockAddr.sin_family = AF_INET; + sockAddr.sin_port = htons(port); - if (Timeout <= 0) + if (timeout <= 0) { // ----- We're not using a timeout : just try to connect ----- - if (connect(mySocket, reinterpret_cast(&SockAddr), sizeof(SockAddr)) == -1) + if (connect(mySocket, reinterpret_cast(&sockAddr), sizeof(sockAddr)) == -1) { // Failed to connect return SocketHelper::GetErrorStatus(); @@ -98,56 +98,56 @@ Socket::Status SocketTCP::Connect(unsigned short Port, const IPAddress& HostAddr // ----- We're using a timeout : we'll need a few tricks to make it work ----- // Save the previous blocking state - bool IsBlocking = myIsBlocking; + bool blocking = myIsBlocking; // Switch to non-blocking to enable our connection timeout - if (IsBlocking) + if (blocking) SetBlocking(false); // Try to connect to host - if (connect(mySocket, reinterpret_cast(&SockAddr), sizeof(SockAddr)) >= 0) + if (connect(mySocket, reinterpret_cast(&sockAddr), sizeof(sockAddr)) >= 0) { // We got instantly connected! (it may no happen a lot...) return Socket::Done; } // Get the error status - Socket::Status Status = SocketHelper::GetErrorStatus(); + Socket::Status status = SocketHelper::GetErrorStatus(); // If we were in non-blocking mode, return immediatly - if (!IsBlocking) - return Status; + if (!blocking) + return status; // Otherwise, wait until something happens to our socket (success, timeout or error) - if (Status == Socket::NotReady) + if (status == Socket::NotReady) { // Setup the selector - fd_set Selector; - FD_ZERO(&Selector); - FD_SET(mySocket, &Selector); + fd_set selector; + FD_ZERO(&selector); + FD_SET(mySocket, &selector); // Setup the timeout - timeval Time; - Time.tv_sec = static_cast(Timeout); - Time.tv_usec = (static_cast(Timeout * 1000) % 1000) * 1000; + timeval time; + time.tv_sec = static_cast(timeout); + time.tv_usec = (static_cast(timeout * 1000) % 1000) * 1000; // Wait for something to write on our socket (would mean the connection has been accepted) - if (select(static_cast(mySocket + 1), NULL, &Selector, NULL, &Time) > 0) + if (select(static_cast(mySocket + 1), NULL, &selector, NULL, &time) > 0) { // Connection succeeded - Status = Socket::Done; + status = Socket::Done; } else { // Failed to connect before timeout is over - Status = SocketHelper::GetErrorStatus(); + status = SocketHelper::GetErrorStatus(); } } // Switch back to blocking mode SetBlocking(true); - return Status; + return status; } } @@ -155,24 +155,24 @@ Socket::Status SocketTCP::Connect(unsigned short Port, const IPAddress& HostAddr //////////////////////////////////////////////////////////// /// Listen to a specified port for incoming data or connections //////////////////////////////////////////////////////////// -bool SocketTCP::Listen(unsigned short Port) +bool SocketTCP::Listen(unsigned short port) { // Make sure our socket is valid if (!IsValid()) Create(); // Build the address - sockaddr_in SockAddr; - memset(SockAddr.sin_zero, 0, sizeof(SockAddr.sin_zero)); - SockAddr.sin_addr.s_addr = htonl(INADDR_ANY); - SockAddr.sin_family = AF_INET; - SockAddr.sin_port = htons(Port); + sockaddr_in sockAddr; + memset(sockAddr.sin_zero, 0, sizeof(sockAddr.sin_zero)); + sockAddr.sin_addr.s_addr = htonl(INADDR_ANY); + sockAddr.sin_family = AF_INET; + sockAddr.sin_port = htons(port); // Bind the socket to the specified port - if (bind(mySocket, reinterpret_cast(&SockAddr), sizeof(SockAddr)) == -1) + if (bind(mySocket, reinterpret_cast(&sockAddr), sizeof(sockAddr)) == -1) { // Not likely to happen, but... - std::cerr << "Failed to bind socket to port " << Port << std::endl; + std::cerr << "Failed to bind socket to port " << port << std::endl; return false; } @@ -180,7 +180,7 @@ bool SocketTCP::Listen(unsigned short Port) if (listen(mySocket, 0) == -1) { // Oops, socket is deaf - std::cerr << "Failed to listen to port " << Port << std::endl; + std::cerr << "Failed to listen to port " << port << std::endl; return false; } @@ -192,27 +192,27 @@ bool SocketTCP::Listen(unsigned short Port) /// Wait for a connection (must be listening to a port). /// This function will block if the socket is blocking //////////////////////////////////////////////////////////// -Socket::Status SocketTCP::Accept(SocketTCP& Connected, IPAddress* Address) +Socket::Status SocketTCP::Accept(SocketTCP& connected, IPAddress* address) { // Address that will be filled with client informations - sockaddr_in ClientAddress; - SocketHelper::LengthType Length = sizeof(ClientAddress); + sockaddr_in clientAddress; + SocketHelper::LengthType length = sizeof(clientAddress); // Accept a new connection - Connected = accept(mySocket, reinterpret_cast(&ClientAddress), &Length); + connected = accept(mySocket, reinterpret_cast(&clientAddress), &length); // Check errors - if (!Connected.IsValid()) + if (!connected.IsValid()) { - if (Address) - *Address = IPAddress(); + if (address) + *address = IPAddress(); return SocketHelper::GetErrorStatus(); } // Fill address if requested - if (Address) - *Address = IPAddress(inet_ntoa(ClientAddress.sin_addr)); + if (address) + *address = IPAddress(inet_ntoa(clientAddress.sin_addr)); return Socket::Done; } @@ -221,25 +221,25 @@ Socket::Status SocketTCP::Accept(SocketTCP& Connected, IPAddress* Address) //////////////////////////////////////////////////////////// /// Send an array of bytes to the host (must be connected first) //////////////////////////////////////////////////////////// -Socket::Status SocketTCP::Send(const char* Data, std::size_t Size) +Socket::Status SocketTCP::Send(const char* data, std::size_t size) { // First check that socket is valid if (!IsValid()) return Socket::Error; // Check parameters - if (Data && Size) + if (data && size) { // Loop until every byte has been sent - int Sent = 0; - int SizeToSend = static_cast(Size); - for (int Length = 0; Length < SizeToSend; Length += Sent) + int sent = 0; + int sizeToSend = static_cast(size); + for (int length = 0; length < sizeToSend; length += sent) { // Send a chunk of data - Sent = send(mySocket, Data + Length, SizeToSend - Length, 0); + sent = send(mySocket, data + length, sizeToSend - length, 0); // Check if an error occured - if (Sent <= 0) + if (sent <= 0) return SocketHelper::GetErrorStatus(); } @@ -258,28 +258,28 @@ Socket::Status SocketTCP::Send(const char* Data, std::size_t Size) /// Receive an array of bytes from the host (must be connected first). /// This function will block if the socket is blocking //////////////////////////////////////////////////////////// -Socket::Status SocketTCP::Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived) +Socket::Status SocketTCP::Receive(char* data, std::size_t maxSize, std::size_t& sizeReceived) { // First clear the size received - SizeReceived = 0; + sizeReceived = 0; // Check that socket is valid if (!IsValid()) return Socket::Error; // Check parameters - if (Data && MaxSize) + if (data && maxSize) { // Receive a chunk of bytes - int Received = recv(mySocket, Data, static_cast(MaxSize), 0); + int received = recv(mySocket, data, static_cast(maxSize), 0); // Check the number of bytes received - if (Received > 0) + if (received > 0) { - SizeReceived = static_cast(Received); + sizeReceived = static_cast(received); return Socket::Done; } - else if (Received == 0) + else if (received == 0) { return Socket::Disconnected; } @@ -300,20 +300,20 @@ Socket::Status SocketTCP::Receive(char* Data, std::size_t MaxSize, std::size_t& //////////////////////////////////////////////////////////// /// Send a packet of data to the host (must be connected first) //////////////////////////////////////////////////////////// -Socket::Status SocketTCP::Send(Packet& PacketToSend) +Socket::Status SocketTCP::Send(Packet& packet) { // Get the data to send from the packet - std::size_t DataSize = 0; - const char* Data = PacketToSend.OnSend(DataSize); + std::size_t dataSize = 0; + const char* data = packet.OnSend(dataSize); // Send the packet size - Uint32 PacketSize = htonl(static_cast(DataSize)); - Send(reinterpret_cast(&PacketSize), sizeof(PacketSize)); + Uint32 packetSize = htonl(static_cast(dataSize)); + Send(reinterpret_cast(&packetSize), sizeof(packetSize)); // Send the packet data - if (PacketSize > 0) + if (packetSize > 0) { - return Send(Data, DataSize); + return Send(data, dataSize); } else { @@ -326,53 +326,53 @@ Socket::Status SocketTCP::Send(Packet& PacketToSend) /// Receive a packet from the host (must be connected first). /// This function will block if the socket is blocking //////////////////////////////////////////////////////////// -Socket::Status SocketTCP::Receive(Packet& PacketToReceive) +Socket::Status SocketTCP::Receive(Packet& packet) { // We start by getting the size of the incoming packet - Uint32 PacketSize = 0; - std::size_t Received = 0; + Uint32 packetSize = 0; + std::size_t received = 0; if (myPendingPacketSize < 0) { - Socket::Status Status = Receive(reinterpret_cast(&PacketSize), sizeof(PacketSize), Received); - if (Status != Socket::Done) - return Status; + Socket::Status status = Receive(reinterpret_cast(&packetSize), sizeof(packetSize), received); + if (status != Socket::Done) + return status; - PacketSize = ntohl(PacketSize); + packetSize = ntohl(packetSize); } else { // There is a pending packet : we already know its size - PacketSize = myPendingPacketSize; + packetSize = myPendingPacketSize; } // Then loop until we receive all the packet data - char Buffer[1024]; - while (myPendingPacket.size() < PacketSize) + char buffer[1024]; + while (myPendingPacket.size() < packetSize) { // Receive a chunk of data - std::size_t SizeToGet = std::min(static_cast(PacketSize - myPendingPacket.size()), sizeof(Buffer)); - Socket::Status Status = Receive(Buffer, SizeToGet, Received); - if (Status != Socket::Done) + std::size_t sizeToGet = std::min(static_cast(packetSize - myPendingPacket.size()), sizeof(buffer)); + Socket::Status status = Receive(buffer, sizeToGet, received); + if (status != Socket::Done) { // We must save the size of the pending packet until we can receive its content - if (Status == Socket::NotReady) - myPendingPacketSize = PacketSize; - return Status; + if (status == Socket::NotReady) + myPendingPacketSize = packetSize; + return status; } // Append it into the packet - if (Received > 0) + if (received > 0) { - myPendingPacket.resize(myPendingPacket.size() + Received); - char* Begin = &myPendingPacket[0] + myPendingPacket.size() - Received; - memcpy(Begin, Buffer, Received); + myPendingPacket.resize(myPendingPacket.size() + received); + char* begin = &myPendingPacket[0] + myPendingPacket.size() - received; + memcpy(begin, buffer, received); } } // We have received all the datas : we can copy it to the user packet, and clear our internal packet - PacketToReceive.Clear(); + packet.Clear(); if (!myPendingPacket.empty()) - PacketToReceive.OnReceive(&myPendingPacket[0], myPendingPacket.size()); + packet.OnReceive(&myPendingPacket[0], myPendingPacket.size()); myPendingPacket.clear(); myPendingPacketSize = -1; @@ -415,18 +415,18 @@ bool SocketTCP::IsValid() const //////////////////////////////////////////////////////////// /// Comparison operator == //////////////////////////////////////////////////////////// -bool SocketTCP::operator ==(const SocketTCP& Other) const +bool SocketTCP::operator ==(const SocketTCP& other) const { - return mySocket == Other.mySocket; + return mySocket == other.mySocket; } //////////////////////////////////////////////////////////// /// Comparison operator != //////////////////////////////////////////////////////////// -bool SocketTCP::operator !=(const SocketTCP& Other) const +bool SocketTCP::operator !=(const SocketTCP& other) const { - return mySocket != Other.mySocket; + return mySocket != other.mySocket; } @@ -435,9 +435,9 @@ bool SocketTCP::operator !=(const SocketTCP& Other) const /// Provided for compatibility with standard containers, as /// comparing two sockets doesn't make much sense... //////////////////////////////////////////////////////////// -bool SocketTCP::operator <(const SocketTCP& Other) const +bool SocketTCP::operator <(const SocketTCP& other) const { - return mySocket < Other.mySocket; + return mySocket < other.mySocket; } @@ -445,19 +445,19 @@ bool SocketTCP::operator <(const SocketTCP& Other) const /// Construct the socket from a socket descriptor /// (for internal use only) //////////////////////////////////////////////////////////// -SocketTCP::SocketTCP(SocketHelper::SocketType Descriptor) +SocketTCP::SocketTCP(SocketHelper::SocketType descriptor) { - Create(Descriptor); + Create(descriptor); } //////////////////////////////////////////////////////////// /// Create the socket //////////////////////////////////////////////////////////// -void SocketTCP::Create(SocketHelper::SocketType Descriptor) +void SocketTCP::Create(SocketHelper::SocketType descriptor) { // Use the given socket descriptor, or get a new one - mySocket = Descriptor ? Descriptor : socket(PF_INET, SOCK_STREAM, 0); + mySocket = descriptor ? descriptor : socket(PF_INET, SOCK_STREAM, 0); myIsBlocking = true; // Reset the pending packet @@ -468,15 +468,15 @@ void SocketTCP::Create(SocketHelper::SocketType Descriptor) if (IsValid()) { // To avoid the "Address already in use" error message when trying to bind to the same port - int Yes = 1; - if (setsockopt(mySocket, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast(&Yes), sizeof(Yes)) == -1) + int yes = 1; + if (setsockopt(mySocket, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast(&yes), sizeof(yes)) == -1) { std::cerr << "Failed to set socket option \"SO_REUSEADDR\" ; " << "binding to a same port may fail if too fast" << std::endl; } // Disable the Nagle algorithm (ie. removes buffering of TCP packets) - if (setsockopt(mySocket, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&Yes), sizeof(Yes)) == -1) + if (setsockopt(mySocket, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&yes), sizeof(yes)) == -1) { std::cerr << "Failed to set socket option \"TCP_NODELAY\" ; " << "all your TCP packets will be buffered" << std::endl; diff --git a/src/SFML/Network/SocketUDP.cpp b/src/SFML/Network/SocketUDP.cpp index 0c977cdcb..cda58288f 100644 --- a/src/SFML/Network/SocketUDP.cpp +++ b/src/SFML/Network/SocketUDP.cpp @@ -47,48 +47,48 @@ SocketUDP::SocketUDP() //////////////////////////////////////////////////////////// /// Change the blocking state of the socket //////////////////////////////////////////////////////////// -void SocketUDP::SetBlocking(bool Blocking) +void SocketUDP::SetBlocking(bool blocking) { // Make sure our socket is valid if (!IsValid()) Create(); - SocketHelper::SetBlocking(mySocket, Blocking); - myIsBlocking = Blocking; + SocketHelper::SetBlocking(mySocket, blocking); + myIsBlocking = blocking; } //////////////////////////////////////////////////////////// /// Bind the socket to a specific port //////////////////////////////////////////////////////////// -bool SocketUDP::Bind(unsigned short Port) +bool SocketUDP::Bind(unsigned short port) { // Check if the socket is already bound to the specified port - if (myPort != Port) + if (myPort != port) { // If the socket was previously bound to another port, we need to unbind it first Unbind(); - if (Port != 0) + if (port != 0) { // Build an address with the specified port - sockaddr_in Addr; - Addr.sin_family = AF_INET; - Addr.sin_port = htons(Port); - Addr.sin_addr.s_addr = INADDR_ANY; - memset(Addr.sin_zero, 0, sizeof(Addr.sin_zero)); + sockaddr_in sockAddr; + sockAddr.sin_family = AF_INET; + sockAddr.sin_port = htons(port); + sockAddr.sin_addr.s_addr = INADDR_ANY; + memset(sockAddr.sin_zero, 0, sizeof(sockAddr.sin_zero)); // Bind the socket to the port - if (bind(mySocket, reinterpret_cast(&Addr), sizeof(Addr)) == -1) + if (bind(mySocket, reinterpret_cast(&sockAddr), sizeof(sockAddr)) == -1) { - std::cerr << "Failed to bind the socket to port " << Port << std::endl; + std::cerr << "Failed to bind the socket to port " << port << std::endl; myPort = 0; return false; } } // Save the new port - myPort = Port; + myPort = port; } return true; @@ -115,32 +115,32 @@ bool SocketUDP::Unbind() //////////////////////////////////////////////////////////// /// Send an array of bytes //////////////////////////////////////////////////////////// -Socket::Status SocketUDP::Send(const char* Data, std::size_t Size, const IPAddress& Address, unsigned short Port) +Socket::Status SocketUDP::Send(const char* data, std::size_t size, const IPAddress& address, unsigned short port) { // Make sure the socket is valid if (!IsValid()) Create(); // Check parameters - if (Data && Size) + if (data && size) { // Build the target address - sockaddr_in Target; - Target.sin_family = AF_INET; - Target.sin_port = htons(Port); - Target.sin_addr.s_addr = inet_addr(Address.ToString().c_str()); - memset(Target.sin_zero, 0, sizeof(Target.sin_zero)); + sockaddr_in sockAddr; + sockAddr.sin_family = AF_INET; + sockAddr.sin_port = htons(port); + sockAddr.sin_addr.s_addr = inet_addr(address.ToString().c_str()); + memset(sockAddr.sin_zero, 0, sizeof(sockAddr.sin_zero)); // Loop until every byte has been sent - int Sent = 0; - int SizeToSend = static_cast(Size); - for (int Length = 0; Length < SizeToSend; Length += Sent) + int sent = 0; + int sizeToSend = static_cast(size); + for (int length = 0; length < sizeToSend; length += sent) { // Send a chunk of data - Sent = sendto(mySocket, Data + Length, SizeToSend - Length, 0, reinterpret_cast(&Target), sizeof(Target)); + sent = sendto(mySocket, data + length, sizeToSend - length, 0, reinterpret_cast(&sockAddr), sizeof(sockAddr)); // Check errors - if (Sent <= 0) + if (sent <= 0) return SocketHelper::GetErrorStatus(); } @@ -159,10 +159,10 @@ Socket::Status SocketUDP::Send(const char* Data, std::size_t Size, const IPAddre /// Receive an array of bytes. /// This function will block if the socket is blocking //////////////////////////////////////////////////////////// -Socket::Status SocketUDP::Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived, IPAddress& Address, unsigned short& Port) +Socket::Status SocketUDP::Receive(char* data, std::size_t maxSize, std::size_t& sizeReceived, IPAddress& address, unsigned short& port) { // First clear the size received - SizeReceived = 0; + sizeReceived = 0; // Make sure the socket is bound to a port if (myPort == 0) @@ -176,32 +176,32 @@ Socket::Status SocketUDP::Receive(char* Data, std::size_t MaxSize, std::size_t& Create(); // Check parameters - if (Data && MaxSize) + if (data && maxSize) { // Data that will be filled with the other computer's address - sockaddr_in Sender; - Sender.sin_family = AF_INET; - Sender.sin_port = 0; - Sender.sin_addr.s_addr = INADDR_ANY; - memset(Sender.sin_zero, 0, sizeof(Sender.sin_zero)); - SocketHelper::LengthType SenderSize = sizeof(Sender); + sockaddr_in sockAddr; + sockAddr.sin_family = AF_INET; + sockAddr.sin_port = 0; + sockAddr.sin_addr.s_addr = INADDR_ANY; + memset(sockAddr.sin_zero, 0, sizeof(sockAddr.sin_zero)); + SocketHelper::LengthType sockAddrSize = sizeof(sockAddr); // Receive a chunk of bytes - int Received = recvfrom(mySocket, Data, static_cast(MaxSize), 0, reinterpret_cast(&Sender), &SenderSize); + int received = recvfrom(mySocket, data, static_cast(maxSize), 0, reinterpret_cast(&sockAddr), &sockAddrSize); // Check the number of bytes received - if (Received > 0) + if (received > 0) { - Address = IPAddress(inet_ntoa(Sender.sin_addr)); - Port = ntohs(Sender.sin_port); - SizeReceived = static_cast(Received); + address = IPAddress(inet_ntoa(sockAddr.sin_addr)); + port = ntohs(sockAddr.sin_port); + sizeReceived = static_cast(received); return Socket::Done; } else { - Address = IPAddress(); - Port = 0; - return Received == 0 ? Socket::Disconnected : SocketHelper::GetErrorStatus(); + address = IPAddress(); + port = 0; + return received == 0 ? Socket::Disconnected : SocketHelper::GetErrorStatus(); } } else @@ -216,20 +216,20 @@ Socket::Status SocketUDP::Receive(char* Data, std::size_t MaxSize, std::size_t& //////////////////////////////////////////////////////////// /// Send a packet of data //////////////////////////////////////////////////////////// -Socket::Status SocketUDP::Send(Packet& PacketToSend, const IPAddress& Address, unsigned short Port) +Socket::Status SocketUDP::Send(Packet& packet, const IPAddress& address, unsigned short port) { // Get the data to send from the packet - std::size_t DataSize = 0; - const char* Data = PacketToSend.OnSend(DataSize); + std::size_t dataSize = 0; + const char* data = packet.OnSend(dataSize); // Send the packet size - Uint32 PacketSize = htonl(static_cast(DataSize)); - Send(reinterpret_cast(&PacketSize), sizeof(PacketSize), Address, Port); + Uint32 packetSize = htonl(static_cast(dataSize)); + Send(reinterpret_cast(&packetSize), sizeof(packetSize), address, port); // Send the packet data - if (PacketSize > 0) + if (packetSize > 0) { - return Send(Data, DataSize, Address, Port); + return Send(data, dataSize, address, port); } else { @@ -242,65 +242,65 @@ Socket::Status SocketUDP::Send(Packet& PacketToSend, const IPAddress& Address, u /// Receive a packet. /// This function will block if the socket is blocking //////////////////////////////////////////////////////////// -Socket::Status SocketUDP::Receive(Packet& PacketToReceive, IPAddress& Address, unsigned short& Port) +Socket::Status SocketUDP::Receive(Packet& packet, IPAddress& address, unsigned short& port) { // This is not safe at all, as data can be lost, duplicated, or arrive in a different order. // So if a packet is split into more than one chunk, nobody knows what could happen... // Conclusion : we shouldn't use packets with UDP, unless we build a more complex protocol on top of it. // We start by getting the size of the incoming packet - Uint32 PacketSize = 0; - std::size_t Received = 0; + Uint32 packetSize = 0; + std::size_t received = 0; if (myPendingPacketSize < 0) { - Socket::Status Status = Receive(reinterpret_cast(&PacketSize), sizeof(PacketSize), Received, Address, Port); - if (Status != Socket::Done) - return Status; + Socket::Status status = Receive(reinterpret_cast(&packetSize), sizeof(packetSize), received, address, port); + if (status != Socket::Done) + return status; - PacketSize = ntohl(PacketSize); + packetSize = ntohl(packetSize); } else { // There is a pending packet : we already know its size - PacketSize = myPendingPacketSize; + packetSize = myPendingPacketSize; } // Clear the user packet - PacketToReceive.Clear(); + packet.Clear(); // Use another address instance for receiving the packet data ; // chunks of data coming from a different sender will be discarded (and lost...) - IPAddress Sender; - unsigned short SenderPort; + IPAddress sender; + unsigned short senderPort; // Then loop until we receive all the packet data - char Buffer[1024]; - while (myPendingPacket.size() < PacketSize) + char buffer[1024]; + while (myPendingPacket.size() < packetSize) { // Receive a chunk of data - std::size_t SizeToGet = std::min(static_cast(PacketSize - myPendingPacket.size()), sizeof(Buffer)); - Socket::Status Status = Receive(Buffer, SizeToGet, Received, Sender, SenderPort); - if (Status != Socket::Done) + std::size_t sizeToGet = std::min(static_cast(packetSize - myPendingPacket.size()), sizeof(buffer)); + Socket::Status status = Receive(buffer, sizeToGet, received, sender, senderPort); + if (status != Socket::Done) { // We must save the size of the pending packet until we can receive its content - if (Status == Socket::NotReady) - myPendingPacketSize = PacketSize; - return Status; + if (status == Socket::NotReady) + myPendingPacketSize = packetSize; + return status; } // Append it into the packet - if ((Sender == Address) && (SenderPort == Port) && (Received > 0)) + if ((sender == address) && (senderPort == port) && (received > 0)) { - myPendingPacket.resize(myPendingPacket.size() + Received); - char* Begin = &myPendingPacket[0] + myPendingPacket.size() - Received; - memcpy(Begin, Buffer, Received); + myPendingPacket.resize(myPendingPacket.size() + received); + char* begin = &myPendingPacket[0] + myPendingPacket.size() - received; + memcpy(begin, buffer, received); } } // We have received all the datas : we can copy it to the user packet, and clear our internal packet - PacketToReceive.Clear(); + packet.Clear(); if (!myPendingPacket.empty()) - PacketToReceive.OnReceive(&myPendingPacket[0], myPendingPacket.size()); + packet.OnReceive(&myPendingPacket[0], myPendingPacket.size()); myPendingPacket.clear(); myPendingPacketSize = -1; @@ -353,18 +353,18 @@ unsigned short SocketUDP::GetPort() const //////////////////////////////////////////////////////////// /// Comparison operator == //////////////////////////////////////////////////////////// -bool SocketUDP::operator ==(const SocketUDP& Other) const +bool SocketUDP::operator ==(const SocketUDP& other) const { - return mySocket == Other.mySocket; + return mySocket == other.mySocket; } //////////////////////////////////////////////////////////// /// Comparison operator != //////////////////////////////////////////////////////////// -bool SocketUDP::operator !=(const SocketUDP& Other) const +bool SocketUDP::operator !=(const SocketUDP& other) const { - return mySocket != Other.mySocket; + return mySocket != other.mySocket; } @@ -373,9 +373,9 @@ bool SocketUDP::operator !=(const SocketUDP& Other) const /// Provided for compatibility with standard containers, as /// comparing two sockets doesn't make much sense... //////////////////////////////////////////////////////////// -bool SocketUDP::operator <(const SocketUDP& Other) const +bool SocketUDP::operator <(const SocketUDP& other) const { - return mySocket < Other.mySocket; + return mySocket < other.mySocket; } @@ -383,19 +383,19 @@ bool SocketUDP::operator <(const SocketUDP& Other) const /// Construct the socket from a socket descriptor /// (for internal use only) //////////////////////////////////////////////////////////// -SocketUDP::SocketUDP(SocketHelper::SocketType Descriptor) +SocketUDP::SocketUDP(SocketHelper::SocketType descriptor) { - Create(Descriptor); + Create(descriptor); } //////////////////////////////////////////////////////////// /// Create the socket //////////////////////////////////////////////////////////// -void SocketUDP::Create(SocketHelper::SocketType Descriptor) +void SocketUDP::Create(SocketHelper::SocketType descriptor) { // Use the given socket descriptor, or get a new one - mySocket = Descriptor ? Descriptor : socket(PF_INET, SOCK_DGRAM, 0); + mySocket = descriptor ? descriptor : socket(PF_INET, SOCK_DGRAM, 0); myIsBlocking = true; // Clear the last port used @@ -409,15 +409,15 @@ void SocketUDP::Create(SocketHelper::SocketType Descriptor) if (IsValid()) { // To avoid the "Address already in use" error message when trying to bind to the same port - int Yes = 1; - if (setsockopt(mySocket, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast(&Yes), sizeof(Yes)) == -1) + int yes = 1; + if (setsockopt(mySocket, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast(&yes), sizeof(yes)) == -1) { std::cerr << "Failed to set socket option \"reuse address\" ; " << "binding to a same port may fail if too fast" << std::endl; } // Enable broadcast by default - if (setsockopt(mySocket, SOL_SOCKET, SO_BROADCAST, reinterpret_cast(&Yes), sizeof(Yes)) == -1) + if (setsockopt(mySocket, SOL_SOCKET, SO_BROADCAST, reinterpret_cast(&yes), sizeof(yes)) == -1) { std::cerr << "Failed to enable broadcast on UDP socket" << std::endl; } diff --git a/src/SFML/Network/Unix/SocketHelper.cpp b/src/SFML/Network/Unix/SocketHelper.cpp index 1fc4e68db..20ee77dc4 100644 --- a/src/SFML/Network/Unix/SocketHelper.cpp +++ b/src/SFML/Network/Unix/SocketHelper.cpp @@ -44,22 +44,22 @@ SocketHelper::SocketType SocketHelper::InvalidSocket() //////////////////////////////////////////////////////////// /// Close / destroy a socket //////////////////////////////////////////////////////////// -bool SocketHelper::Close(SocketHelper::SocketType Socket) +bool SocketHelper::Close(SocketHelper::SocketType socket) { - return close(Socket) != -1; + return close(socket) != -1; } //////////////////////////////////////////////////////////// /// Set a socket as blocking or non-blocking //////////////////////////////////////////////////////////// -void SocketHelper::SetBlocking(SocketHelper::SocketType Socket, bool Block) +void SocketHelper::SetBlocking(SocketHelper::SocketType sock, bool block) { - int Status = fcntl(Socket, F_GETFL); - if (Block) - fcntl(Socket, F_SETFL, Status & ~O_NONBLOCK); + int status = fcntl(sock, F_GETFL); + if (block) + fcntl(sock, F_SETFL, status & ~O_NONBLOCK); else - fcntl(Socket, F_SETFL, Status | O_NONBLOCK); + fcntl(sock, F_SETFL, status | O_NONBLOCK); } diff --git a/src/SFML/Network/Win32/SocketHelper.cpp b/src/SFML/Network/Win32/SocketHelper.cpp index 2d904a739..f84bd498b 100644 --- a/src/SFML/Network/Win32/SocketHelper.cpp +++ b/src/SFML/Network/Win32/SocketHelper.cpp @@ -42,19 +42,19 @@ SocketHelper::SocketType SocketHelper::InvalidSocket() //////////////////////////////////////////////////////////// /// Close / destroy a socket //////////////////////////////////////////////////////////// -bool SocketHelper::Close(SocketHelper::SocketType Socket) +bool SocketHelper::Close(SocketHelper::SocketType socket) { - return closesocket(Socket) != -1; + return closesocket(socket) != -1; } //////////////////////////////////////////////////////////// /// Set a socket as blocking or non-blocking //////////////////////////////////////////////////////////// -void SocketHelper::SetBlocking(SocketHelper::SocketType Socket, bool Block) +void SocketHelper::SetBlocking(SocketHelper::SocketType socket, bool block) { - unsigned long Blocking = Block ? 0 : 1; - ioctlsocket(Socket, FIONBIO, &Blocking); + unsigned long blocking = block ? 0 : 1; + ioctlsocket(socket, FIONBIO, &blocking); } @@ -85,8 +85,8 @@ struct SocketInitializer { SocketInitializer() { - WSADATA InitData; - WSAStartup(MAKEWORD(2,2), &InitData); + WSADATA init; + WSAStartup(MAKEWORD(2,2), &init); } ~SocketInitializer() @@ -95,6 +95,6 @@ struct SocketInitializer } }; -SocketInitializer GlobalInitializer; +SocketInitializer globalInitializer; } // namespace sf diff --git a/src/SFML/System/Lock.cpp b/src/SFML/System/Lock.cpp index eb0967d8e..15b435a7c 100644 --- a/src/SFML/System/Lock.cpp +++ b/src/SFML/System/Lock.cpp @@ -34,8 +34,8 @@ namespace sf //////////////////////////////////////////////////////////// /// Construct the lock with a target mutex (lock it) //////////////////////////////////////////////////////////// -Lock::Lock(Mutex& Mutex) : -myMutex(Mutex) +Lock::Lock(Mutex& mutex) : +myMutex(mutex) { myMutex.Lock(); } diff --git a/src/SFML/System/Randomizer.cpp b/src/SFML/System/Randomizer.cpp index fec209643..dc5ba1325 100644 --- a/src/SFML/System/Randomizer.cpp +++ b/src/SFML/System/Randomizer.cpp @@ -35,13 +35,13 @@ namespace // Set the random numbers sequence seed with the current system time, so that it is always different unsigned int InitializeSeed() { - unsigned int Seed = static_cast(sf::priv::Platform::GetSystemTime() * 1000); - srand(Seed); - return Seed; + unsigned int seed = static_cast(sf::priv::Platform::GetSystemTime() * 1000); + srand(seed); + return seed; } - // Global storing the current seed - unsigned int GlobalSeed = InitializeSeed(); + // Global variable storing the current seed + unsigned int globalSeed = InitializeSeed(); } @@ -51,10 +51,10 @@ namespace sf /// Set the seed for the generator. Using a known seed /// allows you to reproduce the same sequence of random number //////////////////////////////////////////////////////////// -void Randomizer::SetSeed(unsigned int Seed) +void Randomizer::SetSeed(unsigned int seed) { - srand(Seed); - GlobalSeed = Seed; + srand(seed); + globalSeed = seed; } @@ -63,31 +63,31 @@ void Randomizer::SetSeed(unsigned int Seed) //////////////////////////////////////////////////////////// unsigned int Randomizer::GetSeed() { - return GlobalSeed; + return globalSeed; } //////////////////////////////////////////////////////////// /// Get a random float number in a given range //////////////////////////////////////////////////////////// -float Randomizer::Random(float Begin, float End) +float Randomizer::Random(float begin, float end) { // This is not the best algorithm, but it is fast and will be enough in most cases // (see Google for best approaches) - return static_cast(rand()) / RAND_MAX * (End - Begin) + Begin; + return static_cast(rand()) / RAND_MAX * (end - begin) + begin; } //////////////////////////////////////////////////////////// /// Get a random integer number in a given range //////////////////////////////////////////////////////////// -int Randomizer::Random(int Begin, int End) +int Randomizer::Random(int begin, int end) { // This is not the best algorithm, but it is fast and will be enough in most cases // (see Google for best approaches) - return rand() % (End - Begin + 1) + Begin; + return rand() % (end - begin + 1) + begin; } } // namespace sf diff --git a/src/SFML/System/Sleep.cpp b/src/SFML/System/Sleep.cpp index 81ff8854d..ed65e8620 100644 --- a/src/SFML/System/Sleep.cpp +++ b/src/SFML/System/Sleep.cpp @@ -34,10 +34,10 @@ namespace sf //////////////////////////////////////////////////////////// /// Make the current thread sleep for a given time //////////////////////////////////////////////////////////// -void Sleep(float Duration) +void Sleep(float duration) { - if (Duration >= 0) - priv::Platform::Sleep(Duration); + if (duration >= 0) + priv::Platform::Sleep(duration); } } // namespace sf diff --git a/src/SFML/System/Thread.cpp b/src/SFML/System/Thread.cpp index d6c29f42f..d981cf98b 100644 --- a/src/SFML/System/Thread.cpp +++ b/src/SFML/System/Thread.cpp @@ -56,10 +56,10 @@ myUserData (NULL) //////////////////////////////////////////////////////////// /// Construct the thread from a function pointer //////////////////////////////////////////////////////////// -Thread::Thread(Thread::FuncType Function, void* UserData) : +Thread::Thread(Thread::FuncType function, void* userData) : myThreadImpl(NULL), -myFunction (Function), -myUserData (UserData) +myFunction (function), +myUserData (userData) { } diff --git a/src/SFML/System/ThreadLocal.cpp b/src/SFML/System/ThreadLocal.cpp index ae2ebf0b5..49744f5e6 100644 --- a/src/SFML/System/ThreadLocal.cpp +++ b/src/SFML/System/ThreadLocal.cpp @@ -44,10 +44,10 @@ namespace sf //////////////////////////////////////////////////////////// /// Default constructor //////////////////////////////////////////////////////////// -ThreadLocal::ThreadLocal(void* Value) +ThreadLocal::ThreadLocal(void* value) { myImpl = new priv::ThreadLocalImpl; - SetValue(Value); + SetValue(value); } @@ -63,9 +63,9 @@ ThreadLocal::~ThreadLocal() //////////////////////////////////////////////////////////// /// Set the thread-specific value of the variable //////////////////////////////////////////////////////////// -void ThreadLocal::SetValue(void* Value) +void ThreadLocal::SetValue(void* value) { - myImpl->SetValue(Value); + myImpl->SetValue(value); } diff --git a/src/SFML/System/Unix/Platform.cpp b/src/SFML/System/Unix/Platform.cpp index 0149c3614..1f4fb1c78 100644 --- a/src/SFML/System/Unix/Platform.cpp +++ b/src/SFML/System/Unix/Platform.cpp @@ -38,19 +38,19 @@ namespace priv //////////////////////////////////////////////////////////// double Platform::GetSystemTime() { - timeval Time = {0, 0}; - gettimeofday(&Time, NULL); + timeval time = {0, 0}; + gettimeofday(&time, NULL); - return Time.tv_sec + Time.tv_usec / 1000000.; + return time.tv_sec + time.tv_usec / 1000000.; } //////////////////////////////////////////////////////////// /// Suspend the execution of the current thread for a specified time //////////////////////////////////////////////////////////// -void Platform::Sleep(float Time) +void Platform::Sleep(float time) { - usleep(static_cast(Time * 1000000)); + usleep(static_cast(time * 1000000)); } } // namespace priv diff --git a/src/SFML/System/Unix/Platform.hpp b/src/SFML/System/Unix/Platform.hpp index 0cd09904a..b994dd094 100644 --- a/src/SFML/System/Unix/Platform.hpp +++ b/src/SFML/System/Unix/Platform.hpp @@ -55,10 +55,10 @@ public : //////////////////////////////////////////////////////////// /// Suspend the execution of the current thread for a specified time /// - /// \param Time : Time to sleep, in seconds + /// \param time : Time to sleep, in seconds /// //////////////////////////////////////////////////////////// - static void Sleep(float Time); + static void Sleep(float time); }; } // namespace priv diff --git a/src/SFML/System/Unix/ThreadImpl.cpp b/src/SFML/System/Unix/ThreadImpl.cpp index 70c1dbef1..2d7e1db41 100644 --- a/src/SFML/System/Unix/ThreadImpl.cpp +++ b/src/SFML/System/Unix/ThreadImpl.cpp @@ -37,10 +37,10 @@ namespace priv //////////////////////////////////////////////////////////// /// Default constructor //////////////////////////////////////////////////////////// -ThreadImpl::ThreadImpl(Thread* Owner) : +ThreadImpl::ThreadImpl(Thread* owner) : myIsActive(true) { - myIsActive = pthread_create(&myThread, NULL, &ThreadImpl::EntryPoint, Owner) == 0; + myIsActive = pthread_create(&myThread, NULL, &ThreadImpl::EntryPoint, owner) == 0; if (!myIsActive) std::cerr << "Failed to create thread" << std::endl; @@ -73,16 +73,16 @@ void ThreadImpl::Terminate() //////////////////////////////////////////////////////////// /// Global entry point for all threads //////////////////////////////////////////////////////////// -void* ThreadImpl::EntryPoint(void* UserData) +void* ThreadImpl::EntryPoint(void* userData) { // The Thread instance is stored in the user data - Thread* Owner = static_cast(UserData); + Thread* owner = static_cast(userData); // Tell the thread to handle cancel requests immediatly pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); // Forward to the owner - Owner->Run(); + owner->Run(); return NULL; } diff --git a/src/SFML/System/Unix/ThreadImpl.hpp b/src/SFML/System/Unix/ThreadImpl.hpp index 2bf3e384f..90e677183 100644 --- a/src/SFML/System/Unix/ThreadImpl.hpp +++ b/src/SFML/System/Unix/ThreadImpl.hpp @@ -48,10 +48,10 @@ public : //////////////////////////////////////////////////////////// /// Default constructor, launch the thread /// - /// \param Owner : Owner Thread instance to run + /// \param owner : Owner Thread instance to run /// //////////////////////////////////////////////////////////// - ThreadImpl(Thread* Owner); + ThreadImpl(Thread* owner); //////////////////////////////////////////////////////////// /// Wait until the thread finishes @@ -73,12 +73,12 @@ private : //////////////////////////////////////////////////////////// /// Global entry point for all threads /// - /// \param UserData : User-defined data (contains the Thread instance) + /// \param userData : User-defined data (contains the Thread instance) /// /// \return Error code /// //////////////////////////////////////////////////////////// - static void* EntryPoint(void* UserData); + static void* EntryPoint(void* userData); //////////////////////////////////////////////////////////// // Member data diff --git a/src/SFML/System/Unix/ThreadLocalImpl.cpp b/src/SFML/System/Unix/ThreadLocalImpl.cpp index 9d4091bdd..c99db4484 100644 --- a/src/SFML/System/Unix/ThreadLocalImpl.cpp +++ b/src/SFML/System/Unix/ThreadLocalImpl.cpp @@ -53,9 +53,9 @@ ThreadLocalImpl::~ThreadLocalImpl() //////////////////////////////////////////////////////////// /// Set the thread-specific value of the variable //////////////////////////////////////////////////////////// -void ThreadLocalImpl::SetValue(void* Value) +void ThreadLocalImpl::SetValue(void* value) { - pthread_setspecific(myKey, Value); + pthread_setspecific(myKey, value); } diff --git a/src/SFML/System/Unix/ThreadLocalImpl.hpp b/src/SFML/System/Unix/ThreadLocalImpl.hpp index 3457bf637..de9a74c43 100644 --- a/src/SFML/System/Unix/ThreadLocalImpl.hpp +++ b/src/SFML/System/Unix/ThreadLocalImpl.hpp @@ -58,10 +58,10 @@ public : //////////////////////////////////////////////////////////// /// Set the thread-specific value of the variable /// - /// \param Value : Value of the variable for this thread + /// \param value : Value of the variable for this thread /// //////////////////////////////////////////////////////////// - void SetValue(void* Value); + void SetValue(void* value); //////////////////////////////////////////////////////////// /// Retrieve the thread-specific value of the variable diff --git a/src/SFML/System/Win32/Platform.hpp b/src/SFML/System/Win32/Platform.hpp index ae27ec428..0baafd409 100644 --- a/src/SFML/System/Win32/Platform.hpp +++ b/src/SFML/System/Win32/Platform.hpp @@ -55,10 +55,10 @@ public : //////////////////////////////////////////////////////////// /// Suspend the execution of the current thread for a specified time /// - /// \param Time : Time to sleep, in seconds + /// \param time : Time to sleep, in seconds /// //////////////////////////////////////////////////////////// - static void Sleep(float Time); + static void Sleep(float time); }; } // namespace priv diff --git a/src/SFML/System/Win32/ThreadImpl.cpp b/src/SFML/System/Win32/ThreadImpl.cpp index 8faa77e6f..22ad77eb8 100644 --- a/src/SFML/System/Win32/ThreadImpl.cpp +++ b/src/SFML/System/Win32/ThreadImpl.cpp @@ -38,9 +38,9 @@ namespace priv //////////////////////////////////////////////////////////// /// Default constructor //////////////////////////////////////////////////////////// -ThreadImpl::ThreadImpl(Thread* Owner) +ThreadImpl::ThreadImpl(Thread* owner) { - myThread = reinterpret_cast(_beginthreadex(NULL, 0, &ThreadImpl::EntryPoint, Owner, 0, NULL)); + myThread = reinterpret_cast(_beginthreadex(NULL, 0, &ThreadImpl::EntryPoint, owner, 0, NULL)); if (!myThread) std::cerr << "Failed to create thread" << std::endl; @@ -83,13 +83,13 @@ void ThreadImpl::Terminate() //////////////////////////////////////////////////////////// /// Global entry point for all threads //////////////////////////////////////////////////////////// -unsigned int __stdcall ThreadImpl::EntryPoint(void* UserData) +unsigned int __stdcall ThreadImpl::EntryPoint(void* userData) { // The Thread instance is stored in the user data - Thread* Owner = static_cast(UserData); + Thread* owner = static_cast(userData); // Forward to the owner - Owner->Run(); + owner->Run(); // Optional, but it is cleaner _endthreadex(0); diff --git a/src/SFML/System/Win32/ThreadImpl.hpp b/src/SFML/System/Win32/ThreadImpl.hpp index baf714bbb..5e83e71d0 100644 --- a/src/SFML/System/Win32/ThreadImpl.hpp +++ b/src/SFML/System/Win32/ThreadImpl.hpp @@ -48,10 +48,10 @@ public : //////////////////////////////////////////////////////////// /// Default constructor, launch the thread /// - /// \param Owner : Owner Thread instance to run + /// \param owner : Owner Thread instance to run /// //////////////////////////////////////////////////////////// - ThreadImpl(Thread* Owner); + ThreadImpl(Thread* owner); //////////////////////////////////////////////////////////// /// Destructor @@ -79,12 +79,12 @@ private : //////////////////////////////////////////////////////////// /// Global entry point for all threads /// - /// \param UserData : User-defined data (contains the Thread instance) + /// \param userData : User-defined data (contains the Thread instance) /// /// \return Error code /// //////////////////////////////////////////////////////////// - static unsigned int __stdcall EntryPoint(void* UserData); + static unsigned int __stdcall EntryPoint(void* userData); //////////////////////////////////////////////////////////// // Member data diff --git a/src/SFML/System/Win32/ThreadLocalImpl.cpp b/src/SFML/System/Win32/ThreadLocalImpl.cpp index 0757c8b01..cafa76dc3 100644 --- a/src/SFML/System/Win32/ThreadLocalImpl.cpp +++ b/src/SFML/System/Win32/ThreadLocalImpl.cpp @@ -53,9 +53,9 @@ ThreadLocalImpl::~ThreadLocalImpl() //////////////////////////////////////////////////////////// /// Set the thread-specific value of the variable //////////////////////////////////////////////////////////// -void ThreadLocalImpl::SetValue(void* Value) +void ThreadLocalImpl::SetValue(void* value) { - TlsSetValue(myIndex, Value); + TlsSetValue(myIndex, value); } diff --git a/src/SFML/System/Win32/ThreadLocalImpl.hpp b/src/SFML/System/Win32/ThreadLocalImpl.hpp index dc04ef266..2035ecff4 100644 --- a/src/SFML/System/Win32/ThreadLocalImpl.hpp +++ b/src/SFML/System/Win32/ThreadLocalImpl.hpp @@ -58,10 +58,10 @@ public : //////////////////////////////////////////////////////////// /// Set the thread-specific value of the variable /// - /// \param Value : Value of the variable for this thread + /// \param value : Value of the variable for this thread /// //////////////////////////////////////////////////////////// - void SetValue(void* Value); + void SetValue(void* value); //////////////////////////////////////////////////////////// /// Retrieve the thread-specific value of the variable diff --git a/src/SFML/Window/Context.cpp b/src/SFML/Window/Context.cpp index 921e1e859..0fec36daa 100644 --- a/src/SFML/Window/Context.cpp +++ b/src/SFML/Window/Context.cpp @@ -54,9 +54,9 @@ Context::~Context() //////////////////////////////////////////////////////////// /// Activate or deactivate explicitely the context //////////////////////////////////////////////////////////// -void Context::SetActive(bool Active) +void Context::SetActive(bool active) { - myContext->SetActive(Active); + myContext->SetActive(active); } diff --git a/src/SFML/Window/ContextGL.cpp b/src/SFML/Window/ContextGL.cpp index 93054f140..05732b0ee 100644 --- a/src/SFML/Window/ContextGL.cpp +++ b/src/SFML/Window/ContextGL.cpp @@ -56,15 +56,15 @@ namespace { // This thread-local variable will hold the "global" context for each thread - sf::ThreadLocalPtr ThreadContext(NULL); + sf::ThreadLocalPtr threadContext(NULL); // Now we create two global contexts. // The first one is the reference context: it will be shared with every other - // context, and he can't be activated if we want the sharing operation to always succeed. - // That why we need the second context: this one will be activated and used + // context, and it can't be activated if we want the sharing operation to always succeed. + // That's why we need the second context: this one will be activated and used // in the main thread whenever there's no other context (window) active. - ContextType ReferenceContext(NULL); - ContextType DefaultContext(&ReferenceContext); + ContextType referenceContext(NULL); + ContextType defaultContext(&referenceContext); } @@ -77,22 +77,22 @@ namespace priv //////////////////////////////////////////////////////////// ContextGL* ContextGL::New() { - return new ContextType(&ReferenceContext); + return new ContextType(&referenceContext); } //////////////////////////////////////////////////////////// /// Create a new context attached to a window //////////////////////////////////////////////////////////// -ContextGL* ContextGL::New(const WindowImpl* Owner, unsigned int BitsPerPixel, const ContextSettings& Settings) +ContextGL* ContextGL::New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) { - ContextType* Context = new ContextType(&ReferenceContext, Owner, BitsPerPixel, Settings); + ContextType* context = new ContextType(&referenceContext, owner, bitsPerPixel, settings); // Enable antialiasing if needed - if (Context->GetSettings().AntialiasingLevel > 0) + if (context->GetSettings().AntialiasingLevel > 0) glEnable(GL_MULTISAMPLE_ARB); - return Context; + return context; } @@ -101,13 +101,13 @@ ContextGL* ContextGL::New(const WindowImpl* Owner, unsigned int BitsPerPixel, co //////////////////////////////////////////////////////////// ContextGL::~ContextGL() { - if (ThreadContext == this) + if (threadContext == this) { - ThreadContext = NULL; + threadContext = NULL; } - else if (ThreadContext != NULL) + else if (threadContext != NULL) { - ThreadContext->SetActive(true); + threadContext->SetActive(true); } } @@ -125,21 +125,21 @@ const ContextSettings& ContextGL::GetSettings() const /// Activate or deactivate the context as the current target /// for rendering //////////////////////////////////////////////////////////// -bool ContextGL::SetActive(bool Active) +bool ContextGL::SetActive(bool active) { - if (MakeCurrent(Active)) + if (MakeCurrent(active)) { - if (Active && (ThreadContext == NULL)) + if (active && (threadContext == 0)) { // If this is the first context to be activated on this thread, make // it the reference context for the whole thread - ThreadContext = this; + threadContext = this; } - else if (!Active && (ThreadContext != NULL) && (ThreadContext != this)) + else if (!active && (threadContext != NULL) && (threadContext != this)) { // Activate the reference context for this thread to ensure // that there is always an active context for subsequent graphics operations - ThreadContext->SetActive(true); + threadContext->SetActive(true); } return true; @@ -165,12 +165,12 @@ ContextGL::ContextGL() /// This functions can be used by implementations that have /// several valid formats and want to get the best one //////////////////////////////////////////////////////////// -int ContextGL::EvaluateFormat(unsigned int BitsPerPixel, const ContextSettings& Settings, int ColorBits, int DepthBits, int StencilBits, int Antialiasing) +int ContextGL::EvaluateFormat(unsigned int bitsPerPixel, const ContextSettings& settings, int colorBits, int depthBits, int stencilBits, int antialiasing) { - return abs(static_cast(BitsPerPixel - ColorBits)) + - abs(static_cast(Settings.DepthBits - DepthBits)) + - abs(static_cast(Settings.StencilBits - StencilBits)) + - abs(static_cast(Settings.AntialiasingLevel - Antialiasing)); + return abs(static_cast(bitsPerPixel - colorBits)) + + abs(static_cast(settings.DepthBits - depthBits)) + + abs(static_cast(settings.StencilBits - stencilBits)) + + abs(static_cast(settings.AntialiasingLevel - antialiasing)); } } // namespace priv diff --git a/src/SFML/Window/ContextGL.hpp b/src/SFML/Window/ContextGL.hpp index 1ae5c7ff8..650e76503 100644 --- a/src/SFML/Window/ContextGL.hpp +++ b/src/SFML/Window/ContextGL.hpp @@ -57,14 +57,14 @@ public : //////////////////////////////////////////////////////////// /// Create a new context attached to a window /// - /// \param Owner : Pointer to the owner window - /// \param BitsPerPixel : Pixel depth (in bits per pixel) - /// \param Settings : Creation parameters + /// \param owner : Pointer to the owner window + /// \param bitsPerPixel : Pixel depth (in bits per pixel) + /// \param settings : Creation parameters /// /// \return Pointer to the created context /// //////////////////////////////////////////////////////////// - static ContextGL* New(const WindowImpl* Owner, unsigned int BitsPerPixel, const ContextSettings& Settings); + static ContextGL* New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings); public : @@ -86,12 +86,12 @@ public : /// Activate or deactivate the context as the current target /// for rendering /// - /// \param Active : True to activate, false to deactivate + /// \param active : True to activate, false to deactivate /// /// \return True if operation was successful, false otherwise /// //////////////////////////////////////////////////////////// - bool SetActive(bool Active); + bool SetActive(bool active); //////////////////////////////////////////////////////////// /// Display the contents of the context @@ -102,10 +102,10 @@ public : //////////////////////////////////////////////////////////// /// Enable / disable vertical synchronization /// - /// \param Enabled : True to enable v-sync, false to deactivate + /// \param enabled : True to enable v-sync, false to deactivate /// //////////////////////////////////////////////////////////// - virtual void UseVerticalSync(bool Enabled) = 0; + virtual void UseVerticalSync(bool enabled) = 0; protected : @@ -118,29 +118,29 @@ protected : //////////////////////////////////////////////////////////// /// Make this context the current one /// - /// \param Active : True to activate, false to deactivate + /// \param active : True to activate, false to deactivate /// /// \return True on success, false if any error happened /// //////////////////////////////////////////////////////////// - virtual bool MakeCurrent(bool Active) = 0; + virtual bool MakeCurrent(bool active) = 0; //////////////////////////////////////////////////////////// /// Evaluate a pixel format configuration. /// This functions can be used by implementations that have /// several valid formats and want to get the best one /// - /// \param BitsPerPixel : Requested pixel depth (bits per pixel) - /// \param Settings : Requested additionnal settings - /// \param ColorBits : Color bits of the configuration to evaluate - /// \param DepthBits : Depth bits of the configuration to evaluate - /// \param StencilBits : Stencil bits of the configuration to evaluate - /// \param Antialiasing : Antialiasing level of the configuration to evaluate + /// \param bitsPerPixel : Requested pixel depth (bits per pixel) + /// \param settings : Requested additionnal settings + /// \param colorBits : Color bits of the configuration to evaluate + /// \param depthBits : Depth bits of the configuration to evaluate + /// \param stencilBits : Stencil bits of the configuration to evaluate + /// \param antialiasing : Antialiasing level of the configuration to evaluate /// /// \return Score of the configuration : the lower the better /// //////////////////////////////////////////////////////////// - static int EvaluateFormat(unsigned int BitsPerPixel, const ContextSettings& Settings, int ColorBits, int DepthBits, int StencilBits, int Antialiasing); + static int EvaluateFormat(unsigned int bitsPerPixel, const ContextSettings& settings, int colorBits, int depthBits, int stencilBits, int antialiasing); //////////////////////////////////////////////////////////// // Member data diff --git a/src/SFML/Window/Input.cpp b/src/SFML/Window/Input.cpp index 7b10270d2..4e5a6bb86 100644 --- a/src/SFML/Window/Input.cpp +++ b/src/SFML/Window/Input.cpp @@ -60,28 +60,28 @@ myMouseY(0) //////////////////////////////////////////////////////////// /// Get the state of a key //////////////////////////////////////////////////////////// -bool Input::IsKeyDown(Key::Code KeyCode) const +bool Input::IsKeyDown(Key::Code key) const { - return myKeys[KeyCode]; + return myKeys[key]; } //////////////////////////////////////////////////////////// /// Get the state of a mouse button //////////////////////////////////////////////////////////// -bool Input::IsMouseButtonDown(Mouse::Button Button) const +bool Input::IsMouseButtonDown(Mouse::Button button) const { - return myMouseButtons[Button]; + return myMouseButtons[button]; } //////////////////////////////////////////////////////////// /// Get the state of a joystick button //////////////////////////////////////////////////////////// -bool Input::IsJoystickButtonDown(unsigned int JoyId, unsigned int Button) const +bool Input::IsJoystickButtonDown(unsigned int joystick, unsigned int button) const { - if ((JoyId < 2) && (Button < 16)) - return myJoystickButtons[JoyId][Button]; + if ((joystick < 2) && (button < 16)) + return myJoystickButtons[joystick][button]; else return false; } @@ -108,40 +108,40 @@ int Input::GetMouseY() const //////////////////////////////////////////////////////////// /// Get a joystick axis position //////////////////////////////////////////////////////////// -float Input::GetJoystickAxis(unsigned int JoyId, Joy::Axis Axis) const +float Input::GetJoystickAxis(unsigned int joystick, Joy::Axis axis) const { - return myJoystickAxis[JoyId][Axis]; + return myJoystickAxis[joystick][axis]; } //////////////////////////////////////////////////////////// /// /see WindowListener::OnEvent //////////////////////////////////////////////////////////// -void Input::OnEvent(const Event& EventReceived) +void Input::OnEvent(const Event& event) { - switch (EventReceived.Type) + switch (event.Type) { // Key events - case Event::KeyPressed : myKeys[EventReceived.Key.Code] = true; break; - case Event::KeyReleased : myKeys[EventReceived.Key.Code] = false; break; + case Event::KeyPressed : myKeys[event.Key.Code] = true; break; + case Event::KeyReleased : myKeys[event.Key.Code] = false; break; // Mouse event - case Event::MouseButtonPressed : myMouseButtons[EventReceived.MouseButton.Button] = true; break; - case Event::MouseButtonReleased : myMouseButtons[EventReceived.MouseButton.Button] = false; break; + case Event::MouseButtonPressed : myMouseButtons[event.MouseButton.Button] = true; break; + case Event::MouseButtonReleased : myMouseButtons[event.MouseButton.Button] = false; break; // Mouse move event case Event::MouseMoved : - myMouseX = EventReceived.MouseMove.X; - myMouseY = EventReceived.MouseMove.Y; + myMouseX = event.MouseMove.X; + myMouseY = event.MouseMove.Y; break; // Joystick button events - case Event::JoyButtonPressed : myJoystickButtons[EventReceived.JoyButton.JoystickId][EventReceived.JoyButton.Button] = true; break; - case Event::JoyButtonReleased : myJoystickButtons[EventReceived.JoyButton.JoystickId][EventReceived.JoyButton.Button] = false; break; + case Event::JoyButtonPressed : myJoystickButtons[event.JoyButton.JoystickId][event.JoyButton.Button] = true; break; + case Event::JoyButtonReleased : myJoystickButtons[event.JoyButton.JoystickId][event.JoyButton.Button] = false; break; // Joystick move event case Event::JoyMoved : - myJoystickAxis[EventReceived.JoyMove.JoystickId][EventReceived.JoyMove.Axis] = EventReceived.JoyMove.Position; + myJoystickAxis[event.JoyMove.JoystickId][event.JoyMove.Axis] = event.JoyMove.Position; break; // Lost focus event : we must reset all persistent states diff --git a/src/SFML/Window/Linux/ContextGLX.cpp b/src/SFML/Window/Linux/ContextGLX.cpp index f134b59d7..5168cedfb 100644 --- a/src/SFML/Window/Linux/ContextGLX.cpp +++ b/src/SFML/Window/Linux/ContextGLX.cpp @@ -39,28 +39,28 @@ namespace priv //////////////////////////////////////////////////////////// /// Create a new context, not associated to a window //////////////////////////////////////////////////////////// -ContextGLX::ContextGLX(ContextGLX* Shared) : +ContextGLX::ContextGLX(ContextGLX* shared) : myWindow (0), myContext (NULL), myOwnsWindow(true) { // Create a dummy window (disabled and hidden) - int Screen = DefaultScreen(myDisplay.GetDisplay()); + int screen = DefaultScreen(myDisplay.GetDisplay()); myWindow = XCreateWindow(myDisplay.GetDisplay(), - RootWindow(myDisplay.GetDisplay(), Screen), + RootWindow(myDisplay.GetDisplay(), screen), 0, 0, 1, 1, 0, - DefaultDepth(myDisplay.GetDisplay(), Screen), + DefaultDepth(myDisplay.GetDisplay(), screen), InputOutput, - DefaultVisual(myDisplay.GetDisplay(), Screen), + DefaultVisual(myDisplay.GetDisplay(), screen), 0, NULL); // Create the context - CreateContext(Shared, VideoMode::GetDesktopMode().BitsPerPixel, ContextSettings(0, 0, 0)); + CreateContext(shared, VideoMode::GetDesktopMode().BitsPerPixel, ContextSettings(0, 0, 0)); // Activate the context - if (Shared) + if (shared) SetActive(true); } @@ -68,20 +68,20 @@ myOwnsWindow(true) //////////////////////////////////////////////////////////// /// Create a new context attached to a window //////////////////////////////////////////////////////////// -ContextGLX::ContextGLX(ContextGLX* Shared, const WindowImpl* Owner, unsigned int BitsPerPixel, const ContextSettings& Settings) : +ContextGLX::ContextGLX(ContextGLX* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) : myWindow (0), myContext (NULL), myOwnsWindow(false) { // Get the owner window and its device context - myWindow = static_cast(Owner->GetHandle()); + myWindow = static_cast(owner->GetHandle()); // Create the context if (myWindow) - CreateContext(Shared, BitsPerPixel, Settings); + CreateContext(shared, bitsPerPixel, settings); // Activate the context - if (Shared) + if (shared) SetActive(true); } @@ -111,9 +111,9 @@ ContextGLX::~ContextGLX() //////////////////////////////////////////////////////////// /// \see Context::MakeCurrent //////////////////////////////////////////////////////////// -bool ContextGLX::MakeCurrent(bool Active) +bool ContextGLX::MakeCurrent(bool active) { - if (Active) + if (active) { if (myContext) { @@ -150,12 +150,12 @@ void ContextGLX::Display() //////////////////////////////////////////////////////////// /// \see Context::UseVerticalSync //////////////////////////////////////////////////////////// -void ContextGLX::UseVerticalSync(bool Enabled) +void ContextGLX::UseVerticalSync(bool enabled) { - const GLubyte* ProcAddress = reinterpret_cast("glXSwapIntervalSGI"); - PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = reinterpret_cast(glXGetProcAddress(ProcAddress)); + const GLubyte* name = reinterpret_cast("glXSwapIntervalSGI"); + PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = reinterpret_cast(glXGetProcAddress(name)); if (glXSwapIntervalSGI) - glXSwapIntervalSGI(Enabled ? 1 : 0); + glXSwapIntervalSGI(enabled ? 1 : 0); } @@ -171,28 +171,28 @@ bool ContextGLX::IsContextActive() //////////////////////////////////////////////////////////// /// Create the context //////////////////////////////////////////////////////////// -void ContextGLX::CreateContext(ContextGLX* Shared, unsigned int BitsPerPixel, const ContextSettings& Settings) +void ContextGLX::CreateContext(ContextGLX* shared, unsigned int bitsPerPixel, const ContextSettings& settings) { // Save the creation settings - mySettings = Settings; + mySettings = settings; // Get the attributes of the target window - XWindowAttributes WindowAttributes; - if (XGetWindowAttributes(myDisplay.GetDisplay(), myWindow, &WindowAttributes) == 0) + XWindowAttributes windowAttributes; + if (XGetWindowAttributes(myDisplay.GetDisplay(), myWindow, &windowAttributes) == 0) { std::cerr << "Failed to get the window attributes" << std::endl; return; } // Setup the visual infos to match - XVisualInfo Template; - Template.depth = WindowAttributes.depth; - Template.visualid = XVisualIDFromVisual(WindowAttributes.visual); - Template.screen = DefaultScreen(myDisplay.GetDisplay()); + XVisualInfo tpl; + tpl.depth = windowAttributes.depth; + tpl.visualid = XVisualIDFromVisual(windowAttributes.visual); + tpl.screen = DefaultScreen(myDisplay.GetDisplay()); // Get all the visuals matching the template - int NbVisuals = 0; - XVisualInfo* Visuals = XGetVisualInfo(myDisplay.GetDisplay(), VisualDepthMask | VisualIDMask | VisualScreenMask, &Template, &NbVisuals); + int nbVisuals = 0; + XVisualInfo* visuals = XGetVisualInfo(myDisplay.GetDisplay(), VisualDepthMask | VisualIDMask | VisualScreenMask, &tpl, &nbVisuals); if (!Visuals || (NbVisuals == 0)) { if (Visuals) @@ -202,43 +202,43 @@ void ContextGLX::CreateContext(ContextGLX* Shared, unsigned int BitsPerPixel, co } // Find the best visual - int BestScore = 0xFFFF; - XVisualInfo* BestVisual = NULL; - while (!BestVisual) + int bestScore = 0xFFFF; + XVisualInfo* bestVisual = NULL; + while (!bestVisual) { - for (int i = 0; i < NbVisuals; ++i) + for (int i = 0; i < nbVisuals; ++i) { // Get the current visual attributes - int RGBA, DoubleBuffer, Red, Green, Blue, Alpha, Depth, Stencil, MultiSampling, Samples; - glXGetConfig(myDisplay.GetDisplay(), &Visuals[i], GLX_RGBA, &RGBA); - glXGetConfig(myDisplay.GetDisplay(), &Visuals[i], GLX_DOUBLEBUFFER, &DoubleBuffer); - glXGetConfig(myDisplay.GetDisplay(), &Visuals[i], GLX_RED_SIZE, &Red); - glXGetConfig(myDisplay.GetDisplay(), &Visuals[i], GLX_GREEN_SIZE, &Green); - glXGetConfig(myDisplay.GetDisplay(), &Visuals[i], GLX_BLUE_SIZE, &Blue); - glXGetConfig(myDisplay.GetDisplay(), &Visuals[i], GLX_ALPHA_SIZE, &Alpha); - glXGetConfig(myDisplay.GetDisplay(), &Visuals[i], GLX_DEPTH_SIZE, &Depth); - glXGetConfig(myDisplay.GetDisplay(), &Visuals[i], GLX_STENCIL_SIZE, &Stencil); - glXGetConfig(myDisplay.GetDisplay(), &Visuals[i], GLX_SAMPLE_BUFFERS_ARB, &MultiSampling); - glXGetConfig(myDisplay.GetDisplay(), &Visuals[i], GLX_SAMPLES_ARB, &Samples); + int RGBA, doubleBuffer, red, green, blue, alpha, depth, stencil, multiSampling, samples; + glXGetConfig(myDisplay.GetDisplay(), &visuals[i], GLX_RGBA, &RGBA); + glXGetConfig(myDisplay.GetDisplay(), &visuals[i], GLX_DOUBLEBUFFER, &doubleBuffer); + glXGetConfig(myDisplay.GetDisplay(), &visuals[i], GLX_RED_SIZE, &red); + glXGetConfig(myDisplay.GetDisplay(), &visuals[i], GLX_GREEN_SIZE, &green); + glXGetConfig(myDisplay.GetDisplay(), &visuals[i], GLX_BLUE_SIZE, &blue); + glXGetConfig(myDisplay.GetDisplay(), &visuals[i], GLX_ALPHA_SIZE, &alpha); + glXGetConfig(myDisplay.GetDisplay(), &visuals[i], GLX_DEPTH_SIZE, &depth); + glXGetConfig(myDisplay.GetDisplay(), &visuals[i], GLX_STENCIL_SIZE, &stencil); + glXGetConfig(myDisplay.GetDisplay(), &visuals[i], GLX_SAMPLE_BUFFERS_ARB, &multiSampling); + glXGetConfig(myDisplay.GetDisplay(), &visuals[i], GLX_SAMPLES_ARB, &samples); // First check the mandatory parameters - if ((RGBA == 0) || (DoubleBuffer == 0)) + if ((RGBA == 0) || (doubleBuffer == 0)) continue; // Evaluate the current configuration - int Color = Red + Green + Blue + Alpha; - int Score = EvaluateFormat(BitsPerPixel, mySettings, Color, Depth, Stencil, MultiSampling ? Samples : 0); + int color = red + green + blue + alpha; + int score = EvaluateFormat(bitsPerPixel, mySettings, color, depth, stencil, multiSampling ? samples : 0); // Keep it if it's better than the current best - if (Score < BestScore) + if (score < bestScore) { - BestScore = Score; - BestVisual = &Visuals[i]; + bestScore = score; + bestVisual = &visuals[i]; } } // If no visual has been found, try a lower level of antialiasing - if (!BestVisual) + if (!bestVisual) { if (mySettings.AntialiasingLevel > 2) { @@ -260,10 +260,10 @@ void ContextGLX::CreateContext(ContextGLX* Shared, unsigned int BitsPerPixel, co } // Get the context to share display lists with - GLXContext ToShare = Shared ? Shared->myContext : NULL; + GLXContext toShare = shared ? shared->myContext : NULL; // Create the context - myContext = glXCreateContext(myDisplay.GetDisplay(), BestVisual, ToShare, true); + myContext = glXCreateContext(myDisplay.GetDisplay(), bestVisual, toShare, true); if (!myContext) { std::cerr << "Failed to create an OpenGL context for this window" << std::endl; @@ -271,19 +271,19 @@ void ContextGLX::CreateContext(ContextGLX* Shared, unsigned int BitsPerPixel, co } // Update the creation settings from the chosen format - int Depth, Stencil; - glXGetConfig(myDisplay.GetDisplay(), BestVisual, GLX_DEPTH_SIZE, &Depth); - glXGetConfig(myDisplay.GetDisplay(), BestVisual, GLX_STENCIL_SIZE, &Stencil); - mySettings.DepthBits = static_cast(Depth); - mySettings.StencilBits = static_cast(Stencil); + int depth, stencil; + glXGetConfig(myDisplay.GetDisplay(), bestVisual, GLX_DEPTH_SIZE, &depth); + glXGetConfig(myDisplay.GetDisplay(), bestVisual, GLX_STENCIL_SIZE, &stencil); + mySettings.DepthBits = static_cast(depth); + mySettings.StencilBits = static_cast(stencil); // Change the target window's colormap so that it matches the context's one - ::Window Root = RootWindow(myDisplay.GetDisplay(), DefaultScreen(myDisplay.GetDisplay())); - Colormap ColMap = XCreateColormap(myDisplay.GetDisplay(), Root, BestVisual->visual, AllocNone); - XSetWindowColormap(myDisplay.GetDisplay(), myWindow, ColMap); + ::Window root = RootWindow(myDisplay.GetDisplay(), DefaultScreen(myDisplay.GetDisplay())); + Colormap colorMap = XCreateColormap(myDisplay.GetDisplay(), root, bestVisual->visual, AllocNone); + XSetWindowColormap(myDisplay.GetDisplay(), myWindow, colorMap); // Free the temporary visuals array - XFree(Visuals); + XFree(visuals); } } // namespace priv diff --git a/src/SFML/Window/Linux/ContextGLX.hpp b/src/SFML/Window/Linux/ContextGLX.hpp index d4140c7e3..a4a50be44 100644 --- a/src/SFML/Window/Linux/ContextGLX.hpp +++ b/src/SFML/Window/Linux/ContextGLX.hpp @@ -48,21 +48,21 @@ public : //////////////////////////////////////////////////////////// /// Create a new context, not associated to a window /// - /// \param Shared : Context to share the new one with (can be NULL) + /// \param shared : Context to share the new one with (can be NULL) /// //////////////////////////////////////////////////////////// - ContextGLX(ContextGLX* Shared); + ContextGLX(ContextGLX* shared); //////////////////////////////////////////////////////////// /// Create a new context attached to a window /// - /// \param Shared : Context to share the new one with (can be NULL) - /// \param Owner : Pointer to the owner window - /// \param BitsPerPixel : Pixel depth (in bits per pixel) - /// \param Settings : Creation parameters + /// \param shared : Context to share the new one with (can be NULL) + /// \param owner : Pointer to the owner window + /// \param bitsPerPixel : Pixel depth (in bits per pixel) + /// \param settings : Creation parameters /// //////////////////////////////////////////////////////////// - ContextGLX(ContextGLX* Shared, const WindowImpl* Owner, unsigned int BitsPerPixel, const ContextSettings& Settings); + ContextGLX(ContextGLX* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings); //////////////////////////////////////////////////////////// /// Destructor @@ -74,7 +74,7 @@ public : /// \see Context::MakeCurrent /// //////////////////////////////////////////////////////////// - virtual bool MakeCurrent(bool Active); + virtual bool MakeCurrent(bool active); //////////////////////////////////////////////////////////// /// \see Context::Display @@ -86,7 +86,7 @@ public : /// \see Context::UseVerticalSync /// //////////////////////////////////////////////////////////// - virtual void UseVerticalSync(bool Enabled); + virtual void UseVerticalSync(bool enabled); //////////////////////////////////////////////////////////// /// Check if a context is active on the current thread @@ -101,12 +101,12 @@ private : //////////////////////////////////////////////////////////// /// Create the context /// - /// \param Shared : Context to share the new one with (can be NULL) - /// \param BitsPerPixel : Pixel depth, in bits per pixel - /// \param Settings : Creation parameters + /// \param shared : Context to share the new one with (can be NULL) + /// \param bitsPerPixel : Pixel depth, in bits per pixel + /// \param settings : Creation parameters /// //////////////////////////////////////////////////////////// - void CreateContext(ContextGLX* Shared, unsigned int BitsPerPixel, const ContextSettings& Settings); + void CreateContext(ContextGLX* shared, unsigned int bitsPerPixel, const ContextSettings& settings); //////////////////////////////////////////////////////////// // Member data diff --git a/src/SFML/Window/Linux/DisplayRef.cpp b/src/SFML/Window/Linux/DisplayRef.cpp index 97ddf150c..790021b70 100644 --- a/src/SFML/Window/Linux/DisplayRef.cpp +++ b/src/SFML/Window/Linux/DisplayRef.cpp @@ -34,9 +34,9 @@ //////////////////////////////////////////////////////////// namespace { - ::Display* TheDisplay = NULL; - XIM TheInputMethod = NULL; - int RefCount = 0; + ::Display* theDisplay = NULL; + XIM theInputMethod = NULL; + int refCount = 0; } @@ -50,13 +50,13 @@ namespace priv DisplayRef::DisplayRef() { // If the display hasn't been opened yet, open it - if (TheDisplay == NULL) + if (theDisplay == NULL) { - TheDisplay = XOpenDisplay(NULL); - if (TheDisplay) + theDisplay = XOpenDisplay(NULL); + if (theDisplay) { // Create the input method object - TheInputMethod = XOpenIM(TheDisplay, NULL, NULL, NULL); + theInputMethod = XOpenIM(theDisplay, NULL, NULL, NULL); } else { @@ -65,17 +65,17 @@ DisplayRef::DisplayRef() } // Increase the number of references - RefCount++; + refCount++; } //////////////////////////////////////////////////////////// /// Copy constructor //////////////////////////////////////////////////////////// -DisplayRef::DisplayRef(const DisplayRef& Copy) +DisplayRef::DisplayRef(const DisplayRef&) { // Increase the number of references - RefCount++; + refCount++; } @@ -85,17 +85,17 @@ DisplayRef::DisplayRef(const DisplayRef& Copy) DisplayRef::~DisplayRef() { // Decrease the number of references - RefCount--; + refCount--; // If all references have been destroyed, we can close the display - if (RefCount == 0) + if (refCount == 0) { // Destroy the input method object - if (TheInputMethod) - XCloseIM(TheInputMethod); + if (theInputMethod) + XCloseIM(theInputMethod); // Close the display - XCloseDisplay(TheDisplay); + XCloseDisplay(theDisplay); } } @@ -105,7 +105,7 @@ DisplayRef::~DisplayRef() //////////////////////////////////////////////////////////// ::Display* DisplayRef::GetDisplay() const { - return TheDisplay; + return theDisplay; } @@ -114,7 +114,7 @@ DisplayRef::~DisplayRef() //////////////////////////////////////////////////////////// XIM DisplayRef::GetInputMethod() const { - return TheInputMethod; + return theInputMethod; } } // namespace priv diff --git a/src/SFML/Window/Linux/DisplayRef.hpp b/src/SFML/Window/Linux/DisplayRef.hpp index cf8a28a07..98894bf65 100644 --- a/src/SFML/Window/Linux/DisplayRef.hpp +++ b/src/SFML/Window/Linux/DisplayRef.hpp @@ -51,10 +51,10 @@ public : //////////////////////////////////////////////////////////// /// Copy constructor /// - /// \param Copy : Instance to copy + /// \param copy : Instance to copy /// //////////////////////////////////////////////////////////// - DisplayRef(const DisplayRef& Copy); + DisplayRef(const DisplayRef& copy); //////////////////////////////////////////////////////////// /// Destructor diff --git a/src/SFML/Window/Linux/Joystick.cpp b/src/SFML/Window/Linux/Joystick.cpp index 509bc53e7..1e6c339b3 100644 --- a/src/SFML/Window/Linux/Joystick.cpp +++ b/src/SFML/Window/Linux/Joystick.cpp @@ -45,7 +45,7 @@ namespace priv //////////////////////////////////////////////////////////// /// Initialize the instance and bind it to a physical joystick //////////////////////////////////////////////////////////// -void Joystick::Initialize(unsigned int Index) +void Joystick::Initialize(unsigned int index) { // Initial state myNbAxes = 0; @@ -57,7 +57,7 @@ void Joystick::Initialize(unsigned int Index) // Open the joystick handle std::ostringstream oss; - oss << "/dev/input/js" << Index; + oss << "/dev/input/js" << index; myDescriptor = open(oss.str().c_str(), O_RDONLY); if (myDescriptor > 0) { @@ -65,11 +65,11 @@ void Joystick::Initialize(unsigned int Index) fcntl(myDescriptor, F_SETFL, O_NONBLOCK); // Get number of axes and buttons - char NbAxes, NbButtons; - ioctl(myDescriptor, JSIOCGAXES, &NbAxes); - ioctl(myDescriptor, JSIOCGBUTTONS, &NbButtons); - myNbAxes = NbAxes; - myNbButtons = NbButtons; + char nbAxes, nbButtons; + ioctl(myDescriptor, JSIOCGAXES, &nbAxes); + ioctl(myDescriptor, JSIOCGBUTTONS, &nbButtons); + myNbAxes = nbAxes; + myNbButtons = nbButtons; } } @@ -81,24 +81,24 @@ JoystickState Joystick::UpdateState() { if (myDescriptor > 0) { - js_event JoyState; - while (read(myDescriptor, &JoyState, sizeof(JoyState)) > 0) + js_event joyState; + while (read(myDescriptor, &joyState, sizeof(joyState)) > 0) { - switch (JoyState.type & ~JS_EVENT_INIT) + switch (joyState.type & ~JS_EVENT_INIT) { // An axis has been moved case JS_EVENT_AXIS : { - if (JoyState.number < Joy::Count) - myState.Axis[JoyState.number] = JoyState.value * 100.f / 32767.f; + if (joyState.number < Joy::Count) + myState.Axis[joyState.number] = joyState.value * 100.f / 32767.f; break; } // A button has been pressed case JS_EVENT_BUTTON : { - if (JoyState.number < GetButtonsCount()) - myState.Buttons[JoyState.number] = (JoyState.value != 0); + if (joyState.number < GetButtonsCount()) + myState.Buttons[joyState.number] = (joyState.value != 0); break; } } @@ -133,7 +133,7 @@ unsigned int Joystick::GetButtonsCount() const //////////////////////////////////////////////////////////// /// Initialize the instance and bind it to a physical joystick //////////////////////////////////////////////////////////// -void Joystick::Initialize(unsigned int Index) +void Joystick::Initialize(unsigned int index) { } diff --git a/src/SFML/Window/Linux/Joystick.hpp b/src/SFML/Window/Linux/Joystick.hpp index a035f6156..33fb44a8d 100644 --- a/src/SFML/Window/Linux/Joystick.hpp +++ b/src/SFML/Window/Linux/Joystick.hpp @@ -44,10 +44,10 @@ public : //////////////////////////////////////////////////////////// /// Initialize the instance and bind it to a physical joystick /// - /// \param Index : Index of the physical joystick to bind to + /// \param index : Index of the physical joystick to bind to /// //////////////////////////////////////////////////////////// - void Initialize(unsigned int Index); + void Initialize(unsigned int index); //////////////////////////////////////////////////////////// /// Update the current joystick and return its new state diff --git a/src/SFML/Window/Linux/VideoModeSupport.cpp b/src/SFML/Window/Linux/VideoModeSupport.cpp index 7e6a44047..1c20a1ef8 100644 --- a/src/SFML/Window/Linux/VideoModeSupport.cpp +++ b/src/SFML/Window/Linux/VideoModeSupport.cpp @@ -40,51 +40,51 @@ namespace priv //////////////////////////////////////////////////////////// /// Get supported video modes //////////////////////////////////////////////////////////// -void VideoModeSupport::GetSupportedVideoModes(std::vector& Modes) +void VideoModeSupport::GetSupportedVideoModes(std::vector& modes) { // First, clear array to fill - Modes.clear(); + modes.clear(); // Get an access to the display - DisplayRef Disp; - int Screen = DefaultScreen(Disp.GetDisplay()); + DisplayRef disp; + int screen = DefaultScreen(disp.GetDisplay()); // Check if the XRandR extension is present - int Version; - if (XQueryExtension(Disp.GetDisplay(), "RANDR", &Version, &Version, &Version)) + int version; + if (XQueryExtension(Disp.GetDisplay(), "RANDR", &version, &version, &version)) { // Get the current configuration - XRRScreenConfiguration* Config = XRRGetScreenInfo(Disp.GetDisplay(), RootWindow(Disp.GetDisplay(), Screen)); - if (Config) + XRRScreenConfiguration* config = XRRGetScreenInfo(disp.GetDisplay(), RootWindow(disp.GetDisplay(), screen)); + if (config) { // Get the available screen sizes - int NbSizes; - XRRScreenSize* Sizes = XRRConfigSizes(Config, &NbSizes); - if (Sizes && (NbSizes > 0)) + int nbSizes; + XRRScreenSize* sizes = XRRConfigSizes(config, &nbSizes); + if (sizes && (nbSizes > 0)) { // Get the list of supported depths - int NbDepths = 0; - int* Depths = XListDepths(Disp.GetDisplay(), Screen, &NbDepths); - if (Depths && (NbDepths > 0)) + int nbDepths = 0; + int* depths = XListDepths(disp.GetDisplay(), screen, &nbDepths); + if (depths && (nbDepths > 0)) { // Combine depths and sizes to fill the array of supported modes - for (int i = 0; i < NbDepths; ++i) + for (int i = 0; i < nbDepths; ++i) { - for (int j = 0; j < NbSizes; ++j) + for (int j = 0; j < nbSizes; ++j) { // Convert to VideoMode - VideoMode Mode(Sizes[j].width, Sizes[j].height, Depths[i]); + VideoMode mode(sizes[j].width, sizes[j].height, depths[i]); // Add it only if it is not already in the array - if (std::find(Modes.begin(), Modes.end(), Mode) == Modes.end()) - Modes.push_back(Mode); + if (std::find(modes.begin(), modes.end(), mode) == modes.end()) + modes.push_back(mode); } } } } // Free the configuration instance - XRRFreeScreenConfigInfo(Config); + XRRFreeScreenConfigInfo(config); } else { @@ -105,36 +105,36 @@ void VideoModeSupport::GetSupportedVideoModes(std::vector& Modes) //////////////////////////////////////////////////////////// VideoMode VideoModeSupport::GetDesktopVideoMode() { - VideoMode DesktopMode; + VideoMode desktopMode; // Get an access to the display - DisplayRef Disp; - int Screen = DefaultScreen(Disp.GetDisplay()); + DisplayRef disp; + int screen = DefaultScreen(disp.GetDisplay()); // Check if the XRandR extension is present - int Version; - if (XQueryExtension(Disp.GetDisplay(), "RANDR", &Version, &Version, &Version)) + int version; + if (XQueryExtension(disp.GetDisplay(), "RANDR", &version, &version, &version)) { // Get the current configuration - XRRScreenConfiguration* Config = XRRGetScreenInfo(Disp.GetDisplay(), RootWindow(Disp.GetDisplay(), Screen)); - if (Config) + XRRScreenConfiguration* config = XRRGetScreenInfo(disp.GetDisplay(), RootWindow(disp.GetDisplay(), screen)); + if (config) { // Get the current video mode - Rotation CurrentRotation; - int CurrentMode = XRRConfigCurrentConfiguration(Config, &CurrentRotation); + Rotation currentRotation; + int currentMode = XRRConfigCurrentConfiguration(config, ¤tRotation); // Get the available screen sizes - int NbSizes; - XRRScreenSize* Sizes = XRRConfigSizes(Config, &NbSizes); - if (Sizes && (NbSizes > 0)) - DesktopMode = VideoMode(Sizes[CurrentMode].width, Sizes[CurrentMode].height, DefaultDepth(Disp.GetDisplay(), Screen)); + int nbSizes; + XRRScreenSize* sizes = XRRConfigSizes(Config, &nbSizes); + if (sizes && (nbSizes > 0)) + desktopMode = VideoMode(sizes[currentMode].width, sizes[currentMode].height, DefaultDepth(disp.GetDisplay(), screen)); // Free the configuration instance - XRRFreeScreenConfigInfo(Config); + XRRFreeScreenConfigInfo(config); } } - return DesktopMode; + return desktopMode; } } // namespace priv diff --git a/src/SFML/Window/Linux/VideoModeSupport.hpp b/src/SFML/Window/Linux/VideoModeSupport.hpp index 9160ff5f4..758b71aec 100644 --- a/src/SFML/Window/Linux/VideoModeSupport.hpp +++ b/src/SFML/Window/Linux/VideoModeSupport.hpp @@ -47,10 +47,10 @@ public : //////////////////////////////////////////////////////////// /// Get supported video modes /// - /// \param Modes : Array to fill with available video modes + /// \param modes : Array to fill with available video modes /// //////////////////////////////////////////////////////////// - static void GetSupportedVideoModes(std::vector& Modes); + static void GetSupportedVideoModes(std::vector& modes); //////////////////////////////////////////////////////////// /// Get current desktop video mode diff --git a/src/SFML/Window/Linux/WindowImplX11.cpp b/src/SFML/Window/Linux/WindowImplX11.cpp index c0a28fd6a..ceb81d330 100644 --- a/src/SFML/Window/Linux/WindowImplX11.cpp +++ b/src/SFML/Window/Linux/WindowImplX11.cpp @@ -41,8 +41,8 @@ //////////////////////////////////////////////////////////// namespace { - sf::priv::WindowImplX11* FullscreenWindow = NULL; - unsigned long EventMask = FocusChangeMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | + sf::priv::WindowImplX11* fullscreenWindow = NULL; + unsigned long eventMask = FocusChangeMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | PointerMotionMask | KeyPressMask | KeyReleaseMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask; @@ -50,10 +50,10 @@ namespace /// Filter the events received by windows /// (only allow those matching a specific window) //////////////////////////////////////////////////////////// - Bool CheckEvent(::Display*, XEvent* Event, XPointer UserData) + Bool CheckEvent(::Display*, XEvent* event, XPointer userData) { // Just check if the event matches the window - return Event->xany.window == reinterpret_cast< ::Window >(UserData); + return event->xany.window == reinterpret_cast< ::Window >(userData); } } @@ -65,7 +65,7 @@ namespace priv //////////////////////////////////////////////////////////// /// Create the window implementation from an existing control //////////////////////////////////////////////////////////// -WindowImplX11::WindowImplX11(WindowHandle Handle) : +WindowImplX11::WindowImplX11(WindowHandle handle) : myWindow (0), myIsExternal (true), myAtomClose (0), @@ -79,19 +79,19 @@ myKeyRepeat (true) myScreen = DefaultScreen(myDisplay); // Save the window handle - myWindow = Handle; + myWindow = handle; if (myWindow) { // Get the window size - XWindowAttributes WindowAttributes; - if (XGetWindowAttributes(myDisplay, myWindow, &WindowAttributes) == 0) + XWindowAttributes windowAttributes; + if (XGetWindowAttributes(myDisplay, myWindow, &windowAttributes) == 0) { std::cerr << "Failed to get the window attributes" << std::endl; return; } - myWidth = WindowAttributes.width; - myHeight = WindowAttributes.height; + myWidth = windowAttributes.width; + myHeight = windowAttributes.height; // Make sure the window is listening to all the requiered events XSelectInput(myDisplay, myWindow, EventMask & ~ButtonPressMask); @@ -105,7 +105,7 @@ myKeyRepeat (true) //////////////////////////////////////////////////////////// /// Create the window implementation //////////////////////////////////////////////////////////// -WindowImplX11::WindowImplX11(VideoMode Mode, const std::string& Title, unsigned long WindowStyle) : +WindowImplX11::WindowImplX11(VideoMode mode, const std::string& title, unsigned long style) : myWindow (0), myIsExternal (false), myAtomClose (0), @@ -119,40 +119,40 @@ myKeyRepeat (true) myScreen = DefaultScreen(myDisplay); // Compute position and size - int Left, Top; - bool Fullscreen = (WindowStyle & Style::Fullscreen) != 0; - if (!Fullscreen) + int left, top; + bool fullscreen = (style & Style::Fullscreen) != 0; + if (!fullscreen) { - Left = (DisplayWidth(myDisplay, myScreen) - Mode.Width) / 2; - Top = (DisplayHeight(myDisplay, myScreen) - Mode.Height) / 2; + left = (DisplayWidth(myDisplay, myScreen) - mode.Width) / 2; + top = (DisplayHeight(myDisplay, myScreen) - mode.Height) / 2; } else { - Left = 0; - Top = 0; + left = 0; + top = 0; } - int Width = myWidth = Mode.Width; - int Height = myHeight = Mode.Height; + int width = myWidth = mode.Width; + int height = myHeight = mode.Height; // Switch to fullscreen if necessary - if (Fullscreen) - SwitchToFullscreen(Mode); + if (fullscreen) + SwitchToFullscreen(mode); // Define the window attributes - XSetWindowAttributes Attributes; - Attributes.event_mask = EventMask; - Attributes.override_redirect = Fullscreen; + XSetWindowAttributes attributes; + attributes.event_mask = eventMask; + attributes.override_redirect = fullscreen; // Create the window myWindow = XCreateWindow(myDisplay, RootWindow(myDisplay, myScreen), - Left, Top, - Width, Height, + left, top, + width, height, 0, DefaultDepth(myDisplay, myScreen), InputOutput, DefaultVisual(myDisplay, myScreen), - CWEventMask | CWOverrideRedirect, &Attributes); + CWEventMask | CWOverrideRedirect, &attributes); if (!myWindow) { std::cerr << "Failed to create window" << std::endl; @@ -160,10 +160,10 @@ myKeyRepeat (true) } // Set the window's name - XStoreName(myDisplay, myWindow, Title.c_str()); + XStoreName(myDisplay, myWindow, title.c_str()); // Set the window's style (tell the windows manager to change our window's decorations and functions according to the requested style) - if (!Fullscreen) + if (!fullscreen) { Atom WMHintsAtom = XInternAtom(myDisplay, "_MOTIF_WM_HINTS", false); if (WMHintsAtom) @@ -195,39 +195,39 @@ myKeyRepeat (true) unsigned long State; }; - WMHints Hints; - Hints.Flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; - Hints.Decorations = 0; - Hints.Functions = 0; + WMHints hints; + hints.Flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; + hints.Decorations = 0; + hints.Functions = 0; - if (WindowStyle & Style::Titlebar) + if (style & Style::Titlebar) { - Hints.Decorations |= MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MINIMIZE | MWM_DECOR_MENU; - Hints.Functions |= MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE; + hints.Decorations |= MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MINIMIZE | MWM_DECOR_MENU; + hints.Functions |= MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE; } - if (WindowStyle & Style::Resize) + if (style & Style::Resize) { - Hints.Decorations |= MWM_DECOR_MAXIMIZE | MWM_DECOR_RESIZEH; - Hints.Functions |= MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE; + hints.Decorations |= MWM_DECOR_MAXIMIZE | MWM_DECOR_RESIZEH; + hints.Functions |= MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE; } - if (WindowStyle & Style::Close) + if (style & Style::Close) { - Hints.Decorations |= 0; - Hints.Functions |= MWM_FUNC_CLOSE; + hints.Decorations |= 0; + hints.Functions |= MWM_FUNC_CLOSE; } - const unsigned char* HintsPtr = reinterpret_cast(&Hints); - XChangeProperty(myDisplay, myWindow, WMHintsAtom, WMHintsAtom, 32, PropModeReplace, HintsPtr, 5); + const unsigned char* ptr = reinterpret_cast(&hints); + XChangeProperty(myDisplay, myWindow, WMHintsAtom, WMHintsAtom, 32, PropModeReplace, ptr, 5); } // This is a hack to force some windows managers to disable resizing - if (!(WindowStyle & Style::Resize)) + if (!(style & Style::Resize)) { - XSizeHints XSizeHints; - XSizeHints.flags = PMinSize | PMaxSize; - XSizeHints.min_width = XSizeHints.max_width = Width; - XSizeHints.min_height = XSizeHints.max_height = Height; - XSetWMNormalHints(myDisplay, myWindow, &XSizeHints); + XSizeHints sizeHints; + sizeHints.flags = PMinSize | PMaxSize; + sizeHints.min_width = sizeHints.max_width = width; + sizeHints.min_height = sizeHints.max_height = height; + XSetWMNormalHints(myDisplay, myWindow, &sizeHints); } } @@ -235,7 +235,7 @@ myKeyRepeat (true) Initialize(); // In fullscreen mode, we must grab keyboard and mouse inputs - if (Fullscreen) + if (fullscreen) { XGrabPointer(myDisplay, myWindow, true, 0, GrabModeAsync, GrabModeAsync, myWindow, None, CurrentTime); XGrabKeyboard(myDisplay, myWindow, true, GrabModeAsync, GrabModeAsync, CurrentTime); @@ -288,33 +288,33 @@ void WindowImplX11::ProcessEvents() // Process any event in the queue matching our window - XEvent Event; - while (XCheckIfEvent(myDisplay, &Event, &CheckEvent, reinterpret_cast(myWindow))) + XEvent event; + while (XCheckIfEvent(myDisplay, &event, &CheckEvent, reinterpret_cast(myWindow))) { // Detect repeated key events - if ((Event.type == KeyPress) || (Event.type == KeyRelease)) + if ((event.type == KeyPress) || (event.type == KeyRelease)) { - if (Event.xkey.keycode < 256) + if (event.xkey.keycode < 256) { // To detect if it is a repeated key event, we check the current state of the key. // - If the state is "down", KeyReleased events must obviously be discarded. // - KeyPress events are a little bit harder to handle: they depend on the EnableKeyRepeat state, // and we need to properly forward the first one. - char Keys[32]; - XQueryKeymap(myDisplay, Keys); - if (Keys[Event.xkey.keycode >> 3] & (1 << (Event.xkey.keycode % 8))) + char keys[32]; + XQueryKeymap(myDisplay, keys); + if (keys[event.xkey.keycode >> 3] & (1 << (event.xkey.keycode % 8))) { // KeyRelease event + key down = repeated event --> discard - if (Event.type == KeyRelease) + if (event.type == KeyRelease) { - myLastKeyReleaseEvent = Event; + myLastKeyReleaseEvent = event; continue; } // KeyPress event + key repeat disabled + matching KeyRelease event = repeated event --> discard - if ((Event.type == KeyPress) && !myKeyRepeat && - (myLastKeyReleaseEvent.xkey.keycode == Event.xkey.keycode) && - (myLastKeyReleaseEvent.xkey.time == Event.xkey.time)) + if ((event.type == KeyPress) && !myKeyRepeat && + (myLastKeyReleaseEvent.xkey.keycode == event.xkey.keycode) && + (myLastKeyReleaseEvent.xkey.time == event.xkey.time)) { continue; } @@ -323,7 +323,7 @@ void WindowImplX11::ProcessEvents() } // Process the event - ProcessEvent(Event); + ProcessEvent(event); } } @@ -331,9 +331,9 @@ void WindowImplX11::ProcessEvents() //////////////////////////////////////////////////////////// /// /see WindowImpl::ShowMouseCursor //////////////////////////////////////////////////////////// -void WindowImplX11::ShowMouseCursor(bool Show) +void WindowImplX11::ShowMouseCursor(bool show) { - XDefineCursor(myDisplay, myWindow, Show ? None : myHiddenCursor); + XDefineCursor(myDisplay, myWindow, show ? None : myHiddenCursor); XFlush(myDisplay); } @@ -341,9 +341,9 @@ void WindowImplX11::ShowMouseCursor(bool Show) //////////////////////////////////////////////////////////// /// /see sfWindowImpl::SetCursorPosition //////////////////////////////////////////////////////////// -void WindowImplX11::SetCursorPosition(unsigned int Left, unsigned int Top) +void WindowImplX11::SetCursorPosition(unsigned int left, unsigned int top) { - XWarpPointer(myDisplay, None, myWindow, 0, 0, 0, 0, Left, Top); + XWarpPointer(myDisplay, None, myWindow, 0, 0, 0, 0, left, top); XFlush(myDisplay); } @@ -351,9 +351,9 @@ void WindowImplX11::SetCursorPosition(unsigned int Left, unsigned int Top) //////////////////////////////////////////////////////////// /// /see sfWindowImpl::SetPosition //////////////////////////////////////////////////////////// -void WindowImplX11::SetPosition(int Left, int Top) +void WindowImplX11::SetPosition(int left, int top) { - XMoveWindow(myDisplay, myWindow, Left, Top); + XMoveWindow(myDisplay, myWindow, left, top); XFlush(myDisplay); } @@ -361,9 +361,9 @@ void WindowImplX11::SetPosition(int Left, int Top) //////////////////////////////////////////////////////////// /// /see WindowImpl::SetSize //////////////////////////////////////////////////////////// -void WindowImplX11::SetSize(unsigned int Width, unsigned int Height) +void WindowImplX11::SetSize(unsigned int width, unsigned int height) { - XResizeWindow(myDisplay, myWindow, Width, Height); + XResizeWindow(myDisplay, myWindow, width, height); XFlush(myDisplay); } @@ -371,9 +371,9 @@ void WindowImplX11::SetSize(unsigned int Width, unsigned int Height) //////////////////////////////////////////////////////////// /// /see sfWindowImpl::Show //////////////////////////////////////////////////////////// -void WindowImplX11::Show(bool State) +void WindowImplX11::Show(bool show) { - if (State) + if (show) XMapWindow(myDisplay, myWindow); else XUnmapWindow(myDisplay, myWindow); @@ -385,70 +385,70 @@ void WindowImplX11::Show(bool State) //////////////////////////////////////////////////////////// /// /see sfWindowImpl::EnableKeyRepeat //////////////////////////////////////////////////////////// -void WindowImplX11::EnableKeyRepeat(bool Enabled) +void WindowImplX11::EnableKeyRepeat(bool enabled) { - myKeyRepeat = Enabled; + myKeyRepeat = enabled; } //////////////////////////////////////////////////////////// /// /see WindowImpl::SetIcon //////////////////////////////////////////////////////////// -void WindowImplX11::SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels) +void WindowImplX11::SetIcon(unsigned int width, unsigned int height, const Uint8* pixels) { // X11 wants BGRA pixels : swap red and blue channels // Note : this memory will never be freed, but it seems to cause a bug on exit if I do so - Uint8* IconPixels = new Uint8[Width * Height * 4]; - for (std::size_t i = 0; i < Width * Height; ++i) + Uint8* iconPixels = new Uint8[width * height * 4]; + for (std::size_t i = 0; i < width * height; ++i) { - IconPixels[i * 4 + 0] = Pixels[i * 4 + 2]; - IconPixels[i * 4 + 1] = Pixels[i * 4 + 1]; - IconPixels[i * 4 + 2] = Pixels[i * 4 + 0]; - IconPixels[i * 4 + 3] = Pixels[i * 4 + 3]; + iconPixels[i * 4 + 0] = pixels[i * 4 + 2]; + iconPixels[i * 4 + 1] = pixels[i * 4 + 1]; + iconPixels[i * 4 + 2] = pixels[i * 4 + 0]; + iconPixels[i * 4 + 3] = pixels[i * 4 + 3]; } // Create the icon pixmap - Visual* DefVisual = DefaultVisual(myDisplay, myScreen); - unsigned int DefDepth = DefaultDepth(myDisplay, myScreen); - XImage* IconImage = XCreateImage(myDisplay, DefVisual, DefDepth, ZPixmap, 0, (char*)IconPixels, Width, Height, 32, 0); - if (!IconImage) + Visual* defVisual = DefaultVisual(myDisplay, myScreen); + unsigned int defDepth = DefaultDepth(myDisplay, myScreen); + XImage* iconImage = XCreateImage(myDisplay, defVisual, defDepth, ZPixmap, 0, (char*)iconPixels, width, height, 32, 0); + if (!iconImage) { std::cerr << "Failed to set the window's icon" << std::endl; return; } - Pixmap IconPixmap = XCreatePixmap(myDisplay, RootWindow(myDisplay, myScreen), Width, Height, DefDepth); - XGCValues Values; - GC IconGC = XCreateGC(myDisplay, IconPixmap, 0, &Values); - XPutImage(myDisplay, IconPixmap, IconGC, IconImage, 0, 0, 0, 0, Width, Height); - XFreeGC(myDisplay, IconGC); - XDestroyImage(IconImage); + Pixmap iconPixmap = XCreatePixmap(myDisplay, RootWindow(myDisplay, myScreen), width, height, defDepth); + XGCValues values; + GC iconGC = XCreateGC(myDisplay, iconPixmap, 0, &values); + XPutImage(myDisplay, iconPixmap, iconGC, iconImage, 0, 0, 0, 0, width, height); + XFreeGC(myDisplay, iconGC); + XDestroyImage(iconImage); // Create the mask pixmap (must have 1 bit depth) - std::size_t Pitch = (Width + 7) / 8; - static std::vector MaskPixels(Pitch * Height, 0); - for (std::size_t j = 0; j < Height; ++j) + std::size_t pitch = (width + 7) / 8; + static std::vector maskPixels(pitch * height, 0); + for (std::size_t j = 0; j < height; ++j) { - for (std::size_t i = 0; i < Pitch; ++i) + for (std::size_t i = 0; i < pitch; ++i) { for (std::size_t k = 0; k < 8; ++k) { - if (i * 8 + k < Width) + if (i * 8 + k < width) { - Uint8 Opacity = (Pixels[(i * 8 + k + j * Width) * 4 + 3] > 0) ? 1 : 0; - MaskPixels[i + j * Pitch] |= (Opacity << k); + Uint8 opacity = (pixels[(i * 8 + k + j * width) * 4 + 3] > 0) ? 1 : 0; + maskPixels[i + j * pitch] |= (opacity << k); } } } } - Pixmap MaskPixmap = XCreatePixmapFromBitmapData(myDisplay, myWindow, (char*)&MaskPixels[0], Width, Height, 1, 0, 1); + Pixmap maskPixmap = XCreatePixmapFromBitmapData(myDisplay, myWindow, (char*)&maskPixels[0], width, height, 1, 0, 1); // Send our new icon to the window through the WMHints - XWMHints* Hints = XAllocWMHints(); - Hints->flags = IconPixmapHint | IconMaskHint; - Hints->icon_pixmap = IconPixmap; - Hints->icon_mask = MaskPixmap; - XSetWMHints(myDisplay, myWindow, Hints); - XFree(Hints); + XWMHints* hints = XAllocWMHints(); + hints->flags = IconPixmapHint | IconMaskHint; + hints->icon_pixmap = iconPixmap; + hints->icon_mask = maskPixmap; + XSetWMHints(myDisplay, myWindow, hints); + XFree(hints); XFlush(myDisplay); } @@ -457,42 +457,42 @@ void WindowImplX11::SetIcon(unsigned int Width, unsigned int Height, const Uint8 //////////////////////////////////////////////////////////// /// Switch to fullscreen mode //////////////////////////////////////////////////////////// -void WindowImplX11::SwitchToFullscreen(const VideoMode& Mode) +void WindowImplX11::SwitchToFullscreen(const VideoMode& mode) { // Check if the XRandR extension is present - int Version; - if (XQueryExtension(myDisplay, "RANDR", &Version, &Version, &Version)) + int version; + if (XQueryExtension(myDisplay, "RANDR", &version, &version, &version)) { // Get the current configuration - XRRScreenConfiguration* Config = XRRGetScreenInfo(myDisplay, RootWindow(myDisplay, myScreen)); - if (Config) + XRRScreenConfiguration* config = XRRGetScreenInfo(myDisplay, RootWindow(myDisplay, myScreen)); + if (config) { // Get the current rotation - Rotation CurrentRotation; - myOldVideoMode = XRRConfigCurrentConfiguration(Config, &CurrentRotation); + Rotation currentRotation; + myOldVideoMode = XRRConfigCurrentConfiguration(config, ¤tRotation); // Get the available screen sizes - int NbSizes; - XRRScreenSize* Sizes = XRRConfigSizes(Config, &NbSizes); - if (Sizes && (NbSizes > 0)) + int nbSizes; + XRRScreenSize* sizes = XRRConfigSizes(config, &nbSizes); + if (sizes && (nbSizes > 0)) { // Search a matching size - for (int i = 0; i < NbSizes; ++i) + for (int i = 0; i < nbSizes; ++i) { - if ((Sizes[i].width == static_cast(Mode.Width)) && (Sizes[i].height == static_cast(Mode.Height))) + if ((sizes[i].width == static_cast(mode.Width)) && (sizes[i].height == static_cast(mode.Height))) { // Switch to fullscreen mode - XRRSetScreenConfig(myDisplay, Config, RootWindow(myDisplay, myScreen), i, CurrentRotation, CurrentTime); + XRRSetScreenConfig(myDisplay, config, RootWindow(myDisplay, myScreen), i, currentRotation, CurrentTime); // Set "this" as the current fullscreen window - FullscreenWindow = this; + fullscreenWindow = this; break; } } } // Free the configuration instance - XRRFreeScreenConfigInfo(Config); + XRRFreeScreenConfigInfo(config); } else { @@ -521,13 +521,13 @@ void WindowImplX11::Initialize() XSetWMProtocols(myDisplay, myWindow, &myAtomClose, 1); // Create the input context - XIM InputMethod = myDisplayRef.GetInputMethod(); - if (InputMethod) + XIM inputMethod = myDisplayRef.GetInputMethod(); + if (inputMethod) { - myInputContext = XCreateIC(InputMethod, - XNClientWindow, myWindow, - XNFocusWindow, myWindow, - XNInputStyle, XIMPreeditNothing | XIMStatusNothing, + myInputContext = XCreateIC(inputMethod, + XNClientWindow, myWindow, + XNFocusWindow, myWindow, + XNInputStyle, XIMPreeditNothing | XIMStatusNothing, NULL); if (!myInputContext) @@ -552,19 +552,19 @@ void WindowImplX11::Initialize() void WindowImplX11::CreateHiddenCursor() { // Create the cursor's pixmap (1x1 pixels) - Pixmap CursorPixmap = XCreatePixmap(myDisplay, myWindow, 1, 1, 1); - GC GraphicsContext = XCreateGC(myDisplay, CursorPixmap, 0, NULL); - XDrawPoint(myDisplay, CursorPixmap, GraphicsContext, 0, 0); - XFreeGC(myDisplay, GraphicsContext); + Pixmap cursorPixmap = XCreatePixmap(myDisplay, myWindow, 1, 1, 1); + GC graphicsContext = XCreateGC(myDisplay, cursorPixmap, 0, NULL); + XDrawPoint(myDisplay, cursorPixmap, graphicsContext, 0, 0); + XFreeGC(myDisplay, graphicsContext); // Create the cursor, using the pixmap as both the shape and the mask of the cursor - XColor Color; - Color.flags = DoRed | DoGreen | DoBlue; - Color.red = Color.blue = Color.green = 0; - myHiddenCursor = XCreatePixmapCursor(myDisplay, CursorPixmap, CursorPixmap, &Color, &Color, 0, 0); + XColor color; + color.flags = DoRed | DoGreen | DoBlue; + color.red = Color.blue = Color.green = 0; + myHiddenCursor = XCreatePixmapCursor(myDisplay, cursorPixmap, cursorPixmap, &color, &color, 0, 0); // We don't need the pixmap any longer, free it - XFreePixmap(myDisplay, CursorPixmap); + XFreePixmap(myDisplay, cursorPixmap); } @@ -574,25 +574,25 @@ void WindowImplX11::CreateHiddenCursor() void WindowImplX11::CleanUp() { // Restore the previous video mode (in case we were running in fullscreen) - if (FullscreenWindow == this) + if (fullscreenWindow == this) { // Get current screen info - XRRScreenConfiguration* Config = XRRGetScreenInfo(myDisplay, RootWindow(myDisplay, myScreen)); - if (Config) + XRRScreenConfiguration* config = XRRGetScreenInfo(myDisplay, RootWindow(myDisplay, myScreen)); + if (config) { // Get the current rotation - Rotation CurrentRotation; - XRRConfigCurrentConfiguration(Config, &CurrentRotation); + Rotation currentRotation; + XRRConfigCurrentConfiguration(config, ¤tRotation); // Reset the video mode - XRRSetScreenConfig(myDisplay, Config, RootWindow(myDisplay, myScreen), myOldVideoMode, CurrentRotation, CurrentTime); + XRRSetScreenConfig(myDisplay, config, RootWindow(myDisplay, myScreen), myOldVideoMode, currentRotation, CurrentTime); // Free the configuration instance - XRRFreeScreenConfigInfo(Config); + XRRFreeScreenConfigInfo(config); } // Reset the fullscreen window - FullscreenWindow = NULL; + fullscreenWindow = NULL; } // Unhide the mouse cursor (in case it was hidden) @@ -603,9 +603,9 @@ void WindowImplX11::CleanUp() //////////////////////////////////////////////////////////// /// Process an incoming event from the window //////////////////////////////////////////////////////////// -void WindowImplX11::ProcessEvent(XEvent WinEvent) +void WindowImplX11::ProcessEvent(XEvent windowEvent) { - switch (WinEvent.type) + switch (windowEvent.type) { // Destroy event case DestroyNotify : @@ -622,9 +622,9 @@ void WindowImplX11::ProcessEvent(XEvent WinEvent) if (myInputContext) XSetICFocus(myInputContext); - Event Evt; - Evt.Type = Event::GainedFocus; - SendEvent(Evt); + Event event; + event.Type = Event::GainedFocus; + SendEvent(event); break; } @@ -635,25 +635,25 @@ void WindowImplX11::ProcessEvent(XEvent WinEvent) if (myInputContext) XUnsetICFocus(myInputContext); - Event Evt; - Evt.Type = Event::LostFocus; - SendEvent(Evt); + Event event; + event.Type = Event::LostFocus; + SendEvent(event); break; } // Resize event case ConfigureNotify : { - if ((WinEvent.xconfigure.width != static_cast(myWidth)) || (WinEvent.xconfigure.height != static_cast(myHeight))) + if ((windowEvent.xconfigure.width != static_cast(myWidth)) || (windowEvent.xconfigure.height != static_cast(myHeight))) { - myWidth = WinEvent.xconfigure.width; - myHeight = WinEvent.xconfigure.height; + myWidth = windowEvent.xconfigure.width; + myHeight = windowEvent.xconfigure.height; - Event Evt; - Evt.Type = Event::Resized; - Evt.Size.Width = myWidth; - Evt.Size.Height = myHeight; - SendEvent(Evt); + Event event; + event.Type = Event::Resized; + event.Size.Width = myWidth; + event.Size.Height = myHeight; + SendEvent(event); } break; } @@ -661,11 +661,11 @@ void WindowImplX11::ProcessEvent(XEvent WinEvent) // Close event case ClientMessage : { - if ((WinEvent.xclient.format == 32) && (WinEvent.xclient.data.l[0]) == static_cast(myAtomClose)) + if ((windowEvent.xclient.format == 32) && (windowEvent.xclient.data.l[0]) == static_cast(myAtomClose)) { - Event Evt; - Evt.Type = Event::Closed; - SendEvent(Evt); + Event event; + event.Type = Event::Closed; + SendEvent(event); } break; } @@ -674,54 +674,54 @@ void WindowImplX11::ProcessEvent(XEvent WinEvent) case KeyPress : { // Get the keysym of the key that has been pressed - static XComposeStatus KeyboardStatus; - char Buffer[32]; - KeySym Sym; - XLookupString(&WinEvent.xkey, Buffer, sizeof(Buffer), &Sym, &KeyboardStatus); + static XComposeStatus keyboard; + char buffer[32]; + KeySym symbol; + XLookupString(&windowEvent.xkey, buffer, sizeof(buffer), &symbol, &keyboard); // Fill the event parameters - Event Evt; - Evt.Type = Event::KeyPressed; - Evt.Key.Code = KeysymToSF(Sym); - Evt.Key.Alt = WinEvent.xkey.state & Mod1Mask; - Evt.Key.Control = WinEvent.xkey.state & ControlMask; - Evt.Key.Shift = WinEvent.xkey.state & ShiftMask; - SendEvent(Evt); + Event event; + event.Type = Event::KeyPressed; + event.Key.Code = KeysymToSF(symbol); + event.Key.Alt = windowEvent.xkey.state & Mod1Mask; + event.Key.Control = windowEvent.xkey.state & ControlMask; + event.Key.Shift = windowEvent.xkey.state & ShiftMask; + SendEvent(event); // Generate a TextEntered event - if (!XFilterEvent(&WinEvent, None)) + if (!XFilterEvent(&windowEvent, None)) { #ifdef X_HAVE_UTF8_STRING if (myInputContext) { - Status ReturnedStatus; - Uint8 KeyBuffer[16]; - int Length = Xutf8LookupString(myInputContext, &WinEvent.xkey, reinterpret_cast(KeyBuffer), sizeof(KeyBuffer), NULL, &ReturnedStatus); - if (Length > 0) + Status status; + Uint8 keyBuffer[16]; + int length = Xutf8LookupString(myInputContext, &windowEvent.xkey, reinterpret_cast(keyBuffer), sizeof(keyBuffer), NULL, &status); + if (length > 0) { - Uint32 Unicode[2]; // just in case, but 1 character should be enough - const Uint32* End = Unicode::UTF8ToUTF32(KeyBuffer, KeyBuffer + Length, Unicode); + Uint32 unicode[2]; // just in case, but 1 character should be enough + const Uint32* end = Unicode::UTF8ToUTF32(keyBuffer, keyBuffer + length, unicode); - if (End > Unicode) + if (end > unicode) { - Event TextEvt; - TextEvt.Type = Event::TextEntered; - TextEvt.Text.Unicode = Unicode[0]; - SendEvent(TextEvt); + Event textEvent; + textEvent.Type = Event::TextEntered; + textEvent.Text.Unicode = unicode[0]; + SendEvent(textEvent); } } } else #endif { - static XComposeStatus ComposeStatus; - char KeyBuffer[16]; - if (XLookupString(&WinEvent.xkey, KeyBuffer, sizeof(KeyBuffer), NULL, &ComposeStatus)) + static XComposeStatus status; + char keyBuffer[16]; + if (XLookupString(&windowEvent.xkey, keyBuffer, sizeof(keyBuffer), NULL, &status)) { - Event TextEvt; - TextEvt.Type = Event::TextEntered; - TextEvt.Text.Unicode = static_cast(KeyBuffer[0]); - SendEvent(TextEvt); + Event textEvent; + textEvent.Type = Event::TextEntered; + textEvent.Text.Unicode = static_cast(keyBuffer[0]); + SendEvent(textEvent); } } } @@ -733,41 +733,41 @@ void WindowImplX11::ProcessEvent(XEvent WinEvent) case KeyRelease : { // Get the keysym of the key that has been pressed - char Buffer[32]; - KeySym Sym; - XLookupString(&WinEvent.xkey, Buffer, 32, &Sym, NULL); + char buffer[32]; + KeySym symbol; + XLookupString(&windowEvent.xkey, buffer, 32, &symbol, NULL); // Fill the event parameters - Event Evt; - Evt.Type = Event::KeyReleased; - Evt.Key.Code = KeysymToSF(Sym); - Evt.Key.Alt = WinEvent.xkey.state & Mod1Mask; - Evt.Key.Control = WinEvent.xkey.state & ControlMask; - Evt.Key.Shift = WinEvent.xkey.state & ShiftMask; + Event event; + event.Type = Event::KeyReleased; + event.Key.Code = KeysymToSF(symbol); + event.Key.Alt = windowEvent.xkey.state & Mod1Mask; + event.Key.Control = windowEvent.xkey.state & ControlMask; + event.Key.Shift = windowEvent.xkey.state & ShiftMask; + SendEvent(event); - SendEvent(Evt); break; } // Mouse button pressed case ButtonPress : { - unsigned int Button = WinEvent.xbutton.button; - if ((Button == Button1) || (Button == Button2) || (Button == Button3) || (Button == 8) || (Button == 9)) + unsigned int button = windowEvent.xbutton.button; + if ((button == Button1) || (button == Button2) || (button == Button3) || (button == 8) || (button == 9)) { - Event Evt; - Evt.Type = Event::MouseButtonPressed; - Evt.MouseButton.X = WinEvent.xbutton.x; - Evt.MouseButton.Y = WinEvent.xbutton.y; + Event event; + event.Type = Event::MouseButtonPressed; + event.MouseButton.X = windowEvent.xbutton.x; + event.MouseButton.Y = windowEvent.xbutton.y; switch (Button) { - case Button1 : Evt.MouseButton.Button = Mouse::Left; break; - case Button2 : Evt.MouseButton.Button = Mouse::Middle; break; - case Button3 : Evt.MouseButton.Button = Mouse::Right; break; - case 8 : Evt.MouseButton.Button = Mouse::XButton1; break; - case 9 : Evt.MouseButton.Button = Mouse::XButton2; break; + case Button1 : event.MouseButton.Button = Mouse::Left; break; + case Button2 : event.MouseButton.Button = Mouse::Middle; break; + case Button3 : event.MouseButton.Button = Mouse::Right; break; + case 8 : event.MouseButton.Button = Mouse::XButton1; break; + case 9 : event.MouseButton.Button = Mouse::XButton2; break; } - SendEvent(Evt); + SendEvent(event); } break; } @@ -775,29 +775,29 @@ void WindowImplX11::ProcessEvent(XEvent WinEvent) // Mouse button released case ButtonRelease : { - unsigned int Button = WinEvent.xbutton.button; - if ((Button == Button1) || (Button == Button2) || (Button == Button3) || (Button == 8) || (Button == 9)) + unsigned int button = windowEvent.xbutton.button; + if ((button == Button1) || (button == Button2) || (button == Button3) || (button == 8) || (button == 9)) { - Event Evt; - Evt.Type = Event::MouseButtonReleased; - Evt.MouseButton.X = WinEvent.xbutton.x; - Evt.MouseButton.Y = WinEvent.xbutton.y; + Event event; + event.Type = Event::MouseButtonReleased; + event.MouseButton.X = windowEvent.xbutton.x; + event.MouseButton.Y = windowEvent.xbutton.y; switch (Button) { - case Button1 : Evt.MouseButton.Button = Mouse::Left; break; - case Button2 : Evt.MouseButton.Button = Mouse::Middle; break; - case Button3 : Evt.MouseButton.Button = Mouse::Right; break; - case 8 : Evt.MouseButton.Button = Mouse::XButton1; break; - case 9 : Evt.MouseButton.Button = Mouse::XButton2; break; + case Button1 : event.MouseButton.Button = Mouse::Left; break; + case Button2 : event.MouseButton.Button = Mouse::Middle; break; + case Button3 : event.MouseButton.Button = Mouse::Right; break; + case 8 : event.MouseButton.Button = Mouse::XButton1; break; + case 9 : event.MouseButton.Button = Mouse::XButton2; break; } - SendEvent(Evt); + SendEvent(event); } - else if ((Button == Button4) || (Button == Button5)) + else if ((button == Button4) || (button == Button5)) { - Event Evt; - Evt.Type = Event::MouseWheelMoved; - Evt.MouseWheel.Delta = WinEvent.xbutton.button == Button4 ? 1 : -1; - SendEvent(Evt); + Event event; + event.Type = Event::MouseWheelMoved; + event.MouseWheel.Delta = windowEvent.xbutton.button == Button4 ? 1 : -1; + SendEvent(event); } break; } @@ -805,29 +805,29 @@ void WindowImplX11::ProcessEvent(XEvent WinEvent) // Mouse moved case MotionNotify : { - Event Evt; - Evt.Type = Event::MouseMoved; - Evt.MouseMove.X = WinEvent.xmotion.x; - Evt.MouseMove.Y = WinEvent.xmotion.y; - SendEvent(Evt); + Event event; + event.Type = Event::MouseMoved; + event.MouseMove.X = windowEvent.xmotion.x; + event.MouseMove.Y = windowEvent.xmotion.y; + SendEvent(event); break; } // Mouse entered case EnterNotify : { - Event Evt; - Evt.Type = Event::MouseEntered; - SendEvent(Evt); + Event event; + event.Type = Event::MouseEntered; + SendEvent(event); break; } // Mouse left case LeaveNotify : { - Event Evt; - Evt.Type = Event::MouseLeft; - SendEvent(Evt); + Event event; + event.Type = Event::MouseLeft; + SendEvent(event); break; } } @@ -837,13 +837,13 @@ void WindowImplX11::ProcessEvent(XEvent WinEvent) //////////////////////////////////////////////////////////// /// Convert a X11 keysym to SFML key code //////////////////////////////////////////////////////////// -Key::Code WindowImplX11::KeysymToSF(KeySym Sym) +Key::Code WindowImplX11::KeysymToSF(KeySym symbol) { // First convert to uppercase (to avoid dealing with two different keysyms for the same key) - KeySym Lower, Key; - XConvertCase(Sym, &Lower, &Key); + KeySym lower, key; + XConvertCase(symbol, &lower, &key); - switch (Key) + switch (key) { case XK_Shift_L : return Key::LShift; case XK_Shift_R : return Key::RShift; diff --git a/src/SFML/Window/Linux/WindowImplX11.hpp b/src/SFML/Window/Linux/WindowImplX11.hpp index 186b9427b..69409b9c4 100644 --- a/src/SFML/Window/Linux/WindowImplX11.hpp +++ b/src/SFML/Window/Linux/WindowImplX11.hpp @@ -50,20 +50,20 @@ public : //////////////////////////////////////////////////////////// /// Construct the window implementation from an existing control /// - /// \param Handle : Platform-specific handle of the control + /// \param handle : Platform-specific handle of the control /// //////////////////////////////////////////////////////////// - WindowImplX11(WindowHandle Handle); + WindowImplX11(WindowHandle handle); //////////////////////////////////////////////////////////// /// Create the window implementation /// - /// \param Mode : Video mode to use - /// \param Title : Title of the window - /// \param WindowStyle : Window style (resizable, fixed, or fullscren) + /// \param mode : Video mode to use + /// \param title : Title of the window + /// \param style : Window style (resizable, fixed, or fullscren) /// //////////////////////////////////////////////////////////// - WindowImplX11(VideoMode Mode, const std::string& Title, unsigned long WindowStyle); + WindowImplX11(VideoMode mode, const std::string& title, unsigned long style); //////////////////////////////////////////////////////////// /// Destructor @@ -71,14 +71,6 @@ public : //////////////////////////////////////////////////////////// ~WindowImplX11(); - //////////////////////////////////////////////////////////// - /// Check if there's an active context on the current thread - /// - /// \return True if there's a context bound to the current thread - /// - //////////////////////////////////////////////////////////// - static bool IsContextActive(); - private : //////////////////////////////////////////////////////////// @@ -97,43 +89,43 @@ private : /// /see WindowImpl::ShowMouseCursor /// //////////////////////////////////////////////////////////// - virtual void ShowMouseCursor(bool Show); + virtual void ShowMouseCursor(bool show); //////////////////////////////////////////////////////////// /// /see sfWindowImpl::SetCursorPosition /// //////////////////////////////////////////////////////////// - virtual void SetCursorPosition(unsigned int Left, unsigned int Top); + virtual void SetCursorPosition(unsigned int left, unsigned int top); //////////////////////////////////////////////////////////// /// /see sfWindowImpl::SetPosition /// //////////////////////////////////////////////////////////// - virtual void SetPosition(int Left, int Top); + virtual void SetPosition(int left, int top); //////////////////////////////////////////////////////////// /// /see WindowImpl::SetSize /// //////////////////////////////////////////////////////////// - virtual void SetSize(unsigned int Width, unsigned int Height); + virtual void SetSize(unsigned int width, unsigned int height); //////////////////////////////////////////////////////////// /// /see sfWindowImpl::Show /// //////////////////////////////////////////////////////////// - virtual void Show(bool State); + virtual void Show(bool show); //////////////////////////////////////////////////////////// /// /see sfWindowImpl::EnableKeyRepeat /// //////////////////////////////////////////////////////////// - virtual void EnableKeyRepeat(bool Enabled); + virtual void EnableKeyRepeat(bool enabled); //////////////////////////////////////////////////////////// /// /see WindowImpl::SetIcon /// //////////////////////////////////////////////////////////// - virtual void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels); + virtual void SetIcon(unsigned int width, unsigned int height, const Uint8* pixels); //////////////////////////////////////////////////////////// /// Switch to fullscreen mode @@ -141,7 +133,7 @@ private : /// \param Mode : video mode to switch to /// //////////////////////////////////////////////////////////// - void SwitchToFullscreen(const VideoMode& Mode); + void SwitchToFullscreen(const VideoMode& mode); //////////////////////////////////////////////////////////// /// Do some common initializations after the window has been created @@ -164,20 +156,20 @@ private : //////////////////////////////////////////////////////////// /// Process an incoming event from the window /// - /// \param WinEvent : Event which has been received + /// \param windowEvent : Event which has been received /// //////////////////////////////////////////////////////////// - void ProcessEvent(XEvent WinEvent); + void ProcessEvent(XEvent windowEvent); //////////////////////////////////////////////////////////// /// Convert a X11 keysym to SFML key code /// - /// \param Sym : keysym to convert + /// \param symbol : keysym to convert /// /// \return Corrsponding SFML key code /// //////////////////////////////////////////////////////////// - static Key::Code KeysymToSF(KeySym Sym); + static Key::Code KeysymToSF(KeySym symbol); //////////////////////////////////////////////////////////// // Member data diff --git a/src/SFML/Window/VideoMode.cpp b/src/SFML/Window/VideoMode.cpp index 3ed77bc6e..c7a4bebd2 100644 --- a/src/SFML/Window/VideoMode.cpp +++ b/src/SFML/Window/VideoMode.cpp @@ -37,25 +37,37 @@ namespace { // Global array of supported video modes - std::vector SupportedModes; + std::vector supportedModes; // Functor for sorting modes from highest to lowest struct CompareModes { - bool operator ()(const sf::VideoMode& v1, const sf::VideoMode& v2) const + bool operator ()(const sf::VideoMode& left, const sf::VideoMode& right) const { - if (v1.BitsPerPixel > v2.BitsPerPixel) + if (left.BitsPerPixel > right.BitsPerPixel) return true; - else if (v1.BitsPerPixel < v2.BitsPerPixel) + else if (left.BitsPerPixel < right.BitsPerPixel) return false; - else if (v1.Width > v2.Width) + else if (left.Width > right.Width) return true; - else if (v1.Width < v2.Width) + else if (left.Width < right.Width) return false; else - return (v1.Height > v2.Height); + return (left.Height > right.Height); } }; + + //////////////////////////////////////////////////////////// + /// Get and sort valid video modes + //////////////////////////////////////////////////////////// + static void InitializeModes() + { + // We request the array of valid modes + sf::priv::VideoModeSupport::GetSupportedVideoModes(supportedModes); + + // And we sort them from highest to lowest (so that number 0 is the best) + std::sort(supportedModes.begin(), supportedModes.end(), CompareModes()); + } } @@ -76,10 +88,10 @@ BitsPerPixel(0) //////////////////////////////////////////////////////////// /// Construct the video mode with its attributes //////////////////////////////////////////////////////////// -VideoMode::VideoMode(unsigned int ModeWidth, unsigned int ModeHeight, unsigned int ModeBpp) : -Width (ModeWidth), -Height (ModeHeight), -BitsPerPixel(ModeBpp) +VideoMode::VideoMode(unsigned int width, unsigned int height, unsigned int bitsPerPixel) : +Width (width), +Height (height), +BitsPerPixel(bitsPerPixel) { } @@ -99,13 +111,13 @@ VideoMode VideoMode::GetDesktopMode() /// Get a valid video mode /// Index must be in range [0, GetModesCount()[ //////////////////////////////////////////////////////////// -VideoMode VideoMode::GetMode(std::size_t Index) +VideoMode VideoMode::GetMode(std::size_t index) { - if (SupportedModes.empty()) + if (supportedModes.empty()) InitializeModes(); - if (Index < GetModesCount()) - return SupportedModes[Index]; + if (index < GetModesCount()) + return supportedModes[index]; else return VideoMode(); } @@ -116,10 +128,10 @@ VideoMode VideoMode::GetMode(std::size_t Index) //////////////////////////////////////////////////////////// std::size_t VideoMode::GetModesCount() { - if (SupportedModes.empty()) + if (supportedModes.empty()) InitializeModes(); - return SupportedModes.size(); + return supportedModes.size(); } @@ -128,43 +140,30 @@ std::size_t VideoMode::GetModesCount() //////////////////////////////////////////////////////////// bool VideoMode::IsValid() const { - if (SupportedModes.empty()) + if (supportedModes.empty()) InitializeModes(); - return std::find(SupportedModes.begin(), SupportedModes.end(), *this) != SupportedModes.end(); + return std::find(supportedModes.begin(), supportedModes.end(), *this) != supportedModes.end(); } //////////////////////////////////////////////////////////// /// Comparison operator overload -- tell if two video modes are equal //////////////////////////////////////////////////////////// -bool VideoMode::operator ==(const VideoMode& Other) const +bool VideoMode::operator ==(const VideoMode& other) const { - return (Width == Other.Width) && - (Height == Other.Height) && - (BitsPerPixel == Other.BitsPerPixel); + return (Width == other.Width) && + (Height == other.Height) && + (BitsPerPixel == other.BitsPerPixel); } //////////////////////////////////////////////////////////// /// Comparison operator overload -- tell if two video modes are different //////////////////////////////////////////////////////////// -bool VideoMode::operator !=(const VideoMode& Other) const +bool VideoMode::operator !=(const VideoMode& other) const { - return !(*this == Other); -} - - -//////////////////////////////////////////////////////////// -/// Get and sort valid video modes -//////////////////////////////////////////////////////////// -void VideoMode::InitializeModes() -{ - // We request the array of valid modes - priv::VideoModeSupport::GetSupportedVideoModes(SupportedModes); - - // And we sort them from highest to lowest (so that number 0 is the best) - std::sort(SupportedModes.begin(), SupportedModes.end(), CompareModes()); + return !(*this == other); } } // namespace sf diff --git a/src/SFML/Window/Win32/ContextWGL.cpp b/src/SFML/Window/Win32/ContextWGL.cpp index c4af52317..7c623d161 100644 --- a/src/SFML/Window/Win32/ContextWGL.cpp +++ b/src/SFML/Window/Win32/ContextWGL.cpp @@ -39,7 +39,7 @@ namespace priv //////////////////////////////////////////////////////////// /// Create a new context, not associated to a window //////////////////////////////////////////////////////////// -ContextWGL::ContextWGL(ContextWGL* Shared) : +ContextWGL::ContextWGL(ContextWGL* shared) : myWindow (NULL), myDC (NULL), myContext (NULL), @@ -54,10 +54,10 @@ myOwnsWindow(true) // Create the context if (myDC) - CreateContext(Shared, VideoMode::GetDesktopMode().BitsPerPixel, ContextSettings(0, 0, 0)); + CreateContext(shared, VideoMode::GetDesktopMode().BitsPerPixel, ContextSettings(0, 0, 0)); // Activate the context - if (Shared) + if (shared) SetActive(true); } @@ -65,22 +65,22 @@ myOwnsWindow(true) //////////////////////////////////////////////////////////// /// Create a new context attached to a window //////////////////////////////////////////////////////////// -ContextWGL::ContextWGL(ContextWGL* Shared, const WindowImpl* Owner, unsigned int BitsPerPixel, const ContextSettings& Settings) : +ContextWGL::ContextWGL(ContextWGL* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) : myWindow (NULL), myDC (NULL), myContext (NULL), myOwnsWindow(false) { // Get the owner window and its device context - myWindow = static_cast(Owner->GetHandle()); + myWindow = static_cast(owner->GetHandle()); myDC = GetDC(myWindow); // Create the context if (myDC) - CreateContext(Shared, BitsPerPixel, Settings); + CreateContext(shared, bitsPerPixel, settings); // Activate the context - if (Shared) + if (shared) SetActive(true); } @@ -111,9 +111,9 @@ ContextWGL::~ContextWGL() //////////////////////////////////////////////////////////// /// \see Context::MakeCurrent //////////////////////////////////////////////////////////// -bool ContextWGL::MakeCurrent(bool Active) +bool ContextWGL::MakeCurrent(bool active) { - if (Active) + if (active) { if (myDC && myContext) { @@ -150,11 +150,11 @@ void ContextWGL::Display() //////////////////////////////////////////////////////////// /// \see Context::UseVerticalSync //////////////////////////////////////////////////////////// -void ContextWGL::UseVerticalSync(bool Enabled) +void ContextWGL::UseVerticalSync(bool enabled) { PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = reinterpret_cast(wglGetProcAddress("wglSwapIntervalEXT")); if (wglSwapIntervalEXT) - wglSwapIntervalEXT(Enabled ? 1 : 0); + wglSwapIntervalEXT(enabled ? 1 : 0); } @@ -170,20 +170,20 @@ bool ContextWGL::IsContextActive() //////////////////////////////////////////////////////////// /// Create the context //////////////////////////////////////////////////////////// -void ContextWGL::CreateContext(ContextWGL* Shared, unsigned int BitsPerPixel, const ContextSettings& Settings) +void ContextWGL::CreateContext(ContextWGL* shared, unsigned int bitsPerPixel, const ContextSettings& settings) { // Save the creation settings - mySettings = Settings; + mySettings = settings; // Let's find a suitable pixel format -- first try with antialiasing - int BestFormat = 0; + int bestFormat = 0; if (mySettings.AntialiasingLevel > 0) { // Get the wglChoosePixelFormatARB function (it is an extension) PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = reinterpret_cast(wglGetProcAddress("wglChoosePixelFormatARB")); // Define the basic attributes we want for our window - int IntAttributes[] = + int intAttributes[] = { WGL_DRAW_TO_WINDOW_ARB, GL_TRUE, WGL_SUPPORT_OPENGL_ARB, GL_TRUE, @@ -195,11 +195,11 @@ void ContextWGL::CreateContext(ContextWGL* Shared, unsigned int BitsPerPixel, co }; // Let's check how many formats are supporting our requirements - int Formats[128]; - UINT NbFormats; - float FloatAttributes[] = {0, 0}; - bool IsValid = wglChoosePixelFormatARB(myDC, IntAttributes, FloatAttributes, sizeof(Formats) / sizeof(*Formats), Formats, &NbFormats) != 0; - if (!IsValid || (NbFormats == 0)) + int formats[128]; + UINT nbFormats; + float floatAttributes[] = {0, 0}; + bool isValid = wglChoosePixelFormatARB(myDC, intAttributes, floatAttributes, sizeof(formats) / sizeof(*formats), formats, &nbFormats) != 0; + if (!isValid || (nbFormats == 0)) { if (mySettings.AntialiasingLevel > 2) { @@ -207,11 +207,11 @@ void ContextWGL::CreateContext(ContextWGL* Shared, unsigned int BitsPerPixel, co std::cerr << "Failed to find a pixel format supporting " << mySettings.AntialiasingLevel << " antialiasing levels ; trying with 2 levels" << std::endl; - mySettings.AntialiasingLevel = IntAttributes[1] = 2; - IsValid = wglChoosePixelFormatARB(myDC, IntAttributes, FloatAttributes, sizeof(Formats) / sizeof(*Formats), Formats, &NbFormats) != 0; + mySettings.AntialiasingLevel = intAttributes[1] = 2; + isValid = wglChoosePixelFormatARB(myDC, intAttributes, floatAttributes, sizeof(formats) / sizeof(*formats), formats, &nbFormats) != 0; } - if (!IsValid || (NbFormats == 0)) + if (!isValid || (nbFormats == 0)) { // Cannot find any pixel format supporting multisampling ; disabling antialiasing std::cerr << "Failed to find a pixel format supporting antialiasing ; antialiasing will be disabled" << std::endl; @@ -220,49 +220,49 @@ void ContextWGL::CreateContext(ContextWGL* Shared, unsigned int BitsPerPixel, co } // Get the best format among the returned ones - if (IsValid && (NbFormats > 0)) + if (isValid && (nbFormats > 0)) { - int BestScore = 0xFFFF; - for (UINT i = 0; i < NbFormats; ++i) + int bestScore = 0xFFFF; + for (UINT i = 0; i < nbFormats; ++i) { // Get the current format's attributes - PIXELFORMATDESCRIPTOR Attribs; - Attribs.nSize = sizeof(PIXELFORMATDESCRIPTOR); - Attribs.nVersion = 1; - DescribePixelFormat(myDC, Formats[i], sizeof(PIXELFORMATDESCRIPTOR), &Attribs); + PIXELFORMATDESCRIPTOR attributes; + attributes.nSize = sizeof(attributes); + attributes.nVersion = 1; + DescribePixelFormat(myDC, formats[i], sizeof(attributes), &attributes); // Evaluate the current configuration - int Color = Attribs.cRedBits + Attribs.cGreenBits + Attribs.cBlueBits + Attribs.cAlphaBits; - int Score = EvaluateFormat(BitsPerPixel, mySettings, Color, Attribs.cDepthBits, Attribs.cStencilBits, mySettings.AntialiasingLevel); + int color = attributes.cRedBits + attributes.cGreenBits + attributes.cBlueBits + attributes.cAlphaBits; + int score = EvaluateFormat(bitsPerPixel, mySettings, color, attributes.cDepthBits, attributes.cStencilBits, mySettings.AntialiasingLevel); // Keep it if it's better than the current best - if (Score < BestScore) + if (score < bestScore) { - BestScore = Score; - BestFormat = Formats[i]; + bestScore = score; + bestFormat = formats[i]; } } } } // Find a pixel format with no antialiasing, if not needed or not supported - if (BestFormat == 0) + if (bestFormat == 0) { // Setup a pixel format descriptor from the rendering settings - PIXELFORMATDESCRIPTOR PixelDescriptor; - ZeroMemory(&PixelDescriptor, sizeof(PIXELFORMATDESCRIPTOR)); - PixelDescriptor.nSize = sizeof(PIXELFORMATDESCRIPTOR); - PixelDescriptor.nVersion = 1; - PixelDescriptor.iLayerType = PFD_MAIN_PLANE; - PixelDescriptor.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; - PixelDescriptor.iPixelType = PFD_TYPE_RGBA; - PixelDescriptor.cColorBits = static_cast(BitsPerPixel); - PixelDescriptor.cDepthBits = static_cast(mySettings.DepthBits); - PixelDescriptor.cStencilBits = static_cast(mySettings.StencilBits); + PIXELFORMATDESCRIPTOR descriptor; + ZeroMemory(&descriptor, sizeof(descriptor)); + descriptor.nSize = sizeof(descriptor); + descriptor.nVersion = 1; + descriptor.iLayerType = PFD_MAIN_PLANE; + descriptor.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; + descriptor.iPixelType = PFD_TYPE_RGBA; + descriptor.cColorBits = static_cast(bitsPerPixel); + descriptor.cDepthBits = static_cast(mySettings.DepthBits); + descriptor.cStencilBits = static_cast(mySettings.StencilBits); // Get the pixel format that best matches our requirements - BestFormat = ChoosePixelFormat(myDC, &PixelDescriptor); - if (BestFormat == 0) + bestFormat = ChoosePixelFormat(myDC, &descriptor); + if (bestFormat == 0) { std::cerr << "Failed to find a suitable pixel format for device context -- cannot create OpenGL context" << std::endl; return; @@ -270,34 +270,34 @@ void ContextWGL::CreateContext(ContextWGL* Shared, unsigned int BitsPerPixel, co } // Extract the depth and stencil bits from the chosen format - PIXELFORMATDESCRIPTOR ActualFormat; - ActualFormat.nSize = sizeof(PIXELFORMATDESCRIPTOR); - ActualFormat.nVersion = 1; - DescribePixelFormat(myDC, BestFormat, sizeof(PIXELFORMATDESCRIPTOR), &ActualFormat); - mySettings.DepthBits = ActualFormat.cDepthBits; - mySettings.StencilBits = ActualFormat.cStencilBits; + PIXELFORMATDESCRIPTOR actualFormat; + actualFormat.nSize = sizeof(actualFormat); + actualFormat.nVersion = 1; + DescribePixelFormat(myDC, bestFormat, sizeof(actualFormat), &actualFormat); + mySettings.DepthBits = actualFormat.cDepthBits; + mySettings.StencilBits = actualFormat.cStencilBits; // Set the chosen pixel format - if (!SetPixelFormat(myDC, BestFormat, &ActualFormat)) + if (!SetPixelFormat(myDC, bestFormat, &actualFormat)) { std::cerr << "Failed to set pixel format for device context -- cannot create OpenGL context" << std::endl; return; } // Get the context to share display lists with - HGLRC SharedContext = Shared ? Shared->myContext : NULL; + HGLRC sharedContext = shared ? shared->myContext : NULL; // Create the OpenGL context -- first try an OpenGL 3.0 context if it is supported PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = reinterpret_cast(wglGetProcAddress("wglCreateContextAttribsARB")); if (wglCreateContextAttribsARB) { - int Attributes[] = + int attributes[] = { WGL_CONTEXT_MAJOR_VERSION_ARB, 3, WGL_CONTEXT_MINOR_VERSION_ARB, 0, 0, 0 }; - myContext = wglCreateContextAttribsARB(myDC, SharedContext, Attributes); + myContext = wglCreateContextAttribsARB(myDC, sharedContext, attributes); } // If the OpenGL 3.0 context failed, create a regular OpenGL 1.x context @@ -311,9 +311,9 @@ void ContextWGL::CreateContext(ContextWGL* Shared, unsigned int BitsPerPixel, co } // Share this context with others - if (SharedContext) + if (sharedContext) { - if (!wglShareLists(SharedContext, myContext)) + if (!wglShareLists(sharedContext, myContext)) std::cerr << "Failed to share the OpenGL context" << std::endl; } } diff --git a/src/SFML/Window/Win32/ContextWGL.hpp b/src/SFML/Window/Win32/ContextWGL.hpp index 36a1639f3..837da6f47 100644 --- a/src/SFML/Window/Win32/ContextWGL.hpp +++ b/src/SFML/Window/Win32/ContextWGL.hpp @@ -46,21 +46,21 @@ public : //////////////////////////////////////////////////////////// /// Create a new context, not associated to a window /// - /// \param Shared : Context to share the new one with (can be NULL) + /// \param shared : Context to share the new one with (can be NULL) /// //////////////////////////////////////////////////////////// - ContextWGL(ContextWGL* Shared); + ContextWGL(ContextWGL* shared); //////////////////////////////////////////////////////////// /// Create a new context attached to a window /// - /// \param Shared : Context to share the new one with (can be NULL) - /// \param Owner : Pointer to the owner window - /// \param BitsPerPixel : Pixel depth (in bits per pixel) - /// \param Settings : Creation parameters + /// \param shared : Context to share the new one with (can be NULL) + /// \param owner : Pointer to the owner window + /// \param bitsPerPixel : Pixel depth (in bits per pixel) + /// \param settings : Creation parameters /// //////////////////////////////////////////////////////////// - ContextWGL(ContextWGL* Shared, const WindowImpl* Owner, unsigned int BitsPerPixel, const ContextSettings& Settings); + ContextWGL(ContextWGL* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings); //////////////////////////////////////////////////////////// /// Destructor @@ -72,7 +72,7 @@ public : /// \see Context::MakeCurrent /// //////////////////////////////////////////////////////////// - virtual bool MakeCurrent(bool Active); + virtual bool MakeCurrent(bool active); //////////////////////////////////////////////////////////// /// \see Context::Display @@ -84,7 +84,7 @@ public : /// \see Context::UseVerticalSync /// //////////////////////////////////////////////////////////// - virtual void UseVerticalSync(bool Enabled); + virtual void UseVerticalSync(bool enabled); //////////////////////////////////////////////////////////// /// Check if a context is active on the current thread @@ -99,12 +99,12 @@ private : //////////////////////////////////////////////////////////// /// Create the context /// - /// \param Shared : Context to share the new one with (can be NULL) - /// \param BitsPerPixel : Pixel depth, in bits per pixel - /// \param Settings : Creation parameters + /// \param shared : Context to share the new one with (can be NULL) + /// \param bitsPerPixel : Pixel depth, in bits per pixel + /// \param settings : Creation parameters /// //////////////////////////////////////////////////////////// - void CreateContext(ContextWGL* Shared, unsigned int BitsPerPixel, const ContextSettings& Settings); + void CreateContext(ContextWGL* shared, unsigned int bitsPerPixel, const ContextSettings& settings); //////////////////////////////////////////////////////////// // Member data diff --git a/src/SFML/Window/Win32/Joystick.cpp b/src/SFML/Window/Win32/Joystick.cpp index 10bb0d677..d20289b16 100644 --- a/src/SFML/Window/Win32/Joystick.cpp +++ b/src/SFML/Window/Win32/Joystick.cpp @@ -39,7 +39,7 @@ namespace priv //////////////////////////////////////////////////////////// /// Initialize the instance and bind it to a physical joystick //////////////////////////////////////////////////////////// -void Joystick::Initialize(unsigned int Index) +void Joystick::Initialize(unsigned int index) { // Reset state myIndex = JOYSTICKID1; @@ -47,23 +47,23 @@ void Joystick::Initialize(unsigned int Index) myNbButtons = 0; // Get the Index-th connected joystick - MMRESULT Error; - JOYINFOEX JoyInfo; - JoyInfo.dwSize = sizeof(JoyInfo); - JoyInfo.dwFlags = JOY_RETURNALL; - for (unsigned int NbFound = 0; (Error = joyGetPosEx(myIndex, &JoyInfo)) != JOYERR_PARMS; myIndex++) + MMRESULT error; + JOYINFOEX joyInfos; + joyInfos.dwSize = sizeof(joyInfos); + joyInfos.dwFlags = JOY_RETURNALL; + for (unsigned int found = 0; (error = joyGetPosEx(myIndex, &joyInfos)) != JOYERR_PARMS; myIndex++) { // Check if the current joystick is connected - if (Error == JOYERR_NOERROR) + if (error == JOYERR_NOERROR) { // Check if it's the required index - if (NbFound == Index) + if (found == index) { // Ok : store its parameters and return - JOYCAPS Caps; - joyGetDevCaps(myIndex, &Caps, sizeof(Caps)); - myNbAxes = Caps.wNumAxes; - myNbButtons = Caps.wNumButtons; + JOYCAPS caps; + joyGetDevCaps(myIndex, &caps, sizeof(caps)); + myNbAxes = caps.wNumAxes; + myNbButtons = caps.wNumButtons; if (myNbButtons > JoystickState::MaxButtons) myNbButtons = JoystickState::MaxButtons; @@ -71,7 +71,7 @@ void Joystick::Initialize(unsigned int Index) } // Go to the next valid joystick - ++NbFound; + ++found; } } } @@ -82,36 +82,36 @@ void Joystick::Initialize(unsigned int Index) //////////////////////////////////////////////////////////// JoystickState Joystick::UpdateState() { - JoystickState State = {0}; + JoystickState state = {0}; // Get the joystick caps (for range conversions) - JOYCAPS Caps; - if (joyGetDevCaps(myIndex, &Caps, sizeof(Caps)) == JOYERR_NOERROR) + JOYCAPS caps; + if (joyGetDevCaps(myIndex, &caps, sizeof(caps)) == JOYERR_NOERROR) { // Get the current joystick state - JOYINFOEX Pos; - Pos.dwFlags = JOY_RETURNALL; - Pos.dwSize = sizeof(JOYINFOEX); - if (joyGetPosEx(myIndex, &Pos) == JOYERR_NOERROR) + JOYINFOEX pos; + pos.dwFlags = JOY_RETURNALL; + pos.dwSize = sizeof(JOYINFOEX); + if (joyGetPosEx(myIndex, &pos) == JOYERR_NOERROR) { // Axes - State.Axis[Joy::AxisX] = (Pos.dwXpos - (Caps.wXmax + Caps.wXmin) / 2.f) * 200.f / (Caps.wXmax - Caps.wXmin); - State.Axis[Joy::AxisY] = (Pos.dwYpos - (Caps.wYmax + Caps.wYmin) / 2.f) * 200.f / (Caps.wYmax - Caps.wYmin); - State.Axis[Joy::AxisZ] = (Pos.dwZpos - (Caps.wZmax + Caps.wZmin) / 2.f) * 200.f / (Caps.wZmax - Caps.wZmin); - State.Axis[Joy::AxisR] = (Pos.dwRpos - (Caps.wRmax + Caps.wRmin) / 2.f) * 200.f / (Caps.wRmax - Caps.wRmin); - State.Axis[Joy::AxisU] = (Pos.dwUpos - (Caps.wUmax + Caps.wUmin) / 2.f) * 200.f / (Caps.wUmax - Caps.wUmin); - State.Axis[Joy::AxisV] = (Pos.dwVpos - (Caps.wVmax + Caps.wVmin) / 2.f) * 200.f / (Caps.wVmax - Caps.wVmin); + state.Axis[Joy::AxisX] = (pos.dwXpos - (caps.wXmax + caps.wXmin) / 2.f) * 200.f / (caps.wXmax - caps.wXmin); + state.Axis[Joy::AxisY] = (pos.dwYpos - (caps.wYmax + caps.wYmin) / 2.f) * 200.f / (caps.wYmax - caps.wYmin); + state.Axis[Joy::AxisZ] = (pos.dwZpos - (caps.wZmax + caps.wZmin) / 2.f) * 200.f / (caps.wZmax - caps.wZmin); + state.Axis[Joy::AxisR] = (pos.dwRpos - (caps.wRmax + caps.wRmin) / 2.f) * 200.f / (caps.wRmax - caps.wRmin); + state.Axis[Joy::AxisU] = (pos.dwUpos - (caps.wUmax + caps.wUmin) / 2.f) * 200.f / (caps.wUmax - caps.wUmin); + state.Axis[Joy::AxisV] = (pos.dwVpos - (caps.wVmax + caps.wVmin) / 2.f) * 200.f / (caps.wVmax - caps.wVmin); // POV - State.Axis[Joy::AxisPOV] = Pos.dwPOV / 100.f; + state.Axis[Joy::AxisPOV] = pos.dwPOV / 100.f; // Buttons for (unsigned int i = 0; i < GetButtonsCount(); ++i) - State.Buttons[i] = (Pos.dwButtons & (1 << i)) != 0; + state.Buttons[i] = (pos.dwButtons & (1 << i)) != 0; } } - return State; + return state; } diff --git a/src/SFML/Window/Win32/Joystick.hpp b/src/SFML/Window/Win32/Joystick.hpp index 8303a7e53..47076dbc0 100644 --- a/src/SFML/Window/Win32/Joystick.hpp +++ b/src/SFML/Window/Win32/Joystick.hpp @@ -44,10 +44,10 @@ public : //////////////////////////////////////////////////////////// /// Initialize the instance and bind it to a physical joystick /// - /// \param Index : Index of the physical joystick to bind to + /// \param index : Index of the physical joystick to bind to /// //////////////////////////////////////////////////////////// - void Initialize(unsigned int Index); + void Initialize(unsigned int index); //////////////////////////////////////////////////////////// /// Update the current joystick and return its new state diff --git a/src/SFML/Window/Win32/VideoModeSupport.cpp b/src/SFML/Window/Win32/VideoModeSupport.cpp index 8b98e7453..10b3eb273 100644 --- a/src/SFML/Window/Win32/VideoModeSupport.cpp +++ b/src/SFML/Window/Win32/VideoModeSupport.cpp @@ -37,22 +37,22 @@ namespace priv //////////////////////////////////////////////////////////// /// Get supported video modes //////////////////////////////////////////////////////////// -void VideoModeSupport::GetSupportedVideoModes(std::vector& Modes) +void VideoModeSupport::GetSupportedVideoModes(std::vector& modes) { // First, clear array to fill - Modes.clear(); + modes.clear(); // Enumerate all available video modes for primary display adapter - DEVMODE Win32Mode; - Win32Mode.dmSize = sizeof(DEVMODE); - for (int Count = 0; EnumDisplaySettings(NULL, Count, &Win32Mode); ++Count) + DEVMODE win32Mode; + win32Mode.dmSize = sizeof(win32Mode); + for (int count = 0; EnumDisplaySettings(NULL, count, &win32Mode); ++count) { // Convert to sfVideoMode - VideoMode Mode(Win32Mode.dmPelsWidth, Win32Mode.dmPelsHeight, Win32Mode.dmBitsPerPel); + VideoMode mode(win32Mode.dmPelsWidth, win32Mode.dmPelsHeight, win32Mode.dmBitsPerPel); // Add it only if it is not already in the array - if (std::find(Modes.begin(), Modes.end(), Mode) == Modes.end()) - Modes.push_back(Mode); + if (std::find(modes.begin(), modes.end(), mode) == modes.end()) + modes.push_back(mode); } } @@ -62,11 +62,11 @@ void VideoModeSupport::GetSupportedVideoModes(std::vector& Modes) //////////////////////////////////////////////////////////// VideoMode VideoModeSupport::GetDesktopVideoMode() { - DEVMODE Win32Mode; - Win32Mode.dmSize = sizeof(DEVMODE); - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &Win32Mode); + DEVMODE win32Mode; + win32Mode.dmSize = sizeof(win32Mode); + EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &win32Mode); - return VideoMode(Win32Mode.dmPelsWidth, Win32Mode.dmPelsHeight, Win32Mode.dmBitsPerPel); + return VideoMode(win32Mode.dmPelsWidth, win32Mode.dmPelsHeight, win32Mode.dmBitsPerPel); } } // namespace priv diff --git a/src/SFML/Window/Win32/VideoModeSupport.hpp b/src/SFML/Window/Win32/VideoModeSupport.hpp index f00d4749e..14232aaeb 100644 --- a/src/SFML/Window/Win32/VideoModeSupport.hpp +++ b/src/SFML/Window/Win32/VideoModeSupport.hpp @@ -50,7 +50,7 @@ public : /// \param Modes : Array to fill with available video modes /// //////////////////////////////////////////////////////////// - static void GetSupportedVideoModes(std::vector& Modes); + static void GetSupportedVideoModes(std::vector& modes); //////////////////////////////////////////////////////////// /// Get current desktop video mode diff --git a/src/SFML/Window/Win32/WindowImplWin32.cpp b/src/SFML/Window/Win32/WindowImplWin32.cpp index 61076a6ea..8d8731783 100644 --- a/src/SFML/Window/Win32/WindowImplWin32.cpp +++ b/src/SFML/Window/Win32/WindowImplWin32.cpp @@ -60,7 +60,7 @@ WindowImplWin32* WindowImplWin32::ourFullscreenWindow = NULL; //////////////////////////////////////////////////////////// /// Create the window implementation from an existing control //////////////////////////////////////////////////////////// -WindowImplWin32::WindowImplWin32(WindowHandle Handle) : +WindowImplWin32::WindowImplWin32(WindowHandle handle) : myHandle (NULL), myCallback (0), myCursor (NULL), @@ -69,15 +69,15 @@ myKeyRepeatEnabled(true), myIsCursorIn (false) { // Save window handle - myHandle = static_cast(Handle); + myHandle = static_cast(handle); if (myHandle) { // Get window client size - RECT Rect; - GetClientRect(myHandle, &Rect); - myWidth = Rect.right - Rect.left; - myHeight = Rect.bottom - Rect.top; + RECT rectangle; + GetClientRect(myHandle, &rectangle); + myWidth = rectangle.right - rectangle.left; + myHeight = rectangle.bottom - rectangle.top; // We change the event procedure of the control (it is important to save the old one) SetWindowLongPtr(myHandle, GWLP_USERDATA, reinterpret_cast(this)); @@ -89,7 +89,7 @@ myIsCursorIn (false) //////////////////////////////////////////////////////////// /// Create the window implementation //////////////////////////////////////////////////////////// -WindowImplWin32::WindowImplWin32(VideoMode Mode, const std::string& Title, unsigned long WindowStyle) : +WindowImplWin32::WindowImplWin32(VideoMode mode, const std::string& title, unsigned long style) : myHandle (NULL), myCallback (0), myCursor (NULL), @@ -102,60 +102,60 @@ myIsCursorIn (false) RegisterWindowClass(); // Compute position and size - int Left = (GetDeviceCaps(GetDC(NULL), HORZRES) - Mode.Width) / 2; - int Top = (GetDeviceCaps(GetDC(NULL), VERTRES) - Mode.Height) / 2; - int Width = myWidth = Mode.Width; - int Height = myHeight = Mode.Height; + int left = (GetDeviceCaps(GetDC(NULL), HORZRES) - mode.Width) / 2; + int top = (GetDeviceCaps(GetDC(NULL), VERTRES) - mode.Height) / 2; + int width = myWidth = mode.Width; + int height = myHeight = mode.Height; // Choose the window style according to the Style parameter - DWORD Win32Style = WS_VISIBLE; - if (WindowStyle == Style::None) + DWORD win32Style = WS_VISIBLE; + if (style == Style::None) { - Win32Style |= WS_POPUP; + win32Style |= WS_POPUP; } else { - if (WindowStyle & Style::Titlebar) Win32Style |= WS_CAPTION | WS_MINIMIZEBOX; - if (WindowStyle & Style::Resize) Win32Style |= WS_THICKFRAME | WS_MAXIMIZEBOX; - if (WindowStyle & Style::Close) Win32Style |= WS_SYSMENU; + if (style & Style::Titlebar) win32Style |= WS_CAPTION | WS_MINIMIZEBOX; + if (style & Style::Resize) win32Style |= WS_THICKFRAME | WS_MAXIMIZEBOX; + if (style & Style::Close) win32Style |= WS_SYSMENU; } // In windowed mode, adjust width and height so that window will have the requested client area - bool Fullscreen = (WindowStyle & Style::Fullscreen) != 0; - if (!Fullscreen) + bool fullscreen = (style & Style::Fullscreen) != 0; + if (!fullscreen) { - RECT Rect = {0, 0, Width, Height}; - AdjustWindowRect(&Rect, Win32Style, false); - Width = Rect.right - Rect.left; - Height = Rect.bottom - Rect.top; + RECT rectangle = {0, 0, width, height}; + AdjustWindowRect(&rectangle, win32Style, false); + width = rectangle.right - rectangle.left; + height = rectangle.bottom - rectangle.top; } // Create the window if (HasUnicodeSupport()) { - wchar_t WTitle[256]; - int NbChars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, Title.c_str(), static_cast(Title.size()), WTitle, sizeof(WTitle) / sizeof(*WTitle)); - WTitle[NbChars] = L'\0'; - myHandle = CreateWindowW(ourClassNameW, WTitle, Win32Style, Left, Top, Width, Height, NULL, NULL, GetModuleHandle(NULL), this); + wchar_t wTitle[256]; + int count = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, title.c_str(), static_cast(title.size()), wTitle, sizeof(wTitle) / sizeof(*wTitle)); + wTitle[count] = L'\0'; + myHandle = CreateWindowW(ourClassNameW, wTitle, win32Style, left, top, width, height, NULL, NULL, GetModuleHandle(NULL), this); } else { - myHandle = CreateWindowA(ourClassNameA, Title.c_str(), Win32Style, Left, Top, Width, Height, NULL, NULL, GetModuleHandle(NULL), this); + myHandle = CreateWindowA(ourClassNameA, title.c_str(), win32Style, left, top, width, height, NULL, NULL, GetModuleHandle(NULL), this); } // Switch to fullscreen if requested - if (Fullscreen) - SwitchToFullscreen(Mode); + if (fullscreen) + SwitchToFullscreen(mode); // Increment window count ourWindowCount++; // Get the actual size of the window, which can be smaller even after the call to AdjustWindowRect // This happens when the window is bigger than the desktop - RECT ActualRect; - GetClientRect(myHandle, &ActualRect); - myWidth = ActualRect.right - ActualRect.left; - myHeight = ActualRect.bottom - ActualRect.top; + RECT actualRectangle; + GetClientRect(myHandle, &actualRectangle); + myWidth = actualRectangle.right - actualRectangle.left; + myHeight = actualRectangle.bottom - actualRectangle.top; } @@ -215,11 +215,11 @@ void WindowImplWin32::ProcessEvents() // We update the window only if we own it if (!myCallback) { - MSG Message; - while (PeekMessage(&Message, myHandle, 0, 0, PM_REMOVE)) + MSG message; + while (PeekMessage(&message, myHandle, 0, 0, PM_REMOVE)) { - TranslateMessage(&Message); - DispatchMessage(&Message); + TranslateMessage(&message); + DispatchMessage(&message); } } } @@ -228,9 +228,9 @@ void WindowImplWin32::ProcessEvents() //////////////////////////////////////////////////////////// /// /see WindowImpl::ShowMouseCursor //////////////////////////////////////////////////////////// -void WindowImplWin32::ShowMouseCursor(bool Show) +void WindowImplWin32::ShowMouseCursor(bool show) { - if (Show) + if (show) myCursor = LoadCursor(NULL, IDC_ARROW); else myCursor = NULL; @@ -242,78 +242,78 @@ void WindowImplWin32::ShowMouseCursor(bool Show) //////////////////////////////////////////////////////////// /// /see WindowImpl::SetCursorPosition //////////////////////////////////////////////////////////// -void WindowImplWin32::SetCursorPosition(unsigned int Left, unsigned int Top) +void WindowImplWin32::SetCursorPosition(unsigned int left, unsigned int top) { - POINT Pos = {Left, Top}; - ClientToScreen(myHandle, &Pos); - SetCursorPos(Pos.x, Pos.y); + POINT position = {left, top}; + ClientToScreen(myHandle, &position); + SetCursorPos(position.x, position.y); } //////////////////////////////////////////////////////////// /// /see WindowImpl::SetPosition //////////////////////////////////////////////////////////// -void WindowImplWin32::SetPosition(int Left, int Top) +void WindowImplWin32::SetPosition(int left, int top) { - SetWindowPos(myHandle, NULL, Left, Top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(myHandle, NULL, left, top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); } //////////////////////////////////////////////////////////// /// /see WindowImpl::SetSize //////////////////////////////////////////////////////////// -void WindowImplWin32::SetSize(unsigned int Width, unsigned int Height) +void WindowImplWin32::SetSize(unsigned int width, unsigned int height) { // SetWindowPos wants the total size of the window (including title bar and borders), // so we have to compute it - RECT Rect = {0, 0, Width, Height}; - AdjustWindowRect(&Rect, GetWindowLong(myHandle, GWL_STYLE), false); - Width = Rect.right - Rect.left; - Height = Rect.bottom - Rect.top; + RECT rectangle = {0, 0, width, height}; + AdjustWindowRect(&rectangle, GetWindowLong(myHandle, GWL_STYLE), false); + width = rectangle.right - rectangle.left; + height = rectangle.bottom - rectangle.top; - SetWindowPos(myHandle, NULL, 0, 0, Width, Height, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(myHandle, NULL, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER); } //////////////////////////////////////////////////////////// /// /see WindowImpl::Show //////////////////////////////////////////////////////////// -void WindowImplWin32::Show(bool State) +void WindowImplWin32::Show(bool show) { - ShowWindow(myHandle, State ? SW_SHOW : SW_HIDE); + ShowWindow(myHandle, show ? SW_SHOW : SW_HIDE); } //////////////////////////////////////////////////////////// /// /see WindowImpl::EnableKeyRepeat //////////////////////////////////////////////////////////// -void WindowImplWin32::EnableKeyRepeat(bool Enabled) +void WindowImplWin32::EnableKeyRepeat(bool enabled) { - myKeyRepeatEnabled = Enabled; + myKeyRepeatEnabled = enabled; } //////////////////////////////////////////////////////////// /// /see WindowImpl::SetIcon //////////////////////////////////////////////////////////// -void WindowImplWin32::SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels) +void WindowImplWin32::SetIcon(unsigned int width, unsigned int height, const Uint8* pixels) { // First destroy the previous one if (myIcon) DestroyIcon(myIcon); // Windows wants BGRA pixels : swap red and blue channels - std::vector IconPixels(Width * Height * 4); - for (std::size_t i = 0; i < IconPixels.size() / 4; ++i) + std::vector iconPixels(width * height * 4); + for (std::size_t i = 0; i < iconPixels.size() / 4; ++i) { - IconPixels[i * 4 + 0] = Pixels[i * 4 + 2]; - IconPixels[i * 4 + 1] = Pixels[i * 4 + 1]; - IconPixels[i * 4 + 2] = Pixels[i * 4 + 0]; - IconPixels[i * 4 + 3] = Pixels[i * 4 + 3]; + iconPixels[i * 4 + 0] = pixels[i * 4 + 2]; + iconPixels[i * 4 + 1] = pixels[i * 4 + 1]; + iconPixels[i * 4 + 2] = pixels[i * 4 + 0]; + iconPixels[i * 4 + 3] = pixels[i * 4 + 3]; } // Create the icon from the pixels array - myIcon = CreateIcon(GetModuleHandle(NULL), Width, Height, 1, 32, NULL, &IconPixels[0]); + myIcon = CreateIcon(GetModuleHandle(NULL), width, height, 1, 32, NULL, &iconPixels[0]); // Set it as both big and small icon of the window if (myIcon) @@ -369,17 +369,17 @@ void WindowImplWin32::RegisterWindowClass() //////////////////////////////////////////////////////////// /// Switch to fullscreen mode //////////////////////////////////////////////////////////// -void WindowImplWin32::SwitchToFullscreen(const VideoMode& Mode) +void WindowImplWin32::SwitchToFullscreen(const VideoMode& mode) { - DEVMODE DevMode; - DevMode.dmSize = sizeof(DEVMODE); - DevMode.dmPelsWidth = Mode.Width; - DevMode.dmPelsHeight = Mode.Height; - DevMode.dmBitsPerPel = Mode.BitsPerPixel; - DevMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL; + DEVMODE devMode; + devMode.dmSize = sizeof(devMode); + devMode.dmPelsWidth = mode.Width; + devMode.dmPelsHeight = mode.Height; + devMode.dmBitsPerPel = mode.BitsPerPixel; + devMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL; // Apply fullscreen mode - if (ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) + if (ChangeDisplaySettings(&devMode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) { std::cerr << "Failed to change display mode for fullscreen" << std::endl; return; @@ -390,15 +390,15 @@ void WindowImplWin32::SwitchToFullscreen(const VideoMode& Mode) SetWindowLong(myHandle, GWL_EXSTYLE, WS_EX_APPWINDOW); // And resize it so that it fits the entire screen - SetWindowPos(myHandle, HWND_TOP, 0, 0, Mode.Width, Mode.Height, SWP_FRAMECHANGED); + SetWindowPos(myHandle, HWND_TOP, 0, 0, mode.Width, mode.Height, SWP_FRAMECHANGED); ShowWindow(myHandle, SW_SHOW); // Set "this" as the current fullscreen window ourFullscreenWindow = this; // SetPixelFormat can fail (really ?) if window style doesn't contain these flags - long Style = GetWindowLong(myHandle, GWL_STYLE); - SetWindowLong(myHandle, GWL_STYLE, Style | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); + long style = GetWindowLong(myHandle, GWL_STYLE); + SetWindowLong(myHandle, GWL_STYLE, style | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); } @@ -422,13 +422,13 @@ void WindowImplWin32::Cleanup() //////////////////////////////////////////////////////////// /// Process a Win32 event //////////////////////////////////////////////////////////// -void WindowImplWin32::ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam) +void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam) { // Don't process any message until window is created if (myHandle == NULL) return; - switch (Message) + switch (message) { // Destroy event case WM_DESTROY : @@ -442,7 +442,7 @@ void WindowImplWin32::ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam) case WM_SETCURSOR : { // The mouse has moved, if the cursor is in our window we must refresh the cursor - if (LOWORD(LParam) == HTCLIENT) + if (LOWORD(lParam) == HTCLIENT) SetCursor(myCursor); break; @@ -451,9 +451,9 @@ void WindowImplWin32::ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam) // Close event case WM_CLOSE : { - Event Evt; - Evt.Type = Event::Closed; - SendEvent(Evt); + Event event; + event.Type = Event::Closed; + SendEvent(event); break; } @@ -461,44 +461,44 @@ void WindowImplWin32::ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam) case WM_SIZE : { // Update window size - RECT Rect; - GetClientRect(myHandle, &Rect); - myWidth = Rect.right - Rect.left; - myHeight = Rect.bottom - Rect.top; + RECT rectangle; + GetClientRect(myHandle, &rectangle); + myWidth = rectangle.right - rectangle.left; + myHeight = rectangle.bottom - rectangle.top; - Event Evt; - Evt.Type = Event::Resized; - Evt.Size.Width = myWidth; - Evt.Size.Height = myHeight; - SendEvent(Evt); + Event event; + event.Type = Event::Resized; + event.Size.Width = myWidth; + event.Size.Height = myHeight; + SendEvent(event); break; } // Gain focus event case WM_SETFOCUS : { - Event Evt; - Evt.Type = Event::GainedFocus; - SendEvent(Evt); + Event event; + event.Type = Event::GainedFocus; + SendEvent(event); break; } // Lost focus event case WM_KILLFOCUS : { - Event Evt; - Evt.Type = Event::LostFocus; - SendEvent(Evt); + Event event; + event.Type = Event::LostFocus; + SendEvent(event); break; } // Text event case WM_CHAR : { - Event Evt; - Evt.Type = Event::TextEntered; - Evt.Text.Unicode = static_cast(WParam); - SendEvent(Evt); + Event event; + event.Type = Event::TextEntered; + event.Text.Unicode = static_cast(wParam); + SendEvent(event); break; } @@ -506,25 +506,25 @@ void WindowImplWin32::ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam) case WM_KEYDOWN : case WM_SYSKEYDOWN : { - if (myKeyRepeatEnabled || ((LParam & (1 << 30)) == 0)) + if (myKeyRepeatEnabled || ((lParam & (1 << 30)) == 0)) { - Event Evt; - Evt.Type = Event::KeyPressed; - Evt.Key.Alt = HIWORD(GetAsyncKeyState(VK_MENU)) != 0; - Evt.Key.Control = HIWORD(GetAsyncKeyState(VK_CONTROL)) != 0; - Evt.Key.Shift = HIWORD(GetAsyncKeyState(VK_SHIFT)) != 0; + Event event; + event.Type = Event::KeyPressed; + event.Key.Alt = HIWORD(GetAsyncKeyState(VK_MENU)) != 0; + event.Key.Control = HIWORD(GetAsyncKeyState(VK_CONTROL)) != 0; + event.Key.Shift = HIWORD(GetAsyncKeyState(VK_SHIFT)) != 0; - if (WParam != VK_SHIFT) + if (wParam != VK_SHIFT) { - Evt.Key.Code = VirtualKeyCodeToSF(WParam, LParam); - SendEvent(Evt); + event.Key.Code = VirtualKeyCodeToSF(wParam, lParam); + SendEvent(event); } else { // Special case for shift, its state can't be retrieved directly - Evt.Key.Code = GetShiftState(true); - if (Evt.Key.Code != 0) - SendEvent(Evt); + event.Key.Code = GetShiftState(true); + if (event.Key.Code != 0) + SendEvent(event); } } break; @@ -534,23 +534,23 @@ void WindowImplWin32::ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam) case WM_KEYUP : case WM_SYSKEYUP : { - Event Evt; - Evt.Type = Event::KeyReleased; - Evt.Key.Alt = HIWORD(GetAsyncKeyState(VK_MENU)) != 0; - Evt.Key.Control = HIWORD(GetAsyncKeyState(VK_CONTROL)) != 0; - Evt.Key.Shift = HIWORD(GetAsyncKeyState(VK_SHIFT)) != 0; + Event event; + event.Type = Event::KeyReleased; + event.Key.Alt = HIWORD(GetAsyncKeyState(VK_MENU)) != 0; + event.Key.Control = HIWORD(GetAsyncKeyState(VK_CONTROL)) != 0; + event.Key.Shift = HIWORD(GetAsyncKeyState(VK_SHIFT)) != 0; - if (WParam != VK_SHIFT) + if (wParam != VK_SHIFT) { - Evt.Key.Code = VirtualKeyCodeToSF(WParam, LParam); - SendEvent(Evt); + event.Key.Code = VirtualKeyCodeToSF(wParam, lParam); + SendEvent(event); } else { // Special case for shift, its state can't be retrieved directly - Evt.Key.Code = GetShiftState(false); - if (Evt.Key.Code != 0) - SendEvent(Evt); + event.Key.Code = GetShiftState(false); + if (event.Key.Code != 0) + SendEvent(event); } break; @@ -559,106 +559,106 @@ void WindowImplWin32::ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam) // Mouse wheel event case WM_MOUSEWHEEL : { - Event Evt; - Evt.Type = Event::MouseWheelMoved; - Evt.MouseWheel.Delta = static_cast(HIWORD(WParam)) / 120; - SendEvent(Evt); + Event event; + event.Type = Event::MouseWheelMoved; + event.MouseWheel.Delta = static_cast(HIWORD(wParam)) / 120; + SendEvent(event); break; } // Mouse left button down event case WM_LBUTTONDOWN : { - Event Evt; - Evt.Type = Event::MouseButtonPressed; - Evt.MouseButton.Button = Mouse::Left; - Evt.MouseButton.X = LOWORD(LParam); - Evt.MouseButton.Y = HIWORD(LParam); - SendEvent(Evt); + Event event; + event.Type = Event::MouseButtonPressed; + event.MouseButton.Button = Mouse::Left; + event.MouseButton.X = LOWORD(lParam); + event.MouseButton.Y = HIWORD(lParam); + SendEvent(event); break; } // Mouse left button up event case WM_LBUTTONUP : { - Event Evt; - Evt.Type = Event::MouseButtonReleased; - Evt.MouseButton.Button = Mouse::Left; - Evt.MouseButton.X = LOWORD(LParam); - Evt.MouseButton.Y = HIWORD(LParam); - SendEvent(Evt); + Event event; + event.Type = Event::MouseButtonReleased; + event.MouseButton.Button = Mouse::Left; + event.MouseButton.X = LOWORD(lParam); + event.MouseButton.Y = HIWORD(lParam); + SendEvent(event); break; } // Mouse right button down event case WM_RBUTTONDOWN : { - Event Evt; - Evt.Type = Event::MouseButtonPressed; - Evt.MouseButton.Button = Mouse::Right; - Evt.MouseButton.X = LOWORD(LParam); - Evt.MouseButton.Y = HIWORD(LParam); - SendEvent(Evt); + Event event; + event.Type = Event::MouseButtonPressed; + event.MouseButton.Button = Mouse::Right; + event.MouseButton.X = LOWORD(lParam); + event.MouseButton.Y = HIWORD(lParam); + SendEvent(event); break; } // Mouse right button up event case WM_RBUTTONUP : { - Event Evt; - Evt.Type = Event::MouseButtonReleased; - Evt.MouseButton.Button = Mouse::Right; - Evt.MouseButton.X = LOWORD(LParam); - Evt.MouseButton.Y = HIWORD(LParam); - SendEvent(Evt); + Event event; + event.Type = Event::MouseButtonReleased; + event.MouseButton.Button = Mouse::Right; + event.MouseButton.X = LOWORD(lParam); + event.MouseButton.Y = HIWORD(lParam); + SendEvent(event); break; } // Mouse wheel button down event case WM_MBUTTONDOWN : { - Event Evt; - Evt.Type = Event::MouseButtonPressed; - Evt.MouseButton.Button = Mouse::Middle; - Evt.MouseButton.X = LOWORD(LParam); - Evt.MouseButton.Y = HIWORD(LParam); - SendEvent(Evt); + Event event; + event.Type = Event::MouseButtonPressed; + event.MouseButton.Button = Mouse::Middle; + event.MouseButton.X = LOWORD(lParam); + event.MouseButton.Y = HIWORD(lParam); + SendEvent(event); break; } // Mouse wheel button up event case WM_MBUTTONUP : { - Event Evt; - Evt.Type = Event::MouseButtonReleased; - Evt.MouseButton.Button = Mouse::Middle; - Evt.MouseButton.X = LOWORD(LParam); - Evt.MouseButton.Y = HIWORD(LParam); - SendEvent(Evt); + Event event; + event.Type = Event::MouseButtonReleased; + event.MouseButton.Button = Mouse::Middle; + event.MouseButton.X = LOWORD(lParam); + event.MouseButton.Y = HIWORD(lParam); + SendEvent(event); break; } // Mouse X button down event case WM_XBUTTONDOWN : { - Event Evt; - Evt.Type = Event::MouseButtonPressed; - Evt.MouseButton.Button = HIWORD(WParam) == XBUTTON1 ? Mouse::XButton1 : Mouse::XButton2; - Evt.MouseButton.X = LOWORD(LParam); - Evt.MouseButton.Y = HIWORD(LParam); - SendEvent(Evt); + Event event; + event.Type = Event::MouseButtonPressed; + event.MouseButton.Button = HIWORD(wParam) == XBUTTON1 ? Mouse::XButton1 : Mouse::XButton2; + event.MouseButton.X = LOWORD(lParam); + event.MouseButton.Y = HIWORD(lParam); + SendEvent(event); break; } // Mouse X button up event case WM_XBUTTONUP : { - Event Evt; - Evt.Type = Event::MouseButtonReleased; - Evt.MouseButton.Button = HIWORD(WParam) == XBUTTON1 ? Mouse::XButton1 : Mouse::XButton2; - Evt.MouseButton.X = LOWORD(LParam); - Evt.MouseButton.Y = HIWORD(LParam); - SendEvent(Evt); + Event event; + event.Type = Event::MouseButtonReleased; + event.MouseButton.Button = HIWORD(wParam) == XBUTTON1 ? Mouse::XButton1 : Mouse::XButton2; + event.MouseButton.X = LOWORD(lParam); + event.MouseButton.Y = HIWORD(lParam); + SendEvent(event); break; } @@ -668,24 +668,24 @@ void WindowImplWin32::ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam) // Check if we need to generate a MouseEntered event if (!myIsCursorIn) { - TRACKMOUSEEVENT MouseEvent; - MouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); - MouseEvent.hwndTrack = myHandle; - MouseEvent.dwFlags = TME_LEAVE; - TrackMouseEvent(&MouseEvent); + TRACKMOUSEEVENT mouseEvent; + mouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); + mouseEvent.hwndTrack = myHandle; + mouseEvent.dwFlags = TME_LEAVE; + TrackMouseEvent(&mouseEvent); myIsCursorIn = true; - Event Evt; - Evt.Type = Event::MouseEntered; - SendEvent(Evt); + Event event; + event.Type = Event::MouseEntered; + SendEvent(event); } - Event Evt; - Evt.Type = Event::MouseMoved; - Evt.MouseMove.X = LOWORD(LParam); - Evt.MouseMove.Y = HIWORD(LParam); - SendEvent(Evt); + Event event; + event.Type = Event::MouseMoved; + event.MouseMove.X = LOWORD(lParam); + event.MouseMove.Y = HIWORD(lParam); + SendEvent(event); break; } @@ -694,9 +694,9 @@ void WindowImplWin32::ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam) { myIsCursorIn = false; - Event Evt; - Evt.Type = Event::MouseLeft; - SendEvent(Evt); + Event event; + event.Type = Event::MouseLeft; + SendEvent(event); break; } } @@ -707,43 +707,43 @@ void WindowImplWin32::ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam) /// Check the state of the shift keys on a key event, /// and return the corresponding SF key code //////////////////////////////////////////////////////////// -Key::Code WindowImplWin32::GetShiftState(bool KeyDown) +Key::Code WindowImplWin32::GetShiftState(bool keyDown) { - static bool LShiftPrevDown = false; - static bool RShiftPrevDown = false; + static bool lShiftPrevDown = false; + static bool rShiftPrevDown = false; - bool LShiftDown = (HIWORD(GetAsyncKeyState(VK_LSHIFT)) != 0); - bool RShiftDown = (HIWORD(GetAsyncKeyState(VK_RSHIFT)) != 0); + bool lShiftDown = (HIWORD(GetAsyncKeyState(VK_LSHIFT)) != 0); + bool rShiftDown = (HIWORD(GetAsyncKeyState(VK_RSHIFT)) != 0); - Key::Code Code = Key::Code(0); - if (KeyDown) + Key::Code code = Key::Code(0); + if (keyDown) { - if (!LShiftPrevDown && LShiftDown) Code = Key::LShift; - else if (!RShiftPrevDown && RShiftDown) Code = Key::RShift; + if (!lShiftPrevDown && lShiftDown) code = Key::LShift; + else if (!rShiftPrevDown && rShiftDown) code = Key::RShift; } else { - if (LShiftPrevDown && !LShiftDown) Code = Key::LShift; - else if (RShiftPrevDown && !RShiftDown) Code = Key::RShift; + if (lShiftPrevDown && !lShiftDown) code = Key::LShift; + else if (rShiftPrevDown && !rShiftDown) code = Key::RShift; } - LShiftPrevDown = LShiftDown; - RShiftPrevDown = RShiftDown; + lShiftPrevDown = lShiftDown; + rShiftPrevDown = rShiftDown; - return Code; + return code; } //////////////////////////////////////////////////////////// /// Convert a Win32 virtual key code to a SFML key code //////////////////////////////////////////////////////////// -Key::Code WindowImplWin32::VirtualKeyCodeToSF(WPARAM VirtualKey, LPARAM Flags) +Key::Code WindowImplWin32::VirtualKeyCodeToSF(WPARAM key, LPARAM flags) { - switch (VirtualKey) + switch (key) { // VK_SHIFT is handled by the GetShiftState function - case VK_MENU : return (Flags & (1 << 24)) ? Key::RAlt : Key::LAlt; - case VK_CONTROL : return (Flags & (1 << 24)) ? Key::RControl : Key::LControl; + case VK_MENU : return (flags & (1 << 24)) ? Key::RAlt : Key::LAlt; + case VK_CONTROL : return (flags & (1 << 24)) ? Key::RControl : Key::LControl; case VK_LWIN : return Key::LSystem; case VK_RWIN : return Key::RSystem; case VK_APPS : return Key::Menu; @@ -852,13 +852,13 @@ Key::Code WindowImplWin32::VirtualKeyCodeToSF(WPARAM VirtualKey, LPARAM Flags) //////////////////////////////////////////////////////////// bool WindowImplWin32::HasUnicodeSupport() { - OSVERSIONINFO VersionInfo; - ZeroMemory(&VersionInfo, sizeof(VersionInfo)); - VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo); + OSVERSIONINFO version; + ZeroMemory(&version, sizeof(version)); + version.dwOSVersionInfoSize = sizeof(version); - if (GetVersionEx(&VersionInfo)) + if (GetVersionEx(&version)) { - return VersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT; + return version.dwPlatformId == VER_PLATFORM_WIN32_NT; } else { @@ -870,37 +870,37 @@ bool WindowImplWin32::HasUnicodeSupport() //////////////////////////////////////////////////////////// /// Function called whenever one of our windows receives a message //////////////////////////////////////////////////////////// -LRESULT CALLBACK WindowImplWin32::GlobalOnEvent(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam) +LRESULT CALLBACK WindowImplWin32::GlobalOnEvent(HWND handle, UINT message, WPARAM wParam, LPARAM lParam) { // Associate handle and Window instance when the creation message is received - if (Message == WM_CREATE) + if (message == WM_CREATE) { // Get WindowImplWin32 instance (it was passed as the last argument of CreateWindow) - long This = reinterpret_cast(reinterpret_cast(LParam)->lpCreateParams); + long window = reinterpret_cast(reinterpret_cast(lParam)->lpCreateParams); // Set as the "user data" parameter of the window - SetWindowLongPtr(Handle, GWLP_USERDATA, This); + SetWindowLongPtr(handle, GWLP_USERDATA, window); } // Get the WindowImpl instance corresponding to the window handle - WindowImplWin32* Window = reinterpret_cast(GetWindowLongPtr(Handle, GWLP_USERDATA)); + WindowImplWin32* window = reinterpret_cast(GetWindowLongPtr(handle, GWLP_USERDATA)); // Forward the event to the appropriate function - if (Window) + if (window) { - Window->ProcessEvent(Message, WParam, LParam); + window->ProcessEvent(message, wParam, lParam); - if (Window->myCallback) - return CallWindowProc(reinterpret_cast(Window->myCallback), Handle, Message, WParam, LParam); + if (window->myCallback) + return CallWindowProc(reinterpret_cast(window->myCallback), handle, message, wParam, lParam); } // We don't forward the WM_CLOSE message to prevent the OS from automatically destroying the window - if (Message == WM_CLOSE) + if (message == WM_CLOSE) return 0; - static const bool HasUnicode = HasUnicodeSupport(); - return HasUnicode ? DefWindowProcW(Handle, Message, WParam, LParam) : - DefWindowProcA(Handle, Message, WParam, LParam); + static const bool hasUnicode = HasUnicodeSupport(); + return hasUnicode ? DefWindowProcW(handle, message, wParam, lParam) : + DefWindowProcA(handle, message, wParam, lParam); } } // namespace priv diff --git a/src/SFML/Window/Win32/WindowImplWin32.hpp b/src/SFML/Window/Win32/WindowImplWin32.hpp index 4a2c7a79a..cc305ac30 100644 --- a/src/SFML/Window/Win32/WindowImplWin32.hpp +++ b/src/SFML/Window/Win32/WindowImplWin32.hpp @@ -48,20 +48,20 @@ public : //////////////////////////////////////////////////////////// /// Construct the window implementation from an existing control /// - /// \param Handle : Platform-specific handle of the control + /// \param handle : Platform-specific handle of the control /// //////////////////////////////////////////////////////////// - WindowImplWin32(WindowHandle Handle); + WindowImplWin32(WindowHandle handle); //////////////////////////////////////////////////////////// /// Create the window implementation /// - /// \param Mode : Video mode to use - /// \param Title : Title of the window - /// \param WindowStyle : Window style + /// \param mode : Video mode to use + /// \param title : Title of the window + /// \param style : Window style /// //////////////////////////////////////////////////////////// - WindowImplWin32(VideoMode Mode, const std::string& Title, unsigned long WindowStyle); + WindowImplWin32(VideoMode mode, const std::string& title, unsigned long style); //////////////////////////////////////////////////////////// /// Destructor @@ -87,43 +87,43 @@ private : /// /see WindowImpl::ShowMouseCursor /// //////////////////////////////////////////////////////////// - virtual void ShowMouseCursor(bool Show); + virtual void ShowMouseCursor(bool show); //////////////////////////////////////////////////////////// /// /see WindowImpl::SetCursorPosition /// //////////////////////////////////////////////////////////// - virtual void SetCursorPosition(unsigned int Left, unsigned int Top); + virtual void SetCursorPosition(unsigned int left, unsigned int top); //////////////////////////////////////////////////////////// /// /see WindowImpl::SetPosition /// //////////////////////////////////////////////////////////// - virtual void SetPosition(int Left, int Top); + virtual void SetPosition(int left, int top); //////////////////////////////////////////////////////////// /// /see WindowImpl::SetSize /// //////////////////////////////////////////////////////////// - virtual void SetSize(unsigned int Width, unsigned int Height); + virtual void SetSize(unsigned int width, unsigned int height); //////////////////////////////////////////////////////////// /// /see WindowImpl::Show /// //////////////////////////////////////////////////////////// - virtual void Show(bool State); + virtual void Show(bool show); //////////////////////////////////////////////////////////// /// /see WindowImpl::EnableKeyRepeat /// //////////////////////////////////////////////////////////// - virtual void EnableKeyRepeat(bool Enabled); + virtual void EnableKeyRepeat(bool enabled); //////////////////////////////////////////////////////////// /// /see WindowImpl::SetIcon /// //////////////////////////////////////////////////////////// - virtual void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels); + virtual void SetIcon(unsigned int width, unsigned int height, const Uint8* pixels); //////////////////////////////////////////////////////////// /// Register the window class @@ -134,10 +134,10 @@ private : //////////////////////////////////////////////////////////// /// Switch to fullscreen mode /// - /// \param Mode : video mode to switch to + /// \param mode : video mode to switch to /// //////////////////////////////////////////////////////////// - void SwitchToFullscreen(const VideoMode& Mode); + void SwitchToFullscreen(const VideoMode& mode); //////////////////////////////////////////////////////////// /// Free all the graphical resources attached to the window @@ -148,34 +148,34 @@ private : //////////////////////////////////////////////////////////// /// Process a Win32 event /// - /// \param Message : Message to process - /// \param WParam : First parameter of the event - /// \param LParam : Second parameter of the event + /// \param message : Message to process + /// \param wParam : First parameter of the event + /// \param lParam : Second parameter of the event /// //////////////////////////////////////////////////////////// - void ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam); + void ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam); //////////////////////////////////////////////////////////// /// Check the state of the shift keys on a key event, /// and return the corresponding SF key code /// - /// \param KeyDown : True for a keydown event, false for a keyup event + /// \param keyDown : True for a keydown event, false for a keyup event /// /// \return SFML key code corresponding to the shift key /// //////////////////////////////////////////////////////////// - static Key::Code GetShiftState(bool KeyDown); + static Key::Code GetShiftState(bool keyDown); //////////////////////////////////////////////////////////// /// Convert a Win32 virtual key code to a SFML key code /// - /// \param VirtualKey : Virtual key code to convert - /// \param Flags : Additional flags + /// \param key : Virtual key code to convert + /// \param flags : Additional flags /// - /// \return SFML key code corresponding to VirtualKey + /// \return SFML key code corresponding to the key /// //////////////////////////////////////////////////////////// - static Key::Code VirtualKeyCodeToSF(WPARAM VirtualKey, LPARAM Flags); + static Key::Code VirtualKeyCodeToSF(WPARAM key, LPARAM flags); //////////////////////////////////////////////////////////// /// Check if the current version of the OS supports unicode @@ -190,15 +190,15 @@ private : //////////////////////////////////////////////////////////// /// Function called whenever one of our windows receives a message /// - /// \param Handle : Win32 handle of the window - /// \param Message : Message received - /// \param WParam : First parameter of the message - /// \param LParam : Second parameter of the message + /// \param handle : Win32 handle of the window + /// \param message : Message received + /// \param wParam : First parameter of the message + /// \param lParam : Second parameter of the message /// /// \return Something... /// //////////////////////////////////////////////////////////// - static LRESULT CALLBACK GlobalOnEvent(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam); + static LRESULT CALLBACK GlobalOnEvent(HWND handle, UINT message, WPARAM wParam, LPARAM lParam); //////////////////////////////////////////////////////////// // Static member data diff --git a/src/SFML/Window/Window.cpp b/src/SFML/Window/Window.cpp index 6d59a5e0a..40666e6fa 100644 --- a/src/SFML/Window/Window.cpp +++ b/src/SFML/Window/Window.cpp @@ -38,7 +38,7 @@ //////////////////////////////////////////////////////////// namespace { - const sf::Window* FullscreenWindow = NULL; + const sf::Window* fullscreenWindow = NULL; } @@ -63,7 +63,7 @@ mySetCursorPosY (0xFFFF) //////////////////////////////////////////////////////////// /// Construct a new window //////////////////////////////////////////////////////////// -Window::Window(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, const ContextSettings& Settings) : +Window::Window(VideoMode mode, const std::string& title, unsigned long style, const ContextSettings& settings) : myWindow (NULL), myContext (NULL), myLastFrameTime (0.f), @@ -72,14 +72,14 @@ myFramerateLimit(0), mySetCursorPosX (0xFFFF), mySetCursorPosY (0xFFFF) { - Create(Mode, Title, WindowStyle, Settings); + Create(mode, title, style, settings); } //////////////////////////////////////////////////////////// /// Construct the window from an existing control //////////////////////////////////////////////////////////// -Window::Window(WindowHandle Handle, const ContextSettings& Settings) : +Window::Window(WindowHandle handle, const ContextSettings& settings) : myWindow (NULL), myContext (NULL), myLastFrameTime (0.f), @@ -88,7 +88,7 @@ myFramerateLimit(0), mySetCursorPosX (0xFFFF), mySetCursorPosY (0xFFFF) { - Create(Handle, Settings); + Create(handle, settings); } @@ -104,51 +104,51 @@ Window::~Window() //////////////////////////////////////////////////////////// /// Create the window //////////////////////////////////////////////////////////// -void Window::Create(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, const ContextSettings& Settings) +void Window::Create(VideoMode mode, const std::string& title, unsigned long style, const ContextSettings& settings) { // Destroy the previous window implementation Close(); // Fullscreen style requires some tests - if (WindowStyle & Style::Fullscreen) + if (style & Style::Fullscreen) { // Make sure there's not already a fullscreen window (only one is allowed) - if (FullscreenWindow) + if (fullscreenWindow) { std::cerr << "Creating two fullscreen windows is not allowed, switching to windowed mode" << std::endl; - WindowStyle &= ~Style::Fullscreen; + style &= ~Style::Fullscreen; } else { // Make sure the chosen video mode is compatible - if (!Mode.IsValid()) + if (!mode.IsValid()) { std::cerr << "The requested video mode is not available, switching to a valid mode" << std::endl; - Mode = VideoMode::GetMode(0); + mode = VideoMode::GetMode(0); } // Update the fullscreen window - FullscreenWindow = this; + fullscreenWindow = this; } } // Check validity of style - if ((WindowStyle & Style::Close) || (WindowStyle & Style::Resize)) - WindowStyle |= Style::Titlebar; + if ((style & Style::Close) || (style & Style::Resize)) + style |= Style::Titlebar; // Recreate the window implementation delete myWindow; - myWindow = priv::WindowImpl::New(Mode, Title, WindowStyle); + myWindow = priv::WindowImpl::New(mode, title, style); { // Make sure another context is bound, so that: // - the context creation can request OpenGL extensions if necessary // - myContext can safely be destroyed (it's no longer bound) - Context Ctx; + Context context; // Recreate the context delete myContext; - myContext = priv::ContextGL::New(myWindow, Mode.BitsPerPixel, Settings); + myContext = priv::ContextGL::New(myWindow, mode.BitsPerPixel, settings); Initialize(); } @@ -161,21 +161,21 @@ void Window::Create(VideoMode Mode, const std::string& Title, unsigned long Wind //////////////////////////////////////////////////////////// /// Create the window from an existing control //////////////////////////////////////////////////////////// -void Window::Create(WindowHandle Handle, const ContextSettings& Settings) +void Window::Create(WindowHandle handle, const ContextSettings& settings) { // Recreate the window implementation Close(); - myWindow = priv::WindowImpl::New(Handle); + myWindow = priv::WindowImpl::New(handle); { // Make sure another context is bound, so that: // - the context creation can request OpenGL extensions if necessary // - myContext can safely be destroyed (it's no longer bound) - Context Ctx; + Context context; // Recreate the context delete myContext; - myContext = priv::ContextGL::New(myWindow, VideoMode::GetDesktopMode().BitsPerPixel, Settings); + myContext = priv::ContextGL::New(myWindow, VideoMode::GetDesktopMode().BitsPerPixel, settings); Initialize(); } @@ -207,8 +207,8 @@ void Window::Close() } // Update the fullscreen window - if (this == FullscreenWindow) - FullscreenWindow = NULL; + if (this == fullscreenWindow) + fullscreenWindow = NULL; } @@ -246,16 +246,16 @@ unsigned int Window::GetHeight() const //////////////////////////////////////////////////////////// const ContextSettings& Window::GetSettings() const { - static ContextSettings EmptySettings(0, 0, 0); + static const ContextSettings empty(0, 0, 0); - return myContext ? myContext->GetSettings() : EmptySettings; + return myContext ? myContext->GetSettings() : empty; } //////////////////////////////////////////////////////////// /// Get the event on top of events stack, if any //////////////////////////////////////////////////////////// -bool Window::GetEvent(Event& EventReceived) +bool Window::GetEvent(Event& event) { // Let the window implementation process incoming events if the events queue is empty if (myWindow && myEvents.empty()) @@ -264,7 +264,7 @@ bool Window::GetEvent(Event& EventReceived) // Pop first event of queue, if not empty if (!myEvents.empty()) { - EventReceived = myEvents.front(); + event = myEvents.front(); myEvents.pop(); return true; @@ -277,35 +277,35 @@ bool Window::GetEvent(Event& EventReceived) //////////////////////////////////////////////////////////// /// Enable / disable vertical synchronization //////////////////////////////////////////////////////////// -void Window::UseVerticalSync(bool Enabled) +void Window::UseVerticalSync(bool enabled) { if (SetActive()) - myContext->UseVerticalSync(Enabled); + myContext->UseVerticalSync(enabled); } //////////////////////////////////////////////////////////// /// Show or hide the mouse cursor //////////////////////////////////////////////////////////// -void Window::ShowMouseCursor(bool Show) +void Window::ShowMouseCursor(bool show) { if (myWindow) - myWindow->ShowMouseCursor(Show); + myWindow->ShowMouseCursor(show); } //////////////////////////////////////////////////////////// /// Change the position of the mouse cursor //////////////////////////////////////////////////////////// -void Window::SetCursorPosition(unsigned int Left, unsigned int Top) +void Window::SetCursorPosition(unsigned int left, unsigned int top) { if (myWindow) { // Keep coordinates for later checking (to reject the generated MouseMoved event) - mySetCursorPosX = Left; - mySetCursorPosY = Top; + mySetCursorPosX = left; + mySetCursorPosY = top; - myWindow->SetCursorPosition(Left, Top); + myWindow->SetCursorPosition(left, top); } } @@ -313,30 +313,30 @@ void Window::SetCursorPosition(unsigned int Left, unsigned int Top) //////////////////////////////////////////////////////////// /// Change the position of the window on screen //////////////////////////////////////////////////////////// -void Window::SetPosition(int Left, int Top) +void Window::SetPosition(int left, int top) { if (myWindow) - myWindow->SetPosition(Left, Top); + myWindow->SetPosition(left, top); } //////////////////////////////////////////////////////////// /// Change the size of the rendering region of the window //////////////////////////////////////////////////////////// -void Window::SetSize(unsigned int Width, unsigned int Height) +void Window::SetSize(unsigned int width, unsigned int height) { if (myWindow) - myWindow->SetSize(Width, Height); + myWindow->SetSize(width, height); } //////////////////////////////////////////////////////////// /// Show or hide the window //////////////////////////////////////////////////////////// -void Window::Show(bool State) +void Window::Show(bool show) { if (myWindow) - myWindow->Show(State); + myWindow->Show(show); } @@ -344,20 +344,20 @@ void Window::Show(bool State) /// Enable or disable automatic key-repeat. /// Automatic key-repeat is enabled by default //////////////////////////////////////////////////////////// -void Window::EnableKeyRepeat(bool Enabled) +void Window::EnableKeyRepeat(bool enabled) { if (myWindow) - myWindow->EnableKeyRepeat(Enabled); + myWindow->EnableKeyRepeat(enabled); } //////////////////////////////////////////////////////////// /// Change the window's icon //////////////////////////////////////////////////////////// -void Window::SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels) +void Window::SetIcon(unsigned int width, unsigned int height, const Uint8* pixels) { if (myWindow) - myWindow->SetIcon(Width, Height, Pixels); + myWindow->SetIcon(width, height, pixels); } @@ -365,11 +365,11 @@ void Window::SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixel /// Activate or deactivate the window as the current target /// for rendering //////////////////////////////////////////////////////////// -bool Window::SetActive(bool Active) const +bool Window::SetActive(bool active) const { if (myContext) { - if (myContext->SetActive(Active)) + if (myContext->SetActive(active)) { return true; } @@ -394,9 +394,9 @@ void Window::Display() // Limit the framerate if needed if (myFramerateLimit > 0) { - float RemainingTime = 1.f / myFramerateLimit - myClock.GetElapsedTime(); - if (RemainingTime > 0) - Sleep(RemainingTime); + float remainingTime = 1.f / myFramerateLimit - myClock.GetElapsedTime(); + if (remainingTime > 0) + Sleep(remainingTime); } // Measure the time elapsed since last frame @@ -421,9 +421,9 @@ const Input& Window::GetInput() const //////////////////////////////////////////////////////////// /// Set the framerate at a fixed frequency //////////////////////////////////////////////////////////// -void Window::SetFramerateLimit(unsigned int Limit) +void Window::SetFramerateLimit(unsigned int limit) { - myFramerateLimit = Limit; + myFramerateLimit = limit; } @@ -440,10 +440,10 @@ float Window::GetFrameTime() const /// Change the joystick threshold, ie. the value below which /// no move event will be generated //////////////////////////////////////////////////////////// -void Window::SetJoystickThreshold(float Threshold) +void Window::SetJoystickThreshold(float threshold) { if (myWindow) - myWindow->SetJoystickThreshold(Threshold); + myWindow->SetJoystickThreshold(threshold); } @@ -459,19 +459,19 @@ void Window::OnCreate() //////////////////////////////////////////////////////////// /// Receive an event from window //////////////////////////////////////////////////////////// -void Window::OnEvent(const Event& EventReceived) +void Window::OnEvent(const Event& event) { // Discard MouseMove events generated by SetCursorPosition - if ((EventReceived.Type == Event::MouseMoved) && - (EventReceived.MouseMove.X == mySetCursorPosX) && - (EventReceived.MouseMove.Y == mySetCursorPosY)) + if ((event.Type == Event::MouseMoved) && + (event.MouseMove.X == mySetCursorPosX) && + (event.MouseMove.Y == mySetCursorPosY)) { mySetCursorPosX = 0xFFFF; mySetCursorPosY = 0xFFFF; return; } - myEvents.push(EventReceived); + myEvents.push(event); } diff --git a/src/SFML/Window/WindowImpl.cpp b/src/SFML/Window/WindowImpl.cpp index 4c95490c8..21d86826f 100644 --- a/src/SFML/Window/WindowImpl.cpp +++ b/src/SFML/Window/WindowImpl.cpp @@ -56,18 +56,18 @@ namespace priv //////////////////////////////////////////////////////////// /// Create a new window depending on the current OS //////////////////////////////////////////////////////////// -WindowImpl* WindowImpl::New(VideoMode Mode, const std::string& Title, unsigned long WindowStyle) +WindowImpl* WindowImpl::New(VideoMode mode, const std::string& title, unsigned long style) { - return new WindowImplType(Mode, Title, WindowStyle); + return new WindowImplType(mode, title, style); } //////////////////////////////////////////////////////////// /// Create a new window depending on the current OS //////////////////////////////////////////////////////////// -WindowImpl* WindowImpl::New(WindowHandle Handle) +WindowImpl* WindowImpl::New(WindowHandle handle) { - return new WindowImplType(Handle); + return new WindowImplType(handle); } @@ -100,19 +100,19 @@ WindowImpl::~WindowImpl() //////////////////////////////////////////////////////////// /// Add a listener to the window //////////////////////////////////////////////////////////// -void WindowImpl::AddListener(WindowListener* Listener) +void WindowImpl::AddListener(WindowListener* listener) { - if (Listener) - myListeners.insert(Listener); + if (listener) + myListeners.insert(listener); } //////////////////////////////////////////////////////////// /// Remove a listener from the window //////////////////////////////////////////////////////////// -void WindowImpl::RemoveListener(WindowListener* Listener) +void WindowImpl::RemoveListener(WindowListener* listener) { - myListeners.erase(Listener); + myListeners.erase(listener); } @@ -138,9 +138,9 @@ unsigned int WindowImpl::GetHeight() const /// Change the joystick threshold, ie. the value below which /// no move event will be generated //////////////////////////////////////////////////////////// -void WindowImpl::SetJoystickThreshold(float Threshold) +void WindowImpl::SetJoystickThreshold(float threshold) { - myJoyThreshold = Threshold; + myJoyThreshold = threshold; } @@ -160,11 +160,11 @@ void WindowImpl::DoEvents() //////////////////////////////////////////////////////////// /// Send an event to listeners //////////////////////////////////////////////////////////// -void WindowImpl::SendEvent(const Event& EventToSend) +void WindowImpl::SendEvent(const Event& event) { for (std::set::iterator i = myListeners.begin(); i != myListeners.end(); ++i) { - (*i)->OnEvent(EventToSend); + (*i)->OnEvent(event); } } @@ -177,38 +177,38 @@ void WindowImpl::ProcessJoystickEvents() for (unsigned int i = 0; i < JoysticksCount; ++i) { // Copy the previous state of the joystick and get the new one - JoystickState PreviousState = myJoyStates[i]; + JoystickState previousState = myJoyStates[i]; myJoyStates[i] = myJoysticks[i].UpdateState(); // Axis for (unsigned int j = 0; j < myJoysticks[i].GetAxesCount(); ++j) { - float PrevPos = PreviousState.Axis[j]; - float CurrPos = myJoyStates[i].Axis[j]; - if (fabs(CurrPos - PrevPos) >= myJoyThreshold) + float prevPos = previousState.Axis[j]; + float currPos = myJoyStates[i].Axis[j]; + if (fabs(currPos - prevPos) >= myJoyThreshold) { - Event Event; - Event.Type = Event::JoyMoved; - Event.JoyMove.JoystickId = i; - Event.JoyMove.Axis = static_cast(j); - Event.JoyMove.Position = CurrPos; - SendEvent(Event); + Event event; + event.Type = Event::JoyMoved; + event.JoyMove.JoystickId = i; + event.JoyMove.Axis = static_cast(j); + event.JoyMove.Position = currPos; + SendEvent(event); } } // Buttons for (unsigned int j = 0; j < myJoysticks[i].GetButtonsCount(); ++j) { - bool PrevPressed = PreviousState.Buttons[j]; - bool CurrPressed = myJoyStates[i].Buttons[j]; + bool prevPressed = previousState.Buttons[j]; + bool currPressed = myJoyStates[i].Buttons[j]; - if ((!PrevPressed && CurrPressed) || (PrevPressed && !CurrPressed)) + if ((!prevPressed && currPressed) || (prevPressed && !currPressed)) { - Event Event; - Event.Type = CurrPressed ? Event::JoyButtonPressed : Event::JoyButtonReleased; - Event.JoyButton.JoystickId = i; - Event.JoyButton.Button = j; - SendEvent(Event); + Event event; + event.Type = currPressed ? Event::JoyButtonPressed : Event::JoyButtonReleased; + event.JoyButton.JoystickId = i; + event.JoyButton.Button = j; + SendEvent(event); } } } diff --git a/src/SFML/Window/WindowImpl.hpp b/src/SFML/Window/WindowImpl.hpp index 5742f307e..1c63f73cb 100644 --- a/src/SFML/Window/WindowImpl.hpp +++ b/src/SFML/Window/WindowImpl.hpp @@ -54,24 +54,24 @@ public : //////////////////////////////////////////////////////////// /// Create a new window depending on the current OS /// - /// \param Mode : Video mode to use - /// \param Title : Title of the window - /// \param WindowStyle : Window style + /// \param mode : Video mode to use + /// \param title : Title of the window + /// \param style : Window style /// /// \return Pointer to the created window /// //////////////////////////////////////////////////////////// - static WindowImpl* New(VideoMode Mode, const std::string& Title, unsigned long WindowStyle); + static WindowImpl* New(VideoMode mode, const std::string& title, unsigned long style); //////////////////////////////////////////////////////////// /// Create a new window depending on to the current OS /// - /// \param Handle : Platform-specific handle of the control + /// \param handle : Platform-specific handle of the control /// /// \return Pointer to the created window /// //////////////////////////////////////////////////////////// - static WindowImpl* New(WindowHandle Handle); + static WindowImpl* New(WindowHandle handle); public : @@ -84,18 +84,18 @@ public : //////////////////////////////////////////////////////////// /// Add a listener to the window /// - /// \param Listener : Listener to add + /// \param listener : Listener to add /// //////////////////////////////////////////////////////////// - void AddListener(WindowListener* Listener); + void AddListener(WindowListener* listener); //////////////////////////////////////////////////////////// /// Remove a listener from the window /// - /// \param Listener : Listener to remove + /// \param listener : Listener to remove /// //////////////////////////////////////////////////////////// - void RemoveListener(WindowListener* Listener); + void RemoveListener(WindowListener* listener); //////////////////////////////////////////////////////////// /// Get the client width of the window @@ -117,10 +117,10 @@ public : /// Change the joystick threshold, ie. the value below which /// no move event will be generated /// - /// \param Threshold : New threshold, in range [0, 100] + /// \param threshold : New threshold, in range [0, 100] /// //////////////////////////////////////////////////////////// - void SetJoystickThreshold(float Threshold); + void SetJoystickThreshold(float threshold); //////////////////////////////////////////////////////////// /// Process incoming events from operating system @@ -139,63 +139,63 @@ public : //////////////////////////////////////////////////////////// /// Show or hide the mouse cursor /// - /// \param Show : True to show, false to hide + /// \param show : True to show, false to hide /// //////////////////////////////////////////////////////////// - virtual void ShowMouseCursor(bool Show) = 0; + virtual void ShowMouseCursor(bool show) = 0; //////////////////////////////////////////////////////////// /// Change the position of the mouse cursor /// - /// \param Left : Left coordinate of the cursor, relative to the window - /// \param Top : Top coordinate of the cursor, relative to the window + /// \param left : Left coordinate of the cursor, relative to the window + /// \param top : Top coordinate of the cursor, relative to the window /// //////////////////////////////////////////////////////////// - virtual void SetCursorPosition(unsigned int Left, unsigned int Top) = 0; + virtual void SetCursorPosition(unsigned int left, unsigned int top) = 0; //////////////////////////////////////////////////////////// /// Change the position of the window on screen /// - /// \param Left : Left position - /// \param Top : Top position + /// \param left : Left position + /// \param top : Top position /// //////////////////////////////////////////////////////////// - virtual void SetPosition(int Left, int Top) = 0; + virtual void SetPosition(int left, int top) = 0; //////////////////////////////////////////////////////////// /// Change the size of the rendering region of the window /// - /// \param Width : New width - /// \param Height : New height + /// \param width : New width + /// \param height : New height /// //////////////////////////////////////////////////////////// - virtual void SetSize(unsigned int Width, unsigned int Height) = 0; + virtual void SetSize(unsigned int width, unsigned int height) = 0; //////////////////////////////////////////////////////////// /// Show or hide the window /// - /// \param State : True to show, false to hide + /// \param show : True to show, false to hide /// //////////////////////////////////////////////////////////// - virtual void Show(bool State) = 0; + virtual void Show(bool show) = 0; //////////////////////////////////////////////////////////// /// Enable or disable automatic key-repeat /// - /// \param Enabled : True to enable, false to disable + /// \param enabled : True to enable, false to disable /// //////////////////////////////////////////////////////////// - virtual void EnableKeyRepeat(bool Enabled) = 0; + virtual void EnableKeyRepeat(bool enabled) = 0; //////////////////////////////////////////////////////////// /// Change the window's icon /// - /// \param Width : Icon's width, in pixels - /// \param Height : Icon's height, in pixels - /// \param Pixels : Pointer to the pixels in memory, format must be RGBA 32 bits + /// \param width : Icon's width, in pixels + /// \param height : Icon's height, in pixels + /// \param pixels : Pointer to the pixels in memory, format must be RGBA 32 bits /// //////////////////////////////////////////////////////////// - virtual void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels) = 0; + virtual void SetIcon(unsigned int width, unsigned int height, const Uint8* pixels) = 0; protected : @@ -208,10 +208,10 @@ protected : //////////////////////////////////////////////////////////// /// Send an event to listeners (for derived classes only) /// - /// \param EventToSend : Event to send + /// \param event : Event to send /// //////////////////////////////////////////////////////////// - void SendEvent(const Event& EventToSend); + void SendEvent(const Event& event); //////////////////////////////////////////////////////////// // Member data