Changed the naming convention for public member variables/functions and free functions (using lowerCase instead of UpperCase)

This commit is contained in:
Laurent Gomila 2012-03-11 19:10:37 +01:00
parent ff5b69d312
commit 14ac411542
200 changed files with 4302 additions and 4320 deletions

View file

@ -52,20 +52,20 @@ public :
///
/// \param volume New global volume, in the range [0, 100]
///
/// \see GetGlobalVolume
/// \see getGlobalVolume
///
////////////////////////////////////////////////////////////
static void SetGlobalVolume(float volume);
static void setGlobalVolume(float volume);
////////////////////////////////////////////////////////////
/// \brief Get the current value of the global volume
///
/// \return Current global volume, in the range [0, 100]
///
/// \see SetGlobalVolume
/// \see setGlobalVolume
///
////////////////////////////////////////////////////////////
static float GetGlobalVolume();
static float getGlobalVolume();
////////////////////////////////////////////////////////////
/// \brief Set the position of the listener in the scene
@ -76,10 +76,10 @@ public :
/// \param y Y coordinate of the listener's position
/// \param z Z coordinate of the listener's position
///
/// \see GetPosition, SetDirection
/// \see getPosition, setDirection
///
////////////////////////////////////////////////////////////
static void SetPosition(float x, float y, float z);
static void setPosition(float x, float y, float z);
////////////////////////////////////////////////////////////
/// \brief Set the position of the listener in the scene
@ -88,20 +88,20 @@ public :
///
/// \param position New listener's position
///
/// \see GetPosition, SetDirection
/// \see getPosition, setDirection
///
////////////////////////////////////////////////////////////
static void SetPosition(const Vector3f& position);
static void setPosition(const Vector3f& position);
////////////////////////////////////////////////////////////
/// \brief Get the current position of the listener in the scene
///
/// \return Listener's position
///
/// \see SetPosition
/// \see setPosition
///
////////////////////////////////////////////////////////////
static Vector3f GetPosition();
static Vector3f getPosition();
////////////////////////////////////////////////////////////
/// \brief Set the orientation of the listener in the scene
@ -115,10 +115,10 @@ public :
/// \param y Y coordinate of the listener's orientation
/// \param z Z coordinate of the listener's orientation
///
/// \see GetDirection, SetPosition
/// \see getDirection, setPosition
///
////////////////////////////////////////////////////////////
static void SetDirection(float x, float y, float z);
static void setDirection(float x, float y, float z);
////////////////////////////////////////////////////////////
/// \brief Set the orientation of the listener in the scene
@ -130,20 +130,20 @@ public :
///
/// \param direction New listener's orientation
///
/// \see GetDirection, SetPosition
/// \see getDirection, setPosition
///
////////////////////////////////////////////////////////////
static void SetDirection(const Vector3f& direction);
static void setDirection(const Vector3f& direction);
////////////////////////////////////////////////////////////
/// \brief Get the current orientation of the listener in the scene
///
/// \return Listener's orientation
///
/// \see SetDirection
/// \see setDirection
///
////////////////////////////////////////////////////////////
static Vector3f GetDirection();
static Vector3f getDirection();
};
} // namespace sf
@ -172,7 +172,7 @@ public :
/// Usage example:
/// \code
/// // Move the listener to the position (1, 0, -5)
/// sf::Listener::SetPosition(1, 0, -5);
/// sf::Listener::setPosition(1, 0, -5);
///
/// // Make it face the right axis (1, 0, 0)
/// sf::Listener::SetDirection(1, 0, 0);

View file

@ -68,7 +68,7 @@ public :
////////////////////////////////////////////////////////////
/// \brief Open a music from an audio file
///
/// This function doesn't start playing the music (call Play()
/// This function doesn't start playing the music (call play()
/// to do so).
/// Here is a complete list of all the supported audio formats:
/// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam,
@ -78,15 +78,15 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see OpenFromMemory, OpenFromStream
/// \see openFromMemory, openFromStream
///
////////////////////////////////////////////////////////////
bool OpenFromFile(const std::string& filename);
bool openFromFile(const std::string& filename);
////////////////////////////////////////////////////////////
/// \brief Open a music from an audio file in memory
///
/// This function doesn't start playing the music (call Play()
/// This function doesn't start playing the music (call play()
/// to do so).
/// Here is a complete list of all the supported audio formats:
/// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam,
@ -97,15 +97,15 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see OpenFromFile, OpenFromStream
/// \see openFromFile, openFromStream
///
////////////////////////////////////////////////////////////
bool OpenFromMemory(const void* data, std::size_t sizeInBytes);
bool openFromMemory(const void* data, std::size_t sizeInBytes);
////////////////////////////////////////////////////////////
/// \brief Open a music from an audio file in a custom stream
///
/// This function doesn't start playing the music (call Play()
/// This function doesn't start playing the music (call play()
/// to do so).
/// Here is a complete list of all the supported audio formats:
/// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam,
@ -115,10 +115,10 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see OpenFromFile, OpenFromMemory
/// \see openFromFile, openFromMemory
///
////////////////////////////////////////////////////////////
bool OpenFromStream(InputStream& stream);
bool openFromStream(InputStream& stream);
////////////////////////////////////////////////////////////
/// \brief Get the total duration of the music
@ -126,7 +126,7 @@ public :
/// \return Music duration
///
////////////////////////////////////////////////////////////
Time GetDuration() const;
Time getDuration() const;
protected :
@ -141,7 +141,7 @@ protected :
/// \return True to continue playback, false to stop
///
////////////////////////////////////////////////////////////
virtual bool OnGetData(Chunk& data);
virtual bool onGetData(Chunk& data);
////////////////////////////////////////////////////////////
/// \brief Change the current playing position in the stream source
@ -149,7 +149,7 @@ protected :
/// \param timeOffset New playing position, from the beginning of the music
///
////////////////////////////////////////////////////////////
virtual void OnSeek(Time timeOffset);
virtual void onSeek(Time timeOffset);
private :
@ -157,7 +157,7 @@ private :
/// \brief Initialize the internal state after loading a new music
///
////////////////////////////////////////////////////////////
void Initialize();
void initialize();
////////////////////////////////////////////////////////////
// Member data
@ -191,7 +191,7 @@ private :
///
/// As a sound stream, a music is played in its own thread in order
/// not to block the rest of the program. This means that you can
/// leave the music alone after calling Play(), it will manage itself
/// leave the music alone after calling play(), it will manage itself
/// very well.
///
/// Usage example:
@ -200,19 +200,19 @@ private :
/// sf::Music music;
///
/// // Open it from an audio file
/// if (!music.OpenFromFile("music.ogg"))
/// if (!music.openFromFile("music.ogg"))
/// {
/// // error...
/// }
///
/// // Change some parameters
/// music.SetPosition(0, 1, 10); // change its 3D position
/// music.SetPitch(2); // increase the pitch
/// music.SetVolume(50); // reduce the volume
/// music.SetLoop(true); // make it loop
/// music.setPosition(0, 1, 10); // change its 3D position
/// music.setPitch(2); // increase the pitch
/// music.setVolume(50); // reduce the volume
/// music.setLoop(true); // make it loop
///
/// // Play it
/// music.Play();
/// music.play();
/// \endcode
///
/// \see sf::Sound, sf::SoundStream

View file

@ -86,7 +86,7 @@ public :
/// \see Pause, Stop
///
////////////////////////////////////////////////////////////
void Play();
void play();
////////////////////////////////////////////////////////////
/// \brief Pause the sound
@ -97,19 +97,19 @@ public :
/// \see Play, Stop
///
////////////////////////////////////////////////////////////
void Pause();
void pause();
////////////////////////////////////////////////////////////
/// \brief Stop playing the sound
///
/// This function stops the sound if it was playing or paused,
/// and does nothing if it was already stopped.
/// It also resets the playing position (unlike Pause()).
/// It also resets the playing position (unlike pause()).
///
/// \see Play, Pause
///
////////////////////////////////////////////////////////////
void Stop();
void stop();
////////////////////////////////////////////////////////////
/// \brief Set the source buffer containing the audio data to play
@ -123,22 +123,22 @@ public :
/// \see GetBuffer
///
////////////////////////////////////////////////////////////
void SetBuffer(const SoundBuffer& buffer);
void setBuffer(const SoundBuffer& buffer);
////////////////////////////////////////////////////////////
/// \brief Set whether or not the sound should loop after reaching the end
///
/// If set, the sound will restart from beginning after
/// reaching the end and so on, until it is stopped or
/// SetLoop(false) is called.
/// setLoop(false) is called.
/// The default looping state for sound is false.
///
/// \param loop True to play in loop, false to play once
///
/// \see GetLoop
/// \see getLoop
///
////////////////////////////////////////////////////////////
void SetLoop(bool loop);
void setLoop(bool loop);
////////////////////////////////////////////////////////////
/// \brief Change the current playing position of the sound
@ -148,10 +148,10 @@ public :
///
/// \param timeOffset New playing position, from the beginning of the sound
///
/// \see GetPlayingOffset
/// \see getPlayingOffset
///
////////////////////////////////////////////////////////////
void SetPlayingOffset(Time timeOffset);
void setPlayingOffset(Time timeOffset);
////////////////////////////////////////////////////////////
/// \brief Get the audio buffer attached to the sound
@ -159,27 +159,27 @@ public :
/// \return Sound buffer attached to the sound (can be NULL)
///
////////////////////////////////////////////////////////////
const SoundBuffer* GetBuffer() const;
const SoundBuffer* getBuffer() const;
////////////////////////////////////////////////////////////
/// \brief Tell whether or not the sound is in loop mode
///
/// \return True if the sound is looping, false otherwise
///
/// \see SetLoop
/// \see setLoop
///
////////////////////////////////////////////////////////////
bool GetLoop() const;
bool getLoop() const;
////////////////////////////////////////////////////////////
/// \brief Get the current playing position of the sound
///
/// \return Current playing position, from the beginning of the sound
///
/// \see SetPlayingOffset
/// \see setPlayingOffset
///
////////////////////////////////////////////////////////////
Time GetPlayingOffset() const;
Time getPlayingOffset() const;
////////////////////////////////////////////////////////////
/// \brief Get the current status of the sound (stopped, paused, playing)
@ -187,7 +187,7 @@ public :
/// \return Current status of the sound
///
////////////////////////////////////////////////////////////
Status GetStatus() const;
Status getStatus() const;
////////////////////////////////////////////////////////////
/// \brief Overload of assignment operator
@ -208,7 +208,7 @@ public :
/// the sound from using a dead buffer.
///
////////////////////////////////////////////////////////////
void ResetBuffer();
void resetBuffer();
private :
@ -242,7 +242,7 @@ private :
///
/// In order to work, a sound must be given a buffer of audio
/// data to play. Audio data (samples) is stored in sf::SoundBuffer,
/// and attached to a sound with the SetBuffer() function.
/// and attached to a sound with the setBuffer() function.
/// The buffer object attached to a sound must remain alive
/// as long as the sound uses it. Note that multiple sounds
/// can use the same sound buffer at the same time.
@ -250,11 +250,11 @@ private :
/// Usage example:
/// \code
/// sf::SoundBuffer buffer;
/// buffer.LoadFromFile("sound.wav");
/// buffer.loadFromFile("sound.wav");
///
/// sf::Sound sound;
/// sound.SetBuffer(buffer);
/// sound.Play();
/// sound.setBuffer(buffer);
/// sound.play();
/// \endcode
///
/// \see sf::SoundBuffer, sf::Music

View file

@ -84,10 +84,10 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see LoadFromMemory, LoadFromStream, LoadFromSamples, SaveToFile
/// \see loadFromMemory, loadFromStream, loadFromSamples, saveToFile
///
////////////////////////////////////////////////////////////
bool LoadFromFile(const std::string& filename);
bool loadFromFile(const std::string& filename);
////////////////////////////////////////////////////////////
/// \brief Load the sound buffer from a file in memory
@ -101,10 +101,10 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see LoadFromFile, LoadFromStream, LoadFromSamples
/// \see loadFromFile, loadFromStream, loadFromSamples
///
////////////////////////////////////////////////////////////
bool LoadFromMemory(const void* data, std::size_t sizeInBytes);
bool loadFromMemory(const void* data, std::size_t sizeInBytes);
////////////////////////////////////////////////////////////
/// \brief Load the sound buffer from a custom stream
@ -117,10 +117,10 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see LoadFromFile, LoadFromMemory, LoadFromSamples
/// \see loadFromFile, loadFromMemory, loadFromSamples
///
////////////////////////////////////////////////////////////
bool LoadFromStream(InputStream& stream);
bool loadFromStream(InputStream& stream);
////////////////////////////////////////////////////////////
/// \brief Load the sound buffer from an array of audio samples
@ -135,10 +135,10 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see LoadFromFile, LoadFromMemory, SaveToFile
/// \see loadFromFile, loadFromMemory, saveToFile
///
////////////////////////////////////////////////////////////
bool LoadFromSamples(const Int16* samples, std::size_t sampleCount, unsigned int channelCount, unsigned int sampleRate);
bool loadFromSamples(const Int16* samples, std::size_t sampleCount, unsigned int channelCount, unsigned int sampleRate);
////////////////////////////////////////////////////////////
/// \brief Save the sound buffer to an audio file
@ -151,37 +151,37 @@ public :
///
/// \return True if saving succeeded, false if it failed
///
/// \see LoadFromFile, LoadFromMemory, LoadFromSamples
/// \see loadFromFile, loadFromMemory, loadFromSamples
///
////////////////////////////////////////////////////////////
bool SaveToFile(const std::string& filename) const;
bool saveToFile(const std::string& filename) const;
////////////////////////////////////////////////////////////
/// \brief Get the array of audio samples stored in the buffer
///
/// The format of the returned samples is 16 bits signed integer
/// (sf::Int16). The total number of samples in this array
/// is given by the GetSampleCount() function.
/// is given by the getSampleCount() function.
///
/// \return Read-only pointer to the array of sound samples
///
/// \see GetSampleCount
/// \see getSampleCount
///
////////////////////////////////////////////////////////////
const Int16* GetSamples() const;
const Int16* getSamples() const;
////////////////////////////////////////////////////////////
/// \brief Get the number of samples stored in the buffer
///
/// The array of samples can be accessed with the GetSamples()
/// The array of samples can be accessed with the getSamples()
/// function.
///
/// \return Number of samples
///
/// \see GetSamples
/// \see getSamples
///
////////////////////////////////////////////////////////////
std::size_t GetSampleCount() const;
std::size_t getSampleCount() const;
////////////////////////////////////////////////////////////
/// \brief Get the sample rate of the sound
@ -192,10 +192,10 @@ public :
///
/// \return Sample rate (number of samples per second)
///
/// \see GetChannelCount, GetDuration
/// \see getChannelCount, getDuration
///
////////////////////////////////////////////////////////////
unsigned int GetSampleRate() const;
unsigned int getSampleRate() const;
////////////////////////////////////////////////////////////
/// \brief Get the number of channels used by the sound
@ -205,20 +205,20 @@ public :
///
/// \return Number of channels
///
/// \see GetSampleRate, GetDuration
/// \see getSampleRate, getDuration
///
////////////////////////////////////////////////////////////
unsigned int GetChannelCount() const;
unsigned int getChannelCount() const;
////////////////////////////////////////////////////////////
/// \brief Get the total duration of the sound
///
/// \return Sound duration
///
/// \see GetSampleRate, GetChannelCount
/// \see getSampleRate, getChannelCount
///
////////////////////////////////////////////////////////////
Time GetDuration() const;
Time getDuration() const;
////////////////////////////////////////////////////////////
/// \brief Overload of assignment operator
@ -242,7 +242,7 @@ private :
/// \return True on succesful initialization, false on failure
///
////////////////////////////////////////////////////////////
bool Initialize(priv::SoundFile& file);
bool initialize(priv::SoundFile& file);
////////////////////////////////////////////////////////////
/// \brief Update the internal buffer with the cached audio samples
@ -253,7 +253,7 @@ private :
/// \return True on success, false if any error happened
///
////////////////////////////////////////////////////////////
bool Update(unsigned int channelCount, unsigned int sampleRate);
bool update(unsigned int channelCount, unsigned int sampleRate);
////////////////////////////////////////////////////////////
/// \brief Add a sound to the list of sounds that use this buffer
@ -261,7 +261,7 @@ private :
/// \param sound Sound instance to attach
///
////////////////////////////////////////////////////////////
void AttachSound(Sound* sound) const;
void attachSound(Sound* sound) const;
////////////////////////////////////////////////////////////
/// \brief Remove a sound from the list of sounds that use this buffer
@ -269,7 +269,7 @@ private :
/// \param sound Sound instance to detach
///
////////////////////////////////////////////////////////////
void DetachSound(Sound* sound) const;
void detachSound(Sound* sound) const;
////////////////////////////////////////////////////////////
// Types
@ -304,7 +304,7 @@ private :
/// are like texture pixels, and a sf::SoundBuffer is similar to
/// a sf::Texture.
///
/// A sound buffer can be loaded from a file (see LoadFromFile()
/// A sound buffer can be loaded from a file (see loadFromFile()
/// for the complete list of supported formats), from memory, from
/// a custom stream (see sf::InputStream) or directly from an array
/// of samples. It can also be saved back to a file.
@ -333,25 +333,25 @@ private :
/// sf::SoundBuffer buffer;
///
/// // Load it from a file
/// if (!buffer.LoadFromFile("sound.wav"))
/// if (!buffer.loadFromFile("sound.wav"))
/// {
/// // error...
/// }
///
/// // Create a sound source and bind it to the buffer
/// sf::Sound sound1;
/// sound1.SetBuffer(buffer);
/// sound1.setBuffer(buffer);
///
/// // Play the sound
/// sound1.Play();
/// sound1.play();
///
/// // Create another sound source bound to the same buffer
/// sf::Sound sound2;
/// sound2.SetBuffer(buffer);
/// sound2.setBuffer(buffer);
///
/// // Play it with a higher pitch -- the first sound remains unchanged
/// sound2.SetPitch(2);
/// sound2.Play();
/// sound2.setPitch(2);
/// sound2.play();
/// \endcode
///
/// \see sf::Sound, sf::SoundBufferRecorder

View file

@ -56,7 +56,7 @@ public :
/// \return Read-only access to the sound buffer
///
////////////////////////////////////////////////////////////
const SoundBuffer& GetBuffer() const;
const SoundBuffer& getBuffer() const;
private :
@ -66,7 +66,7 @@ private :
/// \return True to start the capture, or false to abort it
///
////////////////////////////////////////////////////////////
virtual bool OnStart();
virtual bool onStart();
////////////////////////////////////////////////////////////
/// \brief Process a new chunk of recorded samples
@ -77,13 +77,13 @@ private :
/// \return True to continue the capture, or false to stop it
///
////////////////////////////////////////////////////////////
virtual bool OnProcessSamples(const Int16* samples, std::size_t sampleCount);
virtual bool onProcessSamples(const Int16* samples, std::size_t sampleCount);
////////////////////////////////////////////////////////////
/// \brief Stop capturing audio data
///
////////////////////////////////////////////////////////////
virtual void OnStop();
virtual void onStop();
////////////////////////////////////////////////////////////
// Member data
@ -105,29 +105,29 @@ private :
/// through a sf::SoundBuffer, so that it can be played, saved
/// to a file, etc.
///
/// It has the same simple interface as its base class (Start(), Stop())
/// It has the same simple interface as its base class (start(), stop())
/// and adds a function to retrieve the recorded sound buffer
/// (GetBuffer()).
/// (getBuffer()).
///
/// As usual, don't forget to call the IsAvailable() function
/// As usual, don't forget to call the isAvailable() function
/// before using this class (see sf::SoundRecorder for more details
/// about this).
///
/// Usage example:
/// \code
/// if (SoundBufferRecorder::IsAvailable())
/// if (SoundBufferRecorder::isAvailable())
/// {
/// // Record some audio data
/// SoundBufferRecorder recorder;
/// recorder.Start();
/// recorder.start();
/// ...
/// recorder.Stop();
/// recorder.stop();
///
/// // Get the buffer containing the captured audio data
/// const sf::SoundBuffer& buffer = recorder.GetBuffer();
/// const sf::SoundBuffer& buffer = recorder.getBuffer();
///
/// // Save it to a file (for example...)
/// buffer.SaveToFile("my_record.ogg");
/// buffer.saveToFile("my_record.ogg");
/// }
/// \endcode
///

View file

@ -61,18 +61,18 @@ public :
///
/// \param sampleRate Desired capture rate, in number of samples per second
///
/// \see Stop
/// \see stop
///
////////////////////////////////////////////////////////////
void Start(unsigned int sampleRate = 44100);
void start(unsigned int sampleRate = 44100);
////////////////////////////////////////////////////////////
/// \brief Stop the capture
///
/// \see Start
/// \see start
///
////////////////////////////////////////////////////////////
void Stop();
void stop();
////////////////////////////////////////////////////////////
/// \brief Get the sample rate
@ -84,7 +84,7 @@ public :
/// \return Sample rate, in samples per second
///
////////////////////////////////////////////////////////////
unsigned int GetSampleRate() const;
unsigned int getSampleRate() const;
////////////////////////////////////////////////////////////
/// \brief Check if the system supports audio capture
@ -97,7 +97,7 @@ public :
/// \return True if audio capture is supported, false otherwise
///
////////////////////////////////////////////////////////////
static bool IsAvailable();
static bool isAvailable();
protected :
@ -122,7 +122,7 @@ private :
/// \return True to start the capture, or false to abort it
///
////////////////////////////////////////////////////////////
virtual bool OnStart();
virtual bool onStart();
////////////////////////////////////////////////////////////
/// \brief Process a new chunk of recorded samples
@ -138,7 +138,7 @@ private :
/// \return True to continue the capture, or false to stop it
///
////////////////////////////////////////////////////////////
virtual bool OnProcessSamples(const Int16* samples, std::size_t sampleCount) = 0;
virtual bool onProcessSamples(const Int16* samples, std::size_t sampleCount) = 0;
////////////////////////////////////////////////////////////
/// \brief Stop capturing audio data
@ -149,7 +149,7 @@ private :
/// implementation does nothing.
///
////////////////////////////////////////////////////////////
virtual void OnStop();
virtual void onStop();
////////////////////////////////////////////////////////////
/// \brief Function called as the entry point of the thread
@ -158,7 +158,7 @@ private :
/// only when the capture is stopped.
///
////////////////////////////////////////////////////////////
void Record();
void record();
////////////////////////////////////////////////////////////
/// \brief Get the new available audio samples and process them
@ -168,7 +168,7 @@ private :
/// forwards them to the derived class.
///
////////////////////////////////////////////////////////////
void ProcessCapturedSamples();
void processCapturedSamples();
////////////////////////////////////////////////////////////
/// \brief Clean up the recorder's internal resources
@ -176,7 +176,7 @@ private :
/// This function is called when the capture stops.
///
////////////////////////////////////////////////////////////
void CleanUp();
void cleanup();
////////////////////////////////////////////////////////////
// Member data
@ -220,8 +220,8 @@ private :
///
/// It is important to note that the audio capture happens in a
/// separate thread, so that it doesn't block the rest of the
/// program. In particular, the OnProcessSamples and OnStop
/// virtual functions (but not OnStart) will be called
/// program. In particular, the onProcessSamples and onStop
/// virtual functions (but not onStart) will be called
/// from this separate thread. It is important to keep this in
/// mind, because you may have to take care of synchronization
/// issues if you share data between threads.
@ -230,7 +230,7 @@ private :
/// \code
/// class CustomRecorder : public sf::SoundRecorder
/// {
/// virtual bool OnStart() // optional
/// virtual bool onStart() // optional
/// {
/// // Initialize whatever has to be done before the capture starts
/// ...
@ -239,7 +239,7 @@ private :
/// return true;
/// }
///
/// virtual bool OnProcessSamples(const Int16* samples, std::size_t sampleCount)
/// virtual bool onProcessSamples(const Int16* samples, std::size_t sampleCount)
/// {
/// // Do something with the new chunk of samples (store them, send them, ...)
/// ...
@ -248,7 +248,7 @@ private :
/// return true;
/// }
///
/// virtual void OnStop() // optional
/// virtual void onStop() // optional
/// {
/// // Clean up whatever has to be done after the capture ends
/// ...
@ -256,12 +256,12 @@ private :
/// }
///
/// // Usage
/// if (CustomRecorder::IsAvailable())
/// if (CustomRecorder::isAvailable())
/// {
/// CustomRecorder recorder;
/// recorder.Start();
/// recorder.start();
/// ...
/// recorder.Stop();
/// recorder.stop();
/// }
/// \endcode
///

View file

@ -78,10 +78,10 @@ public :
///
/// \param pitch New pitch to apply to the sound
///
/// \see GetPitch
/// \see getPitch
///
////////////////////////////////////////////////////////////
void SetPitch(float pitch);
void setPitch(float pitch);
////////////////////////////////////////////////////////////
/// \brief Set the volume of the sound
@ -91,10 +91,10 @@ public :
///
/// \param volume Volume of the sound
///
/// \see GetVolume
/// \see getVolume
///
////////////////////////////////////////////////////////////
void SetVolume(float volume);
void setVolume(float volume);
////////////////////////////////////////////////////////////
/// \brief Set the 3D position of the sound in the audio scene
@ -107,10 +107,10 @@ public :
/// \param y Y coordinate of the position of the sound in the scene
/// \param z Z coordinate of the position of the sound in the scene
///
/// \see GetPosition
/// \see getPosition
///
////////////////////////////////////////////////////////////
void SetPosition(float x, float y, float z);
void setPosition(float x, float y, float z);
////////////////////////////////////////////////////////////
/// \brief Set the 3D position of the sound in the audio scene
@ -121,10 +121,10 @@ public :
///
/// \param position Position of the sound in the scene
///
/// \see GetPosition
/// \see getPosition
///
////////////////////////////////////////////////////////////
void SetPosition(const Vector3f& position);
void setPosition(const Vector3f& position);
////////////////////////////////////////////////////////////
/// \brief Make the sound's position relative to the listener or absolute
@ -137,10 +137,10 @@ public :
///
/// \param relative True to set the position relative, false to set it absolute
///
/// \see IsRelativeToListener
/// \see isRelativeToListener
///
////////////////////////////////////////////////////////////
void SetRelativeToListener(bool relative);
void setRelativeToListener(bool relative);
////////////////////////////////////////////////////////////
/// \brief Set the minimum distance of the sound
@ -154,10 +154,10 @@ public :
///
/// \param distance New minimum distance of the sound
///
/// \see GetMinDistance, SetAttenuation
/// \see getMinDistance, setAttenuation
///
////////////////////////////////////////////////////////////
void SetMinDistance(float distance);
void setMinDistance(float distance);
////////////////////////////////////////////////////////////
/// \brief Set the attenuation factor of the sound
@ -173,40 +173,40 @@ public :
///
/// \param attenuation New attenuation factor of the sound
///
/// \see GetAttenuation, SetMinDistance
/// \see getAttenuation, setMinDistance
///
////////////////////////////////////////////////////////////
void SetAttenuation(float attenuation);
void setAttenuation(float attenuation);
////////////////////////////////////////////////////////////
/// \brief Get the pitch of the sound
///
/// \return Pitch of the sound
///
/// \see SetPitch
/// \see setPitch
///
////////////////////////////////////////////////////////////
float GetPitch() const;
float getPitch() const;
////////////////////////////////////////////////////////////
/// \brief Get the volume of the sound
///
/// \return Volume of the sound, in the range [0, 100]
///
/// \see SetVolume
/// \see setVolume
///
////////////////////////////////////////////////////////////
float GetVolume() const;
float getVolume() const;
////////////////////////////////////////////////////////////
/// \brief Get the 3D position of the sound in the audio scene
///
/// \return Position of the sound
///
/// \see SetPosition
/// \see setPosition
///
////////////////////////////////////////////////////////////
Vector3f GetPosition() const;
Vector3f getPosition() const;
////////////////////////////////////////////////////////////
/// \brief Tell whether the sound's position is relative to the
@ -214,30 +214,30 @@ public :
///
/// \return True if the position is relative, false if it's absolute
///
/// \see SetRelativeToListener
/// \see setRelativeToListener
///
////////////////////////////////////////////////////////////
bool IsRelativeToListener() const;
bool isRelativeToListener() const;
////////////////////////////////////////////////////////////
/// \brief Get the minimum distance of the sound
///
/// \return Minimum distance of the sound
///
/// \see SetMinDistance, GetAttenuation
/// \see setMinDistance, getAttenuation
///
////////////////////////////////////////////////////////////
float GetMinDistance() const;
float getMinDistance() const;
////////////////////////////////////////////////////////////
/// \brief Get the attenuation factor of the sound
///
/// \return Attenuation factor of the sound
///
/// \see SetAttenuation, GetMinDistance
/// \see setAttenuation, getMinDistance
///
////////////////////////////////////////////////////////////
float GetAttenuation() const;
float getAttenuation() const;
protected :
@ -255,7 +255,7 @@ protected :
/// \return Current status of the sound
///
////////////////////////////////////////////////////////////
Status GetStatus() const;
Status getStatus() const;
////////////////////////////////////////////////////////////
// Member data

View file

@ -51,8 +51,8 @@ public :
////////////////////////////////////////////////////////////
struct Chunk
{
const Int16* Samples; ///< Pointer to the audio samples
std::size_t SampleCount; ///< Number of samples pointed by Samples
const Int16* samples; ///< Pointer to the audio samples
std::size_t sampleCount; ///< Number of samples pointed by Samples
};
////////////////////////////////////////////////////////////
@ -70,10 +70,10 @@ public :
/// This function uses its own thread so that it doesn't block
/// the rest of the program while the stream is played.
///
/// \see Pause, Stop
/// \see pause, stop
///
////////////////////////////////////////////////////////////
void Play();
void play();
////////////////////////////////////////////////////////////
/// \brief Pause the audio stream
@ -81,22 +81,22 @@ public :
/// This function pauses the stream if it was playing,
/// otherwise (stream already paused or stopped) it has no effect.
///
/// \see Play, Stop
/// \see play, stop
///
////////////////////////////////////////////////////////////
void Pause();
void pause();
////////////////////////////////////////////////////////////
/// \brief Stop playing the audio stream
///
/// This function stops the stream if it was playing or paused,
/// and does nothing if it was already stopped.
/// It also resets the playing position (unlike Pause()).
/// It also resets the playing position (unlike pause()).
///
/// \see Play, Pause
/// \see play, pause
///
////////////////////////////////////////////////////////////
void Stop();
void stop();
////////////////////////////////////////////////////////////
/// \brief Return the number of channels of the stream
@ -106,7 +106,7 @@ public :
/// \return Number of channels
///
////////////////////////////////////////////////////////////
unsigned int GetChannelCount() const;
unsigned int getChannelCount() const;
////////////////////////////////////////////////////////////
/// \brief Get the stream sample rate of the stream
@ -117,7 +117,7 @@ public :
/// \return Sample rate, in number of samples per second
///
////////////////////////////////////////////////////////////
unsigned int GetSampleRate() const;
unsigned int getSampleRate() const;
////////////////////////////////////////////////////////////
/// \brief Get the current status of the stream (stopped, paused, playing)
@ -125,7 +125,7 @@ public :
/// \return Current status
///
////////////////////////////////////////////////////////////
Status GetStatus() const;
Status getStatus() const;
////////////////////////////////////////////////////////////
/// \brief Change the current playing position of the stream
@ -135,45 +135,45 @@ public :
///
/// \param timeOffset New playing position, from the beginning of the stream
///
/// \see GetPlayingOffset
/// \see getPlayingOffset
///
////////////////////////////////////////////////////////////
void SetPlayingOffset(Time timeOffset);
void setPlayingOffset(Time timeOffset);
////////////////////////////////////////////////////////////
/// \brief Get the current playing position of the stream
///
/// \return Current playing position, from the beginning of the stream
///
/// \see SetPlayingOffset
/// \see setPlayingOffset
///
////////////////////////////////////////////////////////////
Time GetPlayingOffset() const;
Time getPlayingOffset() const;
////////////////////////////////////////////////////////////
/// \brief Set whether or not the stream should loop after reaching the end
///
/// If set, the stream will restart from beginning after
/// reaching the end and so on, until it is stopped or
/// SetLoop(false) is called.
/// setLoop(false) is called.
/// The default looping state for streams is false.
///
/// \param loop True to play in loop, false to play once
///
/// \see GetLoop
/// \see getLoop
///
////////////////////////////////////////////////////////////
void SetLoop(bool loop);
void setLoop(bool loop);
////////////////////////////////////////////////////////////
/// \brief Tell whether or not the stream is in loop mode
///
/// \return True if the stream is looping, false otherwise
///
/// \see SetLoop
/// \see setLoop
///
////////////////////////////////////////////////////////////
bool GetLoop() const;
bool getLoop() const;
protected :
@ -190,7 +190,7 @@ protected :
///
/// This function must be called by derived classes as soon
/// as they know the audio settings of the stream to play.
/// Any attempt to manipulate the stream (Play(), ...) before
/// Any attempt to manipulate the stream (play(), ...) before
/// calling this function will fail.
/// It can be called multiple times if the settings of the
/// audio stream change, but only when the stream is stopped.
@ -199,7 +199,7 @@ protected :
/// \param sampleRate Sample rate, in samples per second
///
////////////////////////////////////////////////////////////
void Initialize(unsigned int channelCount, unsigned int sampleRate);
void initialize(unsigned int channelCount, unsigned int sampleRate);
private :
@ -210,7 +210,7 @@ private :
/// only when the sound is stopped.
///
////////////////////////////////////////////////////////////
void Stream();
void stream();
////////////////////////////////////////////////////////////
/// \brief Request a new chunk of audio samples from the stream source
@ -226,7 +226,7 @@ private :
/// \return True to continue playback, false to stop
///
////////////////////////////////////////////////////////////
virtual bool OnGetData(Chunk& data) = 0;
virtual bool onGetData(Chunk& data) = 0;
////////////////////////////////////////////////////////////
/// \brief Change the current playing position in the stream source
@ -237,7 +237,7 @@ private :
/// \param timeOffset New playing position, relative to the beginning of the stream
///
////////////////////////////////////////////////////////////
virtual void OnSeek(Time timeOffset) = 0;
virtual void onSeek(Time timeOffset) = 0;
////////////////////////////////////////////////////////////
/// \brief Fill a new buffer with audio samples, and append
@ -252,7 +252,7 @@ private :
/// \return True if the stream source has requested to stop, false otherwise
///
////////////////////////////////////////////////////////////
bool FillAndPushBuffer(unsigned int bufferNum);
bool fillAndPushBuffer(unsigned int bufferNum);
////////////////////////////////////////////////////////////
/// \brief Fill the audio buffers and put them all into the playing queue
@ -263,7 +263,7 @@ private :
/// \return True if the derived class has requested to stop, false otherwise
///
////////////////////////////////////////////////////////////
bool FillQueue();
bool fillQueue();
////////////////////////////////////////////////////////////
/// \brief Clear all the audio buffers and empty the playing queue
@ -271,7 +271,7 @@ private :
/// This function is called when the stream is stopped.
///
////////////////////////////////////////////////////////////
void ClearQueue();
void clearQueue();
enum
{
@ -320,8 +320,8 @@ private :
/// by combining this class with the network module.
///
/// A derived class has to override two virtual functions:
/// \li OnGetData fills a new chunk of audio data to be played
/// \li OnSeek changes the current playing position in the source
/// \li onGetData fills a new chunk of audio data to be played
/// \li onSeek changes the current playing position in the source
///
/// It is important to note that each SoundStream is played in its
/// own separate thread, so that the streaming loop doesn't block the
@ -336,7 +336,7 @@ private :
/// {
/// public :
///
/// bool Open(const std::string& location)
/// bool open(const std::string& location)
/// {
/// // Open the source and get audio settings
/// ...
@ -344,22 +344,22 @@ private :
/// unsigned int sampleRate = ...;
///
/// // Initialize the stream -- important!
/// Initialize(channelCount, sampleRate);
/// initialize(channelCount, sampleRate);
/// }
///
/// private :
///
/// virtual bool OnGetData(Chunk& data)
/// virtual bool onGetData(Chunk& data)
/// {
/// // Fill the chunk with audio data from the stream source
/// data.Samples = ...;
/// data.SampleCount = ...;
/// data.samples = ...;
/// data.sampleCount = ...;
///
/// // Return true to continue playing
/// return true;
/// }
///
/// virtual void OnSeek(Uint32 timeOffset)
/// virtual void onSeek(Uint32 timeOffset)
/// {
/// // Change the current position in the stream source
/// ...
@ -368,8 +368,8 @@ private :
///
/// // Usage
/// CustomStream stream;
/// stream.Open("path/to/stream");
/// stream.Play();
/// stream.open("path/to/stream");
/// stream.play();
/// \endcode
///
/// \see sf::Music

View file

@ -56,40 +56,40 @@ public :
///
/// \param radius New radius of the circle
///
/// \see GetRadius
/// \see getRadius
///
////////////////////////////////////////////////////////////
void SetRadius(float radius);
void setRadius(float radius);
////////////////////////////////////////////////////////////
/// \brief Get the radius of the circle
///
/// \return Radius of the circle
///
/// \see SetRadius
/// \see setRadius
///
////////////////////////////////////////////////////////////
float GetRadius() const;
float getRadius() const;
////////////////////////////////////////////////////////////
/// \brief Set the number of points of the circle
///
/// \param count New number of points of the circle
///
/// \see GetPointCount
/// \see getPointCount
///
////////////////////////////////////////////////////////////
void SetPointCount(unsigned int count);
void setPointCount(unsigned int count);
////////////////////////////////////////////////////////////
/// \brief Get the number of points of the shape
///
/// \return Number of points of the shape
///
/// \see SetPointCount
/// \see setPointCount
///
////////////////////////////////////////////////////////////
virtual unsigned int GetPointCount() const;
virtual unsigned int getPointCount() const;
////////////////////////////////////////////////////////////
/// \brief Get a point of the shape
@ -101,7 +101,7 @@ public :
/// \return Index-th point of the shape
///
////////////////////////////////////////////////////////////
virtual Vector2f GetPoint(unsigned int index) const;
virtual Vector2f getPoint(unsigned int index) const;
private :
@ -129,12 +129,12 @@ private :
/// Usage example:
/// \code
/// sf::CircleShape circle;
/// circle.SetRadius(150);
/// circle.SetOutlineColor(sf::Color::Red);
/// circle.SetOutlineThickness(5);
/// circle.SetPosition(10, 20);
/// circle.setRadius(150);
/// circle.setOutlineColor(sf::Color::Red);
/// circle.setOutlineThickness(5);
/// circle.setPosition(10, 20);
/// ...
/// window.Draw(circle);
/// window.draw(circle);
/// \endcode
///
/// Since the graphics card can't draw perfect circles, we have to

View file

@ -58,20 +58,20 @@ public :
///
/// \param count New number of points of the polygon
///
/// \see GetPointCount
/// \see getPointCount
///
////////////////////////////////////////////////////////////
void SetPointCount(unsigned int count);
void setPointCount(unsigned int count);
////////////////////////////////////////////////////////////
/// \brief Get the number of points of the polygon
///
/// \return Number of points of the polygon
///
/// \see SetPointCount
/// \see setPointCount
///
////////////////////////////////////////////////////////////
virtual unsigned int GetPointCount() const;
virtual unsigned int getPointCount() const;
////////////////////////////////////////////////////////////
/// \brief Set the position of a point
@ -85,10 +85,10 @@ public :
/// \param index Index of the point to change, in range [0 .. GetPointCount() - 1]
/// \param point New position of the point
///
/// \see GetPoint
/// \see getPoint
///
////////////////////////////////////////////////////////////
void SetPoint(unsigned int index, const Vector2f& point);
void setPoint(unsigned int index, const Vector2f& point);
////////////////////////////////////////////////////////////
/// \brief Get the position of a point
@ -99,10 +99,10 @@ public :
///
/// \return Position of the index-th point of the polygon
///
/// \see SetPoint
/// \see setPoint
///
////////////////////////////////////////////////////////////
virtual Vector2f GetPoint(unsigned int index) const;
virtual Vector2f getPoint(unsigned int index) const;
private :
@ -134,15 +134,15 @@ private :
/// Usage example:
/// \code
/// sf::ConvexShape polygon;
/// polygon.SetPointCount(3);
/// polygon.SetPoint(0, sf::Vector2f(0, 0));
/// polygon.SetPoint(1, sf::Vector2f(0, 10));
/// polygon.SetPoint(2, sf::Vector2f(25, 5));
/// polygon.SetOutlineColor(sf::Color::Red);
/// polygon.SetOutlineThickness(5);
/// polygon.SetPosition(10, 20);
/// polygon.setPointCount(3);
/// polygon.setPoint(0, sf::Vector2f(0, 0));
/// polygon.setPoint(1, sf::Vector2f(0, 10));
/// polygon.setPoint(2, sf::Vector2f(25, 5));
/// polygon.setOutlineColor(sf::Color::Red);
/// polygon.setOutlineThickness(5);
/// polygon.setPosition(10, 20);
/// ...
/// window.Draw(polygon);
/// window.draw(polygon);
/// \endcode
///
/// \see sf::Shape, sf::RectangleShape, sf::CircleShape

View file

@ -66,7 +66,7 @@ private :
/// \param states Current render states
///
////////////////////////////////////////////////////////////
virtual void Draw(RenderTarget& target, RenderStates states) const = 0;
virtual void draw(RenderTarget& target, RenderStates states) const = 0;
};
} // namespace sf
@ -100,14 +100,14 @@ private :
///
/// private :
///
/// virtual void Draw(sf::RenderTarget& target, RenderStates states) const
/// virtual void draw(sf::RenderTarget& target, RenderStates states) const
/// {
/// // You can draw other high-level objects
/// target.Draw(m_sprite, states);
/// target.draw(m_sprite, states);
///
/// // ... or use the low-level API
/// states.Texture = &m_texture;
/// target.Draw(m_vertices, states);
/// target.draw(m_vertices, states);
///
/// // ... or draw with OpenGL directly
/// glBegin(GL_QUADS);

View file

@ -88,10 +88,10 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see LoadFromMemory, LoadFromStream
/// \see loadFromMemory, loadFromStream
///
////////////////////////////////////////////////////////////
bool LoadFromFile(const std::string& filename);
bool loadFromFile(const std::string& filename);
////////////////////////////////////////////////////////////
/// \brief Load the font from a file in memory
@ -107,10 +107,10 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see LoadFromFile, LoadFromStream
/// \see loadFromFile, loadFromStream
///
////////////////////////////////////////////////////////////
bool LoadFromMemory(const void* data, std::size_t sizeInBytes);
bool loadFromMemory(const void* data, std::size_t sizeInBytes);
////////////////////////////////////////////////////////////
/// \brief Load the font from a custom stream
@ -125,10 +125,10 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see LoadFromFile, LoadFromMemory
/// \see loadFromFile, loadFromMemory
///
////////////////////////////////////////////////////////////
bool LoadFromStream(InputStream& stream);
bool loadFromStream(InputStream& stream);
////////////////////////////////////////////////////////////
/// \brief Retrieve a glyph of the font
@ -140,7 +140,7 @@ public :
/// \return The glyph corresponding to \a codePoint and \a characterSize
///
////////////////////////////////////////////////////////////
const Glyph& GetGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const;
const Glyph& getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const;
////////////////////////////////////////////////////////////
/// \brief Get the kerning offset of two glyphs
@ -158,7 +158,7 @@ public :
/// \return Kerning value for \a first and \a second, in pixels
///
////////////////////////////////////////////////////////////
int GetKerning(Uint32 first, Uint32 second, unsigned int characterSize) const;
int getKerning(Uint32 first, Uint32 second, unsigned int characterSize) const;
////////////////////////////////////////////////////////////
/// \brief Get the line spacing
@ -171,7 +171,7 @@ public :
/// \return Line spacing, in pixels
///
////////////////////////////////////////////////////////////
int GetLineSpacing(unsigned int characterSize) const;
int getLineSpacing(unsigned int characterSize) const;
////////////////////////////////////////////////////////////
/// \brief Retrieve the texture containing the loaded glyphs of a certain size
@ -185,7 +185,7 @@ public :
/// \return Texture containing the glyphs of the requested size
///
////////////////////////////////////////////////////////////
const Texture& GetTexture(unsigned int characterSize) const;
const Texture& getTexture(unsigned int characterSize) const;
////////////////////////////////////////////////////////////
/// \brief Overload of assignment operator
@ -209,7 +209,7 @@ public :
/// \return Reference to the built-in default font
///
////////////////////////////////////////////////////////////
static const Font& GetDefaultFont();
static const Font& getDefaultFont();
private :
@ -219,11 +219,11 @@ private :
////////////////////////////////////////////////////////////
struct Row
{
Row(unsigned int top, unsigned int height) : Width(0), Top(top), Height(height) {}
Row(unsigned int top, unsigned int height) : width(0), top(top), height(height) {}
unsigned int Width; ///< Current width of the row
unsigned int Top; ///< Y position of the row into the texture
unsigned int Height; ///< Height of the row
unsigned int width; ///< Current width of the row
unsigned int top; ///< Y position of the row into the texture
unsigned int height; ///< Height of the row
};
////////////////////////////////////////////////////////////
@ -239,17 +239,17 @@ private :
{
Page();
GlyphTable Glyphs; ///< Table mapping code points to their corresponding glyph
sf::Texture Texture; ///< Texture containing the pixels of the glyphs
unsigned int NextRow; ///< Y position of the next new row in the texture
std::vector<Row> Rows; ///< List containing the position of all the existing rows
GlyphTable glyphs; ///< Table mapping code points to their corresponding glyph
sf::Texture texture; ///< Texture containing the pixels of the glyphs
unsigned int nextRow; ///< Y position of the next new row in the texture
std::vector<Row> rows; ///< List containing the position of all the existing rows
};
////////////////////////////////////////////////////////////
/// \brief Free all the internal resources
///
////////////////////////////////////////////////////////////
void Cleanup();
void cleanup();
////////////////////////////////////////////////////////////
/// \brief Load a new glyph and store it in the cache
@ -261,7 +261,7 @@ private :
/// \return The glyph corresponding to \a codePoint and \a characterSize
///
////////////////////////////////////////////////////////////
Glyph LoadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const;
Glyph loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const;
////////////////////////////////////////////////////////////
/// \brief Find a suitable rectangle within the texture for a glyph
@ -273,7 +273,7 @@ private :
/// \return Found rectangle within the texture
///
////////////////////////////////////////////////////////////
IntRect FindGlyphRect(Page& page, unsigned int width, unsigned int height) const;
IntRect findGlyphRect(Page& page, unsigned int width, unsigned int height) const;
////////////////////////////////////////////////////////////
/// \brief Make sure that the given size is the current one
@ -283,7 +283,7 @@ private :
/// \return True on success, false if any error happened
///
////////////////////////////////////////////////////////////
bool SetCurrentSize(unsigned int characterSize) const;
bool setCurrentSize(unsigned int characterSize) const;
////////////////////////////////////////////////////////////
// Types
@ -313,7 +313,7 @@ private :
///
/// Fonts can be loaded from a file, from memory or from a custom
/// stream, and supports the most common types of fonts. See
/// the LoadFromFile function for the complete list of supported formats.
/// the loadFromFile function for the complete list of supported formats.
///
/// Once it is loaded, a sf::Font instance provides three
/// types of informations about the font:
@ -347,22 +347,22 @@ private :
/// sf::Font font;
///
/// // Load it from a file
/// if (!font.LoadFromFile("arial.ttf"))
/// if (!font.loadFromFile("arial.ttf"))
/// {
/// // error...
/// }
///
/// // Create a text which uses our font
/// sf::Text text1;
/// text1.SetFont(font);
/// text1.SetCharacterSize(30);
/// text1.SetStyle(sf::Text::Regular);
/// text1.setFont(font);
/// text1.setCharacterSize(30);
/// text1.setStyle(sf::Text::Regular);
///
/// // Create another text using the same font, but with different parameters
/// sf::Text text2;
/// text2.SetFont(font);
/// text2.SetCharacterSize(50);
/// text1.SetStyle(sf::Text::Italic);
/// text2.setFont(font);
/// text2.setCharacterSize(50);
/// text1.setStyle(sf::Text::Italic);
/// \endcode
///
/// Apart from loading font files, and passing them to instances

View file

@ -46,14 +46,14 @@ public :
/// \brief Default constructor
///
////////////////////////////////////////////////////////////
Glyph() : Advance(0) {}
Glyph() : advance(0) {}
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
int Advance; ///< Offset to move horizontically to the next character
IntRect Bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline
IntRect TextureRect; ///< Texture coordinates of the glyph inside the font's texture
int advance; ///< Offset to move horizontically to the next character
IntRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline
IntRect textureRect; ///< Texture coordinates of the glyph inside the font's texture
};
} // namespace sf

View file

@ -63,7 +63,7 @@ public :
/// \param color Fill color
///
////////////////////////////////////////////////////////////
void Create(unsigned int width, unsigned int height, const Color& color = Color(0, 0, 0));
void create(unsigned int width, unsigned int height, const Color& color = Color(0, 0, 0));
////////////////////////////////////////////////////////////
/// \brief Create the image from an array of pixels
@ -78,7 +78,7 @@ public :
/// \param pixels Array of pixels to copy to the image
///
////////////////////////////////////////////////////////////
void Create(unsigned int width, unsigned int height, const Uint8* pixels);
void create(unsigned int width, unsigned int height, const Uint8* pixels);
////////////////////////////////////////////////////////////
/// \brief Load the image from a file on disk
@ -92,10 +92,10 @@ public :
///
/// \return True if loading was successful
///
/// \see LoadFromMemory, LoadFromStream, SaveToFile
/// \see loadFromMemory, loadFromStream, saveToFile
///
////////////////////////////////////////////////////////////
bool LoadFromFile(const std::string& filename);
bool loadFromFile(const std::string& filename);
////////////////////////////////////////////////////////////
/// \brief Load the image from a file in memory
@ -110,10 +110,10 @@ public :
///
/// \return True if loading was successful
///
/// \see LoadFromFile, LoadFromStream
/// \see loadFromFile, loadFromStream
///
////////////////////////////////////////////////////////////
bool LoadFromMemory(const void* data, std::size_t size);
bool loadFromMemory(const void* data, std::size_t size);
////////////////////////////////////////////////////////////
/// \brief Load the image from a custom stream
@ -127,10 +127,10 @@ public :
///
/// \return True if loading was successful
///
/// \see LoadFromFile, LoadFromMemory
/// \see loadFromFile, loadFromMemory
///
////////////////////////////////////////////////////////////
bool LoadFromStream(InputStream& stream);
bool loadFromStream(InputStream& stream);
////////////////////////////////////////////////////////////
/// \brief Save the image to a file on disk
@ -144,30 +144,30 @@ public :
///
/// \return True if saving was successful
///
/// \see Create, LoadFromFile, LoadFromMemory
/// \see create, loadFromFile, loadFromMemory
///
////////////////////////////////////////////////////////////
bool SaveToFile(const std::string& filename) const;
bool saveToFile(const std::string& filename) const;
////////////////////////////////////////////////////////////
/// \brief Return the width of the image
///
/// \return Width in pixels
///
/// \see GetHeight
/// \see getHeight
///
////////////////////////////////////////////////////////////
unsigned int GetWidth() const;
unsigned int getWidth() const;
////////////////////////////////////////////////////////////
/// \brief Return the height of the image
///
/// \return Height in pixels
///
/// \see GetWidth
/// \see getWidth
///
////////////////////////////////////////////////////////////
unsigned int GetHeight() const;
unsigned int getHeight() const;
////////////////////////////////////////////////////////////
/// \brief Create a transparency mask from a specified color-key
@ -180,7 +180,7 @@ public :
/// \param alpha Alpha value to assign to transparent pixels
///
////////////////////////////////////////////////////////////
void CreateMaskFromColor(const Color& color, Uint8 alpha = 0);
void createMaskFromColor(const Color& color, Uint8 alpha = 0);
////////////////////////////////////////////////////////////
/// \brief Copy pixels from another image onto this one
@ -202,7 +202,7 @@ public :
/// \param applyAlpha Should the copy take in account the source transparency?
///
////////////////////////////////////////////////////////////
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);
////////////////////////////////////////////////////////////
/// \brief Change the color of a pixel
@ -215,10 +215,10 @@ public :
/// \param y Y coordinate of pixel to change
/// \param color New color of the pixel
///
/// \see GetPixel
/// \see getPixel
///
////////////////////////////////////////////////////////////
void SetPixel(unsigned int x, unsigned int y, const Color& color);
void setPixel(unsigned int x, unsigned int y, const Color& color);
////////////////////////////////////////////////////////////
/// \brief Get the color of a pixel
@ -232,8 +232,10 @@ public :
///
/// \return Color of the pixel at coordinates (x, y)
///
/// \see setPixel
///
////////////////////////////////////////////////////////////
Color GetPixel(unsigned int x, unsigned int y) const;
Color getPixel(unsigned int x, unsigned int y) const;
////////////////////////////////////////////////////////////
/// \brief Get a read-only pointer to the array of pixels
@ -248,19 +250,19 @@ public :
/// \return Read-only pointer to the array of pixels
///
////////////////////////////////////////////////////////////
const Uint8* GetPixelsPtr() const;
const Uint8* getPixelsPtr() const;
////////////////////////////////////////////////////////////
/// \brief Flip the image horizontally (left <-> right)
///
////////////////////////////////////////////////////////////
void FlipHorizontally();
void flipHorizontally();
////////////////////////////////////////////////////////////
/// \brief Flip the image vertically (top <-> bottom)
///
////////////////////////////////////////////////////////////
void FlipVertically();
void flipVertically();
private :
@ -293,7 +295,7 @@ private :
/// channels -- just like a sf::Color.
/// All the functions that return an array of pixels follow
/// this rule, and all parameters that you pass to sf::Image
/// functions (such as LoadFromPixels) must use this
/// functions (such as loadFromPixels) must use this
/// representation as well.
///
/// A sf::Image can be copied, but it is a heavy resource and
@ -304,24 +306,24 @@ private :
/// \code
/// // Load an image file from a file
/// sf::Image background;
/// if (!background.LoadFromFile("background.jpg"))
/// if (!background.loadFromFile("background.jpg"))
/// return -1;
///
/// // Create a 20x20 image filled with black color
/// sf::Image image;
/// if (!image.Create(20, 20, sf::Color::Black))
/// if (!image.create(20, 20, sf::Color::Black))
/// return -1;
///
/// // Copy image1 on image2 at position (10, 10)
/// image.Copy(background, 10, 10);
/// image.copy(background, 10, 10);
///
/// // Make the top-left pixel transparent
/// sf::Color color = image.GetPixel(0, 0);
/// sf::Color color = image.getPixel(0, 0);
/// color.a = 0;
/// image.SetPixel(0, 0, color);
/// image.setPixel(0, 0, color);
///
/// // Save the image to a file
/// if (!image.SaveToFile("result.png"))
/// if (!image.saveToFile("result.png"))
/// return -1;
/// \endcode
///

View file

@ -100,10 +100,10 @@ public :
///
/// \return True if the point is inside, false otherwise
///
/// \see Intersects
/// \see intersects
///
////////////////////////////////////////////////////////////
bool Contains(T x, T y) const;
bool contains(T x, T y) const;
////////////////////////////////////////////////////////////
/// \brief Check if a point is inside the rectangle's area
@ -112,10 +112,10 @@ public :
///
/// \return True if the point is inside, false otherwise
///
/// \see Intersects
/// \see intersects
///
////////////////////////////////////////////////////////////
bool Contains(const Vector2<T>& point) const;
bool contains(const Vector2<T>& point) const;
////////////////////////////////////////////////////////////
/// \brief Check the intersection between two rectangles
@ -124,10 +124,10 @@ public :
///
/// \return True if rectangles overlap, false otherwise
///
/// \see Contains
/// \see contains
///
////////////////////////////////////////////////////////////
bool Intersects(const Rect<T>& rectangle) const;
bool intersects(const Rect<T>& rectangle) const;
////////////////////////////////////////////////////////////
/// \brief Check the intersection between two rectangles
@ -140,18 +140,18 @@ public :
///
/// \return True if rectangles overlap, false otherwise
///
/// \see Contains
/// \see contains
///
////////////////////////////////////////////////////////////
bool Intersects(const Rect<T>& rectangle, Rect<T>& intersection) const;
bool intersects(const Rect<T>& rectangle, Rect<T>& intersection) const;
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
T Left; ///< Left coordinate of the rectangle
T Top; ///< Top coordinate of the rectangle
T Width; ///< Width of the rectangle
T Height; ///< Height of the rectangle
T left; ///< Left coordinate of the rectangle
T top; ///< Top coordinate of the rectangle
T width; ///< Width of the rectangle
T height; ///< Height of the rectangle
};
////////////////////////////////////////////////////////////
@ -202,18 +202,18 @@ typedef Rect<float> FloatRect;
///
/// A rectangle is defined by its top-left corner and its size.
/// It is a very simple class defined for convenience, so
/// its member variables (Left, Top, Width and Height) are public
/// its member variables (left, top, width and height) are public
/// and can be accessed directly, just like the vector classes
/// (Vector2 and Vector3).
///
/// To keep things simple, sf::Rect doesn't define
/// functions to emulate the properties that are not directly
/// members (such as Right, Bottom, Center, etc.), it rather
/// members (such as right, bottom, center, etc.), it rather
/// only provides intersection functions.
///
/// sf::Rect uses the usual rules for its boundaries:
/// \li The Left and Top edges are included in the rectangle's area
/// \li The right (Left + Width) and bottom (Top + Height) edges are excluded from the rectangle's area
/// \li The left and top edges are included in the rectangle's area
/// \li The right (left + width) and bottom (top + height) edges are excluded from the rectangle's area
///
/// This means that sf::IntRect(0, 0, 1, 1) and sf::IntRect(1, 1, 1, 1)
/// don't intersect.
@ -236,12 +236,12 @@ typedef Rect<float> FloatRect;
/// sf::IntRect r2(position, size);
///
/// // Test intersections with the point (3, 1)
/// bool b1 = r1.Contains(3, 1); // true
/// bool b2 = r2.Contains(3, 1); // false
/// bool b1 = r1.contains(3, 1); // true
/// bool b2 = r2.contains(3, 1); // false
///
/// // Test the intersection between r1 and r2
/// sf::IntRect result;
/// bool b3 = r1.Intersects(r2, result); // true
/// bool b3 = r1.intersects(r2, result); // true
/// // result == (4, 2, 16, 3)
/// \endcode
///

View file

@ -26,10 +26,10 @@
////////////////////////////////////////////////////////////
template <typename T>
Rect<T>::Rect() :
Left (0),
Top (0),
Width (0),
Height(0)
left (0),
top (0),
width (0),
height(0)
{
}
@ -38,10 +38,10 @@ Height(0)
////////////////////////////////////////////////////////////
template <typename T>
Rect<T>::Rect(T left, T top, T width, T height) :
Left (left),
Top (top),
Width (width),
Height(height)
left (left),
top (top),
width (width),
height(height)
{
}
@ -50,10 +50,10 @@ Height(height)
////////////////////////////////////////////////////////////
template <typename T>
Rect<T>::Rect(const Vector2<T>& position, const Vector2<T>& size) :
Left (position.x),
Top (position.y),
Width (size.x),
Height(size.y)
left (position.x),
top (position.y),
width (size.x),
height(size.y)
{
}
@ -63,53 +63,53 @@ Height(size.y)
template <typename T>
template <typename U>
Rect<T>::Rect(const Rect<U>& rectangle) :
Left (static_cast<T>(rectangle.Left)),
Top (static_cast<T>(rectangle.Top)),
Width (static_cast<T>(rectangle.Width)),
Height(static_cast<T>(rectangle.Height))
left (static_cast<T>(rectangle.left)),
top (static_cast<T>(rectangle.Top)),
width (static_cast<T>(rectangle.Width)),
height(static_cast<T>(rectangle.Height))
{
}
////////////////////////////////////////////////////////////
template <typename T>
bool Rect<T>::Contains(T x, T y) const
bool Rect<T>::contains(T x, T y) const
{
return (x >= Left) && (x < Left + Width) && (y >= Top) && (y < Top + Height);
return (x >= left) && (x < left + width) && (y >= top) && (y < top + height);
}
////////////////////////////////////////////////////////////
template <typename T>
bool Rect<T>::Contains(const Vector2<T>& point) const
bool Rect<T>::contains(const Vector2<T>& point) const
{
return Contains(point.x, point.y);
return contains(point.x, point.y);
}
////////////////////////////////////////////////////////////
template <typename T>
bool Rect<T>::Intersects(const Rect<T>& rectangle) const
bool Rect<T>::intersects(const Rect<T>& rectangle) const
{
Rect<T> intersection;
return Intersects(rectangle, intersection);
return intersects(rectangle, intersection);
}
////////////////////////////////////////////////////////////
template <typename T>
bool Rect<T>::Intersects(const Rect<T>& rectangle, Rect<T>& intersection) const
bool Rect<T>::intersects(const Rect<T>& rectangle, Rect<T>& intersection) const
{
// Compute the intersection boundaries
T left = std::max(Left, rectangle.Left);
T top = std::max(Top, rectangle.Top);
T right = std::min(Left + Width, rectangle.Left + rectangle.Width);
T bottom = std::min(Top + Height, rectangle.Top + rectangle.Height);
T interLeft = std::max(left, rectangle.left);
T interTop = std::max(top, rectangle.top);
T interRight = std::min(left + width, rectangle.left + rectangle.width);
T interBottom = std::min(top + height, rectangle.top + rectangle.height);
// If the intersection is valid (positive non zero area), then there is an intersection
if ((left < right) && (top < bottom))
if ((interLeft < interRight) && (interTop < interBottom))
{
intersection = Rect<T>(left, top, right - left, bottom - top);
intersection = Rect<T>(interLeft, interTop, interRight - interLeft, interBottom - interTop);
return true;
}
else
@ -124,8 +124,8 @@ bool Rect<T>::Intersects(const Rect<T>& rectangle, Rect<T>& intersection) const
template <typename T>
inline bool operator ==(const Rect<T>& left, const Rect<T>& right)
{
return (left.Left == right.Left) && (left.Width == right.Width) &&
(left.Top == right.Top) && (left.Height == right.Height);
return (left.left == right.left) && (left.width == right.width) &&
(left.top == right.top) && (left.height == right.height);
}
@ -133,6 +133,5 @@ inline bool operator ==(const Rect<T>& left, const Rect<T>& right)
template <typename T>
inline bool operator !=(const Rect<T>& left, const Rect<T>& right)
{
return (left.Left != right.Left) || (left.Width != right.Width) ||
(left.Top != right.Top) || (left.Height != right.Height);
return !(left == right);
}

View file

@ -55,20 +55,20 @@ public :
///
/// \param size New size of the rectangle
///
/// \see GetSize
/// \see getSize
///
////////////////////////////////////////////////////////////
void SetSize(const Vector2f& size);
void setSize(const Vector2f& size);
////////////////////////////////////////////////////////////
/// \brief Get the size of the rectangle
///
/// \return Size of the rectangle
///
/// \see SetSize
/// \see setSize
///
////////////////////////////////////////////////////////////
const Vector2f& GetSize() const;
const Vector2f& getSize() const;
////////////////////////////////////////////////////////////
/// \brief Get the number of points defining the shape
@ -76,7 +76,7 @@ public :
/// \return Number of points of the shape
///
////////////////////////////////////////////////////////////
virtual unsigned int GetPointCount() const;
virtual unsigned int getPointCount() const;
////////////////////////////////////////////////////////////
/// \brief Get a point of the shape
@ -88,7 +88,7 @@ public :
/// \return Index-th point of the shape
///
////////////////////////////////////////////////////////////
virtual Vector2f GetPoint(unsigned int index) const;
virtual Vector2f getPoint(unsigned int index) const;
private :
@ -115,12 +115,12 @@ private :
/// Usage example:
/// \code
/// sf::RectangleShape rectangle;
/// rectangle.SetSize(sf::Vector2f(100, 50));
/// rectangle.SetOutlineColor(sf::Color::Red);
/// rectangle.SetOutlineThickness(5);
/// rectangle.SetPosition(10, 20);
/// rectangle.setSize(sf::Vector2f(100, 50));
/// rectangle.setOutlineColor(sf::Color::Red);
/// rectangle.setOutlineThickness(5);
/// rectangle.setPosition(10, 20);
/// ...
/// window.Draw(rectangle);
/// window.draw(rectangle);
/// \endcode
///
/// \see sf::Shape, sf::CircleShape, sf::ConvexShape

View file

@ -66,7 +66,7 @@ public :
/// \param blendMode Blend mode to use
///
////////////////////////////////////////////////////////////
RenderStates(sf::BlendMode blendMode);
RenderStates(BlendMode blendMode);
////////////////////////////////////////////////////////////
/// \brief Construct a default set of render states with a custom transform
@ -74,7 +74,7 @@ public :
/// \param transform Transform to use
///
////////////////////////////////////////////////////////////
RenderStates(const sf::Transform& transform);
RenderStates(const Transform& transform);
////////////////////////////////////////////////////////////
/// \brief Construct a default set of render states with a custom texture
@ -82,7 +82,7 @@ public :
/// \param texture Texture to use
///
////////////////////////////////////////////////////////////
RenderStates(const sf::Texture* texture);
RenderStates(const Texture* texture);
////////////////////////////////////////////////////////////
/// \brief Construct a default set of render states with a custom shader
@ -90,7 +90,7 @@ public :
/// \param shader Shader to use
///
////////////////////////////////////////////////////////////
RenderStates(const sf::Shader* shader);
RenderStates(const Shader* shader);
////////////////////////////////////////////////////////////
/// \brief Construct a set of render states with all its attributes
@ -101,8 +101,8 @@ public :
/// \param shader Shader to use
///
////////////////////////////////////////////////////////////
RenderStates(sf::BlendMode blendMode, const sf::Transform& transform,
const sf::Texture* texture, const sf::Shader* shader);
RenderStates(BlendMode blendMode, const Transform& transform,
const Texture* texture, const Shader* shader);
////////////////////////////////////////////////////////////
// Static member data
@ -112,10 +112,10 @@ public :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
sf::BlendMode BlendMode; ///< Blending mode
sf::Transform Transform; ///< Transform
const sf::Texture* Texture; ///< Texture
const sf::Shader* Shader; ///< Shader
BlendMode blendMode; ///< Blending mode
Transform transform; ///< Transform
const Texture* texture; ///< Texture
const Shader* shader; ///< Shader
};
} // namespace sf
@ -158,7 +158,7 @@ public :
/// function: sf::RenderStates has an implicit one-argument
/// constructor for each state.
/// \code
/// window.Draw(sprite, shader);
/// window.draw(sprite, shader);
/// \endcode
///
/// When you're inside the Draw function of a drawable

View file

@ -67,7 +67,7 @@ public :
/// \param color Fill color to use to clear the render target
///
////////////////////////////////////////////////////////////
void Clear(const Color& color = Color(0, 0, 0, 255));
void clear(const Color& color = Color(0, 0, 0, 255));
////////////////////////////////////////////////////////////
/// \brief Change the current active view
@ -81,24 +81,24 @@ public :
/// so it is not necessary to keep the original one alive
/// after calling this function.
/// To restore the original view of the target, you can pass
/// the result of GetDefaultView() to this function.
/// the result of getDefaultView() to this function.
///
/// \param view New view to use
///
/// \see GetView, GetDefaultView
/// \see getView, getDefaultView
///
////////////////////////////////////////////////////////////
void SetView(const View& view);
void setView(const View& view);
////////////////////////////////////////////////////////////
/// \brief Get the view currently in use in the render target
///
/// \return The view object that is currently used
///
/// \see SetView, GetDefaultView
/// \see setView, getDefaultView
///
////////////////////////////////////////////////////////////
const View& GetView() const;
const View& getView() const;
////////////////////////////////////////////////////////////
/// \brief Get the default view of the render target
@ -108,10 +108,10 @@ public :
///
/// \return The default view of the render target
///
/// \see SetView, GetView
/// \see setView, getView
///
////////////////////////////////////////////////////////////
const View& GetDefaultView() const;
const View& getDefaultView() const;
////////////////////////////////////////////////////////////
/// \brief Get the viewport of a view, applied to this render target
@ -126,7 +126,7 @@ public :
/// \return Viewport rectangle, expressed in pixels
///
////////////////////////////////////////////////////////////
IntRect GetViewport(const View& view) const;
IntRect getViewport(const View& view) const;
////////////////////////////////////////////////////////////
/// \brief Convert a point from target coordinates to view coordinates
@ -150,7 +150,7 @@ public :
/// \return The converted point, in "world" units
///
////////////////////////////////////////////////////////////
Vector2f ConvertCoords(unsigned int x, unsigned int y) const;
Vector2f convertCoords(unsigned int x, unsigned int y) const;
////////////////////////////////////////////////////////////
/// \brief Convert a point from target coordinates to view coordinates
@ -176,7 +176,7 @@ public :
/// \return The converted point, in "world" units
///
////////////////////////////////////////////////////////////
Vector2f ConvertCoords(unsigned int x, unsigned int y, const View& view) const;
Vector2f convertCoords(unsigned int x, unsigned int y, const View& view) const;
////////////////////////////////////////////////////////////
/// \brief Draw a drawable object to the render-target
@ -185,7 +185,7 @@ public :
/// \param states Render states to use for drawing
///
////////////////////////////////////////////////////////////
void Draw(const Drawable& drawable, const RenderStates& states = RenderStates::Default);
void draw(const Drawable& drawable, const RenderStates& states = RenderStates::Default);
////////////////////////////////////////////////////////////
/// \brief Draw primitives defined by an array of vertices
@ -196,7 +196,7 @@ public :
/// \param states Render states to use for drawing
///
////////////////////////////////////////////////////////////
void Draw(const Vertex* vertices, unsigned int vertexCount,
void draw(const Vertex* vertices, unsigned int vertexCount,
PrimitiveType type, const RenderStates& states = RenderStates::Default);
////////////////////////////////////////////////////////////
@ -204,10 +204,8 @@ public :
///
/// \return Size in pixels
///
/// \see GetHeight
///
////////////////////////////////////////////////////////////
virtual Vector2u GetSize() const = 0;
virtual Vector2u getSize() const = 0;
////////////////////////////////////////////////////////////
/// \brief Save the current OpenGL render states and matrices
@ -222,10 +220,10 @@ public :
/// calls Draw functions. Example:
/// \code
/// // OpenGL code here...
/// window.PushGLStates();
/// window.Draw(...);
/// window.Draw(...);
/// window.PopGLStates();
/// window.pushGLStates();
/// window.draw(...);
/// window.draw(...);
/// window.popGLStates();
/// // OpenGL code here...
/// \endcode
///
@ -238,44 +236,44 @@ public :
/// saved and restored). Take a look at the ResetGLStates
/// function if you do so.
///
/// \see PopGLStates
/// \see popGLStates
///
////////////////////////////////////////////////////////////
void PushGLStates();
void pushGLStates();
////////////////////////////////////////////////////////////
/// \brief Restore the previously saved OpenGL render states and matrices
///
/// See the description of PushGLStates to get a detailed
/// See the description of pushGLStates to get a detailed
/// description of these functions.
///
/// \see PushGLStates
/// \see pushGLStates
///
////////////////////////////////////////////////////////////
void PopGLStates();
void popGLStates();
////////////////////////////////////////////////////////////
/// \brief Reset the internal OpenGL states so that the target is ready for drawing
///
/// This function can be used when you mix SFML drawing
/// and direct OpenGL rendering, if you choose not to use
/// PushGLStates/PopGLStates. It makes sure that all OpenGL
/// states needed by SFML are set, so that subsequent Draw()
/// pushGLStates/popGLStates. It makes sure that all OpenGL
/// states needed by SFML are set, so that subsequent draw()
/// calls will work as expected.
///
/// Example:
/// \code
/// // OpenGL code here...
/// glPushAttrib(...);
/// window.ResetGLStates();
/// window.Draw(...);
/// window.Draw(...);
/// window.resetGLStates();
/// window.draw(...);
/// window.draw(...);
/// glPopAttrib(...);
/// // OpenGL code here...
/// \endcode
///
////////////////////////////////////////////////////////////
void ResetGLStates();
void resetGLStates();
protected :
@ -292,13 +290,13 @@ protected :
/// target is created and ready for drawing.
///
////////////////////////////////////////////////////////////
void Initialize();
void initialize();
////////////////////////////////////////////////////////////
/// \brief Apply the current view
///
////////////////////////////////////////////////////////////
void ApplyCurrentView();
void applyCurrentView();
////////////////////////////////////////////////////////////
/// \brief Apply a new blending mode
@ -306,7 +304,7 @@ protected :
/// \param mode Blending mode to apply
///
////////////////////////////////////////////////////////////
void ApplyBlendMode(BlendMode mode);
void applyBlendMode(BlendMode mode);
////////////////////////////////////////////////////////////
/// \brief Apply a new transform
@ -314,7 +312,7 @@ protected :
/// \param transform Transform to apply
///
////////////////////////////////////////////////////////////
void ApplyTransform(const Transform& transform);
void applyTransform(const Transform& transform);
////////////////////////////////////////////////////////////
/// \brief Apply a new texture
@ -322,7 +320,7 @@ protected :
/// \param texture Texture to apply
///
////////////////////////////////////////////////////////////
void ApplyTexture(const Texture* texture);
void applyTexture(const Texture* texture);
////////////////////////////////////////////////////////////
/// \brief Apply a new shader
@ -330,7 +328,7 @@ protected :
/// \param shader Shader to apply
///
////////////////////////////////////////////////////////////
void ApplyShader(const Shader* shader);
void applyShader(const Shader* shader);
private :
@ -346,7 +344,7 @@ private :
/// \return True if the function succeeded
///
////////////////////////////////////////////////////////////
virtual bool Activate(bool active) = 0;
virtual bool activate(bool active) = 0;
////////////////////////////////////////////////////////////
/// \brief Render states cache
@ -356,11 +354,11 @@ private :
{
enum {VertexCacheSize = 4};
bool ViewChanged; ///< Has the current view changed since last draw?
BlendMode LastBlendMode; ///< Cached blending mode
Uint64 LastTextureId; ///< Cached texture
bool UseVertexCache; ///< Did we previously use the vertex cache?
Vertex VertexCache[VertexCacheSize]; ///< Pre-transformed vertices cache
bool viewChanged; ///< Has the current view changed since last draw?
BlendMode lastBlendMode; ///< Cached blending mode
Uint64 lastTextureId; ///< Cached texture
bool useVertexCache; ///< Did we previously use the vertex cache?
Vertex vertexCache[VertexCacheSize]; ///< Pre-transformed vertices cache
};
////////////////////////////////////////////////////////////
@ -397,7 +395,7 @@ private :
/// OpenGL stuff. It is even possible to mix together OpenGL calls
/// and regular SFML drawing commands. When doing so, make sure that
/// OpenGL states are not messed up by calling the
/// PushGLStates/PopGLStates functions.
/// pushGLStates/popGLStates functions.
///
/// \see sf::RenderWindow, sf::RenderTexture, sf::View
///

View file

@ -52,9 +52,9 @@ public :
/// \brief Default constructor
///
/// Constructs an empty, invalid render-texture. You must
/// call Create to have a valid render-texture.
/// call create to have a valid render-texture.
///
/// \see Create
/// \see create
///
////////////////////////////////////////////////////////////
RenderTexture();
@ -76,37 +76,37 @@ public :
/// a depth-buffer. Otherwise it is unnecessary, and you should
/// leave this parameter to false (which is its default value).
///
/// \param width Width of the render-texture
/// \param height Height of the render-texture
/// \param depthBuffer Do you want this render-texture to have a depth buffer?
/// \param width Width of the render-texture
/// \param height Height of the render-texture
/// \param depthBuffer Do you want this render-texture to have a depth buffer?
///
/// \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);
////////////////////////////////////////////////////////////
/// \brief Enable or disable texture smoothing
///
/// This function is similar to Texture::SetSmooth.
/// This function is similar to Texture::setSmooth.
/// This parameter is disabled by default.
///
/// \param smooth True to enable smoothing, false to disable it
///
/// \see IsSmooth
/// \see isSmooth
///
////////////////////////////////////////////////////////////
void SetSmooth(bool smooth);
void setSmooth(bool smooth);
////////////////////////////////////////////////////////////
/// \brief Tell whether the smooth filtering is enabled or not
///
/// \return True if texture smoothing is enabled
///
/// \see SetSmooth
/// \see setSmooth
///
////////////////////////////////////////////////////////////
bool IsSmooth() const;
bool isSmooth() const;
////////////////////////////////////////////////////////////
/// \brief Activate of deactivate the render-texture for rendering
@ -123,7 +123,7 @@ public :
/// \return True if operation was successful, false otherwise
///
////////////////////////////////////////////////////////////
bool SetActive(bool active = true);
bool setActive(bool active = true);
////////////////////////////////////////////////////////////
/// \brief Update the contents of the target texture
@ -134,18 +134,18 @@ public :
/// it may leave the texture in an undefined state.
///
////////////////////////////////////////////////////////////
void Display();
void display();
////////////////////////////////////////////////////////////
/// \brief Return the size of the rendering region of the texture
///
/// The returned value is the size that you passed to
/// the Create function.
/// the create function.
///
/// \return Size in pixels
///
////////////////////////////////////////////////////////////
virtual Vector2u GetSize() const;
virtual Vector2u getSize() const;
////////////////////////////////////////////////////////////
/// \brief Get a read-only reference to the target texture
@ -161,7 +161,7 @@ public :
/// \return Const reference to the texture
///
////////////////////////////////////////////////////////////
const Texture& GetTexture() const;
const Texture& getTexture() const;
private :
@ -176,7 +176,7 @@ private :
/// \return True if the function succeeded
///
////////////////////////////////////////////////////////////
virtual bool Activate(bool active);
virtual bool activate(bool active);
////////////////////////////////////////////////////////////
// Member data
@ -215,35 +215,35 @@ private :
///
/// // Create a new render-texture
/// sf::RenderTexture texture;
/// if (!texture.Create(500, 500))
/// if (!texture.create(500, 500))
/// return -1
///
/// // The main loop
/// while (window.IsOpen())
/// while (window.isOpen())
/// {
/// // Event processing
/// // ...
///
/// // Clear the whole texture with red color
/// texture.Clear(sf::Color::Red);
/// texture.clear(sf::Color::Red);
///
/// // Draw stuff to the texture
/// texture.Draw(sprite); // sprite is a sf::Sprite
/// texture.Draw(shape); // shape is a sf::Shape
/// texture.Draw(text); // text is a sf::Text
/// texture.draw(sprite); // sprite is a sf::Sprite
/// texture.draw(shape); // shape is a sf::Shape
/// texture.draw(text); // text is a sf::Text
///
/// // We're done drawing to the texture
/// texture.Display();
/// texture.display();
///
/// // Now we start rendering to the window, clear it first
/// window.Clear();
/// window.clear();
///
/// // Draw the texture
/// sf::Sprite sprite(texture.GetTexture());
/// window.Draw(sprite);
/// sf::Sprite sprite(texture.getTexture());
/// window.draw(sprite);
///
/// // End the current frame and display its contents on screen
/// window.Display();
/// window.display();
/// }
/// \endcode
///

View file

@ -109,7 +109,7 @@ public :
/// \return Size in pixels
///
////////////////////////////////////////////////////////////
virtual Vector2u GetSize() const;
virtual Vector2u getSize() const;
////////////////////////////////////////////////////////////
/// \brief Copy the current contents of the window to an image
@ -118,14 +118,14 @@ public :
/// screenshots of the application. If you want to update an
/// image with the contents of the window and then use it for
/// drawing, you should rather use a sf::Texture and its
/// Update(Window&) function.
/// update(Window&) function.
/// You can also draw things directly to a texture with the
/// sf::RenderTexture class.
///
/// \return Image containing the captured contents
///
////////////////////////////////////////////////////////////
Image Capture() const;
Image capture() const;
private :
@ -137,7 +137,7 @@ private :
/// the window is created.
///
////////////////////////////////////////////////////////////
virtual void OnCreate();
virtual void onCreate();
////////////////////////////////////////////////////////////
/// \brief Function called after the window has been resized
@ -146,7 +146,7 @@ private :
/// perform custom actions when the size of the window changes.
///
////////////////////////////////////////////////////////////
virtual void OnResize();
virtual void onResize();
////////////////////////////////////////////////////////////
/// \brief Activate the target for rendering
@ -156,7 +156,7 @@ private :
/// \return True if the function succeeded
///
////////////////////////////////////////////////////////////
virtual bool Activate(bool active);
virtual bool activate(bool active);
};
} // namespace sf
@ -188,30 +188,30 @@ private :
/// sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
///
/// // Limit the framerate to 60 frames per second (this step is optional)
/// window.SetFramerateLimit(60);
/// window.setFramerateLimit(60);
///
/// // The main loop - ends as soon as the window is closed
/// while (window.IsOpen())
/// while (window.isOpen())
/// {
/// // Event processing
/// sf::Event event;
/// while (window.PollEvent(event))
/// while (window.pollEvent(event))
/// {
/// // Request for closing the window
/// if (event.Type == sf::Event::Closed)
/// window.Close();
/// if (event.type == sf::Event::Closed)
/// window.close();
/// }
///
/// // Clear the whole window before rendering a new frame
/// window.Clear();
/// window.clear();
///
/// // Draw some graphical entities
/// window.Draw(sprite);
/// window.Draw(circle);
/// window.Draw(text);
/// window.draw(sprite);
/// window.draw(circle);
/// window.draw(text);
///
/// // End the current frame and display its contents on screen
/// window.Display();
/// window.display();
/// }
/// \endcode
///
@ -233,15 +233,15 @@ private :
/// ...
///
/// // Start the rendering loop
/// while (window.IsOpen())
/// while (window.isOpen())
/// {
/// // Process events
/// ...
///
/// // Draw a background sprite
/// window.PushGLStates();
/// window.Draw(sprite);
/// window.PopGLStates();
/// window.pushGLStates();
/// window.draw(sprite);
/// window.popGLStates();
///
/// // Draw a 3D object using OpenGL
/// glBegin(GL_QUADS);
@ -250,12 +250,12 @@ private :
/// glEnd();
///
/// // Draw text on top of the 3D object
/// window.PushGLStates();
/// window.Draw(text);
/// window.PopGLStates();
/// window.pushGLStates();
/// window.draw(text);
/// window.popGLStates();
///
/// // Finally, display the rendered frame on screen
/// window.Display();
/// window.display();
/// }
/// \endcode
///

View file

@ -63,7 +63,7 @@ public :
};
////////////////////////////////////////////////////////////
/// \brief Special type/value that can be passed to SetParameter,
/// \brief Special type/value that can be passed to setParameter,
/// and that represents the texture of the object being drawn
///
////////////////////////////////////////////////////////////
@ -102,10 +102,10 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see LoadFromMemory, LoadFromStream
/// \see loadFromMemory, loadFromStream
///
////////////////////////////////////////////////////////////
bool LoadFromFile(const std::string& filename, Type type);
bool loadFromFile(const std::string& filename, Type type);
////////////////////////////////////////////////////////////
/// \brief Load both the vertex and fragment shaders from files
@ -123,10 +123,10 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see LoadFromMemory, LoadFromStream
/// \see loadFromMemory, loadFromStream
///
////////////////////////////////////////////////////////////
bool LoadFromFile(const std::string& vertexShaderFilename, const std::string& fragmentShaderFilename);
bool loadFromFile(const std::string& vertexShaderFilename, const std::string& fragmentShaderFilename);
////////////////////////////////////////////////////////////
/// \brief Load either the vertex or fragment shader from a source code in memory
@ -143,10 +143,10 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see LoadFromFile, LoadFromStream
/// \see loadFromFile, loadFromStream
///
////////////////////////////////////////////////////////////
bool LoadFromMemory(const std::string& shader, Type type);
bool loadFromMemory(const std::string& shader, Type type);
////////////////////////////////////////////////////////////
/// \brief Load both the vertex and fragment shaders from source codes in memory
@ -164,10 +164,10 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see LoadFromFile, LoadFromStream
/// \see loadFromFile, loadFromStream
///
////////////////////////////////////////////////////////////
bool LoadFromMemory(const std::string& vertexShader, const std::string& fragmentShader);
bool loadFromMemory(const std::string& vertexShader, const std::string& fragmentShader);
////////////////////////////////////////////////////////////
/// \brief Load either the vertex or fragment shader from a custom stream
@ -184,10 +184,10 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see LoadFromFile, LoadFromMemory
/// \see loadFromFile, loadFromMemory
///
////////////////////////////////////////////////////////////
bool LoadFromStream(InputStream& stream, Type type);
bool loadFromStream(InputStream& stream, Type type);
////////////////////////////////////////////////////////////
/// \brief Load both the vertex and fragment shaders from custom streams
@ -205,10 +205,10 @@ public :
///
/// \return True if loading succeeded, false if it failed
///
/// \see LoadFromFile, LoadFromMemory
/// \see loadFromFile, loadFromMemory
///
////////////////////////////////////////////////////////////
bool LoadFromStream(InputStream& vertexShaderStream, InputStream& fragmentShaderStream);
bool loadFromStream(InputStream& vertexShaderStream, InputStream& fragmentShaderStream);
////////////////////////////////////////////////////////////
/// \brief Change a float parameter of the shader
@ -222,14 +222,14 @@ public :
/// uniform float myparam; // this is the variable in the shader
/// \endcode
/// \code
/// shader.SetParameter("myparam", 5.2f);
/// shader.setParameter("myparam", 5.2f);
/// \endcode
///
/// \param name Name of the parameter in the shader
/// \param x Value to assign
///
////////////////////////////////////////////////////////////
void SetParameter(const std::string& name, float x);
void setParameter(const std::string& name, float x);
////////////////////////////////////////////////////////////
/// \brief Change a 2-components vector parameter of the shader
@ -243,7 +243,7 @@ public :
/// uniform vec2 myparam; // this is the variable in the shader
/// \endcode
/// \code
/// shader.SetParameter("myparam", 5.2f, 6.0f);
/// shader.setParameter("myparam", 5.2f, 6.0f);
/// \endcode
///
/// \param name Name of the parameter in the shader
@ -251,7 +251,7 @@ public :
/// \param y Second component of the value to assign
///
////////////////////////////////////////////////////////////
void SetParameter(const std::string& name, float x, float y);
void setParameter(const std::string& name, float x, float y);
////////////////////////////////////////////////////////////
/// \brief Change a 3-components vector parameter of the shader
@ -265,7 +265,7 @@ public :
/// uniform vec3 myparam; // this is the variable in the shader
/// \endcode
/// \code
/// shader.SetParameter("myparam", 5.2f, 6.0f, -8.1f);
/// shader.setParameter("myparam", 5.2f, 6.0f, -8.1f);
/// \endcode
///
/// \param name Name of the parameter in the shader
@ -274,7 +274,7 @@ public :
/// \param z Third component of the value 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);
////////////////////////////////////////////////////////////
/// \brief Change a 4-components vector parameter of the shader
@ -288,7 +288,7 @@ public :
/// uniform vec4 myparam; // this is the variable in the shader
/// \endcode
/// \code
/// shader.SetParameter("myparam", 5.2f, 6.0f, -8.1f, 0.4f);
/// shader.setParameter("myparam", 5.2f, 6.0f, -8.1f, 0.4f);
/// \endcode
///
/// \param name Name of the parameter in the shader
@ -298,7 +298,7 @@ public :
/// \param w Fourth component of the value 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);
////////////////////////////////////////////////////////////
/// \brief Change a 2-components vector parameter of the shader
@ -312,14 +312,14 @@ public :
/// uniform vec2 myparam; // this is the variable in the shader
/// \endcode
/// \code
/// shader.SetParameter("myparam", sf::Vector2f(5.2f, 6.0f));
/// shader.setParameter("myparam", sf::Vector2f(5.2f, 6.0f));
/// \endcode
///
/// \param name Name of the parameter in the shader
/// \param vector Vector to assign
///
////////////////////////////////////////////////////////////
void SetParameter(const std::string& name, const Vector2f& vector);
void setParameter(const std::string& name, const Vector2f& vector);
////////////////////////////////////////////////////////////
/// \brief Change a 3-components vector parameter of the shader
@ -333,14 +333,14 @@ public :
/// uniform vec3 myparam; // this is the variable in the shader
/// \endcode
/// \code
/// shader.SetParameter("myparam", sf::Vector3f(5.2f, 6.0f, -8.1f));
/// shader.setParameter("myparam", sf::Vector3f(5.2f, 6.0f, -8.1f));
/// \endcode
///
/// \param name Name of the parameter in the shader
/// \param vector Vector to assign
///
////////////////////////////////////////////////////////////
void SetParameter(const std::string& name, const Vector3f& vector);
void setParameter(const std::string& name, const Vector3f& vector);
////////////////////////////////////////////////////////////
/// \brief Change a color parameter of the shader
@ -360,14 +360,14 @@ public :
/// uniform vec4 color; // this is the variable in the shader
/// \endcode
/// \code
/// shader.SetParameter("color", sf::Color(255, 128, 0, 255));
/// shader.setParameter("color", sf::Color(255, 128, 0, 255));
/// \endcode
///
/// \param name Name of the parameter in the shader
/// \param color Color to assign
///
////////////////////////////////////////////////////////////
void SetParameter(const std::string& name, const Color& color);
void setParameter(const std::string& name, const Color& color);
////////////////////////////////////////////////////////////
/// \brief Change a matrix parameter of the shader
@ -383,14 +383,14 @@ public :
/// \code
/// sf::Transform transform;
/// transform.Translate(5, 10);
/// shader.SetParameter("matrix", transform);
/// shader.setParameter("matrix", transform);
/// \endcode
///
/// \param name Name of the parameter in the shader
/// \param transform Transform to assign
///
////////////////////////////////////////////////////////////
void SetParameter(const std::string& name, const sf::Transform& transform);
void setParameter(const std::string& name, const sf::Transform& transform);
////////////////////////////////////////////////////////////
/// \brief Change a texture parameter of the shader
@ -406,7 +406,7 @@ public :
/// \code
/// sf::Texture texture;
/// ...
/// shader.SetParameter("the_texture", texture);
/// shader.setParameter("the_texture", texture);
/// \endcode
/// It is important to note that \a texture must remain alive as long
/// as the shader uses it, no copy is made internally.
@ -415,14 +415,14 @@ public :
/// known in advance, you can pass the special value
/// sf::Shader::CurrentTexture:
/// \code
/// shader.SetParameter("the_texture", sf::Shader::CurrentTexture).
/// shader.setParameter("the_texture", sf::Shader::CurrentTexture).
/// \endcode
///
/// \param name Name of the texture in the shader
/// \param texture Texture to assign
///
////////////////////////////////////////////////////////////
void SetParameter(const std::string& name, const Texture& texture);
void setParameter(const std::string& name, const Texture& texture);
////////////////////////////////////////////////////////////
/// \brief Change a texture parameter of the shader
@ -439,13 +439,13 @@ public :
/// uniform sampler2D current; // this is the variable in the shader
/// \endcode
/// \code
/// shader.SetParameter("current", sf::Shader::CurrentTexture);
/// shader.setParameter("current", sf::Shader::CurrentTexture);
/// \endcode
///
/// \param name Name of the texture in the shader
///
////////////////////////////////////////////////////////////
void SetParameter(const std::string& name, CurrentTextureType);
void setParameter(const std::string& name, CurrentTextureType);
////////////////////////////////////////////////////////////
/// \brief Bind the shader for rendering (activate it)
@ -454,16 +454,16 @@ public :
/// you want to use the shader with a custom OpenGL rendering
/// instead of a SFML drawable.
/// \code
/// window.SetActive();
/// shader.Bind();
/// window.setActive();
/// shader.bind();
/// ... render OpenGL geometry ...
/// shader.Unbind();
/// shader.unbind();
/// \endcode
///
/// \see Unbind
/// \see unbind
///
////////////////////////////////////////////////////////////
void Bind() const;
void bind() const;
////////////////////////////////////////////////////////////
/// \brief Unbind the shader (deactivate it)
@ -472,10 +472,10 @@ public :
/// you want to use the shader with a custom OpenGL rendering
/// instead of a SFML drawable.
///
/// \see Bind
/// \see bind
///
////////////////////////////////////////////////////////////
void Unbind() const;
void unbind() const;
////////////////////////////////////////////////////////////
/// \brief Tell whether or not the system supports shaders
@ -487,7 +487,7 @@ public :
/// \return True if shaders are supported, false otherwise
///
////////////////////////////////////////////////////////////
static bool IsAvailable();
static bool isAvailable();
private :
@ -503,7 +503,7 @@ private :
/// \return True on success, false if any error happened
///
////////////////////////////////////////////////////////////
bool Compile(const char* vertexShaderCode, const char* fragmentShaderCode);
bool compile(const char* vertexShaderCode, const char* fragmentShaderCode);
////////////////////////////////////////////////////////////
/// \brief Bind all the textures used by the shader
@ -512,7 +512,7 @@ private :
/// updates the corresponding variables in the shader accordingly.
///
////////////////////////////////////////////////////////////
void BindTextures() const;
void bindTextures() const;
////////////////////////////////////////////////////////////
// Types
@ -563,13 +563,13 @@ private :
/// \li transforms (matrices)
///
/// The value of the variables can be changed at any time
/// with either the various overloads of the SetParameter function:
/// with either the various overloads of the setParameter function:
/// \code
/// shader.SetParameter("offset", 2.f);
/// shader.SetParameter("color", 0.5f, 0.8f, 0.3f);
/// shader.SetParameter("matrix", transform); // transform is a sf::Transform
/// shader.SetParameter("overlay", texture); // texture is a sf::Texture
/// shader.SetParameter("texture", sf::Shader::CurrentTexture);
/// shader.setParameter("offset", 2.f);
/// shader.setParameter("color", 0.5f, 0.8f, 0.3f);
/// shader.setParameter("matrix", transform); // transform is a sf::Transform
/// shader.setParameter("overlay", texture); // texture is a sf::Texture
/// shader.setParameter("texture", sf::Shader::CurrentTexture);
/// \endcode
///
/// The special Shader::CurrentTexture argument maps the
@ -579,14 +579,14 @@ private :
/// To apply a shader to a drawable, you must pass it as an
/// additional parameter to the Draw function:
/// \code
/// window.Draw(sprite, shader);
/// window.draw(sprite, shader);
/// \endcode
///
/// ... which is in fact just a shortcut for this:
/// \code
/// sf::RenderStates states;
/// states.Shader = shader;
/// window.Draw(sprite, states);
/// states.shader = shader;
/// window.draw(sprite, states);
/// \endcode
///
/// Shaders can be used on any drawable, but some combinations are
@ -605,7 +605,7 @@ private :
/// \li draw everything to a sf::RenderTexture, then draw it to
/// the main target using the shader
/// \li draw everything directly to the main target, then use
/// sf::Texture::Update(Window&) to copy its contents to a texture
/// sf::Texture::update(Window&) to copy its contents to a texture
/// and draw it to the main target using the shader
///
/// The first technique is more optimized because it doesn't involve
@ -617,10 +617,10 @@ private :
/// sf::Shader can also be used directly as a raw shader for
/// custom OpenGL geometry.
/// \code
/// window.SetActive();
/// shader.Bind();
/// window.setActive();
/// shader.bind();
/// ... render OpenGL geometry ...
/// shader.Unbind();
/// shader.unbind();
/// \endcode
///
////////////////////////////////////////////////////////////

View file

@ -68,10 +68,10 @@ public :
/// \param texture New texture
/// \param resetRect Should the texture rect be reset to the size of the new texture?
///
/// \see GetTexture, SetTextureRect
/// \see getTexture, setTextureRect
///
////////////////////////////////////////////////////////////
void SetTexture(const Texture* texture, bool resetRect = false);
void setTexture(const Texture* texture, bool resetRect = false);
////////////////////////////////////////////////////////////
/// \brief Set the sub-rectangle of the texture that the shape will display
@ -82,10 +82,10 @@ public :
///
/// \param rect Rectangle defining the region of the texture to display
///
/// \see GetTextureRect, SetTexture
/// \see getTextureRect, setTexture
///
////////////////////////////////////////////////////////////
void SetTextureRect(const IntRect& rect);
void setTextureRect(const IntRect& rect);
////////////////////////////////////////////////////////////
/// \brief Set the fill color of the shape
@ -99,10 +99,10 @@ public :
///
/// \param color New color of the shape
///
/// \see GetFillColor, SetOutlineColor
/// \see getFillColor, setOutlineColor
///
////////////////////////////////////////////////////////////
void SetFillColor(const Color& color);
void setFillColor(const Color& color);
////////////////////////////////////////////////////////////
/// \brief Set the outline color of the shape
@ -112,10 +112,10 @@ public :
///
/// \param color New outline color of the shape
///
/// \see GetOutlineColor, SetFillColor
/// \see getOutlineColor, setFillColor
///
////////////////////////////////////////////////////////////
void SetOutlineColor(const Color& color);
void setOutlineColor(const Color& color);
////////////////////////////////////////////////////////////
/// \brief Set the thickness of the shape's outline
@ -126,10 +126,10 @@ public :
///
/// \param thickness New outline thickness
///
/// \see GetOutlineThickness
/// \see getOutlineThickness
///
////////////////////////////////////////////////////////////
void SetOutlineThickness(float thickness);
void setOutlineThickness(float thickness);
////////////////////////////////////////////////////////////
/// \brief Get the source texture of the shape
@ -140,58 +140,60 @@ public :
///
/// \return Pointer to the shape's texture
///
/// \see SetTexture
/// \see setTexture
///
////////////////////////////////////////////////////////////
const Texture* GetTexture() const;
const Texture* getTexture() const;
////////////////////////////////////////////////////////////
/// \brief Get the sub-rectangle of the texture displayed by the shape
///
/// \return Texture rectangle of the shape
///
/// \see SetTextureRect
/// \see setTextureRect
///
////////////////////////////////////////////////////////////
const IntRect& GetTextureRect() const;
const IntRect& getTextureRect() const;
////////////////////////////////////////////////////////////
/// \brief Get the fill color of the shape
///
/// \return Fill color of the shape
///
/// \see SetFillColor
/// \see setFillColor
///
////////////////////////////////////////////////////////////
const Color& GetFillColor() const;
const Color& getFillColor() const;
////////////////////////////////////////////////////////////
/// \brief Get the outline color of the shape
///
/// \return Outline color of the shape
///
/// \see SetOutlineColor
/// \see setOutlineColor
///
////////////////////////////////////////////////////////////
const Color& GetOutlineColor() const;
const Color& getOutlineColor() const;
////////////////////////////////////////////////////////////
/// \brief Get the outline thickness of the shape
///
/// \return Outline thickness of the shape
///
/// \see SetOutlineThickness
/// \see setOutlineThickness
///
////////////////////////////////////////////////////////////
float GetOutlineThickness() const;
float getOutlineThickness() const;
////////////////////////////////////////////////////////////
/// \brief Get the total number of points of the shape
///
/// \return Number of points of the shape
///
/// \see getPoint
///
////////////////////////////////////////////////////////////
virtual unsigned int GetPointCount() const = 0;
virtual unsigned int getPointCount() const = 0;
////////////////////////////////////////////////////////////
/// \brief Get a point of the shape
@ -202,8 +204,10 @@ public :
///
/// \return Index-th point of the shape
///
/// \see getPointCount
///
////////////////////////////////////////////////////////////
virtual Vector2f GetPoint(unsigned int index) const = 0;
virtual Vector2f getPoint(unsigned int index) const = 0;
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of the entity
@ -217,7 +221,7 @@ public :
/// \return Local bounding rectangle of the entity
///
////////////////////////////////////////////////////////////
FloatRect GetLocalBounds() const;
FloatRect getLocalBounds() const;
////////////////////////////////////////////////////////////
/// \brief Get the global bounding rectangle of the entity
@ -231,7 +235,7 @@ public :
/// \return Global bounding rectangle of the entity
///
////////////////////////////////////////////////////////////
FloatRect GetGlobalBounds() const;
FloatRect getGlobalBounds() const;
protected :
@ -246,10 +250,10 @@ protected :
///
/// This function must be called by the derived class everytime
/// the shape's points change (ie. the result of either
/// GetPointCount or GetPoint is different).
/// getPointCount or getPoint is different).
///
////////////////////////////////////////////////////////////
void Update();
void update();
private :
@ -260,31 +264,31 @@ private :
/// \param states Current render states
///
////////////////////////////////////////////////////////////
virtual void Draw(RenderTarget& target, RenderStates states) const;
virtual void draw(RenderTarget& target, RenderStates states) const;
////////////////////////////////////////////////////////////
/// \brief Update the fill vertices' color
///
////////////////////////////////////////////////////////////
void UpdateFillColors();
void updateFillColors();
////////////////////////////////////////////////////////////
/// \brief Update the fill vertices' texture coordinates
///
////////////////////////////////////////////////////////////
void UpdateTexCoords();
void updateTexCoords();
////////////////////////////////////////////////////////////
/// \brief Update the outline vertices' position
///
////////////////////////////////////////////////////////////
void UpdateOutline();
void updateOutline();
////////////////////////////////////////////////////////////
/// \brief Update the outline vertices' color
///
////////////////////////////////////////////////////////////
void UpdateOutlineColors();
void updateOutlineColors();
private :
@ -333,8 +337,8 @@ private :
///
/// You can write your own derived shape class, there are only
/// two virtual functions to override:
/// \li GetOutlinePointCount must return the number of points of the shape
/// \li GetOutlinePoint must return the points of the shape
/// \li getPointCount must return the number of points of the shape
/// \li getPoint must return the points of the shape
///
/// \see sf::RectangleShape, sf::CircleShape, sf::ConvexShape, sf::Transformable
///

View file

@ -61,7 +61,7 @@ public :
///
/// \param texture Source texture
///
/// \see SetTexture
/// \see setTexture
///
////////////////////////////////////////////////////////////
explicit Sprite(const Texture& texture);
@ -72,7 +72,7 @@ public :
/// \param texture Source texture
/// \param rectangle Sub-rectangle of the texture to assign to the sprite
///
/// \see SetTexture, SetTextureRect
/// \see setTexture, setTextureRect
///
////////////////////////////////////////////////////////////
Sprite(const Texture& texture, const IntRect& rectangle);
@ -93,10 +93,10 @@ public :
/// \param texture New texture
/// \param resetRect Should the texture rect be reset to the size of the new texture?
///
/// \see GetTexture, SetTextureRect
/// \see getTexture, setTextureRect
///
////////////////////////////////////////////////////////////
void SetTexture(const Texture& texture, bool resetRect = false);
void setTexture(const Texture& texture, bool resetRect = false);
////////////////////////////////////////////////////////////
/// \brief Set the sub-rectangle of the texture that the sprite will display
@ -107,10 +107,10 @@ public :
///
/// \param rectangle Rectangle defining the region of the texture to display
///
/// \see GetTextureRect, SetTexture
/// \see getTextureRect, setTexture
///
////////////////////////////////////////////////////////////
void SetTextureRect(const IntRect& rectangle);
void setTextureRect(const IntRect& rectangle);
////////////////////////////////////////////////////////////
/// \brief Set the global color of the sprite
@ -122,10 +122,10 @@ public :
///
/// \param color New color of the sprite
///
/// \see GetColor
/// \see getColor
///
////////////////////////////////////////////////////////////
void SetColor(const Color& color);
void setColor(const Color& color);
////////////////////////////////////////////////////////////
/// \brief Get the source texture of the sprite
@ -136,30 +136,30 @@ public :
///
/// \return Pointer to the sprite's texture
///
/// \see SetTexture
/// \see setTexture
///
////////////////////////////////////////////////////////////
const Texture* GetTexture() const;
const Texture* getTexture() const;
////////////////////////////////////////////////////////////
/// \brief Get the sub-rectangle of the texture displayed by the sprite
///
/// \return Texture rectangle of the sprite
///
/// \see SetTextureRect
/// \see setTextureRect
///
////////////////////////////////////////////////////////////
const IntRect& GetTextureRect() const;
const IntRect& getTextureRect() const;
////////////////////////////////////////////////////////////
/// \brief Get the global color of the sprite
///
/// \return Global color of the sprite
///
/// \see SetColor
/// \see setColor
///
////////////////////////////////////////////////////////////
const Color& GetColor() const;
const Color& getColor() const;
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of the entity
@ -173,7 +173,7 @@ public :
/// \return Local bounding rectangle of the entity
///
////////////////////////////////////////////////////////////
FloatRect GetLocalBounds() const;
FloatRect getLocalBounds() const;
////////////////////////////////////////////////////////////
/// \brief Get the global bounding rectangle of the entity
@ -187,7 +187,7 @@ public :
/// \return Global bounding rectangle of the entity
///
////////////////////////////////////////////////////////////
FloatRect GetGlobalBounds() const;
FloatRect getGlobalBounds() const;
private :
@ -198,19 +198,19 @@ private :
/// \param states Current render states
///
////////////////////////////////////////////////////////////
virtual void Draw(RenderTarget& target, RenderStates states) const;
virtual void draw(RenderTarget& target, RenderStates states) const;
////////////////////////////////////////////////////////////
/// \brief Update the vertices' positions
///
////////////////////////////////////////////////////////////
void UpdatePositions();
void updatePositions();
////////////////////////////////////////////////////////////
/// \brief Update the vertices' texture coordinates
///
////////////////////////////////////////////////////////////
void UpdateTexCoords();
void updateTexCoords();
////////////////////////////////////////////////////////////
// Member data
@ -259,17 +259,17 @@ private :
/// \code
/// // Declare and load a texture
/// sf::Texture texture;
/// texture.LoadFromFile("texture.png");
/// texture.loadFromFile("texture.png");
///
/// // Create a sprite
/// sf::Sprite sprite;
/// sprite.SetTexture(texture);
/// sprite.SetTextureRect(sf::IntRect(10, 10, 50, 30));
/// sprite.SetColor(sf::Color(255, 255, 255, 200));
/// sprite.SetPosition(100, 25);
/// sprite.setTexture(texture);
/// sprite.setTextureRect(sf::IntRect(10, 10, 50, 30));
/// sprite.setColor(sf::Color(255, 255, 255, 200));
/// sprite.setPosition(100, 25);
///
/// // Draw it
/// window.Draw(sprite);
/// window.draw(sprite);
/// \endcode
///
/// \see sf::Texture, sf::Transformable

View file

@ -77,7 +77,7 @@ public :
/// \param characterSize Base size of characters, in pixels
///
////////////////////////////////////////////////////////////
explicit Text(const String& string, const Font& font = Font::GetDefaultFont(), unsigned int characterSize = 30);
explicit Text(const String& string, const Font& font = Font::getDefaultFont(), unsigned int characterSize = 30);
////////////////////////////////////////////////////////////
/// \brief Set the text's string
@ -95,10 +95,10 @@ public :
///
/// \param string New string
///
/// \see GetString
/// \see getString
///
////////////////////////////////////////////////////////////
void SetString(const String& string);
void setString(const String& string);
////////////////////////////////////////////////////////////
/// \brief Set the text's font
@ -110,14 +110,14 @@ public :
/// If the font is destroyed and the text tries to
/// use it, the behaviour is undefined.
/// Texts have a valid font by default, which the built-in
/// Font::GetDefaultFont().
/// Font::getDefaultFont().
///
/// \param font New font
///
/// \see GetFont
/// \see getFont
///
////////////////////////////////////////////////////////////
void SetFont(const Font& font);
void setFont(const Font& font);
////////////////////////////////////////////////////////////
/// \brief Set the character size
@ -126,10 +126,10 @@ public :
///
/// \param size New character size, in pixels
///
/// \see GetCharacterSize
/// \see getCharacterSize
///
////////////////////////////////////////////////////////////
void SetCharacterSize(unsigned int size);
void setCharacterSize(unsigned int size);
////////////////////////////////////////////////////////////
/// \brief Set the text's style
@ -140,10 +140,10 @@ public :
///
/// \param style New style
///
/// \see GetStyle
/// \see getStyle
///
////////////////////////////////////////////////////////////
void SetStyle(Uint32 style);
void setStyle(Uint32 style);
////////////////////////////////////////////////////////////
/// \brief Set the global color of the text
@ -152,10 +152,10 @@ public :
///
/// \param color New color of the text
///
/// \see GetColor
/// \see getColor
///
////////////////////////////////////////////////////////////
void SetColor(const Color& color);
void setColor(const Color& color);
////////////////////////////////////////////////////////////
/// \brief Get the text's string
@ -164,17 +164,17 @@ public :
/// be converted to standard string types. So, the following
/// lines of code are all valid:
/// \code
/// sf::String s1 = text.GetString();
/// std::string s2 = text.GetString();
/// std::wstring s3 = text.GetString();
/// sf::String s1 = text.getString();
/// std::string s2 = text.getString();
/// std::wstring s3 = text.getString();
/// \endcode
///
/// \return Text's string
///
/// \see GetString
/// \see setString
///
////////////////////////////////////////////////////////////
const String& GetString() const;
const String& getString() const;
////////////////////////////////////////////////////////////
/// \brief Get the text's font
@ -184,40 +184,40 @@ public :
///
/// \return Text's font
///
/// \see SetFont
/// \see setFont
///
////////////////////////////////////////////////////////////
const Font& GetFont() const;
const Font& getFont() const;
////////////////////////////////////////////////////////////
/// \brief Get the character size
///
/// \return Size of the characters, in pixels
///
/// \see SetCharacterSize
/// \see setCharacterSize
///
////////////////////////////////////////////////////////////
unsigned int GetCharacterSize() const;
unsigned int getCharacterSize() const;
////////////////////////////////////////////////////////////
/// \brief Get the text's style
///
/// \return Text's style
///
/// \see SetStyle
/// \see setStyle
///
////////////////////////////////////////////////////////////
Uint32 GetStyle() const;
Uint32 getStyle() const;
////////////////////////////////////////////////////////////
/// \brief Get the global color of the text
///
/// \return Global color of the text
///
/// \see SetColor
/// \see setColor
///
////////////////////////////////////////////////////////////
const Color& GetColor() const;
const Color& getColor() const;
////////////////////////////////////////////////////////////
/// \brief Return the position of the \a index-th character
@ -234,7 +234,7 @@ public :
/// \return Position of the character
///
////////////////////////////////////////////////////////////
Vector2f FindCharacterPos(std::size_t index) const;
Vector2f findCharacterPos(std::size_t index) const;
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of the entity
@ -248,7 +248,7 @@ public :
/// \return Local bounding rectangle of the entity
///
////////////////////////////////////////////////////////////
FloatRect GetLocalBounds() const;
FloatRect getLocalBounds() const;
////////////////////////////////////////////////////////////
/// \brief Get the global bounding rectangle of the entity
@ -262,7 +262,7 @@ public :
/// \return Global bounding rectangle of the entity
///
////////////////////////////////////////////////////////////
FloatRect GetGlobalBounds() const;
FloatRect getGlobalBounds() const;
private :
@ -273,13 +273,13 @@ private :
/// \param states Current render states
///
////////////////////////////////////////////////////////////
virtual void Draw(RenderTarget& target, RenderStates states) const;
virtual void draw(RenderTarget& target, RenderStates states) const;
////////////////////////////////////////////////////////////
/// \brief Update the text's geometry
///
////////////////////////////////////////////////////////////
void UpdateGeometry();
void updateGeometry();
////////////////////////////////////////////////////////////
// Member data
@ -335,17 +335,17 @@ private :
/// \code
/// // Declare and load a font
/// sf::Font font;
/// font.LoadFromFile("arial.ttf");
/// font.loadFromFile("arial.ttf");
///
/// // Create a text
/// sf::Text text("hello");
/// text.SetFont(font);
/// text.SetCharacterSize(30);
/// text.SetStyle(sf::Text::Bold);
/// text.SetColor(sf::Color::Red);
/// text.setFont(font);
/// text.setCharacterSize(30);
/// text.setStyle(sf::Text::Bold);
/// text.setColor(sf::Color::Red);
///
/// // Draw it
/// window.Draw(text);
/// window.draw(text);
/// \endcode
///
/// Note that you don't need to load a font to draw text,

View file

@ -93,7 +93,7 @@ public :
/// \return True if creation was successful
///
////////////////////////////////////////////////////////////
bool Create(unsigned int width, unsigned int height);
bool create(unsigned int width, unsigned int height);
////////////////////////////////////////////////////////////
/// \brief Load the texture from a file on disk
@ -101,8 +101,8 @@ public :
/// This function is a shortcut for the following code:
/// \code
/// sf::Image image;
/// image.LoadFromFile(filename);
/// texture.LoadFromImage(image, area);
/// image.loadFromFile(filename);
/// texture.loadFromImage(image, area);
/// \endcode
///
/// The \a area argument can be used to load only a sub-rectangle
@ -112,7 +112,7 @@ public :
/// is adjusted to fit the image size.
///
/// The maximum size for a texture depends on the graphics
/// driver and can be retrieved with the GetMaximumSize function.
/// driver and can be retrieved with the getMaximumSize function.
///
/// If this function fails, the texture is left unchanged.
///
@ -121,10 +121,10 @@ public :
///
/// \return True if loading was successful
///
/// \see LoadFromMemory, LoadFromStream, LoadFromImage
/// \see loadFromMemory, loadFromStream, loadFromImage
///
////////////////////////////////////////////////////////////
bool LoadFromFile(const std::string& filename, const IntRect& area = IntRect());
bool loadFromFile(const std::string& filename, const IntRect& area = IntRect());
////////////////////////////////////////////////////////////
/// \brief Load the texture from a file in memory
@ -132,8 +132,8 @@ public :
/// This function is a shortcut for the following code:
/// \code
/// sf::Image image;
/// image.LoadFromMemory(data, size);
/// texture.LoadFromImage(image, area);
/// image.loadFromMemory(data, size);
/// texture.loadFromImage(image, area);
/// \endcode
///
/// The \a area argument can be used to load only a sub-rectangle
@ -143,7 +143,7 @@ public :
/// is adjusted to fit the image size.
///
/// The maximum size for a texture depends on the graphics
/// driver and can be retrieved with the GetMaximumSize function.
/// driver and can be retrieved with the getMaximumSize function.
///
/// If this function fails, the texture is left unchanged.
///
@ -153,10 +153,10 @@ public :
///
/// \return True if loading was successful
///
/// \see LoadFromFile, LoadFromStream, LoadFromImage
/// \see loadFromFile, loadFromStream, loadFromImage
///
////////////////////////////////////////////////////////////
bool LoadFromMemory(const void* data, std::size_t size, const IntRect& area = IntRect());
bool loadFromMemory(const void* data, std::size_t size, const IntRect& area = IntRect());
////////////////////////////////////////////////////////////
/// \brief Load the texture from a file in memory
@ -164,8 +164,8 @@ public :
/// This function is a shortcut for the following code:
/// \code
/// sf::Image image;
/// image.LoadFromStream(stream);
/// texture.LoadFromImage(image, area);
/// image.loadFromStream(stream);
/// texture.loadFromImage(image, area);
/// \endcode
///
/// The \a area argument can be used to load only a sub-rectangle
@ -175,7 +175,7 @@ public :
/// is adjusted to fit the image size.
///
/// The maximum size for a texture depends on the graphics
/// driver and can be retrieved with the GetMaximumSize function.
/// driver and can be retrieved with the getMaximumSize function.
///
/// If this function fails, the texture is left unchanged.
///
@ -184,10 +184,10 @@ public :
///
/// \return True if loading was successful
///
/// \see LoadFromFile, LoadFromMemory, LoadFromImage
/// \see loadFromFile, loadFromMemory, loadFromImage
///
////////////////////////////////////////////////////////////
bool LoadFromStream(sf::InputStream& stream, const IntRect& area = IntRect());
bool loadFromStream(sf::InputStream& stream, const IntRect& area = IntRect());
////////////////////////////////////////////////////////////
/// \brief Load the texture from an image
@ -199,7 +199,7 @@ public :
/// is adjusted to fit the image size.
///
/// The maximum size for a texture depends on the graphics
/// driver and can be retrieved with the GetMaximumSize function.
/// driver and can be retrieved with the getMaximumSize function.
///
/// If this function fails, the texture is left unchanged.
///
@ -208,30 +208,30 @@ public :
///
/// \return True if loading was successful
///
/// \see LoadFromFile, LoadFromMemory
/// \see loadFromFile, loadFromMemory
///
////////////////////////////////////////////////////////////
bool LoadFromImage(const Image& image, const IntRect& area = IntRect());
bool loadFromImage(const Image& image, const IntRect& area = IntRect());
////////////////////////////////////////////////////////////
/// \brief Return the width of the texture
///
/// \return Width in pixels
///
/// \see GetHeight
/// \see getHeight
///
////////////////////////////////////////////////////////////
unsigned int GetWidth() const;
unsigned int getWidth() const;
////////////////////////////////////////////////////////////
/// \brief Return the height of the texture
///
/// \return Height in pixels
///
/// \see GetWidth
/// \see getWidth
///
////////////////////////////////////////////////////////////
unsigned int GetHeight() const;
unsigned int getHeight() const;
////////////////////////////////////////////////////////////
/// \brief Copy the texture pixels to an image
@ -243,10 +243,10 @@ public :
///
/// \return Image containing the texture's pixels
///
/// \see LoadFromImage
/// \see loadFromImage
///
////////////////////////////////////////////////////////////
Image CopyToImage() const;
Image copyToImage() const;
////////////////////////////////////////////////////////////
/// \brief Update the whole texture from an array of pixels
@ -264,7 +264,7 @@ public :
/// \param pixels Array of pixels to copy to the texture
///
////////////////////////////////////////////////////////////
void Update(const Uint8* pixels);
void update(const Uint8* pixels);
////////////////////////////////////////////////////////////
/// \brief Update a part of the texture from an array of pixels
@ -286,7 +286,7 @@ public :
/// \param y Y offset in the texture where to copy the source pixels
///
////////////////////////////////////////////////////////////
void Update(const Uint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y);
void update(const Uint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y);
////////////////////////////////////////////////////////////
/// \brief Update the texture from an image
@ -306,7 +306,7 @@ public :
/// \param image Image to copy to the texture
///
////////////////////////////////////////////////////////////
void Update(const Image& image);
void update(const Image& image);
////////////////////////////////////////////////////////////
/// \brief Update a part of the texture from an image
@ -323,7 +323,7 @@ public :
/// \param y Y offset in the texture where to copy the source image
///
////////////////////////////////////////////////////////////
void Update(const Image& image, unsigned int x, unsigned int y);
void update(const Image& image, unsigned int x, unsigned int y);
////////////////////////////////////////////////////////////
/// \brief Update the texture from the contents of a window
@ -343,7 +343,7 @@ public :
/// \param window Window to copy to the texture
///
////////////////////////////////////////////////////////////
void Update(const Window& window);
void update(const Window& window);
////////////////////////////////////////////////////////////
/// \brief Update a part of the texture from the contents of a window
@ -360,7 +360,7 @@ public :
/// \param y Y offset in the texture where to copy the source window
///
////////////////////////////////////////////////////////////
void Update(const Window& window, unsigned int x, unsigned int y);
void update(const Window& window, unsigned int x, unsigned int y);
////////////////////////////////////////////////////////////
/// \brief Activate the texture for rendering
@ -382,7 +382,7 @@ public :
/// \param coordinateType Type of texture coordinates to use
///
////////////////////////////////////////////////////////////
void Bind(CoordinateType coordinateType = Normalized) const;
void bind(CoordinateType coordinateType = Normalized) const;
////////////////////////////////////////////////////////////
/// \brief Enable or disable the smooth filter
@ -395,20 +395,20 @@ public :
///
/// \param smooth True to enable smoothing, false to disable it
///
/// \see IsSmooth
/// \see isSmooth
///
////////////////////////////////////////////////////////////
void SetSmooth(bool smooth);
void setSmooth(bool smooth);
////////////////////////////////////////////////////////////
/// \brief Tell whether the smooth filter is enabled or not
///
/// \return True if smoothing is enabled, false if it is disabled
///
/// \see SetSmooth
/// \see setSmooth
///
////////////////////////////////////////////////////////////
bool IsSmooth() const;
bool isSmooth() const;
////////////////////////////////////////////////////////////
/// \brief Enable or disable repeating
@ -429,20 +429,20 @@ public :
///
/// \param repeated True to repeat the texture, false to disable repeating
///
/// \see IsRepeated
/// \see isRepeated
///
////////////////////////////////////////////////////////////
void SetRepeated(bool repeated);
void setRepeated(bool repeated);
////////////////////////////////////////////////////////////
/// \brief Tell whether the texture is repeated or not
///
/// \return True if repeat mode is enabled, false if it is disabled
///
/// \see SetRepeated
/// \see setRepeated
///
////////////////////////////////////////////////////////////
bool IsRepeated() const;
bool isRepeated() const;
////////////////////////////////////////////////////////////
/// \brief Overload of assignment operator
@ -464,7 +464,7 @@ public :
/// \return Maximum size allowed for textures, in pixels
///
////////////////////////////////////////////////////////////
static unsigned int GetMaximumSize();
static unsigned int getMaximumSize();
private :
@ -484,7 +484,7 @@ private :
/// \return Valid nearest size (greater than or equal to specified size)
///
////////////////////////////////////////////////////////////
static unsigned int GetValidSize(unsigned int size);
static unsigned int getValidSize(unsigned int size);
////////////////////////////////////////////////////////////
// Member data
@ -518,7 +518,7 @@ private :
/// Being stored in the graphics card memory has some drawbacks.
/// A texture cannot be manipulated as freely as a sf::Image,
/// you need to prepare the pixels first and then upload them
/// to the texture in a single operation (see Texture::Update).
/// to the texture in a single operation (see Texture::update).
///
/// sf::Texture makes it easy to convert from/to sf::Image, but
/// keep in mind that these calls require transfers between
@ -531,7 +531,7 @@ private :
/// However, if you want to perform some modifications on the pixels
/// before creating the final texture, you can load your file to a
/// sf::Image, do whatever you need with the pixels, and then call
/// Texture::LoadFromImage.
/// Texture::loadFromImage.
///
/// Since they live in the graphics card memory, the pixels of a texture
/// cannot be accessed without a slow copy first. And they cannot be
@ -552,15 +552,15 @@ private :
///
/// // Load a texture from a file
/// sf::Texture texture;
/// if (!texture.LoadFromFile("texture.png"))
/// if (!texture.loadFromFile("texture.png"))
/// return -1;
///
/// // Assign it to a sprite
/// sf::Sprite sprite;
/// sprite.SetTexture(texture);
/// sprite.setTexture(texture);
///
/// // Draw the textured sprite
/// window.Draw(sprite);
/// window.draw(sprite);
/// \endcode
///
/// \code
@ -569,7 +569,7 @@ private :
///
/// // Create an empty texture
/// sf::Texture texture;
/// if (!texture.Create(640, 480))
/// if (!texture.create(640, 480))
/// return -1;
///
/// // Create a sprite that will display the texture
@ -581,10 +581,10 @@ private :
///
/// // update the texture
/// sf::Uint8* pixels = ...; // get a fresh chunk of pixels (the next frame of a movie, for example)
/// texture.Update(pixels);
/// texture.update(pixels);
///
/// // draw it
/// window.Draw(sprite);
/// window.draw(sprite);
///
/// ...
/// }

View file

@ -78,13 +78,13 @@ public :
///
/// \code
/// sf::Transform transform = ...;
/// glLoadMatrixf(transform.GetMatrix());
/// glLoadMatrixf(transform.getMatrix());
/// \endcode
///
/// \return Pointer to a 4x4 matrix
///
////////////////////////////////////////////////////////////
const float* GetMatrix() const;
const float* getMatrix() const;
////////////////////////////////////////////////////////////
/// \brief Return the inverse of the transform
@ -95,7 +95,7 @@ public :
/// \return A new transform which is the inverse of self
///
////////////////////////////////////////////////////////////
Transform GetInverse() const;
Transform getInverse() const;
////////////////////////////////////////////////////////////
/// \brief Transform a 2D point
@ -106,7 +106,7 @@ public :
/// \return Transformed point
///
////////////////////////////////////////////////////////////
Vector2f TransformPoint(float x, float y) const;
Vector2f transformPoint(float x, float y) const;
////////////////////////////////////////////////////////////
/// \brief Transform a 2D point
@ -116,7 +116,7 @@ public :
/// \return Transformed point
///
////////////////////////////////////////////////////////////
Vector2f TransformPoint(const Vector2f& point) const;
Vector2f transformPoint(const Vector2f& point) const;
////////////////////////////////////////////////////////////
/// \brief Transform a rectangle
@ -132,7 +132,7 @@ public :
/// \return Transformed rectangle
///
////////////////////////////////////////////////////////////
FloatRect TransformRect(const FloatRect& rectangle) const;
FloatRect transformRect(const FloatRect& rectangle) const;
////////////////////////////////////////////////////////////
/// \brief Combine the current transform with another one
@ -146,7 +146,7 @@ public :
/// \return Reference to *this
///
////////////////////////////////////////////////////////////
Transform& Combine(const Transform& transform);
Transform& combine(const Transform& transform);
////////////////////////////////////////////////////////////
/// \brief Combine the current transform with a translation
@ -155,7 +155,7 @@ public :
/// can be chained.
/// \code
/// sf::Transform transform;
/// transform.Translate(100, 200).Rotate(45);
/// transform.translate(100, 200).rotate(45);
/// \endcode
///
/// \param x Offset to apply on X axis
@ -163,10 +163,10 @@ public :
///
/// \return Reference to *this
///
/// \see Rotate, Scale
/// \see rotate, scale
///
////////////////////////////////////////////////////////////
Transform& Translate(float x, float y);
Transform& translate(float x, float y);
////////////////////////////////////////////////////////////
/// \brief Combine the current transform with a translation
@ -175,17 +175,17 @@ public :
/// can be chained.
/// \code
/// sf::Transform transform;
/// transform.Translate(sf::Vector2f(100, 200)).Rotate(45);
/// transform.translate(sf::Vector2f(100, 200)).rotate(45);
/// \endcode
///
/// \param offset Translation offset to apply
///
/// \return Reference to *this
///
/// \see Rotate, Scale
/// \see rotate, scale
///
////////////////////////////////////////////////////////////
Transform& Translate(const Vector2f& offset);
Transform& translate(const Vector2f& offset);
////////////////////////////////////////////////////////////
/// \brief Combine the current transform with a rotation
@ -194,17 +194,17 @@ public :
/// can be chained.
/// \code
/// sf::Transform transform;
/// transform.Rotate(90).Translate(50, 20);
/// transform.rotate(90).translate(50, 20);
/// \endcode
///
/// \param angle Rotation angle, in degrees
///
/// \return Reference to *this
///
/// \see Translate, Scale
/// \see translate, scale
///
////////////////////////////////////////////////////////////
Transform& Rotate(float angle);
Transform& rotate(float angle);
////////////////////////////////////////////////////////////
/// \brief Combine the current transform with a rotation
@ -212,13 +212,13 @@ public :
/// The center of rotation is provided for convenience as a second
/// argument, so that you can build rotations around arbitrary points
/// more easily (and efficiently) than the usual
/// Translate(-center).Rotate(angle).Translate(center).
/// translate(-center).rotate(angle).translate(center).
///
/// This function returns a reference to *this, so that calls
/// can be chained.
/// \code
/// sf::Transform transform;
/// transform.Rotate(90, 8, 3).Translate(50, 20);
/// transform.rotate(90, 8, 3).translate(50, 20);
/// \endcode
///
/// \param angle Rotation angle, in degrees
@ -227,10 +227,10 @@ public :
///
/// \return Reference to *this
///
/// \see Translate, Scale
/// \see translate, scale
///
////////////////////////////////////////////////////////////
Transform& Rotate(float angle, float centerX, float centerY);
Transform& rotate(float angle, float centerX, float centerY);
////////////////////////////////////////////////////////////
/// \brief Combine the current transform with a rotation
@ -238,13 +238,13 @@ public :
/// The center of rotation is provided for convenience as a second
/// argument, so that you can build rotations around arbitrary points
/// more easily (and efficiently) than the usual
/// Translate(-center).Rotate(angle).Translate(center).
/// translate(-center).rotate(angle).translate(center).
///
/// This function returns a reference to *this, so that calls
/// can be chained.
/// \code
/// sf::Transform transform;
/// transform.Rotate(90, sf::Vector2f(8, 3)).Translate(sf::Vector2f(50, 20));
/// transform.rotate(90, sf::Vector2f(8, 3)).translate(sf::Vector2f(50, 20));
/// \endcode
///
/// \param angle Rotation angle, in degrees
@ -252,10 +252,10 @@ public :
///
/// \return Reference to *this
///
/// \see Translate, Scale
/// \see translate, scale
///
////////////////////////////////////////////////////////////
Transform& Rotate(float angle, const Vector2f& center);
Transform& rotate(float angle, const Vector2f& center);
////////////////////////////////////////////////////////////
/// \brief Combine the current transform with a scaling
@ -264,7 +264,7 @@ public :
/// can be chained.
/// \code
/// sf::Transform transform;
/// transform.Scale(2, 1).Rotate(45);
/// transform.scale(2, 1).rotate(45);
/// \endcode
///
/// \param scaleX Scaling factor on the X axis
@ -272,10 +272,10 @@ public :
///
/// \return Reference to *this
///
/// \see Translate, Rotate
/// \see translate, rotate
///
////////////////////////////////////////////////////////////
Transform& Scale(float scaleX, float scaleY);
Transform& scale(float scaleX, float scaleY);
////////////////////////////////////////////////////////////
/// \brief Combine the current transform with a scaling
@ -283,13 +283,13 @@ public :
/// The center of scaling is provided for convenience as a second
/// argument, so that you can build scaling around arbitrary points
/// more easily (and efficiently) than the usual
/// Translate(-center).Scale(factors).Translate(center).
/// translate(-center).scale(factors).translate(center).
///
/// This function returns a reference to *this, so that calls
/// can be chained.
/// \code
/// sf::Transform transform;
/// transform.Scale(2, 1, 8, 3).Rotate(45);
/// transform.scale(2, 1, 8, 3).rotate(45);
/// \endcode
///
/// \param scaleX Scaling factor on X axis
@ -299,10 +299,10 @@ public :
///
/// \return Reference to *this
///
/// \see Translate, Rotate
/// \see translate, rotate
///
////////////////////////////////////////////////////////////
Transform& Scale(float scaleX, float scaleY, float centerX, float centerY);
Transform& scale(float scaleX, float scaleY, float centerX, float centerY);
////////////////////////////////////////////////////////////
/// \brief Combine the current transform with a scaling
@ -311,17 +311,17 @@ public :
/// can be chained.
/// \code
/// sf::Transform transform;
/// transform.Scale(sf::Vector2f(2, 1)).Rotate(45);
/// transform.scale(sf::Vector2f(2, 1)).rotate(45);
/// \endcode
///
/// \param factors Scaling factors
///
/// \return Reference to *this
///
/// \see Translate, Rotate
/// \see translate, rotate
///
////////////////////////////////////////////////////////////
Transform& Scale(const Vector2f& factors);
Transform& scale(const Vector2f& factors);
////////////////////////////////////////////////////////////
/// \brief Combine the current transform with a scaling
@ -329,13 +329,13 @@ public :
/// The center of scaling is provided for convenience as a second
/// argument, so that you can build scaling around arbitrary points
/// more easily (and efficiently) than the usual
/// Translate(-center).Scale(factors).Translate(center).
/// translate(-center).scale(factors).translate(center).
///
/// This function returns a reference to *this, so that calls
/// can be chained.
/// \code
/// sf::Transform transform;
/// transform.Scale(sf::Vector2f(2, 1), sf::Vector2f(8, 3)).Rotate(45);
/// transform.scale(sf::Vector2f(2, 1), sf::Vector2f(8, 3)).rotate(45);
/// \endcode
///
/// \param factors Scaling factors
@ -343,10 +343,10 @@ public :
///
/// \return Reference to *this
///
/// \see Translate, Rotate
/// \see translate, rotate
///
////////////////////////////////////////////////////////////
Transform& Scale(const Vector2f& factors, const Vector2f& center);
Transform& scale(const Vector2f& factors, const Vector2f& center);
////////////////////////////////////////////////////////////
// Static member data
@ -365,7 +365,7 @@ private:
/// \relates sf::Transform
/// \brief Overload of binary operator * to combine two transforms
///
/// This call is equivalent to calling Transform(left).Combine(right).
/// This call is equivalent to calling Transform(left).combine(right).
///
/// \param left Left operand (the first transform)
/// \param right Right operand (the second transform)
@ -379,7 +379,7 @@ SFML_GRAPHICS_API Transform operator *(const Transform& left, const Transform& r
/// \relates sf::Transform
/// \brief Overload of binary operator *= to combine two transforms
///
/// This call is equivalent to calling left.Combine(right).
/// This call is equivalent to calling left.combine(right).
///
/// \param left Left operand (the first transform)
/// \param right Right operand (the second transform)
@ -393,7 +393,7 @@ SFML_GRAPHICS_API Transform& operator *=(Transform& left, const Transform& right
/// \relates sf::Transform
/// \brief Overload of binary operator * to transform a point
///
/// This call is equivalent to calling left.TransformPoint(right).
/// This call is equivalent to calling left.transformPoint(right).
///
/// \param left Left operand (the transform)
/// \param right Right operand (the point to transform)
@ -431,18 +431,18 @@ SFML_GRAPHICS_API Vector2f operator *(const Transform& left, const Vector2f& rig
/// \code
/// // define a translation transform
/// sf::Transform translation;
/// translation.Translate(20, 50);
/// translation.translate(20, 50);
///
/// // define a rotation transform
/// sf::Transform rotation;
/// rotation.Rotate(45);
/// rotation.rotate(45);
///
/// // combine them
/// sf::Transform transform = translation * rotation;
///
/// // use the result to transform stuff...
/// sf::Vector2f point = transform.TransformPoint(10, 20);
/// sf::FloatRect rect = transform.TransformRect(sf::FloatRect(0, 0, 10, 100));
/// sf::Vector2f point = transform.transformPoint(10, 20);
/// sf::FloatRect rect = transform.transformRect(sf::FloatRect(0, 0, 10, 100));
/// \endcode
///
/// \see sf::Transformable, sf::RenderStates

View file

@ -55,7 +55,7 @@ public :
virtual ~Transformable();
////////////////////////////////////////////////////////////
/// \brief Set the position of the object
/// \brief set the position of the object
///
/// This function completely overwrites the previous position.
/// See Move to apply an offset based on the previous position instead.
@ -64,13 +64,13 @@ public :
/// \param x X coordinate of the new position
/// \param y Y coordinate of the new position
///
/// \see Move, GetPosition
/// \see move, getPosition
///
////////////////////////////////////////////////////////////
void SetPosition(float x, float y);
void setPosition(float x, float y);
////////////////////////////////////////////////////////////
/// \brief Set the position of the object
/// \brief set the position of the object
///
/// This function completely overwrites the previous position.
/// See Move to apply an offset based on the previous position instead.
@ -78,13 +78,13 @@ public :
///
/// \param position New position
///
/// \see Move, GetPosition
/// \see move, getPosition
///
////////////////////////////////////////////////////////////
void SetPosition(const Vector2f& position);
void setPosition(const Vector2f& position);
////////////////////////////////////////////////////////////
/// \brief Set the orientation of the object
/// \brief set the orientation of the object
///
/// This function completely overwrites the previous rotation.
/// See Rotate to add an angle based on the previous rotation instead.
@ -92,13 +92,13 @@ public :
///
/// \param angle New rotation, in degrees
///
/// \see Rotate, GetRotation
/// \see rotate, getRotation
///
////////////////////////////////////////////////////////////
void SetRotation(float angle);
void setRotation(float angle);
////////////////////////////////////////////////////////////
/// \brief Set the scale factors of the object
/// \brief set the scale factors of the object
///
/// This function completely overwrites the previous scale.
/// See Scale to add a factor based on the previous scale instead.
@ -107,13 +107,13 @@ public :
/// \param factorX New horizontal scale factor
/// \param factorY New vertical scale factor
///
/// \see Scale, GetScale
/// \see scale, getScale
///
////////////////////////////////////////////////////////////
void SetScale(float factorX, float factorY);
void setScale(float factorX, float factorY);
////////////////////////////////////////////////////////////
/// \brief Set the scale factors of the object
/// \brief set the scale factors of the object
///
/// This function completely overwrites the previous scale.
/// See Scale to add a factor based on the previous scale instead.
@ -121,13 +121,13 @@ public :
///
/// \param factors New scale factors
///
/// \see Scale, GetScale
/// \see scale, getScale
///
////////////////////////////////////////////////////////////
void SetScale(const Vector2f& factors);
void setScale(const Vector2f& factors);
////////////////////////////////////////////////////////////
/// \brief Set the local origin of the object
/// \brief set the local origin of the object
///
/// The origin of an object defines the center point for
/// all transformations (position, scale, rotation).
@ -139,13 +139,13 @@ public :
/// \param x X coordinate of the new origin
/// \param y Y coordinate of the new origin
///
/// \see GetOrigin
/// \see getOrigin
///
////////////////////////////////////////////////////////////
void SetOrigin(float x, float y);
void setOrigin(float x, float y);
////////////////////////////////////////////////////////////
/// \brief Set the local origin of the object
/// \brief set the local origin of the object
///
/// The origin of an object defines the center point for
/// all transformations (position, scale, rotation).
@ -156,160 +156,160 @@ public :
///
/// \param origin New origin
///
/// \see GetOrigin
/// \see getOrigin
///
////////////////////////////////////////////////////////////
void SetOrigin(const Vector2f& origin);
void setOrigin(const Vector2f& origin);
////////////////////////////////////////////////////////////
/// \brief Get the position of the object
/// \brief get the position of the object
///
/// \return Current position
///
/// \see SetPosition
/// \see setPosition
///
////////////////////////////////////////////////////////////
const Vector2f& GetPosition() const;
const Vector2f& getPosition() const;
////////////////////////////////////////////////////////////
/// \brief Get the orientation of the object
/// \brief get the orientation of the object
///
/// The rotation is always in the range [0, 360].
///
/// \return Current rotation, in degrees
///
/// \see SetRotation
/// \see setRotation
///
////////////////////////////////////////////////////////////
float GetRotation() const;
float getRotation() const;
////////////////////////////////////////////////////////////
/// \brief Get the current scale of the object
/// \brief get the current scale of the object
///
/// \return Current scale factors
///
/// \see SetScale
/// \see setScale
///
////////////////////////////////////////////////////////////
const Vector2f& GetScale() const;
const Vector2f& getScale() const;
////////////////////////////////////////////////////////////
/// \brief Get the local origin of the object
/// \brief get the local origin of the object
///
/// \return Current origin
///
/// \see SetOrigin
/// \see setOrigin
///
////////////////////////////////////////////////////////////
const Vector2f& GetOrigin() const;
const Vector2f& getOrigin() const;
////////////////////////////////////////////////////////////
/// \brief Move the object by a given offset
///
/// This function adds to the current position of the object,
/// unlike SetPosition which overwrites it.
/// unlike setPosition which overwrites it.
/// Thus, it is equivalent to the following code:
/// \code
/// sf::Vector2f pos = object.GetPosition();
/// object.SetPosition(pos.x + offsetX, pos.y + offsetY);
/// sf::Vector2f pos = object.getPosition();
/// object.setPosition(pos.x + offsetX, pos.y + offsetY);
/// \endcode
///
/// \param offsetX X offset
/// \param offsetY Y offset
///
/// \see SetPosition
/// \see setPosition
///
////////////////////////////////////////////////////////////
void Move(float offsetX, float offsetY);
void move(float offsetX, float offsetY);
////////////////////////////////////////////////////////////
/// \brief Move the object by a given offset
///
/// This function adds to the current position of the object,
/// unlike SetPosition which overwrites it.
/// unlike setPosition which overwrites it.
/// Thus, it is equivalent to the following code:
/// \code
/// object.SetPosition(object.GetPosition() + offset);
/// object.setPosition(object.getPosition() + offset);
/// \endcode
///
/// \param offset Offset
///
/// \see SetPosition
/// \see setPosition
///
////////////////////////////////////////////////////////////
void Move(const Vector2f& offset);
void move(const Vector2f& offset);
////////////////////////////////////////////////////////////
/// \brief Rotate the object
///
/// This function adds to the current rotation of the object,
/// unlike SetRotation which overwrites it.
/// unlike setRotation which overwrites it.
/// Thus, it is equivalent to the following code:
/// \code
/// object.SetRotation(object.GetRotation() + angle);
/// object.setRotation(object.getRotation() + angle);
/// \endcode
///
/// \param angle Angle of rotation, in degrees
///
////////////////////////////////////////////////////////////
void Rotate(float angle);
void rotate(float angle);
////////////////////////////////////////////////////////////
/// \brief Scale the object
///
/// This function multiplies the current scale of the object,
/// unlike SetScale which overwrites it.
/// unlike setScale which overwrites it.
/// Thus, it is equivalent to the following code:
/// \code
/// sf::Vector2f scale = object.GetScale();
/// object.SetScale(scale.x * factorX, scale.y * factorY);
/// sf::Vector2f scale = object.getScale();
/// object.setScale(scale.x * factorX, scale.y * factorY);
/// \endcode
///
/// \param factorX Horizontal scale factor
/// \param factorY Vertical scale factor
///
/// \see SetScale
/// \see setScale
///
////////////////////////////////////////////////////////////
void Scale(float factorX, float factorY);
void scale(float factorX, float factorY);
////////////////////////////////////////////////////////////
/// \brief Scale the object
///
/// This function multiplies the current scale of the object,
/// unlike SetScale which overwrites it.
/// unlike setScale which overwrites it.
/// Thus, it is equivalent to the following code:
/// \code
/// sf::Vector2f scale = object.GetScale();
/// object.SetScale(scale.x * factor.x, scale.y * factor.y);
/// sf::Vector2f scale = object.getScale();
/// object.setScale(scale.x * factor.x, scale.y * factor.y);
/// \endcode
///
/// \param factor Scale factors
///
/// \see SetScale
/// \see setScale
///
////////////////////////////////////////////////////////////
void Scale(const Vector2f& factor);
void scale(const Vector2f& factor);
////////////////////////////////////////////////////////////
/// \brief Get the combined transform of the object
/// \brief get the combined transform of the object
///
/// \return Transform combining the position/rotation/scale/origin of the object
///
/// \see GetInverseTransform
/// \see getInverseTransform
///
////////////////////////////////////////////////////////////
const Transform& GetTransform() const;
const Transform& getTransform() const;
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of the object
/// \brief get the inverse of the combined transform of the object
///
/// \return Inverse of the combined transformations applied to the object
///
/// \see GetTransform
/// \see getTransform
///
////////////////////////////////////////////////////////////
const Transform& GetInverseTransform() const;
const Transform& getInverseTransform() const;
private :
@ -377,17 +377,17 @@ private :
/// \code
/// class MyEntity : public sf::Transformable, public sf::Drawable
/// {
/// virtual void Draw(sf::RenderTarget& target, sf::RenderStates states) const
/// virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const
/// {
/// states.Transform *= GetTransform();
/// target.Draw(..., states);
/// states.transform *= getTransform();
/// target.draw(..., states);
/// }
/// };
///
/// MyEntity entity;
/// entity.SetPosition(10, 20);
/// entity.SetRotation(45);
/// window.Draw(entity);
/// entity.setPosition(10, 20);
/// entity.setRotation(45);
/// window.draw(entity);
/// \endcode
///
/// It can also be used as a member, if you don't want to use
@ -397,18 +397,18 @@ private :
/// class MyEntity
/// {
/// public :
/// void setPosition(const MyVector& v)
/// void SetPosition(const MyVector& v)
/// {
/// m_transform.SetPosition(v.x(), v.y());
/// myTransform.setPosition(v.x(), v.y());
/// }
///
/// void draw(sf::RenderTarget& target) const
/// void Draw(sf::RenderTarget& target) const
/// {
/// target.Draw(..., m_transform.GetTransform());
/// target.draw(..., myTransform.getTransform());
/// }
///
/// private :
/// sf::Transformable m_transform;
/// sf::Transformable myTransform;
/// };
/// \endcode
///

View file

@ -68,7 +68,7 @@ public :
/// \param color Vertex color
///
////////////////////////////////////////////////////////////
Vertex(const Vector2f& position, const sf::Color& color);
Vertex(const Vector2f& position, const Color& color);
////////////////////////////////////////////////////////////
/// \brief Construct the vertex from its position and texture coordinates
@ -89,14 +89,14 @@ public :
/// \param texCoords Vertex texture coordinates
///
////////////////////////////////////////////////////////////
Vertex(const Vector2f& position, const sf::Color& color, const Vector2f& texCoords);
Vertex(const Vector2f& position, const Color& color, const Vector2f& texCoords);
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Vector2f Position; ///< 2D position of the vertex
sf::Color Color; ///< Color of the vertex
Vector2f TexCoords; ///< Coordinates of the texture's pixel to map to the vertex
Vector2f position; ///< 2D position of the vertex
Color color; ///< Color of the vertex
Vector2f texCoords; ///< Coordinates of the texture's pixel to map to the vertex
};
} // namespace sf
@ -136,7 +136,7 @@ public :
/// };
///
/// // draw it
/// window.Draw(vertices, 4, sf::Quads);
/// window.draw(vertices, 4, sf::Quads);
/// \endcode
///
/// Note: although texture coordinates are supposed to be an integer

View file

@ -69,7 +69,7 @@ public :
/// \return Number of vertices in the array
///
////////////////////////////////////////////////////////////
unsigned int GetVertexCount() const;
unsigned int getVertexCount() const;
////////////////////////////////////////////////////////////
/// \brief Get a read-write access to a vertex by its index
@ -82,7 +82,7 @@ public :
///
/// \return Reference to the index-th vertex
///
/// \see GetVertexCount
/// \see getVertexCount
///
////////////////////////////////////////////////////////////
Vertex& operator [](unsigned int index);
@ -98,7 +98,7 @@ public :
///
/// \return Const reference to the index-th vertex
///
/// \see GetVertexCount
/// \see getVertexCount
///
////////////////////////////////////////////////////////////
const Vertex& operator [](unsigned int index) const;
@ -112,7 +112,7 @@ public :
/// reallocating all the memory.
///
////////////////////////////////////////////////////////////
void Clear();
void clear();
////////////////////////////////////////////////////////////
/// \brief Resize the vertex array
@ -126,7 +126,7 @@ public :
/// \param vertexCount New size of the array (number of vertices)
///
////////////////////////////////////////////////////////////
void Resize(unsigned int vertexCount);
void resize(unsigned int vertexCount);
////////////////////////////////////////////////////////////
/// \brief Add a vertex to the array
@ -134,7 +134,7 @@ public :
/// \param vertex Vertex to add
///
////////////////////////////////////////////////////////////
void Append(const Vertex& vertex);
void append(const Vertex& vertex);
////////////////////////////////////////////////////////////
/// \brief Set the type of primitives to draw
@ -150,7 +150,7 @@ public :
/// \param type Type of primitive
///
////////////////////////////////////////////////////////////
void SetPrimitiveType(PrimitiveType type);
void setPrimitiveType(PrimitiveType type);
////////////////////////////////////////////////////////////
/// \brief Get the type of primitives drawn by the vertex array
@ -158,7 +158,7 @@ public :
/// \return Primitive type
///
////////////////////////////////////////////////////////////
PrimitiveType GetPrimitiveType() const;
PrimitiveType getPrimitiveType() const;
////////////////////////////////////////////////////////////
/// \brief Compute the bounding rectangle of the vertex array
@ -169,7 +169,7 @@ public :
/// \return Bounding rectangle of the vertex array
///
////////////////////////////////////////////////////////////
FloatRect GetBounds() const;
FloatRect getBounds() const;
private :
@ -180,7 +180,7 @@ private :
/// \param states Current render states
///
////////////////////////////////////////////////////////////
virtual void Draw(RenderTarget& target, RenderStates states) const;
virtual void draw(RenderTarget& target, RenderStates states) const;
private:
@ -210,12 +210,12 @@ private:
/// Example:
/// \code
/// sf::VertexArray lines(sf::LinesStrip, 4);
/// lines[0].Position = sf::Vector2f(10, 0);
/// lines[1].Position = sf::Vector2f(20, 0);
/// lines[2].Position = sf::Vector2f(30, 5);
/// lines[3].Position = sf::Vector2f(40, 2);
/// lines[0].position = sf::Vector2f(10, 0);
/// lines[1].position = sf::Vector2f(20, 0);
/// lines[2].position = sf::Vector2f(30, 5);
/// lines[3].position = sf::Vector2f(40, 2);
///
/// window.Draw(lines);
/// window.draw(lines);
/// \endcode
///
/// \see sf::Vertex

View file

@ -75,20 +75,20 @@ public :
/// \param x X coordinate of the new center
/// \param y Y coordinate of the new center
///
/// \see SetSize, GetCenter
/// \see setSize, getCenter
///
////////////////////////////////////////////////////////////
void SetCenter(float x, float y);
void setCenter(float x, float y);
////////////////////////////////////////////////////////////
/// \brief Set the center of the view
///
/// \param center New center
///
/// \see SetSize, GetCenter
/// \see setSize, getCenter
///
////////////////////////////////////////////////////////////
void SetCenter(const Vector2f& center);
void setCenter(const Vector2f& center);
////////////////////////////////////////////////////////////
/// \brief Set the size of the view
@ -96,20 +96,20 @@ public :
/// \param width New width of the view
/// \param height New height of the view
///
/// \see SetCenter, GetCenter
/// \see setCenter, getCenter
///
////////////////////////////////////////////////////////////
void SetSize(float width, float height);
void setSize(float width, float height);
////////////////////////////////////////////////////////////
/// \brief Set the size of the view
///
/// \param size New size
///
/// \see SetCenter, GetCenter
/// \see setCenter, getCenter
///
////////////////////////////////////////////////////////////
void SetSize(const Vector2f& size);
void setSize(const Vector2f& size);
////////////////////////////////////////////////////////////
/// \brief Set the orientation of the view
@ -118,10 +118,10 @@ public :
///
/// \param angle New angle, in degrees
///
/// \see GetRotation
/// \see getRotation
///
////////////////////////////////////////////////////////////
void SetRotation(float angle);
void setRotation(float angle);
////////////////////////////////////////////////////////////
/// \brief Set the target viewport
@ -130,15 +130,15 @@ public :
/// view are displayed, expressed as a factor (between 0 and 1)
/// of the size of the RenderTarget to which the view is applied.
/// 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)).
/// be defined with View.setViewport(sf::FloatRect(0, 0, 0.5, 1)).
/// By default, a view has a viewport which covers the entire target.
///
/// \param viewport New viewport rectangle
///
/// \see GetViewport
/// \see getViewport
///
////////////////////////////////////////////////////////////
void SetViewport(const FloatRect& viewport);
void setViewport(const FloatRect& viewport);
////////////////////////////////////////////////////////////
/// \brief Reset the view to the given rectangle
@ -147,50 +147,50 @@ public :
///
/// \param rectangle Rectangle defining the zone to display
///
/// \see SetCenter, SetSize, SetRotation
/// \see setCenter, setSize, setRotation
///
////////////////////////////////////////////////////////////
void Reset(const FloatRect& rectangle);
void reset(const FloatRect& rectangle);
////////////////////////////////////////////////////////////
/// \brief Get the center of the view
///
/// \return Center of the view
///
/// \see GetSize, SetCenter
/// \see getSize, setCenter
///
////////////////////////////////////////////////////////////
const Vector2f& GetCenter() const;
const Vector2f& getCenter() const;
////////////////////////////////////////////////////////////
/// \brief Get the size of the view
///
/// \return Size of the view
///
/// \see GetCenter, SetSize
/// \see getCenter, setSize
///
////////////////////////////////////////////////////////////
const Vector2f& GetSize() const;
const Vector2f& getSize() const;
////////////////////////////////////////////////////////////
/// \brief Get the current orientation of the view
///
/// \return Rotation angle of the view, in degrees
///
/// \see SetRotation
/// \see setRotation
///
////////////////////////////////////////////////////////////
float GetRotation() const;
float getRotation() const;
////////////////////////////////////////////////////////////
/// \brief Get the target viewport rectangle of the view
///
/// \return Viewport rectangle, expressed as a factor of the target size
///
/// \see SetViewport
/// \see setViewport
///
////////////////////////////////////////////////////////////
const FloatRect& GetViewport() const;
const FloatRect& getViewport() const;
////////////////////////////////////////////////////////////
/// \brief Move the view relatively to its current position
@ -198,30 +198,30 @@ public :
/// \param offsetX X coordinate of the move offset
/// \param offsetY Y coordinate of the move offset
///
/// \see SetCenter, Rotate, Zoom
/// \see setCenter, rotate, zoom
///
////////////////////////////////////////////////////////////
void Move(float offsetX, float offsetY);
void move(float offsetX, float offsetY);
////////////////////////////////////////////////////////////
/// \brief Move the view relatively to its current position
///
/// \param offset Move offset
///
/// \see SetCenter, Rotate, Zoom
/// \see setCenter, rotate, zoom
///
////////////////////////////////////////////////////////////
void Move(const Vector2f& offset);
void move(const Vector2f& offset);
////////////////////////////////////////////////////////////
/// \brief Rotate the view relatively to its current orientation
///
/// \param angle Angle to rotate, in degrees
///
/// \see SetRotation, Move, Zoom
/// \see setRotation, move, zoom
///
////////////////////////////////////////////////////////////
void Rotate(float angle);
void rotate(float angle);
////////////////////////////////////////////////////////////
/// \brief Resize the view rectangle relatively to its current size
@ -235,10 +235,10 @@ public :
///
/// \param factor Zoom factor to apply
///
/// \see SetSize, Move, Rotate
/// \see setSize, move, rotate
///
////////////////////////////////////////////////////////////
void Zoom(float factor);
void zoom(float factor);
////////////////////////////////////////////////////////////
/// \brief Get the projection transform of the view
@ -247,10 +247,10 @@ public :
///
/// \return Projection transform defining the view
///
/// \see GetInverseTransform
/// \see getInverseTransform
///
////////////////////////////////////////////////////////////
const Transform& GetTransform() const;
const Transform& getTransform() const;
////////////////////////////////////////////////////////////
/// \brief Get the inverse projection transform of the view
@ -259,10 +259,10 @@ public :
///
/// \return Inverse of the projection transform defining the view
///
/// \see GetTransform
/// \see getTransform
///
////////////////////////////////////////////////////////////
const Transform& GetInverseTransform() const;
const Transform& getInverseTransform() const;
private :
@ -315,25 +315,25 @@ private :
/// sf::View view;
///
/// // Initialize the view to a rectangle located at (100, 100) and with a size of 400x200
/// view.Reset(sf::FloatRect(100, 100, 400, 200));
/// view.reset(sf::FloatRect(100, 100, 400, 200));
///
/// // Rotate it by 45 degrees
/// view.Rotate(45);
/// view.rotate(45);
///
/// // Set its target viewport to be half of the window
/// view.SetViewport(sf::FloatRect(0.f, 0.f, 0.5f, 1.f));
/// view.setViewport(sf::FloatRect(0.f, 0.f, 0.5f, 1.f));
///
/// // Apply it
/// window.SetView(view);
/// window.setView(view);
///
/// // Render stuff
/// window.Draw(someSprite);
/// window.draw(someSprite);
///
/// // Set the default view back
/// window.SetView(window.GetDefaultView());
/// window.setView(window.getDefaultView());
///
/// // Render stuff not affected by the view
/// window.Draw(someText);
/// window.draw(someText);
/// \endcode
///
/// \see sf::RenderWindow, sf::RenderTexture

View file

@ -154,7 +154,7 @@ public :
/// \return True if the status is a success, false if it is a failure
///
////////////////////////////////////////////////////////////
bool IsOk() const;
bool isOk() const;
////////////////////////////////////////////////////////////
/// \brief Get the status code of the response
@ -162,7 +162,7 @@ public :
/// \return Status code
///
////////////////////////////////////////////////////////////
Status GetStatus() const;
Status getStatus() const;
////////////////////////////////////////////////////////////
/// \brief Get the full message contained in the response
@ -170,7 +170,7 @@ public :
/// \return The response message
///
////////////////////////////////////////////////////////////
const std::string& GetMessage() const;
const std::string& getMessage() const;
private :
@ -203,7 +203,7 @@ public :
/// \return Directory name
///
////////////////////////////////////////////////////////////
const std::string& GetDirectory() const;
const std::string& getDirectory() const;
private :
@ -237,7 +237,7 @@ public :
/// \return Array containing the requested filenames
///
////////////////////////////////////////////////////////////
const std::vector<std::string>& GetFilenames() const;
const std::vector<std::string>& getFilenames() const;
private :
@ -275,20 +275,20 @@ public :
///
/// \return Server response to the request
///
/// \see Disconnect
/// \see disconnect
///
////////////////////////////////////////////////////////////
Response Connect(const IpAddress& server, unsigned short port = 21, Time timeout = Time::Zero);
Response connect(const IpAddress& server, unsigned short port = 21, Time timeout = Time::Zero);
////////////////////////////////////////////////////////////
/// \brief Close the connection with the server
///
/// \return Server response to the request
///
/// \see Connect
/// \see connect
///
////////////////////////////////////////////////////////////
Response Disconnect();
Response disconnect();
////////////////////////////////////////////////////////////
/// \brief Log in using an anonymous account
@ -299,7 +299,7 @@ public :
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
Response Login();
Response login();
////////////////////////////////////////////////////////////
/// \brief Log in using a username and a password
@ -313,7 +313,7 @@ public :
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
Response Login(const std::string& name, const std::string& password);
Response login(const std::string& name, const std::string& password);
////////////////////////////////////////////////////////////
/// \brief Send a null command to keep the connection alive
@ -324,7 +324,7 @@ public :
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
Response KeepAlive();
Response keepAlive();
////////////////////////////////////////////////////////////
/// \brief Get the current working directory
@ -334,10 +334,10 @@ public :
///
/// \return Server response to the request
///
/// \see GetDirectoryListing, ChangeDirectory, ParentDirectory
/// \see getDirectoryListing, changeDirectory, parentDirectory
///
////////////////////////////////////////////////////////////
DirectoryResponse GetWorkingDirectory();
DirectoryResponse getWorkingDirectory();
////////////////////////////////////////////////////////////
/// \brief Get the contents of the given directory
@ -351,10 +351,10 @@ public :
///
/// \return Server response to the request
///
/// \see GetWorkingDirectory, ChangeDirectory, ParentDirectory
/// \see getWorkingDirectory, changeDirectory, parentDirectory
///
////////////////////////////////////////////////////////////
ListingResponse GetDirectoryListing(const std::string& directory = "");
ListingResponse getDirectoryListing(const std::string& directory = "");
////////////////////////////////////////////////////////////
/// \brief Change the current working directory
@ -365,20 +365,20 @@ public :
///
/// \return Server response to the request
///
/// \see GetWorkingDirectory, GetDirectoryListing, ParentDirectory
/// \see getWorkingDirectory, getDirectoryListing, parentDirectory
///
////////////////////////////////////////////////////////////
Response ChangeDirectory(const std::string& directory);
Response changeDirectory(const std::string& directory);
////////////////////////////////////////////////////////////
/// \brief Go to the parent directory of the current one
///
/// \return Server response to the request
///
/// \see GetWorkingDirectory, GetDirectoryListing, ChangeDirectory
/// \see getWorkingDirectory, getDirectoryListing, changeDirectory
///
////////////////////////////////////////////////////////////
Response ParentDirectory();
Response parentDirectory();
////////////////////////////////////////////////////////////
/// \brief Create a new directory
@ -390,10 +390,10 @@ public :
///
/// \return Server response to the request
///
/// \see DeleteDirectory
/// \see deleteDirectory
///
////////////////////////////////////////////////////////////
Response CreateDirectory(const std::string& name);
Response createDirectory(const std::string& name);
////////////////////////////////////////////////////////////
/// \brief Remove an existing directory
@ -407,10 +407,10 @@ public :
///
/// \return Server response to the request
///
/// \see CreateDirectory
/// \see createDirectory
///
////////////////////////////////////////////////////////////
Response DeleteDirectory(const std::string& name);
Response deleteDirectory(const std::string& name);
////////////////////////////////////////////////////////////
/// \brief Rename an existing file
@ -423,10 +423,10 @@ public :
///
/// \return Server response to the request
///
/// \see DeleteFile
/// \see deleteFile
///
////////////////////////////////////////////////////////////
Response RenameFile(const std::string& file, const std::string& newName);
Response renameFile(const std::string& file, const std::string& newName);
////////////////////////////////////////////////////////////
/// \brief Remove an existing file
@ -440,10 +440,10 @@ public :
///
/// \return Server response to the request
///
/// \see RenameFile
/// \see renameFile
///
////////////////////////////////////////////////////////////
Response DeleteFile(const std::string& name);
Response deleteFile(const std::string& name);
////////////////////////////////////////////////////////////
/// \brief Download a file from the server
@ -459,10 +459,10 @@ public :
///
/// \return Server response to the request
///
/// \see Upload
/// \see upload
///
////////////////////////////////////////////////////////////
Response Download(const std::string& remoteFile, const std::string& localPath, TransferMode mode = Binary);
Response download(const std::string& remoteFile, const std::string& localPath, TransferMode mode = Binary);
////////////////////////////////////////////////////////////
/// \brief Upload a file to the server
@ -478,8 +478,10 @@ public :
///
/// \return Server response to the request
///
/// \see download
///
////////////////////////////////////////////////////////////
Response Upload(const std::string& localFile, const std::string& remotePath, TransferMode mode = Binary);
Response upload(const std::string& localFile, const std::string& remotePath, TransferMode mode = Binary);
private :
@ -492,7 +494,7 @@ private :
/// \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 = "");
////////////////////////////////////////////////////////////
/// \brief Receive a response from the server
@ -503,7 +505,7 @@ private :
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
Response GetResponse();
Response getResponse();
////////////////////////////////////////////////////////////
/// \brief Utility class for exchanging datas with the server
@ -543,11 +545,11 @@ private :
///
/// Every command returns a FTP response, which contains the
/// status code as well as a message from the server. Some
/// commands such as GetWorkingDirectory and GetDirectoryListing
/// commands such as getWorkingDirectory and getDirectoryListing
/// return additional data, and use a class derived from
/// sf::Ftp::Response to provide this data.
///
/// All commands, especially Upload and Download, may take some
/// All commands, especially upload and download, may take some
/// time to complete. This is important to know if you don't want
/// to block your application while the server is completing
/// the task.
@ -558,32 +560,32 @@ private :
/// sf::Ftp ftp;
///
/// // Connect to the server
/// sf::Ftp::Response response = ftp.Connect("ftp://ftp.myserver.com");
/// if (response.IsOk())
/// sf::Ftp::Response response = ftp.connect("ftp://ftp.myserver.com");
/// if (response.isOk())
/// std::cout << "Connected" << std::endl;
///
/// // Log in
/// response = ftp.Login("laurent", "dF6Zm89D");
/// if (response.IsOk())
/// response = ftp.login("laurent", "dF6Zm89D");
/// if (response.isOk())
/// std::cout << "Logged in" << std::endl;
///
/// // Print the working directory
/// sf::Ftp::DirectoryResponse directory = ftp.GetWorkingDirectory();
/// if (directory.IsOk())
/// std::cout << "Working directory: " << directory.GetDirectory() << std::endl;
/// sf::Ftp::DirectoryResponse directory = ftp.getWorkingDirectory();
/// if (directory.isOk())
/// std::cout << "Working directory: " << directory.getDirectory() << std::endl;
///
/// // Create a new directory
/// response = ftp.CreateDirectory("files");
/// if (response.IsOk())
/// response = ftp.createDirectory("files");
/// if (response.isOk())
/// std::cout << "Created new directory" << std::endl;
///
/// // Upload a file to this new directory
/// response = ftp.Upload("local-path/file.txt", "files", sf::Ftp::Ascii);
/// if (response.IsOk())
/// response = ftp.upload("local-path/file.txt", "files", sf::Ftp::Ascii);
/// if (response.isOk())
/// std::cout << "File uploaded" << std::endl;
///
/// // Disconnect from the server (optional)
/// ftp.Disconnect();
/// ftp.disconnect();
/// \endcode
///
////////////////////////////////////////////////////////////

View file

@ -92,7 +92,7 @@ public :
/// \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);
////////////////////////////////////////////////////////////
/// \brief Set the request method
@ -104,7 +104,7 @@ public :
/// \param method Method to use for the request
///
////////////////////////////////////////////////////////////
void SetMethod(Method method);
void setMethod(Method method);
////////////////////////////////////////////////////////////
/// \brief Set the requested URI
@ -116,7 +116,7 @@ public :
/// \param uri URI to request, relative to the host
///
////////////////////////////////////////////////////////////
void SetUri(const std::string& uri);
void setUri(const std::string& uri);
////////////////////////////////////////////////////////////
/// \brief Set the HTTP version for the request
@ -127,7 +127,7 @@ public :
/// \param minor Minor HTTP version number
///
////////////////////////////////////////////////////////////
void SetHttpVersion(unsigned int major, unsigned int minor);
void setHttpVersion(unsigned int major, unsigned int minor);
////////////////////////////////////////////////////////////
/// \brief Set the body of the request
@ -139,7 +139,7 @@ public :
/// \param body Content of the body
///
////////////////////////////////////////////////////////////
void SetBody(const std::string& body);
void setBody(const std::string& body);
private :
@ -154,7 +154,7 @@ public :
/// \return String containing the request, ready to be sent
///
////////////////////////////////////////////////////////////
std::string Prepare() const;
std::string prepare() const;
////////////////////////////////////////////////////////////
/// \brief Check if the request defines a field
@ -166,7 +166,7 @@ public :
/// \return True if the field exists, false otherwise
///
////////////////////////////////////////////////////////////
bool HasField(const std::string& field) const;
bool hasField(const std::string& field) const;
////////////////////////////////////////////////////////////
// Types
@ -178,7 +178,7 @@ public :
////////////////////////////////////////////////////////////
FieldTable m_fields; ///< Fields of the header associated to their value
Method m_method; ///< Method to use for the request
std::string m_uRI; ///< Target URI of the request
std::string m_uri; ///< Target URI of the request
unsigned int m_majorVersion; ///< Major HTTP version
unsigned int m_minorVersion; ///< Minor HTTP version
std::string m_body; ///< Body of the request
@ -252,7 +252,7 @@ public :
/// \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;
////////////////////////////////////////////////////////////
/// \brief Get the response status code
@ -265,27 +265,27 @@ public :
/// \return Status code of the response
///
////////////////////////////////////////////////////////////
Status GetStatus() const;
Status getStatus() const;
////////////////////////////////////////////////////////////
/// \brief Get the major HTTP version number of the response
///
/// \return Major HTTP version number
///
/// \see GetMinorHttpVersion
/// \see getMinorHttpVersion
///
////////////////////////////////////////////////////////////
unsigned int GetMajorHttpVersion() const;
unsigned int getMajorHttpVersion() const;
////////////////////////////////////////////////////////////
/// \brief Get the minor HTTP version number of the response
///
/// \return Minor HTTP version number
///
/// \see GetMajorHttpVersion
/// \see getMajorHttpVersion
///
////////////////////////////////////////////////////////////
unsigned int GetMinorHttpVersion() const;
unsigned int getMinorHttpVersion() const;
////////////////////////////////////////////////////////////
/// \brief Get the body of the response
@ -299,7 +299,7 @@ public :
/// \return The response body
///
////////////////////////////////////////////////////////////
const std::string& GetBody() const;
const std::string& getBody() const;
private :
@ -314,7 +314,7 @@ public :
/// \param data Content of the response to parse
///
////////////////////////////////////////////////////////////
void Parse(const std::string& data);
void parse(const std::string& data);
////////////////////////////////////////////////////////////
// Types
@ -368,7 +368,7 @@ public :
/// \param port Port to use for connection
///
////////////////////////////////////////////////////////////
void SetHost(const std::string& host, unsigned short port = 0);
void setHost(const std::string& host, unsigned short port = 0);
////////////////////////////////////////////////////////////
/// \brief Send a HTTP request and return the server's response.
@ -388,7 +388,7 @@ public :
/// \return Server's response
///
////////////////////////////////////////////////////////////
Response SendRequest(const Request& request, Time timeout = Time::Zero);
Response sendRequest(const Request& request, Time timeout = Time::Zero);
private :
@ -444,19 +444,19 @@ private :
/// sf::Http http;
///
/// // We'll work on http://www.sfml-dev.org
/// http.SetHost("http://www.sfml-dev.org");
/// http.setHost("http://www.sfml-dev.org");
///
/// // Prepare a request to get the 'features.php' page
/// sf::Http::Request request("features.php");
///
/// // Send the request
/// sf::Http::Response response = http.SendRequest(request);
/// sf::Http::Response response = http.sendRequest(request);
///
/// // Check the status code and display the result
/// sf::Http::Response::Status status = response.GetStatus();
/// sf::Http::Response::Status status = response.getStatus();
/// if (status == sf::Http::Response::Ok)
/// {
/// std::cout << response.GetBody() << std::endl;
/// std::cout << response.getBody() << std::endl;
/// }
/// else
/// {

View file

@ -103,7 +103,7 @@ public :
///
/// \param address 4 bytes of the address packed into a 32-bits integer
///
/// \see ToInteger
/// \see toInteger
///
////////////////////////////////////////////////////////////
explicit IpAddress(Uint32 address);
@ -117,10 +117,10 @@ public :
///
/// \return String representation of the address
///
/// \see ToInteger
/// \see toInteger
///
////////////////////////////////////////////////////////////
std::string ToString() const;
std::string toString() const;
////////////////////////////////////////////////////////////
/// \brief Get an integer representation of the address
@ -133,10 +133,10 @@ public :
///
/// \return 32-bits unsigned integer representation of the address
///
/// \see ToString
/// \see toString
///
////////////////////////////////////////////////////////////
Uint32 ToInteger() const;
Uint32 toInteger() const;
////////////////////////////////////////////////////////////
/// \brief Get the computer's local address
@ -144,15 +144,15 @@ public :
/// The local address is the address of the computer from the
/// LAN point of view, i.e. something like 192.168.1.56. It is
/// meaningful only for communications over the local network.
/// Unlike GetPublicAddress, this function is fast and may be
/// Unlike getPublicAddress, this function is fast and may be
/// used safely anywhere.
///
/// \return Local IP address of the computer
///
/// \see GetPublicAddress
/// \see getPublicAddress
///
////////////////////////////////////////////////////////////
static IpAddress GetLocalAddress();
static IpAddress getLocalAddress();
////////////////////////////////////////////////////////////
/// \brief Get the computer's public address
@ -173,10 +173,10 @@ public :
///
/// \return Public IP address of the computer
///
/// \see GetLocalAddress
/// \see getLocalAddress
///
////////////////////////////////////////////////////////////
static IpAddress GetPublicAddress(Time timeout = Time::Zero);
static IpAddress getPublicAddress(Time timeout = Time::Zero);
////////////////////////////////////////////////////////////
// Static member data
@ -306,8 +306,8 @@ SFML_NETWORK_API std::ostream& operator <<(std::ostream& stream, const IpAddress
/// sf::IpAddress a5("my_computer"); // a local address created from a network name
/// sf::IpAddress a6("89.54.1.169"); // a distant address
/// sf::IpAddress a7("www.google.com"); // a distant address created from a network name
/// sf::IpAddress a8 = sf::IpAddress::GetLocalAddress(); // my address on the local network
/// sf::IpAddress a9 = sf::IpAddress::GetPublicAddress(); // my address on the internet
/// sf::IpAddress a8 = sf::IpAddress::getLocalAddress(); // my address on the local network
/// sf::IpAddress a9 = sf::IpAddress::getPublicAddress(); // my address on the internet
/// \endcode
///
/// Note that sf::IpAddress currently doesn't support IPv6

View file

@ -71,20 +71,20 @@ public :
/// \param data Pointer to the sequence of bytes to append
/// \param sizeInBytes Number of bytes to append
///
/// \see Clear
/// \see clear
///
////////////////////////////////////////////////////////////
void Append(const void* data, std::size_t sizeInBytes);
void append(const void* data, std::size_t sizeInBytes);
////////////////////////////////////////////////////////////
/// \brief Clear the packet
///
/// After calling Clear, the packet is empty.
///
/// \see Append
/// \see append
///
////////////////////////////////////////////////////////////
void Clear();
void clear();
////////////////////////////////////////////////////////////
/// \brief Get a pointer to the data contained in the packet
@ -96,23 +96,23 @@ public :
///
/// \return Pointer to the data
///
/// \see GetDataSize
/// \see getDataSize
///
////////////////////////////////////////////////////////////
const char* GetData() const;
const char* getData() const;
////////////////////////////////////////////////////////////
/// \brief Get the size of the data contained in the packet
///
/// This function returns the number of bytes pointed to by
/// what GetData returns.
/// what getData returns.
///
/// \return Data size, in bytes
///
/// \see GetData
/// \see getData
///
////////////////////////////////////////////////////////////
std::size_t GetDataSize() const;
std::size_t getDataSize() const;
////////////////////////////////////////////////////////////
/// \brief Tell if the reading position has reached the
@ -126,7 +126,7 @@ public :
/// \see operator bool
///
////////////////////////////////////////////////////////////
bool EndOfPacket() const;
bool endOfPacket() const;
public:
@ -165,7 +165,7 @@ public:
///
/// \return True if last data extraction from packet was successful
///
/// \see EndOfPacket
/// \see endOfPacket
///
////////////////////////////////////////////////////////////
operator BoolType() const;
@ -230,7 +230,7 @@ private :
/// \return True if \a size bytes can be read from the packet
///
////////////////////////////////////////////////////////////
bool CheckSize(std::size_t size);
bool checkSize(std::size_t size);
////////////////////////////////////////////////////////////
/// \brief Called before the packet is sent over the network
@ -247,10 +247,10 @@ private :
///
/// \return Pointer to the array of bytes to send
///
/// \see OnReceive
/// \see onReceive
///
////////////////////////////////////////////////////////////
virtual const char* OnSend(std::size_t& size);
virtual const char* onSend(std::size_t& size);
////////////////////////////////////////////////////////////
/// \brief Called after the packet is received over the network
@ -266,8 +266,10 @@ private :
/// \param data Pointer to the received bytes
/// \param size Number of bytes
///
/// \see onSend
///
////////////////////////////////////////////////////////////
virtual void OnReceive(const char* data, std::size_t size);
virtual void onReceive(const char* data, std::size_t size);
////////////////////////////////////////////////////////////
// Member data
@ -316,13 +318,13 @@ private :
/// packet << x << s << d;
///
/// // Send it over the network (socket is a valid sf::TcpSocket)
/// socket.Send(packet);
/// socket.send(packet);
///
/// -----------------------------------------------------------------
///
/// // Receive the packet at the other end
/// sf::Packet packet;
/// socket.Receive(packet);
/// socket.receive(packet);
///
/// // Extract the variables contained in the packet
/// sf::Uint32 x;
@ -369,26 +371,26 @@ private :
/// and after it is received. This is typically used to
/// handle automatic compression or encryption of the data.
/// This is achieved by inheriting from sf::Packet, and overriding
/// the OnSend and OnReceive functions.
/// the onSend and onReceive functions.
///
/// Here is an example:
/// \code
/// class ZipPacket : public sf::Packet
/// {
/// virtual const char* OnSend(std::size_t& size)
/// virtual const char* onSend(std::size_t& size)
/// {
/// const char* srcData = GetData();
/// std::size_t srcSize = GetDataSize();
/// const char* srcData = getData();
/// std::size_t srcSize = getDataSize();
///
/// return MySuperZipFunction(srcData, srcSize, &size);
/// }
///
/// virtual void OnReceive(const char* data, std::size_t size)
/// virtual void onReceive(const char* data, std::size_t size)
/// {
/// std::size_t dstSize;
/// const char* dstData = MySuperUnzipFunction(data, size, &dstSize);
///
/// Append(dstData, dstSize);
/// append(dstData, dstSize);
/// }
/// };
///

View file

@ -89,20 +89,20 @@ public :
///
/// \param blocking True to set the socket as blocking, false for non-blocking
///
/// \see IsBlocking
/// \see isBlocking
///
////////////////////////////////////////////////////////////
void SetBlocking(bool blocking);
void setBlocking(bool blocking);
////////////////////////////////////////////////////////////
/// \brief Tell whether the socket is in blocking or non-blocking mode
///
/// \return True if the socket is blocking, false otherwise
///
/// \see SetBlocking
/// \see setBlocking
///
////////////////////////////////////////////////////////////
bool IsBlocking() const;
bool isBlocking() const;
protected :
@ -136,7 +136,7 @@ protected :
/// \return The internal (OS-specific) handle of the socket
///
////////////////////////////////////////////////////////////
SocketHandle GetHandle() const;
SocketHandle getHandle() const;
////////////////////////////////////////////////////////////
/// \brief Create the internal representation of the socket
@ -144,7 +144,7 @@ protected :
/// This function can only be accessed by derived classes.
///
////////////////////////////////////////////////////////////
void Create();
void create();
////////////////////////////////////////////////////////////
/// \brief Create the internal representation of the socket
@ -155,7 +155,7 @@ protected :
/// \param handle OS-specific handle of the socket to wrap
///
////////////////////////////////////////////////////////////
void Create(SocketHandle handle);
void create(SocketHandle handle);
////////////////////////////////////////////////////////////
/// \brief Close the socket gracefully
@ -163,7 +163,7 @@ protected :
/// This function can only be accessed by derived classes.
///
////////////////////////////////////////////////////////////
void Close();
void close();
private :

View file

@ -73,10 +73,10 @@ public :
///
/// \param socket Reference to the socket to add
///
/// \see Remove, Clear
/// \see remove, clear
///
////////////////////////////////////////////////////////////
void Add(Socket& socket);
void add(Socket& socket);
////////////////////////////////////////////////////////////
/// \brief Remove a socket from the selector
@ -86,10 +86,10 @@ public :
///
/// \param socket Reference to the socket to remove
///
/// \see Add, Clear
/// \see add, clear
///
////////////////////////////////////////////////////////////
void Remove(Socket& socket);
void remove(Socket& socket);
////////////////////////////////////////////////////////////
/// \brief Remove all the sockets stored in the selector
@ -98,17 +98,17 @@ public :
/// removes all the references that the selector has to
/// external sockets.
///
/// \see Add, Remove
/// \see add, remove
///
////////////////////////////////////////////////////////////
void Clear();
void clear();
////////////////////////////////////////////////////////////
/// \brief Wait until one or more sockets are ready to receive
///
/// This function returns as soon as at least one socket has
/// some data available to be received. To know which sockets are
/// ready, use the IsReady function.
/// ready, use the isReady function.
/// If you use a timeout and no socket is ready before the timeout
/// is over, the function returns false.
///
@ -116,17 +116,17 @@ public :
///
/// \return True if there are sockets ready, false otherwise
///
/// \see IsReady
/// \see isReady
///
////////////////////////////////////////////////////////////
bool Wait(Time timeout = Time::Zero);
bool wait(Time timeout = Time::Zero);
////////////////////////////////////////////////////////////
/// \brief Test a socket to know if it is ready to receive data
///
/// This function must be used after a call to Wait, to know
/// which sockets are ready to receive data. If a socket is
/// ready, a call to Receive will never block because we know
/// ready, a call to receive will never block because we know
/// that there is data available to read.
/// Note that if this function returns true for a TcpListener,
/// this means that it is ready to accept a new connection.
@ -135,10 +135,10 @@ public :
///
/// \return True if the socket is ready to read, false otherwise
///
/// \see IsReady
/// \see isReady
///
////////////////////////////////////////////////////////////
bool IsReady(Socket& socket) const;
bool isReady(Socket& socket) const;
////////////////////////////////////////////////////////////
/// \brief Overload of assignment operator
@ -199,7 +199,7 @@ private :
/// \code
/// // Create a socket to listen to new connections
/// sf::TcpListener listener;
/// listener.Listen(55001);
/// listener.listen(55001);
///
/// // Create a list to store the future clients
/// std::list<sf::TcpSocket*> clients;
@ -208,16 +208,16 @@ private :
/// sf::SocketSelector selector;
///
/// // Add the listener to the selector
/// selector.Add(listener);
/// selector.add(listener);
///
/// // Endless loop that waits for new connections
/// while (running)
/// {
/// // Make the selector wait for data on any socket
/// if (selector.Wait())
/// if (selector.wait())
/// {
/// // Test the listener
/// if (selector.IsReady(listener))
/// if (selector.isReady(listener))
/// {
/// // The listener is ready: there is a pending connection
/// sf::TcpSocket* client = new sf::TcpSocket;
@ -228,7 +228,7 @@ private :
///
/// // Add the new client to the selector so that we will
/// // be notified when he sends something
/// selector.Add(*client);
/// selector.add(*client);
/// }
/// }
/// else
@ -237,11 +237,11 @@ private :
/// for (std::list<sf::TcpSocket*>::iterator it = clients.begin(); it != clients.end(); ++it)
/// {
/// sf::TcpSocket& client = **it;
/// if (selector.IsReady(client))
/// if (selector.isReady(client))
/// {
/// // The client has sent some data, we can receive it
/// sf::Packet packet;
/// if (client.Receive(packet) == sf::Socket::Done)
/// if (client.receive(packet) == sf::Socket::Done)
/// {
/// ...
/// }

View file

@ -58,10 +58,10 @@ public :
///
/// \return Port to which the socket is bound
///
/// \see Listen
/// \see listen
///
////////////////////////////////////////////////////////////
unsigned short GetLocalPort() const;
unsigned short getLocalPort() const;
////////////////////////////////////////////////////////////
/// \brief Start listening for connections
@ -75,10 +75,10 @@ public :
///
/// \return Status code
///
/// \see Accept, Close
/// \see accept, close
///
////////////////////////////////////////////////////////////
Status Listen(unsigned short port);
Status listen(unsigned short port);
////////////////////////////////////////////////////////////
/// \brief Stop listening and close the socket
@ -86,10 +86,10 @@ public :
/// This function gracefully stops the listener. If the
/// socket is not listening, this function has no effect.
///
/// \see Listen
/// \see listen
///
////////////////////////////////////////////////////////////
void Close();
void close();
////////////////////////////////////////////////////////////
/// \brief Accept a new connection
@ -101,10 +101,10 @@ public :
///
/// \return Status code
///
/// \see Listen
/// \see listen
///
////////////////////////////////////////////////////////////
Status Accept(TcpSocket& socket);
Status accept(TcpSocket& socket);
};
@ -122,7 +122,7 @@ public :
/// a given port and waits for connections on that port.
/// This is all it can do.
///
/// When a new connection is received, you must call Accept and
/// When a new connection is received, you must call accept and
/// the listener returns a new instance of sf::TcpSocket that
/// is properly initialized and can be used to communicate with
/// the new client.
@ -134,7 +134,7 @@ public :
///
/// A listener is automatically closed on destruction, like all
/// other types of socket. However if you want to stop listening
/// before the socket is destroyed, you can call its Close()
/// before the socket is destroyed, you can call its close()
/// function.
///
/// Usage example:
@ -142,17 +142,17 @@ public :
/// // Create a listener socket and make it wait for new
/// // connections on port 55001
/// sf::TcpListener listener;
/// listener.Listen(55001);
/// listener.listen(55001);
///
/// // Endless loop that waits for new connections
/// while (running)
/// {
/// sf::TcpSocket client;
/// if (listener.Accept(client) == sf::Socket::Done)
/// if (listener.accept(client) == sf::Socket::Done)
/// {
/// // A new client just connected!
/// std::cout << "New connection received from " << client.GetRemoteAddress() << std::endl;
/// DoSomethingWith(client);
/// std::cout << "New connection received from " << client.getRemoteAddress() << std::endl;
/// doSomethingWith(client);
/// }
/// }
/// \endcode

View file

@ -60,10 +60,10 @@ public :
///
/// \return Port to which the socket is bound
///
/// \see Connect, GetRemotePort
/// \see connect, getRemotePort
///
////////////////////////////////////////////////////////////
unsigned short GetLocalPort() const;
unsigned short getLocalPort() const;
////////////////////////////////////////////////////////////
/// \brief Get the address of the connected peer
@ -73,10 +73,10 @@ public :
///
/// \return Address of the remote peer
///
/// \see GetRemotePort
/// \see getRemotePort
///
////////////////////////////////////////////////////////////
IpAddress GetRemoteAddress() const;
IpAddress getRemoteAddress() const;
////////////////////////////////////////////////////////////
/// \brief Get the port of the connected peer to which
@ -86,10 +86,10 @@ public :
///
/// \return Remote port to which the socket is connected
///
/// \see GetRemoteAddress
/// \see getRemoteAddress
///
////////////////////////////////////////////////////////////
unsigned short GetRemotePort() const;
unsigned short getRemotePort() const;
////////////////////////////////////////////////////////////
/// \brief Connect the socket to a remote peer
@ -105,10 +105,10 @@ public :
///
/// \return Status code
///
/// \see Disconnect
/// \see disconnect
///
////////////////////////////////////////////////////////////
Status Connect(const IpAddress& remoteAddress, unsigned short remotePort, Time timeout = Time::Zero);
Status connect(const IpAddress& remoteAddress, unsigned short remotePort, Time timeout = Time::Zero);
////////////////////////////////////////////////////////////
/// \brief Disconnect the socket from its remote peer
@ -119,7 +119,7 @@ public :
/// \see Connect
///
////////////////////////////////////////////////////////////
void Disconnect();
void disconnect();
////////////////////////////////////////////////////////////
/// \brief Send raw data to the remote peer
@ -131,10 +131,10 @@ public :
///
/// \return Status code
///
/// \see Receive
/// \see receive
///
////////////////////////////////////////////////////////////
Status Send(const char* data, std::size_t size);
Status send(const char* data, std::size_t size);
////////////////////////////////////////////////////////////
/// \brief Receive raw data from the remote peer
@ -149,10 +149,10 @@ public :
///
/// \return Status code
///
/// \see Send
/// \see send
///
////////////////////////////////////////////////////////////
Status Receive(char* data, std::size_t size, std::size_t& received);
Status receive(char* data, std::size_t size, std::size_t& received);
////////////////////////////////////////////////////////////
/// \brief Send a formatted packet of data to the remote peer
@ -163,10 +163,10 @@ public :
///
/// \return Status code
///
/// \see Receive
/// \see receive
///
////////////////////////////////////////////////////////////
Status Send(Packet& packet);
Status send(Packet& packet);
////////////////////////////////////////////////////////////
/// \brief Receive a formatted packet of data from the remote peer
@ -179,10 +179,10 @@ public :
///
/// \return Status code
///
/// \see Send
/// \see send
///
////////////////////////////////////////////////////////////
Status Receive(Packet& packet);
Status receive(Packet& packet);
private:
@ -227,10 +227,10 @@ private:
///
/// When a socket is connected to a remote host, you can
/// retrieve informations about this host with the
/// GetRemoteAddress and GetRemotePort functions. You can
/// getRemoteAddress and GetRemotePort functions. You can
/// also get the local port to which the socket is bound
/// (which is automatically chosen when the socket is connected),
/// with the GetLocalPort function.
/// with the getLocalPort function.
///
/// Sending and receiving data can use either the low-level
/// or the high-level functions. The low-level functions
@ -245,7 +245,7 @@ private:
///
/// The socket is automatically disconnected when it is destroyed,
/// but if you want to explicitely close the connection while
/// the socket instance is still alive, you can call Disconnect.
/// the socket instance is still alive, you can call disconnect.
///
/// Usage example:
/// \code
@ -253,38 +253,38 @@ private:
///
/// // Create a socket and connect it to 192.168.1.50 on port 55001
/// sf::TcpSocket socket;
/// socket.Connect("192.168.1.50", 55001);
/// socket.connect("192.168.1.50", 55001);
///
/// // Send a message to the connected host
/// std::string message = "Hi, I am a client";
/// socket.Send(message.c_str(), message.size() + 1);
/// socket.send(message.c_str(), message.size() + 1);
///
/// // Receive an answer from the server
/// char buffer[1024];
/// std::size_t received = 0;
/// socket.Receive(buffer, sizeof(buffer), received);
/// socket.receive(buffer, sizeof(buffer), received);
/// std::cout << "The server said: " << buffer << std::endl;
///
/// // ----- The server -----
///
/// // Create a listener to wait for incoming connections on port 55001
/// sf::TcpListener listener;
/// listener.Listen(55001);
/// listener.listen(55001);
///
/// // Wait for a connection
/// sf::TcpSocket socket;
/// listener.Accept(socket);
/// std::cout << "New client connected: " << socket.GetRemoteAddress() << std::endl;
/// listener.accept(socket);
/// std::cout << "New client connected: " << socket.getRemoteAddress() << std::endl;
///
/// // Receive a message from the client
/// char buffer[1024];
/// std::size_t received = 0;
/// socket.Receive(buffer, sizeof(buffer), received);
/// socket.receive(buffer, sizeof(buffer), received);
/// std::cout << "The client said: " << buffer << std::endl;
///
/// // Send an answer
/// std::string message = "Welcome, client";
/// socket.Send(message.c_str(), message.size() + 1);
/// socket.send(message.c_str(), message.size() + 1);
/// \endcode
///
/// \see sf::Socket, sf::UdpSocket, sf::Packet

View file

@ -68,10 +68,10 @@ public :
///
/// \return Port to which the socket is bound
///
/// \see Bind
/// \see bind
///
////////////////////////////////////////////////////////////
unsigned short GetLocalPort() const;
unsigned short getLocalPort() const;
////////////////////////////////////////////////////////////
/// \brief Bind the socket to a specific port
@ -80,16 +80,16 @@ public :
/// able to receive data on that port.
/// You can use the special value Socket::AnyPort to tell the
/// system to automatically pick an available port, and then
/// call GetLocalPort to retrieve the chosen port.
/// call getLocalPort to retrieve the chosen port.
///
/// \param port Port to bind the socket to
///
/// \return Status code
///
/// \see Unbind, GetLocalPort
/// \see unbind, getLocalPort
///
////////////////////////////////////////////////////////////
Status Bind(unsigned short port);
Status bind(unsigned short port);
////////////////////////////////////////////////////////////
/// \brief Unbind the socket from the local port to which it is bound
@ -98,10 +98,10 @@ public :
/// available after this function is called. If the
/// socket is not bound to a port, this function has no effect.
///
/// \see Bind
/// \see bind
///
////////////////////////////////////////////////////////////
void Unbind();
void unbind();
////////////////////////////////////////////////////////////
/// \brief Send raw data to a remote peer
@ -117,10 +117,10 @@ public :
///
/// \return Status code
///
/// \see Receive
/// \see receive
///
////////////////////////////////////////////////////////////
Status Send(const char* data, std::size_t size, const IpAddress& remoteAddress, unsigned short remotePort);
Status send(const char* data, std::size_t size, const IpAddress& remoteAddress, unsigned short remotePort);
////////////////////////////////////////////////////////////
/// \brief Receive raw data from a remote peer
@ -140,10 +140,10 @@ public :
///
/// \return Status code
///
/// \see Send
/// \see send
///
////////////////////////////////////////////////////////////
Status Receive(char* data, std::size_t size, std::size_t& received, IpAddress& remoteAddress, unsigned short& remotePort);
Status receive(char* data, std::size_t size, std::size_t& received, IpAddress& remoteAddress, unsigned short& remotePort);
////////////////////////////////////////////////////////////
/// \brief Send a formatted packet of data to a remote peer
@ -158,18 +158,16 @@ public :
///
/// \return Status code
///
/// \see Receive
/// \see receive
///
////////////////////////////////////////////////////////////
Status Send(Packet& packet, const IpAddress& remoteAddress, unsigned short remotePort);
Status send(Packet& packet, const IpAddress& remoteAddress, unsigned short remotePort);
////////////////////////////////////////////////////////////
/// \brief Receive a formatted packet of data from a remote peer
///
/// In blocking mode, this function will wait until the whole packet
/// has been received.
/// Warning: this functon doesn't properly handle mixed data
/// received from multiple peers.
///
/// \param packet Packet to fill with the received data
/// \param remoteAddress Address of the peer that sent the data
@ -177,10 +175,10 @@ public :
///
/// \return Status code
///
/// \see Send
/// \see send
///
////////////////////////////////////////////////////////////
Status Receive(Packet& packet, IpAddress& remoteAddress, unsigned short& remotePort);
Status receive(Packet& packet, IpAddress& remoteAddress, unsigned short& remotePort);
private:
@ -206,8 +204,8 @@ private:
///
/// It is a datagram protocol: bounded blocks of data (datagrams)
/// are transfered over the network rather than a continuous
/// stream of data (TCP). Therefore, one call to Send will always
/// match one call to Receive (if the datagram is not lost),
/// stream of data (TCP). Therefore, one call to send will always
/// match one call to receive (if the datagram is not lost),
/// with the same data that was sent.
///
/// The UDP protocol is lightweight but unreliable. Unreliable
@ -247,37 +245,37 @@ private:
///
/// // Create a socket and bind it to the port 55001
/// sf::UdpSocket socket;
/// socket.Bind(55001);
/// socket.bind(55001);
///
/// // Send a message to 192.168.1.50 on port 55002
/// std::string message = "Hi, I am " + sf::IpAddress::GetLocalAddress().ToString();
/// socket.Send(message.c_str(), message.size() + 1, "192.168.1.50", 55002);
/// std::string message = "Hi, I am " + sf::IpAddress::getLocalAddress().toString();
/// socket.send(message.c_str(), message.size() + 1, "192.168.1.50", 55002);
///
/// // Receive an answer (most likely from 192.168.1.50, but could be anyone else)
/// char buffer[1024];
/// std::size_t received = 0;
/// sf::IpAddress sender;
/// unsigned short port;
/// socket.Receive(buffer, sizeof(buffer), received, sender, port);
/// socket.receive(buffer, sizeof(buffer), received, sender, port);
/// std::cout << sender.ToString() << " said: " << buffer << std::endl;
///
/// // ----- The server -----
///
/// // Create a socket and bind it to the port 55002
/// sf::UdpSocket socket;
/// socket.Bind(55002);
/// socket.bind(55002);
///
/// // Receive a message from anyone
/// char buffer[1024];
/// std::size_t received = 0;
/// sf::IpAddress sender;
/// unsigned short port;
/// socket.Receive(buffer, sizeof(buffer), received, sender, port);
/// socket.receive(buffer, sizeof(buffer), received, sender, port);
/// std::cout << sender.ToString() << " said: " << buffer << std::endl;
///
/// // Send an answer
/// std::string message = "Welcome " + sender.ToString();
/// socket.Send(message.c_str(), message.size() + 1, sender, port);
/// std::string message = "Welcome " + sender.toString();
/// socket.send(message.c_str(), message.size() + 1, sender, port);
/// \endcode
///
/// \see sf::Socket, sf::TcpSocket, sf::Packet

View file

@ -54,13 +54,13 @@ public :
/// \brief Get the elapsed time
///
/// This function returns the time elapsed since the last call
/// to Restart() (or the construction of the instance if Restart()
/// to restart() (or the construction of the instance if restart()
/// has not been called).
///
/// \return Time elapsed
///
////////////////////////////////////////////////////////////
Time GetElapsedTime() const;
Time getElapsedTime() const;
////////////////////////////////////////////////////////////
/// \brief Restart the clock
@ -71,7 +71,7 @@ public :
/// \return Time elapsed
///
////////////////////////////////////////////////////////////
Time Restart();
Time restart();
private :
@ -103,9 +103,9 @@ private :
/// \code
/// sf::Clock clock;
/// ...
/// Time time1 = clock.GetElapsedTime();
/// Time time1 = clock.getElapsedTime();
/// ...
/// Time time2 = clock.Restart();
/// Time time2 = clock.restart();
/// \endcode
///
/// The sf::Time value returned by the clock can then be

View file

@ -38,7 +38,7 @@ namespace sf
/// \brief Standard stream used by SFML to output warnings and errors
///
////////////////////////////////////////////////////////////
SFML_SYSTEM_API std::ostream& Err();
SFML_SYSTEM_API std::ostream& err();
} // namespace sf
@ -50,7 +50,7 @@ SFML_SYSTEM_API std::ostream& Err();
/// \fn sf::Err
/// \ingroup system
///
/// By default, sf::Err() outputs to the same location as std::cerr,
/// By default, sf::err() outputs to the same location as std::cerr,
/// (-> the stderr descriptor) which is the console if there's
/// one available.
///
@ -58,7 +58,7 @@ SFML_SYSTEM_API std::ostream& Err();
/// insertion operations defined by the STL
/// (operator <<, manipulators, etc.).
///
/// sf::Err() can be redirected to write to another output, independantly
/// sf::err() can be redirected to write to another output, independantly
/// of std::cerr, by using the rdbuf() function provided by the
/// std::ostream class.
///
@ -66,13 +66,13 @@ SFML_SYSTEM_API std::ostream& Err();
/// \code
/// // Redirect to a file
/// std::ofstream file("sfml-log.txt");
/// std::streambuf* previous = sf::Err().rdbuf(file.rdbuf());
/// std::streambuf* previous = sf::err().rdbuf(file.rdbuf());
///
/// // Redirect to nothing
/// sf::Err().rdbuf(NULL);
/// sf::err().rdbuf(NULL);
///
/// // Restore the original output
/// sf::Err().rdbuf(previous);
/// sf::err().rdbuf(previous);
/// \endcode
///
////////////////////////////////////////////////////////////

View file

@ -56,7 +56,7 @@ public :
/// \return The number of bytes actually read
///
////////////////////////////////////////////////////////////
virtual Int64 Read(char* data, Int64 size) = 0;
virtual Int64 read(char* data, Int64 size) = 0;
////////////////////////////////////////////////////////////
/// \brief Change the current reading position
@ -66,7 +66,7 @@ public :
/// \return The position actually sought to, or -1 on error
///
////////////////////////////////////////////////////////////
virtual Int64 Seek(Int64 position) = 0;
virtual Int64 seek(Int64 position) = 0;
////////////////////////////////////////////////////////////
/// \brief Get the current reading position in the stream
@ -74,7 +74,7 @@ public :
/// \return The current position, or -1 on error.
///
////////////////////////////////////////////////////////////
virtual Int64 Tell() = 0;
virtual Int64 tell() = 0;
////////////////////////////////////////////////////////////
/// \brief Return the size of the stream
@ -82,7 +82,7 @@ public :
/// \return The total number of bytes available in the stream, or -1 on error
///
////////////////////////////////////////////////////////////
virtual Int64 GetSize() = 0;
virtual Int64 getSize() = 0;
};
} // namespace sf
@ -99,12 +99,12 @@ public :
/// from which SFML can load resources.
///
/// SFML resource classes like sf::Texture and
/// sf::SoundBuffer provide LoadFromFile and LoadFromMemory functions,
/// sf::SoundBuffer provide loadFromFile and loadFromMemory functions,
/// which read data from conventional sources. However, if you
/// have data coming from a different source (over a network,
/// embedded, encrypted, compressed, etc) you can derive your
/// own class from sf::InputStream and load SFML resources with
/// their LoadFromStream function.
/// their loadFromStream function.
///
/// Usage example:
/// \code
@ -115,15 +115,15 @@ public :
///
/// ZipStream(std::string archive);
///
/// bool Open(std::string filename);
/// bool open(std::string filename);
///
/// Int64 Read(char* data, Int64 size);
/// Int64 read(char* data, Int64 size);
///
/// Int64 Seek(Int64 position);
/// Int64 seek(Int64 position);
///
/// Int64 Tell();
/// Int64 tell();
///
/// Int64 GetSize();
/// Int64 getSize();
///
/// private :
///
@ -133,14 +133,14 @@ public :
/// // now you can load textures...
/// sf::Texture texture;
/// ZipStream stream("resources.zip");
/// stream.Open("images/img.png");
/// texture.LoadFromStream(stream);
/// stream.open("images/img.png");
/// texture.loadFromStream(stream);
///
/// // musics...
/// sf::Music music;
/// ZipStream stream("resources.zip");
/// stream.Open("musics/msc.ogg");
/// music.OpenFromStream(stream);
/// stream.open("musics/msc.ogg");
/// music.openFromStream(stream);
///
/// // etc.
/// \endcode

View file

@ -70,7 +70,7 @@ public :
/// \see Unlock
///
////////////////////////////////////////////////////////////
void Lock();
void lock();
////////////////////////////////////////////////////////////
/// \brief Unlock the mutex
@ -78,7 +78,7 @@ public :
/// \see Lock
///
////////////////////////////////////////////////////////////
void Unlock();
void unlock();
private :
@ -115,16 +115,16 @@ private :
///
/// void thread1()
/// {
/// mutex.Lock(); // this call will block the thread if the mutex is already locked by thread2
/// mutex.lock(); // this call will block the thread if the mutex is already locked by thread2
/// database.write(...);
/// mutex.Unlock(); // if thread2 was waiting, it will now be unblocked
/// mutex.unlock(); // if thread2 was waiting, it will now be unblocked
/// }
///
/// void thread2()
/// {
/// mutex.Lock(); // this call will block the thread if the mutex is already locked by thread1
/// mutex.lock(); // this call will block the thread if the mutex is already locked by thread1
/// database.write(...);
/// mutex.Unlock(); // if thread1 was waiting, it will now be unblocked
/// mutex.unlock(); // if thread1 was waiting, it will now be unblocked
/// }
/// \endcode
///
@ -140,8 +140,8 @@ private :
/// a mutex multiple times in the same thread without creating
/// a deadlock. In this case, the first call to Lock() behaves
/// as usual, and the following ones have no effect.
/// However, you must call Unlock() exactly as many times as you
/// called Lock(). If you don't, the mutex won't be released.
/// However, you must call unlock() exactly as many times as you
/// called lock(). If you don't, the mutex won't be released.
///
/// \see sf::Lock
///

View file

@ -38,13 +38,13 @@ namespace sf
/// \ingroup system
/// \brief Make the current thread sleep for a given duration
///
/// sf::Sleep is the best way to block a program or one of its
/// sf::sleep is the best way to block a program or one of its
/// threads, as it doesn't consume any CPU power.
///
/// \param duration Time to sleep
///
////////////////////////////////////////////////////////////
void SFML_SYSTEM_API Sleep(Time duration);
void SFML_SYSTEM_API sleep(Time duration);
} // namespace sf

View file

@ -159,15 +159,15 @@ public :
/// \brief Implicit cast operator to std::string (ANSI string)
///
/// The current global locale is used for conversion. If you
/// want to explicitely specify a locale, see ToAnsiString.
/// want to explicitely specify a locale, see toAnsiString.
/// Characters that do not fit in the target encoding are
/// discarded from the returned string.
/// This operator is defined for convenience, and is equivalent
/// to calling ToAnsiString().
/// to calling toAnsiString().
///
/// \return Converted ANSI string
///
/// \see ToAnsiString, operator std::wstring
/// \see toAnsiString, operator std::wstring
///
////////////////////////////////////////////////////////////
operator std::string() const;
@ -178,11 +178,11 @@ public :
/// Characters that do not fit in the target encoding are
/// discarded from the returned string.
/// This operator is defined for convenience, and is equivalent
/// to calling ToWideString().
/// to calling toWideString().
///
/// \return Converted wide string
///
/// \see ToWideString, operator std::string
/// \see toWideString, operator std::string
///
////////////////////////////////////////////////////////////
operator std::wstring() const;
@ -199,10 +199,10 @@ public :
///
/// \return Converted ANSI string
///
/// \see ToWideString, operator std::string
/// \see toWideString, operator std::string
///
////////////////////////////////////////////////////////////
std::string ToAnsiString(const std::locale& locale = std::locale()) const;
std::string toAnsiString(const std::locale& locale = std::locale()) const;
////////////////////////////////////////////////////////////
/// \brief Convert the unicode string to a wide string
@ -212,10 +212,10 @@ public :
///
/// \return Converted wide string
///
/// \see ToAnsiString, operator std::wstring
/// \see toAnsiString, operator std::wstring
///
////////////////////////////////////////////////////////////
std::wstring ToWideString() const;
std::wstring toWideString() const;
////////////////////////////////////////////////////////////
/// \brief Overload of assignment operator
@ -268,30 +268,30 @@ public :
///
/// This function removes all the characters from the string.
///
/// \see IsEmpty, Erase
/// \see isEmpty, erase
///
////////////////////////////////////////////////////////////
void Clear();
void clear();
////////////////////////////////////////////////////////////
/// \brief Get the size of the string
///
/// \return Number of characters in the string
///
/// \see IsEmpty
/// \see isEmpty
///
////////////////////////////////////////////////////////////
std::size_t GetSize() const;
std::size_t getSize() const;
////////////////////////////////////////////////////////////
/// \brief Check whether the string is empty or not
///
/// \return True if the string is empty (i.e. contains no character)
///
/// \see Clear, GetSize
/// \see clear, getSize
///
////////////////////////////////////////////////////////////
bool IsEmpty() const;
bool isEmpty() const;
////////////////////////////////////////////////////////////
/// \brief Erase one or more characters from the string
@ -303,7 +303,7 @@ public :
/// \param count Number of characters to erase
///
////////////////////////////////////////////////////////////
void Erase(std::size_t position, std::size_t count = 1);
void erase(std::size_t position, std::size_t count = 1);
////////////////////////////////////////////////////////////
/// \brief Insert one or more characters into the string
@ -315,7 +315,7 @@ public :
/// \param str Characters to insert
///
////////////////////////////////////////////////////////////
void Insert(std::size_t position, const String& str);
void insert(std::size_t position, const String& str);
////////////////////////////////////////////////////////////
/// \brief Find a sequence of one or more characters in the string
@ -329,7 +329,7 @@ public :
/// \return Position of \a str in the string, or String::InvalidPos if not found
///
////////////////////////////////////////////////////////////
std::size_t Find(const String& str, std::size_t start = 0) const;
std::size_t find(const String& str, std::size_t start = 0) const;
////////////////////////////////////////////////////////////
/// \brief Get a pointer to the C-style array of characters
@ -342,27 +342,27 @@ public :
/// \return Read-only pointer to the array of characters
///
////////////////////////////////////////////////////////////
const Uint32* GetData() const;
const Uint32* getData() const;
////////////////////////////////////////////////////////////
/// \brief Return an iterator to the beginning of the string
///
/// \return Read-write iterator to the beginning of the string characters
///
/// \see End
/// \see end
///
////////////////////////////////////////////////////////////
Iterator Begin();
Iterator begin();
////////////////////////////////////////////////////////////
/// \brief Return an iterator to the beginning of the string
///
/// \return Read-only iterator to the beginning of the string characters
///
/// \see End
/// \see end
///
////////////////////////////////////////////////////////////
ConstIterator Begin() const;
ConstIterator begin() const;
////////////////////////////////////////////////////////////
/// \brief Return an iterator to the beginning of the string
@ -373,10 +373,10 @@ public :
///
/// \return Read-write iterator to the end of the string characters
///
/// \see Begin
/// \see begin
///
////////////////////////////////////////////////////////////
Iterator End();
Iterator end();
////////////////////////////////////////////////////////////
/// \brief Return an iterator to the beginning of the string
@ -387,10 +387,10 @@ public :
///
/// \return Read-only iterator to the end of the string characters
///
/// \see Begin
/// \see begin
///
////////////////////////////////////////////////////////////
ConstIterator End() const;
ConstIterator end() const;
private :
@ -524,7 +524,7 @@ SFML_SYSTEM_API String operator +(const String& left, const String& right);
/// std::locale locale;
/// sf::String s;
/// ...
/// std::string s1 = s.ToAnsiString(locale);
/// std::string s1 = s.toAnsiString(locale);
/// s = sf::String("hello", locale);
/// \endcode
///

View file

@ -143,7 +143,7 @@ public :
/// running in parallel to the calling code.
///
////////////////////////////////////////////////////////////
void Launch();
void launch();
////////////////////////////////////////////////////////////
/// \brief Wait until the thread finishes
@ -156,7 +156,7 @@ public :
/// returns without doing anything.
///
////////////////////////////////////////////////////////////
void Wait();
void wait();
////////////////////////////////////////////////////////////
/// \brief Terminate the thread
@ -169,7 +169,7 @@ public :
/// the thread function terminate by itself.
///
////////////////////////////////////////////////////////////
void Terminate();
void terminate();
private :
@ -181,7 +181,7 @@ private :
/// This function is called by the thread implementation.
///
////////////////////////////////////////////////////////////
void Run();
void run();
////////////////////////////////////////////////////////////
// Member data
@ -224,19 +224,19 @@ private :
///
/// The thread ends when its function is terminated. If the
/// owner sf::Thread instance is destroyed before the
/// thread is finished, the destructor will wait (see Wait())
/// thread is finished, the destructor will wait (see wait())
///
/// Usage examples:
/// \code
/// // example 1: non member function with one argument
///
/// void ThreadFunc(int argument)
/// void threadFunc(int argument)
/// {
/// ...
/// }
///
/// sf::Thread thread(&ThreadFunc, 5);
/// thread.Launch(); // start the thread (internally calls ThreadFunc(5))
/// sf::Thread thread(&threadFunc, 5);
/// thread.launch(); // start the thread (internally calls threadFunc(5))
/// \endcode
///
/// \code
@ -245,15 +245,15 @@ private :
/// class Task
/// {
/// public :
/// void Run()
/// void run()
/// {
/// ...
/// }
/// };
///
/// Task task;
/// sf::Thread thread(&Task::Run, &task);
/// thread.Launch(); // start the thread (internally calls task.run())
/// sf::Thread thread(&Task::run, &task);
/// thread.launch(); // start the thread (internally calls task.run())
/// \endcode
///
/// \code
@ -268,7 +268,7 @@ private :
/// };
///
/// sf::Thread thread(Task());
/// thread.Launch(); // start the thread (internally calls operator() on the Task instance)
/// thread.launch(); // start the thread (internally calls operator() on the Task instance)
/// \endcode
///
/// Creating parallel threads of execution can be dangerous:

View file

@ -28,7 +28,7 @@ namespace priv
struct ThreadFunc
{
virtual ~ThreadFunc() {}
virtual void Run() = 0;
virtual void run() = 0;
};
// Specialization using a functor (including free functions) with no argument
@ -36,7 +36,7 @@ template <typename T>
struct ThreadFunctor : ThreadFunc
{
ThreadFunctor(T functor) : m_functor(functor) {}
virtual void Run() {m_functor();}
virtual void run() {m_functor();}
T m_functor;
};
@ -45,7 +45,7 @@ template <typename F, typename A>
struct ThreadFunctorWithArg : ThreadFunc
{
ThreadFunctorWithArg(F function, A arg) : m_function(function), m_arg(arg) {}
virtual void Run() {m_function(m_arg);}
virtual void run() {m_function(m_arg);}
F m_function;
A m_arg;
};
@ -55,7 +55,7 @@ template <typename C>
struct ThreadMemberFunc : ThreadFunc
{
ThreadMemberFunc(void(C::*function)(), C* object) : m_function(function), m_object(object) {}
virtual void Run() {(m_object->*m_function)();}
virtual void run() {(m_object->*m_function)();}
void(C::*m_function)();
C* m_object;
};

View file

@ -68,7 +68,7 @@ public :
/// \param value Value of the variable for the current thread
///
////////////////////////////////////////////////////////////
void SetValue(void* value);
void setValue(void* value);
////////////////////////////////////////////////////////////
/// \brief Retrieve the thread-specific value of the variable
@ -76,7 +76,7 @@ public :
/// \return Value of the variable for the current thread
///
////////////////////////////////////////////////////////////
void* GetValue() const;
void* getValue() const;
private :

View file

@ -128,25 +128,25 @@ public :
/// MyClass object2;
/// sf::ThreadLocalPtr<MyClass> objectPtr;
///
/// void Thread1()
/// void thread1()
/// {
/// objectPtr = &object1; // doesn't impact Thread2
/// objectPtr = &object1; // doesn't impact thread2
/// ...
/// }
///
/// void Thread2()
/// void thread2()
/// {
/// objectPtr = &object2; // doesn't impact Thread1
/// objectPtr = &object2; // doesn't impact thread1
/// ...
/// }
///
/// int main()
/// {
/// // Create and launch the two threads
/// sf::Thread thread1(&Thread1);
/// sf::Thread thread2(&Thread2);
/// thread1.Launch();
/// thread2.Launch();
/// sf::Thread t1(&thread1);
/// sf::Thread t2(&thread2);
/// t1.launch();
/// t2.launch();
///
/// return 0;
/// }

View file

@ -37,7 +37,7 @@ ThreadLocal(value)
template <typename T>
T& ThreadLocalPtr<T>::operator *() const
{
return *static_cast<T*>(GetValue());
return *static_cast<T*>(getValue());
}
@ -45,7 +45,7 @@ T& ThreadLocalPtr<T>::operator *() const
template <typename T>
T* ThreadLocalPtr<T>::operator ->() const
{
return static_cast<T*>(GetValue());
return static_cast<T*>(getValue());
}
@ -53,7 +53,7 @@ T* ThreadLocalPtr<T>::operator ->() const
template <typename T>
ThreadLocalPtr<T>::operator T*() const
{
return static_cast<T*>(GetValue());
return static_cast<T*>(getValue());
}
@ -61,7 +61,7 @@ ThreadLocalPtr<T>::operator T*() const
template <typename T>
ThreadLocalPtr<T>& ThreadLocalPtr<T>::operator =(T* value)
{
SetValue(value);
setValue(value);
return *this;
}
@ -70,7 +70,7 @@ ThreadLocalPtr<T>& ThreadLocalPtr<T>::operator =(T* value)
template <typename T>
ThreadLocalPtr<T>& ThreadLocalPtr<T>::operator =(const ThreadLocalPtr<T>& right)
{
SetValue(right.GetValue());
setValue(right.getValue());
return *this;
}

View file

@ -54,30 +54,30 @@ public :
///
/// \return Time in seconds
///
/// \see AsMilliseconds, AsMicroseconds
/// \see asMilliseconds, asMicroseconds
///
////////////////////////////////////////////////////////////
float AsSeconds() const;
float asSeconds() const;
////////////////////////////////////////////////////////////
/// \brief Return the time value as a number of milliseconds
///
/// \return Time in milliseconds
///
/// \see AsSeconds, AsMicroseconds
/// \see asSeconds, asMicroseconds
///
////////////////////////////////////////////////////////////
Int32 AsMilliseconds() const;
Int32 asMilliseconds() const;
////////////////////////////////////////////////////////////
/// \brief Return the time value as a number of microseconds
///
/// \return Time in microseconds
///
/// \see AsSeconds, AsMilliseconds
/// \see asSeconds, asMilliseconds
///
////////////////////////////////////////////////////////////
Int64 AsMicroseconds() const;
Int64 asMicroseconds() const;
////////////////////////////////////////////////////////////
// Static member data
@ -86,15 +86,15 @@ public :
private :
friend SFML_SYSTEM_API Time Seconds(float);
friend SFML_SYSTEM_API Time Milliseconds(Int32);
friend SFML_SYSTEM_API Time Microseconds(Int64);
friend SFML_SYSTEM_API Time seconds(float);
friend SFML_SYSTEM_API Time milliseconds(Int32);
friend SFML_SYSTEM_API Time microseconds(Int64);
////////////////////////////////////////////////////////////
/// \brief Construct from a number of microseconds
///
/// This function is internal. To construct time values,
/// use sf::Seconds, sf::Milliseconds or sf::Microseconds instead.
/// use sf::seconds, sf::milliseconds or sf::microseconds instead.
///
/// \param microseconds Number of microseconds
///
@ -117,10 +117,10 @@ private :
///
/// \return Time value constructed from the amount of seconds
///
/// \see Milliseconds, Microseconds
/// \see milliseconds, microseconds
///
////////////////////////////////////////////////////////////
SFML_SYSTEM_API Time Seconds(float amount);
SFML_SYSTEM_API Time seconds(float amount);
////////////////////////////////////////////////////////////
/// \relates Time
@ -130,10 +130,10 @@ SFML_SYSTEM_API Time Seconds(float amount);
///
/// \return Time value constructed from the amount of milliseconds
///
/// \see Seconds, Microseconds
/// \see seconds, microseconds
///
////////////////////////////////////////////////////////////
SFML_SYSTEM_API Time Milliseconds(Int32 amount);
SFML_SYSTEM_API Time milliseconds(Int32 amount);
////////////////////////////////////////////////////////////
/// \relates Time
@ -143,10 +143,10 @@ SFML_SYSTEM_API Time Milliseconds(Int32 amount);
///
/// \return Time value constructed from the amount of microseconds
///
/// \see Seconds, Milliseconds
/// \see seconds, milliseconds
///
////////////////////////////////////////////////////////////
SFML_SYSTEM_API Time Microseconds(Int64 amount);
SFML_SYSTEM_API Time microseconds(Int64 amount);
////////////////////////////////////////////////////////////
/// \relates Time
@ -428,23 +428,23 @@ SFML_SYSTEM_API Time& operator /=(Time& left, Int64 right);
///
/// Usage example:
/// \code
/// sf::Time t1 = sf::Seconds(0.1f);
/// Int32 milli = t1.AsMilliseconds(); // 100
/// sf::Time t1 = sf::seconds(0.1f);
/// Int32 milli = t1.asMilliseconds(); // 100
///
/// sf::Time t2 = sf::Milliseconds(30);
/// Int64 micro = t2.AsMicroseconds(); // 30000
/// sf::Time t2 = sf::milliseconds(30);
/// Int64 micro = t2.asMicroseconds(); // 30000
///
/// sf::Time t3 = sf::Microseconds(-800000);
/// float sec = t3.AsSeconds(); // -0.8
/// sf::Time t3 = sf::microseconds(-800000);
/// float sec = t3.asSeconds(); // -0.8
/// \endcode
///
/// \code
/// void Update(sf::Time elapsed)
/// void update(sf::Time elapsed)
/// {
/// position += speed * elapsed.AsSeconds();
/// position += speed * elapsed.asSeconds();
/// }
///
/// Update(sf::Milliseconds(100));
/// Update(sf::milliseconds(100));
/// \endcode
///
/// \see sf::Clock

View file

@ -64,7 +64,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In>
static In Decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
////////////////////////////////////////////////////////////
/// \brief Encode a single UTF-8 character
@ -80,7 +80,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename Out>
static Out Encode(Uint32 input, Out output, Uint8 replacement = 0);
static Out encode(Uint32 input, Out output, Uint8 replacement = 0);
////////////////////////////////////////////////////////////
/// \brief Advance to the next UTF-8 character
@ -95,7 +95,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In>
static In Next(In begin, In end);
static In next(In begin, In end);
////////////////////////////////////////////////////////////
/// \brief Count the number of characters of a UTF-8 sequence
@ -111,7 +111,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In>
static std::size_t Count(In begin, In end);
static std::size_t count(In begin, In end);
////////////////////////////////////////////////////////////
/// \brief Convert an ANSI characters range to UTF-8
@ -128,7 +128,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out FromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale());
static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale());
////////////////////////////////////////////////////////////
/// \brief Convert a wide characters range to UTF-8
@ -141,7 +141,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out FromWide(In begin, In end, Out output);
static Out fromWide(In begin, In end, Out output);
////////////////////////////////////////////////////////////
/// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-8
@ -154,7 +154,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out FromLatin1(In begin, In end, Out output);
static Out fromLatin1(In begin, In end, Out output);
////////////////////////////////////////////////////////////
/// \brief Convert an UTF-8 characters range to ANSI characters
@ -172,7 +172,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale());
static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale());
////////////////////////////////////////////////////////////
/// \brief Convert an UTF-8 characters range to wide characters
@ -186,7 +186,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToWide(In begin, In end, Out output, wchar_t replacement = 0);
static Out toWide(In begin, In end, Out output, wchar_t replacement = 0);
////////////////////////////////////////////////////////////
/// \brief Convert an UTF-8 characters range to latin-1 (ISO-5589-1) characters
@ -200,7 +200,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToLatin1(In begin, In end, Out output, char replacement = 0);
static Out toLatin1(In begin, In end, Out output, char replacement = 0);
////////////////////////////////////////////////////////////
/// \brief Convert a UTF-8 characters range to UTF-8
@ -218,7 +218,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToUtf8(In begin, In end, Out output);
static Out toUtf8(In begin, In end, Out output);
////////////////////////////////////////////////////////////
/// \brief Convert a UTF-8 characters range to UTF-16
@ -231,7 +231,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToUtf16(In begin, In end, Out output);
static Out toUtf16(In begin, In end, Out output);
////////////////////////////////////////////////////////////
/// \brief Convert a UTF-8 characters range to UTF-32
@ -244,7 +244,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToUtf32(In begin, In end, Out output);
static Out toUtf32(In begin, In end, Out output);
};
////////////////////////////////////////////////////////////
@ -271,7 +271,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In>
static In Decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
////////////////////////////////////////////////////////////
/// \brief Encode a single UTF-16 character
@ -287,7 +287,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename Out>
static Out Encode(Uint32 input, Out output, Uint16 replacement = 0);
static Out encode(Uint32 input, Out output, Uint16 replacement = 0);
////////////////////////////////////////////////////////////
/// \brief Advance to the next UTF-16 character
@ -302,7 +302,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In>
static In Next(In begin, In end);
static In next(In begin, In end);
////////////////////////////////////////////////////////////
/// \brief Count the number of characters of a UTF-16 sequence
@ -318,7 +318,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In>
static std::size_t Count(In begin, In end);
static std::size_t count(In begin, In end);
////////////////////////////////////////////////////////////
/// \brief Convert an ANSI characters range to UTF-16
@ -335,7 +335,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out FromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale());
static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale());
////////////////////////////////////////////////////////////
/// \brief Convert a wide characters range to UTF-16
@ -348,7 +348,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out FromWide(In begin, In end, Out output);
static Out fromWide(In begin, In end, Out output);
////////////////////////////////////////////////////////////
/// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-16
@ -361,7 +361,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out FromLatin1(In begin, In end, Out output);
static Out fromLatin1(In begin, In end, Out output);
////////////////////////////////////////////////////////////
/// \brief Convert an UTF-16 characters range to ANSI characters
@ -379,7 +379,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale());
static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale());
////////////////////////////////////////////////////////////
/// \brief Convert an UTF-16 characters range to wide characters
@ -393,7 +393,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToWide(In begin, In end, Out output, wchar_t replacement = 0);
static Out toWide(In begin, In end, Out output, wchar_t replacement = 0);
////////////////////////////////////////////////////////////
/// \brief Convert an UTF-16 characters range to latin-1 (ISO-5589-1) characters
@ -407,7 +407,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToLatin1(In begin, In end, Out output, char replacement = 0);
static Out toLatin1(In begin, In end, Out output, char replacement = 0);
////////////////////////////////////////////////////////////
/// \brief Convert a UTF-16 characters range to UTF-8
@ -420,7 +420,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToUtf8(In begin, In end, Out output);
static Out toUtf8(In begin, In end, Out output);
////////////////////////////////////////////////////////////
/// \brief Convert a UTF-16 characters range to UTF-16
@ -438,7 +438,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToUtf16(In begin, In end, Out output);
static Out toUtf16(In begin, In end, Out output);
////////////////////////////////////////////////////////////
/// \brief Convert a UTF-16 characters range to UTF-32
@ -451,7 +451,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToUtf32(In begin, In end, Out output);
static Out toUtf32(In begin, In end, Out output);
};
////////////////////////////////////////////////////////////
@ -479,7 +479,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In>
static In Decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
////////////////////////////////////////////////////////////
/// \brief Encode a single UTF-32 character
@ -496,7 +496,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename Out>
static Out Encode(Uint32 input, Out output, Uint32 replacement = 0);
static Out encode(Uint32 input, Out output, Uint32 replacement = 0);
////////////////////////////////////////////////////////////
/// \brief Advance to the next UTF-32 character
@ -511,7 +511,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In>
static In Next(In begin, In end);
static In next(In begin, In end);
////////////////////////////////////////////////////////////
/// \brief Count the number of characters of a UTF-32 sequence
@ -526,7 +526,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In>
static std::size_t Count(In begin, In end);
static std::size_t count(In begin, In end);
////////////////////////////////////////////////////////////
/// \brief Convert an ANSI characters range to UTF-32
@ -543,7 +543,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out FromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale());
static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale());
////////////////////////////////////////////////////////////
/// \brief Convert a wide characters range to UTF-32
@ -556,7 +556,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out FromWide(In begin, In end, Out output);
static Out fromWide(In begin, In end, Out output);
////////////////////////////////////////////////////////////
/// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-32
@ -569,7 +569,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out FromLatin1(In begin, In end, Out output);
static Out fromLatin1(In begin, In end, Out output);
////////////////////////////////////////////////////////////
/// \brief Convert an UTF-32 characters range to ANSI characters
@ -587,7 +587,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale());
static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale());
////////////////////////////////////////////////////////////
/// \brief Convert an UTF-32 characters range to wide characters
@ -601,7 +601,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToWide(In begin, In end, Out output, wchar_t replacement = 0);
static Out toWide(In begin, In end, Out output, wchar_t replacement = 0);
////////////////////////////////////////////////////////////
/// \brief Convert an UTF-16 characters range to latin-1 (ISO-5589-1) characters
@ -615,7 +615,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToLatin1(In begin, In end, Out output, char replacement = 0);
static Out toLatin1(In begin, In end, Out output, char replacement = 0);
////////////////////////////////////////////////////////////
/// \brief Convert a UTF-32 characters range to UTF-8
@ -628,7 +628,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToUtf8(In begin, In end, Out output);
static Out toUtf8(In begin, In end, Out output);
////////////////////////////////////////////////////////////
/// \brief Convert a UTF-32 characters range to UTF-16
@ -641,7 +641,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToUtf16(In begin, In end, Out output);
static Out toUtf16(In begin, In end, Out output);
////////////////////////////////////////////////////////////
/// \brief Convert a UTF-32 characters range to UTF-32
@ -659,7 +659,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In, typename Out>
static Out ToUtf32(In begin, In end, Out output);
static Out toUtf32(In begin, In end, Out output);
////////////////////////////////////////////////////////////
/// \brief Decode a single ANSI character to UTF-32
@ -675,7 +675,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In>
static Uint32 DecodeAnsi(In input, const std::locale& locale = std::locale());
static Uint32 decodeAnsi(In input, const std::locale& locale = std::locale());
////////////////////////////////////////////////////////////
/// \brief Decode a single wide character to UTF-32
@ -690,7 +690,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename In>
static Uint32 DecodeWide(In input);
static Uint32 decodeWide(In input);
////////////////////////////////////////////////////////////
/// \brief Encode a single UTF-32 character to ANSI
@ -708,7 +708,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename Out>
static Out EncodeAnsi(Uint32 codepoint, Out output, char replacement = 0, const std::locale& locale = std::locale());
static Out encodeAnsi(Uint32 codepoint, Out output, char replacement = 0, const std::locale& locale = std::locale());
////////////////////////////////////////////////////////////
/// \brief Encode a single UTF-32 character to wide
@ -725,7 +725,7 @@ public :
///
////////////////////////////////////////////////////////////
template <typename Out>
static Out EncodeWide(Uint32 codepoint, Out output, wchar_t replacement = 0);
static Out encodeWide(Uint32 codepoint, Out output, wchar_t replacement = 0);
};
#include <SFML/System/Utf.inl>

View file

@ -36,7 +36,7 @@
////////////////////////////////////////////////////////////
template <typename In>
In Utf<8>::Decode(In begin, In end, Uint32& output, Uint32 replacement)
In Utf<8>::decode(In begin, In end, Uint32& output, Uint32 replacement)
{
// Some useful precomputed data
static const int trailing[256] =
@ -55,7 +55,7 @@ In Utf<8>::Decode(In begin, In end, Uint32& output, Uint32 replacement)
0x00000000, 0x00003080, 0x000E2080, 0x03C82080, 0xFA082080, 0x82082080
};
// Decode the character
// decode the character
int trailingBytes = trailing[static_cast<Uint8>(*begin)];
if (begin + trailingBytes < end)
{
@ -84,7 +84,7 @@ In Utf<8>::Decode(In begin, In end, Uint32& output, Uint32 replacement)
////////////////////////////////////////////////////////////
template <typename Out>
Out Utf<8>::Encode(Uint32 input, Out output, Uint8 replacement)
Out Utf<8>::encode(Uint32 input, Out output, Uint8 replacement)
{
// Some useful precomputed data
static const Uint8 firstBytes[7] =
@ -92,7 +92,7 @@ Out Utf<8>::Encode(Uint32 input, Out output, Uint8 replacement)
0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
};
// Encode the character
// encode the character
if ((input > 0x0010FFFF) || ((input >= 0xD800) && (input <= 0xDBFF)))
{
// Invalid character
@ -104,25 +104,25 @@ Out Utf<8>::Encode(Uint32 input, Out output, Uint8 replacement)
// Valid character
// Get the number of bytes to write
int bytesToWrite = 1;
if (input < 0x80) bytesToWrite = 1;
else if (input < 0x800) bytesToWrite = 2;
else if (input < 0x10000) bytesToWrite = 3;
else if (input <= 0x0010FFFF) bytesToWrite = 4;
int bytestoWrite = 1;
if (input < 0x80) bytestoWrite = 1;
else if (input < 0x800) bytestoWrite = 2;
else if (input < 0x10000) bytestoWrite = 3;
else if (input <= 0x0010FFFF) bytestoWrite = 4;
// Extract the bytes to write
Uint8 bytes[4];
switch (bytesToWrite)
switch (bytestoWrite)
{
case 4 : bytes[3] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6;
case 3 : bytes[2] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6;
case 2 : bytes[1] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6;
case 1 : bytes[0] = static_cast<Uint8> (input | firstBytes[bytesToWrite]);
case 1 : bytes[0] = static_cast<Uint8> (input | firstBytes[bytestoWrite]);
}
// Add them to the output
const Uint8* currentByte = bytes;
switch (bytesToWrite)
switch (bytestoWrite)
{
case 4 : *output++ = *currentByte++;
case 3 : *output++ = *currentByte++;
@ -137,21 +137,21 @@ Out Utf<8>::Encode(Uint32 input, Out output, Uint8 replacement)
////////////////////////////////////////////////////////////
template <typename In>
In Utf<8>::Next(In begin, In end)
In Utf<8>::next(In begin, In end)
{
Uint32 codepoint;
return Decode(begin, end, codepoint);
return decode(begin, end, codepoint);
}
////////////////////////////////////////////////////////////
template <typename In>
std::size_t Utf<8>::Count(In begin, In end)
std::size_t Utf<8>::count(In begin, In end)
{
std::size_t length = 0;
while (begin < end)
{
begin = Next(begin, end);
begin = next(begin, end);
++length;
}
@ -161,12 +161,12 @@ std::size_t Utf<8>::Count(In begin, In end)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<8>::FromAnsi(In begin, In end, Out output, const std::locale& locale)
Out Utf<8>::fromAnsi(In begin, In end, Out output, const std::locale& locale)
{
while (begin < end)
{
Uint32 codepoint = Utf<32>::DecodeAnsi(*begin++, locale);
output = Encode(codepoint, output);
Uint32 codepoint = Utf<32>::decodeAnsi(*begin++, locale);
output = encode(codepoint, output);
}
return output;
@ -175,12 +175,12 @@ Out Utf<8>::FromAnsi(In begin, In end, Out output, const std::locale& locale)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<8>::FromWide(In begin, In end, Out output)
Out Utf<8>::fromWide(In begin, In end, Out output)
{
while (begin < end)
{
Uint32 codepoint = Utf<32>::DecodeWide(*begin++);
output = Encode(codepoint, output);
Uint32 codepoint = Utf<32>::decodeWide(*begin++);
output = encode(codepoint, output);
}
return output;
@ -189,12 +189,12 @@ Out Utf<8>::FromWide(In begin, In end, Out output)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<8>::FromLatin1(In begin, In end, Out output)
Out Utf<8>::fromLatin1(In begin, In end, Out output)
{
// Latin-1 is directly compatible with Unicode encodings,
// and can thus be treated as (a sub-range of) UTF-32
while (begin < end)
output = Encode(*begin++, output);
output = encode(*begin++, output);
return output;
}
@ -202,13 +202,13 @@ Out Utf<8>::FromLatin1(In begin, In end, Out output)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<8>::ToAnsi(In begin, In end, Out output, char replacement, const std::locale& locale)
Out Utf<8>::toAnsi(In begin, In end, Out output, char replacement, const std::locale& locale)
{
while (begin < end)
{
Uint32 codepoint;
begin = Decode(begin, end, codepoint);
output = Utf<32>::EncodeAnsi(codepoint, output, replacement, locale);
begin = decode(begin, end, codepoint);
output = Utf<32>::encodeAnsi(codepoint, output, replacement, locale);
}
return output;
@ -217,13 +217,13 @@ Out Utf<8>::ToAnsi(In begin, In end, Out output, char replacement, const std::lo
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<8>::ToWide(In begin, In end, Out output, wchar_t replacement)
Out Utf<8>::toWide(In begin, In end, Out output, wchar_t replacement)
{
while (begin < end)
{
Uint32 codepoint;
begin = Decode(begin, end, codepoint);
output = Utf<32>::EncodeWide(codepoint, output, replacement);
begin = decode(begin, end, codepoint);
output = Utf<32>::encodeWide(codepoint, output, replacement);
}
return output;
@ -232,14 +232,14 @@ Out Utf<8>::ToWide(In begin, In end, Out output, wchar_t replacement)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<8>::ToLatin1(In begin, In end, Out output, char replacement)
Out Utf<8>::toLatin1(In begin, In end, Out output, char replacement)
{
// Latin-1 is directly compatible with Unicode encodings,
// and can thus be treated as (a sub-range of) UTF-32
while (begin < end)
{
Uint32 codepoint;
begin = Decode(begin, end, codepoint);
begin = decode(begin, end, codepoint);
*output++ = codepoint < 256 ? static_cast<char>(codepoint) : replacement;
}
@ -249,7 +249,7 @@ Out Utf<8>::ToLatin1(In begin, In end, Out output, char replacement)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<8>::ToUtf8(In begin, In end, Out output)
Out Utf<8>::toUtf8(In begin, In end, Out output)
{
while (begin < end)
*output++ = *begin++;
@ -260,13 +260,13 @@ Out Utf<8>::ToUtf8(In begin, In end, Out output)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<8>::ToUtf16(In begin, In end, Out output)
Out Utf<8>::toUtf16(In begin, In end, Out output)
{
while (begin < end)
{
Uint32 codepoint;
begin = Decode(begin, end, codepoint);
output = Utf<16>::Encode(codepoint, output);
begin = decode(begin, end, codepoint);
output = Utf<16>::encode(codepoint, output);
}
return output;
@ -275,12 +275,12 @@ Out Utf<8>::ToUtf16(In begin, In end, Out output)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<8>::ToUtf32(In begin, In end, Out output)
Out Utf<8>::toUtf32(In begin, In end, Out output)
{
while (begin < end)
{
Uint32 codepoint;
begin = Decode(begin, end, codepoint);
begin = decode(begin, end, codepoint);
*output++ = codepoint;
}
@ -290,7 +290,7 @@ Out Utf<8>::ToUtf32(In begin, In end, Out output)
////////////////////////////////////////////////////////////
template <typename In>
In Utf<16>::Decode(In begin, In end, Uint32& output, Uint32 replacement)
In Utf<16>::decode(In begin, In end, Uint32& output, Uint32 replacement)
{
Uint16 first = *begin++;
@ -330,7 +330,7 @@ In Utf<16>::Decode(In begin, In end, Uint32& output, Uint32 replacement)
////////////////////////////////////////////////////////////
template <typename Out>
Out Utf<16>::Encode(Uint32 input, Out output, Uint16 replacement)
Out Utf<16>::encode(Uint32 input, Out output, Uint16 replacement)
{
if (input < 0xFFFF)
{
@ -367,21 +367,21 @@ Out Utf<16>::Encode(Uint32 input, Out output, Uint16 replacement)
////////////////////////////////////////////////////////////
template <typename In>
In Utf<16>::Next(In begin, In end)
In Utf<16>::next(In begin, In end)
{
Uint32 codepoint;
return Decode(begin, end, codepoint);
return decode(begin, end, codepoint);
}
////////////////////////////////////////////////////////////
template <typename In>
std::size_t Utf<16>::Count(In begin, In end)
std::size_t Utf<16>::count(In begin, In end)
{
std::size_t length = 0;
while (begin < end)
{
begin = Next(begin, end);
begin = next(begin, end);
++length;
}
@ -391,12 +391,12 @@ std::size_t Utf<16>::Count(In begin, In end)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<16>::FromAnsi(In begin, In end, Out output, const std::locale& locale)
Out Utf<16>::fromAnsi(In begin, In end, Out output, const std::locale& locale)
{
while (begin < end)
{
Uint32 codepoint = Utf<32>::DecodeAnsi(*begin++, locale);
output = Encode(codepoint, output);
Uint32 codepoint = Utf<32>::decodeAnsi(*begin++, locale);
output = encode(codepoint, output);
}
return output;
@ -405,12 +405,12 @@ Out Utf<16>::FromAnsi(In begin, In end, Out output, const std::locale& locale)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<16>::FromWide(In begin, In end, Out output)
Out Utf<16>::fromWide(In begin, In end, Out output)
{
while (begin < end)
{
Uint32 codepoint = Utf<32>::DecodeWide(*begin++);
output = Encode(codepoint, output);
Uint32 codepoint = Utf<32>::decodeWide(*begin++);
output = encode(codepoint, output);
}
return output;
@ -419,7 +419,7 @@ Out Utf<16>::FromWide(In begin, In end, Out output)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<16>::FromLatin1(In begin, In end, Out output)
Out Utf<16>::fromLatin1(In begin, In end, Out output)
{
// Latin-1 is directly compatible with Unicode encodings,
// and can thus be treated as (a sub-range of) UTF-32
@ -432,13 +432,13 @@ Out Utf<16>::FromLatin1(In begin, In end, Out output)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<16>::ToAnsi(In begin, In end, Out output, char replacement, const std::locale& locale)
Out Utf<16>::toAnsi(In begin, In end, Out output, char replacement, const std::locale& locale)
{
while (begin < end)
{
Uint32 codepoint;
begin = Decode(begin, end, codepoint);
output = Utf<32>::EncodeAnsi(codepoint, output, replacement, locale);
begin = decode(begin, end, codepoint);
output = Utf<32>::encodeAnsi(codepoint, output, replacement, locale);
}
return output;
@ -447,13 +447,13 @@ Out Utf<16>::ToAnsi(In begin, In end, Out output, char replacement, const std::l
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<16>::ToWide(In begin, In end, Out output, wchar_t replacement)
Out Utf<16>::toWide(In begin, In end, Out output, wchar_t replacement)
{
while (begin < end)
{
Uint32 codepoint;
begin = Decode(begin, end, codepoint);
output = Utf<32>::EncodeWide(codepoint, output, replacement);
begin = decode(begin, end, codepoint);
output = Utf<32>::encodeWide(codepoint, output, replacement);
}
return output;
@ -462,7 +462,7 @@ Out Utf<16>::ToWide(In begin, In end, Out output, wchar_t replacement)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<16>::ToLatin1(In begin, In end, Out output, char replacement)
Out Utf<16>::toLatin1(In begin, In end, Out output, char replacement)
{
// Latin-1 is directly compatible with Unicode encodings,
// and can thus be treated as (a sub-range of) UTF-32
@ -478,13 +478,13 @@ Out Utf<16>::ToLatin1(In begin, In end, Out output, char replacement)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<16>::ToUtf8(In begin, In end, Out output)
Out Utf<16>::toUtf8(In begin, In end, Out output)
{
while (begin < end)
{
Uint32 codepoint;
begin = Decode(begin, end, codepoint);
output = Utf<8>::Encode(codepoint, output);
begin = decode(begin, end, codepoint);
output = Utf<8>::encode(codepoint, output);
}
return output;
@ -493,7 +493,7 @@ Out Utf<16>::ToUtf8(In begin, In end, Out output)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<16>::ToUtf16(In begin, In end, Out output)
Out Utf<16>::toUtf16(In begin, In end, Out output)
{
while (begin < end)
*output++ = *begin++;
@ -504,12 +504,12 @@ Out Utf<16>::ToUtf16(In begin, In end, Out output)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<16>::ToUtf32(In begin, In end, Out output)
Out Utf<16>::toUtf32(In begin, In end, Out output)
{
while (begin < end)
{
Uint32 codepoint;
begin = Decode(begin, end, codepoint);
begin = decode(begin, end, codepoint);
*output++ = codepoint;
}
@ -519,7 +519,7 @@ Out Utf<16>::ToUtf32(In begin, In end, Out output)
////////////////////////////////////////////////////////////
template <typename In>
In Utf<32>::Decode(In begin, In end, Uint32& output, Uint32)
In Utf<32>::decode(In begin, In end, Uint32& output, Uint32)
{
output = *begin++;
return begin;
@ -528,7 +528,7 @@ In Utf<32>::Decode(In begin, In end, Uint32& output, Uint32)
////////////////////////////////////////////////////////////
template <typename Out>
Out Utf<32>::Encode(Uint32 input, Out output, Uint32 replacement)
Out Utf<32>::encode(Uint32 input, Out output, Uint32 replacement)
{
*output++ = input;
return output;
@ -537,7 +537,7 @@ Out Utf<32>::Encode(Uint32 input, Out output, Uint32 replacement)
////////////////////////////////////////////////////////////
template <typename In>
In Utf<32>::Next(In begin, In end)
In Utf<32>::next(In begin, In end)
{
return ++begin;
}
@ -545,7 +545,7 @@ In Utf<32>::Next(In begin, In end)
////////////////////////////////////////////////////////////
template <typename In>
std::size_t Utf<32>::Count(In begin, In end)
std::size_t Utf<32>::count(In begin, In end)
{
return begin - end;
}
@ -553,10 +553,10 @@ std::size_t Utf<32>::Count(In begin, In end)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<32>::FromAnsi(In begin, In end, Out output, const std::locale& locale)
Out Utf<32>::fromAnsi(In begin, In end, Out output, const std::locale& locale)
{
while (begin < end)
*output++ = DecodeAnsi(*begin++, locale);
*output++ = decodeAnsi(*begin++, locale);
return output;
}
@ -564,10 +564,10 @@ Out Utf<32>::FromAnsi(In begin, In end, Out output, const std::locale& locale)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<32>::FromWide(In begin, In end, Out output)
Out Utf<32>::fromWide(In begin, In end, Out output)
{
while (begin < end)
*output++ = DecodeWide(*begin++);
*output++ = decodeWide(*begin++);
return output;
}
@ -575,7 +575,7 @@ Out Utf<32>::FromWide(In begin, In end, Out output)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<32>::FromLatin1(In begin, In end, Out output)
Out Utf<32>::fromLatin1(In begin, In end, Out output)
{
// Latin-1 is directly compatible with Unicode encodings,
// and can thus be treated as (a sub-range of) UTF-32
@ -588,10 +588,10 @@ Out Utf<32>::FromLatin1(In begin, In end, Out output)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<32>::ToAnsi(In begin, In end, Out output, char replacement, const std::locale& locale)
Out Utf<32>::toAnsi(In begin, In end, Out output, char replacement, const std::locale& locale)
{
while (begin < end)
output = EncodeAnsi(*begin++, output, replacement, locale);
output = encodeAnsi(*begin++, output, replacement, locale);
return output;
}
@ -599,10 +599,10 @@ Out Utf<32>::ToAnsi(In begin, In end, Out output, char replacement, const std::l
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<32>::ToWide(In begin, In end, Out output, wchar_t replacement)
Out Utf<32>::toWide(In begin, In end, Out output, wchar_t replacement)
{
while (begin < end)
output = EncodeWide(*begin++, output, replacement);
output = encodeWide(*begin++, output, replacement);
return output;
}
@ -610,7 +610,7 @@ Out Utf<32>::ToWide(In begin, In end, Out output, wchar_t replacement)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<32>::ToLatin1(In begin, In end, Out output, char replacement)
Out Utf<32>::toLatin1(In begin, In end, Out output, char replacement)
{
// Latin-1 is directly compatible with Unicode encodings,
// and can thus be treated as (a sub-range of) UTF-32
@ -626,20 +626,20 @@ Out Utf<32>::ToLatin1(In begin, In end, Out output, char replacement)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<32>::ToUtf8(In begin, In end, Out output)
Out Utf<32>::toUtf8(In begin, In end, Out output)
{
while (begin < end)
output = Utf<8>::Encode(*begin++, output);
output = Utf<8>::encode(*begin++, output);
return output;
}
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<32>::ToUtf16(In begin, In end, Out output)
Out Utf<32>::toUtf16(In begin, In end, Out output)
{
while (begin < end)
output = Utf<16>::Encode(*begin++, output);
output = Utf<16>::encode(*begin++, output);
return output;
}
@ -647,7 +647,7 @@ Out Utf<32>::ToUtf16(In begin, In end, Out output)
////////////////////////////////////////////////////////////
template <typename In, typename Out>
Out Utf<32>::ToUtf32(In begin, In end, Out output)
Out Utf<32>::toUtf32(In begin, In end, Out output)
{
while (begin < end)
*output++ = *begin++;
@ -658,7 +658,7 @@ Out Utf<32>::ToUtf32(In begin, In end, Out output)
////////////////////////////////////////////////////////////
template <typename In>
Uint32 Utf<32>::DecodeAnsi(In input, const std::locale& locale)
Uint32 Utf<32>::decodeAnsi(In input, const std::locale& locale)
{
// On Windows, gcc's standard library (glibc++) has almost
// no support for Unicode stuff. As a consequence, in this
@ -687,7 +687,7 @@ Uint32 Utf<32>::DecodeAnsi(In input, const std::locale& locale)
////////////////////////////////////////////////////////////
template <typename In>
Uint32 Utf<32>::DecodeWide(In input)
Uint32 Utf<32>::decodeWide(In input)
{
// The encoding of wide characters is not well defined and is left to the system;
// however we can safely assume that it is UCS-2 on Windows and
@ -701,7 +701,7 @@ Uint32 Utf<32>::DecodeWide(In input)
////////////////////////////////////////////////////////////
template <typename Out>
Out Utf<32>::EncodeAnsi(Uint32 codepoint, Out output, char replacement, const std::locale& locale)
Out Utf<32>::encodeAnsi(Uint32 codepoint, Out output, char replacement, const std::locale& locale)
{
// On Windows, gcc's standard library (glibc++) has almost
// no support for Unicode stuff. As a consequence, in this
@ -736,7 +736,7 @@ Out Utf<32>::EncodeAnsi(Uint32 codepoint, Out output, char replacement, const st
////////////////////////////////////////////////////////////
template <typename Out>
Out Utf<32>::EncodeWide(Uint32 codepoint, Out output, wchar_t replacement)
Out Utf<32>::encodeWide(Uint32 codepoint, Out output, wchar_t replacement)
{
// The encoding of wide characters is not well defined and is left to the system;
// however we can safely assume that it is UCS-2 on Windows and

View file

@ -73,7 +73,7 @@ public :
/// \return True on success, false on failure
///
////////////////////////////////////////////////////////////
bool SetActive(bool active);
bool setActive(bool active);
public :
@ -125,7 +125,7 @@ private :
///
/// Usage example:
/// \code
/// void ThreadFunction(void*)
/// void threadFunction(void*)
/// {
/// sf::Context context;
/// // from now on, you have a valid context

View file

@ -46,22 +46,22 @@ struct ContextSettings
///
////////////////////////////////////////////////////////////
explicit ContextSettings(unsigned int depth = 0, unsigned int stencil = 0, unsigned int antialiasing = 0, unsigned int major = 2, unsigned int minor = 0) :
DepthBits (depth),
StencilBits (stencil),
AntialiasingLevel(antialiasing),
MajorVersion (major),
MinorVersion (minor)
depthBits (depth),
stencilBits (stencil),
antialiasingLevel(antialiasing),
majorVersion (major),
minorVersion (minor)
{
}
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
unsigned int DepthBits; ///< Bits of the depth buffer
unsigned int StencilBits; ///< Bits of the stencil buffer
unsigned int AntialiasingLevel; ///< Level of antialiasing
unsigned int MajorVersion; ///< Major number of the context version to create
unsigned int MinorVersion; ///< Minor number of the context version to create
unsigned int depthBits; ///< Bits of the depth buffer
unsigned int stencilBits; ///< Bits of the stencil buffer
unsigned int antialiasingLevel; ///< Level of antialiasing
unsigned int majorVersion; ///< Major number of the context version to create
unsigned int minorVersion; ///< Minor number of the context version to create
};
} // namespace sf
@ -81,14 +81,14 @@ struct ContextSettings
/// you may need to use this structure only if you're using
/// SFML as a windowing system for custom OpenGL rendering.
///
/// The DepthBits and StencilBits members define the number
/// The depthBits and stencilBits members define the number
/// of bits per pixel requested for the (respectively) depth
/// and stencil buffers.
///
/// AntialiasingLevel represents the requested number of
/// antialiasingLevel represents the requested number of
/// multisampling levels for anti-aliasing.
///
/// MajorVersion and MinorVersion define the version of the
/// majorVersion and minorVersion define the version of the
/// OpenGL context that you want. Only versions greater or
/// equal to 3.0 are relevant; versions lesser than 3.0 are
/// all handled the same way (i.e. you can use any version
@ -99,6 +99,6 @@ struct ContextSettings
/// are not supported by the system; instead, SFML will try to
/// find the closest valid match. You can then retrieve the
/// settings that the window actually used to create its context,
/// with Window::GetSettings().
/// with Window::getSettings().
///
////////////////////////////////////////////////////////////

View file

@ -50,8 +50,8 @@ public :
////////////////////////////////////////////////////////////
struct SizeEvent
{
unsigned int Width; ///< New width, in pixels
unsigned int Height; ///< New height, in pixels
unsigned int width; ///< New width, in pixels
unsigned int height; ///< New height, in pixels
};
////////////////////////////////////////////////////////////
@ -60,11 +60,11 @@ public :
////////////////////////////////////////////////////////////
struct KeyEvent
{
Keyboard::Key Code; ///< Code of the key that has been pressed
bool Alt; ///< Is the Alt key pressed?
bool Control; ///< Is the Control key pressed?
bool Shift; ///< Is the Shift key pressed?
bool System; ///< Is the System key pressed?
Keyboard::Key code; ///< Code of the key that has been pressed
bool alt; ///< Is the Alt key pressed?
bool control; ///< Is the Control key pressed?
bool shift; ///< Is the Shift key pressed?
bool system; ///< Is the System key pressed?
};
////////////////////////////////////////////////////////////
@ -73,7 +73,7 @@ public :
////////////////////////////////////////////////////////////
struct TextEvent
{
Uint32 Unicode; ///< UTF-32 unicode value of the character
Uint32 unicode; ///< UTF-32 unicode value of the character
};
////////////////////////////////////////////////////////////
@ -82,8 +82,8 @@ public :
////////////////////////////////////////////////////////////
struct MouseMoveEvent
{
int X; ///< X position of the mouse pointer, relative to the left of the owner window
int Y; ///< Y position of the mouse pointer, relative to the top of the owner window
int x; ///< X position of the mouse pointer, relative to the left of the owner window
int y; ///< Y position of the mouse pointer, relative to the top of the owner window
};
////////////////////////////////////////////////////////////
@ -93,9 +93,9 @@ public :
////////////////////////////////////////////////////////////
struct MouseButtonEvent
{
Mouse::Button Button; ///< Code of the button that has been pressed
int X; ///< X position of the mouse pointer, relative to the left of the owner window
int Y; ///< Y position of the mouse pointer, relative to the top of the owner window
Mouse::Button button; ///< Code of the button that has been pressed
int x; ///< X position of the mouse pointer, relative to the left of the owner window
int y; ///< Y position of the mouse pointer, relative to the top of the owner window
};
////////////////////////////////////////////////////////////
@ -104,9 +104,9 @@ public :
////////////////////////////////////////////////////////////
struct MouseWheelEvent
{
int Delta; ///< Number of ticks the wheel has moved (positive is up, negative is down)
int X; ///< X position of the mouse pointer, relative to the left of the owner window
int Y; ///< Y position of the mouse pointer, relative to the top of the owner window
int delta; ///< Number of ticks the wheel has moved (positive is up, negative is down)
int x; ///< X position of the mouse pointer, relative to the left of the owner window
int y; ///< Y position of the mouse pointer, relative to the top of the owner window
};
////////////////////////////////////////////////////////////
@ -116,7 +116,7 @@ public :
////////////////////////////////////////////////////////////
struct JoystickConnectEvent
{
unsigned int JoystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1])
unsigned int joystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1])
};
////////////////////////////////////////////////////////////
@ -125,9 +125,9 @@ public :
////////////////////////////////////////////////////////////
struct JoystickMoveEvent
{
unsigned int JoystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1])
Joystick::Axis Axis; ///< Axis on which the joystick moved
float Position; ///< New position on the axis (in range [-100 .. 100])
unsigned int joystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1])
Joystick::Axis axis; ///< Axis on which the joystick moved
float position; ///< New position on the axis (in range [-100 .. 100])
};
////////////////////////////////////////////////////////////
@ -137,8 +137,8 @@ public :
////////////////////////////////////////////////////////////
struct JoystickButtonEvent
{
unsigned int JoystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1])
unsigned int Button; ///< Index of the button that has been pressed (in range [0 .. Joystick::ButtonCount - 1])
unsigned int joystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1])
unsigned int button; ///< Index of the button that has been pressed (in range [0 .. Joystick::ButtonCount - 1])
};
////////////////////////////////////////////////////////////
@ -172,19 +172,19 @@ public :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
EventType Type; ///< Type of the event
EventType type; ///< Type of the event
union
{
SizeEvent Size; ///< Size event parameters
KeyEvent Key; ///< Key event parameters
TextEvent Text; ///< Text event parameters
MouseMoveEvent MouseMove; ///< Mouse move event parameters
MouseButtonEvent MouseButton; ///< Mouse button event parameters
MouseWheelEvent MouseWheel; ///< Mouse wheel event parameters
JoystickMoveEvent JoystickMove; ///< Joystick move event parameters
JoystickButtonEvent JoystickButton; ///< Joystick button event parameters
JoystickConnectEvent JoystickConnect; ///< Joystick (dis)connect event parameters
SizeEvent size; ///< Size event parameters
KeyEvent key; ///< Key event parameters
TextEvent text; ///< Text event parameters
MouseMoveEvent mouseMove; ///< Mouse move event parameters
MouseButtonEvent mouseButton; ///< Mouse button event parameters
MouseWheelEvent mouseWheel; ///< Mouse wheel event parameters
JoystickMoveEvent joystickMove; ///< Joystick move event parameters
JoystickButtonEvent joystickButton; ///< Joystick button event parameters
JoystickConnectEvent joystickConnect; ///< Joystick (dis)connect event parameters
};
};
@ -200,7 +200,7 @@ public :
///
/// sf::Event holds all the informations about a system event
/// that just happened. Events are retrieved using the
/// sf::Window::PollEvent and sf::Window::WaitEvent functions.
/// sf::Window::pollEvent and sf::Window::waitEvent functions.
///
/// A sf::Event instance contains the type of the event
/// (mouse moved, key pressed, window closed, ...) as well
@ -210,25 +210,25 @@ public :
/// filled; all other members will have undefined values and must not
/// be read if the type of the event doesn't match. For example,
/// if you received a KeyPressed event, then you must read the
/// event.Key member, all other members such as event.MouseMove
/// or event.Text will have undefined values.
/// event.key member, all other members such as event.MouseMove
/// or event.text will have undefined values.
///
/// Usage example:
/// \code
/// sf::Event event;
/// while (window.PollEvent(event))
/// while (window.pollEvent(event))
/// {
/// // Request for closing the window
/// if (event.Type == sf::Event::Closed)
/// window.Close();
/// if (event.type == sf::Event::Closed)
/// window.close();
///
/// // The escape key was pressed
/// if ((event.Type == sf::Event::KeyPressed) && (event.Key.Code == sf::Keyboard::Escape))
/// window.Close();
/// if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape))
/// window.close();
///
/// // The window was resized
/// if (event.Type == sf::Event::Resized)
/// DoSomethingWithTheNewSize(event.Size.Width, event.Size.Height);
/// if (event.type == sf::Event::Resized)
/// doSomethingWithTheNewSize(event.size.width, event.size.height);
///
/// // etc ...
/// }

View file

@ -53,7 +53,11 @@ protected :
////////////////////////////////////////////////////////////
~GlResource();
static void EnsureGlContext();
////////////////////////////////////////////////////////////
/// \brief Make sure that a valid OpenGL context exists in the current thread
///
////////////////////////////////////////////////////////////
static void ensureGlContext();
};
} // namespace sf

View file

@ -76,7 +76,7 @@ public :
/// \return True if the joystick is connected, false otherwise
///
////////////////////////////////////////////////////////////
static bool IsConnected(unsigned int joystick);
static bool isConnected(unsigned int joystick);
////////////////////////////////////////////////////////////
/// \brief Return the number of buttons supported by a joystick
@ -88,7 +88,7 @@ public :
/// \return Number of buttons supported by the joystick
///
////////////////////////////////////////////////////////////
static unsigned int GetButtonCount(unsigned int joystick);
static unsigned int getButtonCount(unsigned int joystick);
////////////////////////////////////////////////////////////
/// \brief Check if a joystick supports a given axis
@ -101,7 +101,7 @@ public :
/// \return True if the joystick supports the axis, false otherwise
///
////////////////////////////////////////////////////////////
static bool HasAxis(unsigned int joystick, Axis axis);
static bool hasAxis(unsigned int joystick, Axis axis);
////////////////////////////////////////////////////////////
/// \brief Check if a joystick button is pressed
@ -114,7 +114,7 @@ public :
/// \return True if the button is pressed, false otherwise
///
////////////////////////////////////////////////////////////
static bool IsButtonPressed(unsigned int joystick, unsigned int button);
static bool isButtonPressed(unsigned int joystick, unsigned int button);
////////////////////////////////////////////////////////////
/// \brief Get the current position of a joystick axis
@ -127,7 +127,7 @@ public :
/// \return Current position of the axis, in range [-100 .. 100]
///
////////////////////////////////////////////////////////////
static float GetAxisPosition(unsigned int joystick, Axis axis);
static float getAxisPosition(unsigned int joystick, Axis axis);
////////////////////////////////////////////////////////////
/// \brief Update the states of all joysticks
@ -138,7 +138,7 @@ public :
/// in this case the joysticks states are not updated automatically.
///
////////////////////////////////////////////////////////////
static void Update();
static void update();
};
} // namespace sf
@ -173,29 +173,29 @@ public :
/// \li 8 axes per joystick (sf::Joystick::AxisCount)
///
/// Unlike the keyboard or mouse, the state of joysticks is sometimes
/// not directly available (depending on the OS), therefore an Update()
/// not directly available (depending on the OS), therefore an update()
/// function must be called in order to update the current state of
/// joysticks. When you have a window with event handling, this is done
/// automatically, you don't need to call anything. But if you have no
/// window, or if you want to check joysticks state before creating one,
/// you must call sf::Joystick::Update explicitely.
/// you must call sf::Joystick::update explicitely.
///
/// Usage example:
/// \code
/// // Is joystick #0 connected?
/// bool connected = sf::Joystick::IsConnected(0);
/// bool connected = sf::Joystick::isConnected(0);
///
/// // How many buttons does joystick #0 support?
/// unsigned int buttons = sf::Joystick::GetButtonCount(0);
/// unsigned int buttons = sf::Joystick::getButtonCount(0);
///
/// // Does joystick #0 define a X axis?
/// bool hasX = sf::Joystick::HasAxis(0, sf::Joystick::X);
/// bool hasX = sf::Joystick::hasAxis(0, sf::Joystick::X);
///
/// // Is button #2 pressed on joystick #0?
/// bool pressed = sf::Joystick::IsButtonPressed(0, 2);
/// bool pressed = sf::Joystick::isButtonPressed(0, 2);
///
/// // What's the current position of the Y axis on joystick #0?
/// float position = sf::Joystick::GetAxisPosition(0, sf::Joystick::Y);
/// float position = sf::Joystick::getAxisPosition(0, sf::Joystick::Y);
/// \endcode
///
/// \see sf::Keyboard, sf::Mouse

View file

@ -160,7 +160,7 @@ public :
/// \return True if the key is pressed, false otherwise
///
////////////////////////////////////////////////////////////
static bool IsKeyPressed(Key key);
static bool isKeyPressed(Key key);
};
} // namespace sf
@ -189,15 +189,15 @@ public :
///
/// Usage example:
/// \code
/// if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Left))
/// if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
/// {
/// // move left...
/// }
/// else if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Right))
/// else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
/// {
/// // move right...
/// }
/// else if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Escape))
/// else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
/// {
/// // quit...
/// }

View file

@ -67,7 +67,7 @@ public :
/// \return True if the button is pressed, false otherwise
///
////////////////////////////////////////////////////////////
static bool IsButtonPressed(Button button);
static bool isButtonPressed(Button button);
////////////////////////////////////////////////////////////
/// \brief Get the current position of the mouse in desktop coordinates
@ -78,7 +78,7 @@ public :
/// \return Current position of the mouse
///
////////////////////////////////////////////////////////////
static Vector2i GetPosition();
static Vector2i getPosition();
////////////////////////////////////////////////////////////
/// \brief Get the current position of the mouse in window coordinates
@ -91,7 +91,7 @@ public :
/// \return Current position of the mouse
///
////////////////////////////////////////////////////////////
static Vector2i GetPosition(const Window& relativeTo);
static Vector2i getPosition(const Window& relativeTo);
////////////////////////////////////////////////////////////
/// \brief Set the current position of the mouse in desktop coordinates
@ -102,7 +102,7 @@ public :
/// \param position New position of the mouse
///
////////////////////////////////////////////////////////////
static void SetPosition(const Vector2i& position);
static void setPosition(const Vector2i& position);
////////////////////////////////////////////////////////////
/// \brief Set the current position of the mouse in window coordinates
@ -114,7 +114,7 @@ public :
/// \param relativeTo Reference window
///
////////////////////////////////////////////////////////////
static void SetPosition(const Vector2i& position, const Window& relativeTo);
static void setPosition(const Vector2i& position, const Window& relativeTo);
};
} // namespace sf
@ -150,16 +150,16 @@ public :
///
/// Usage example:
/// \code
/// if (sf::Mouse::IsButtonPressed(sf::Mouse::Left))
/// if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
/// {
/// // left click...
/// }
///
/// // get global mouse position
/// sf::Vector2i position = sf::Mouse::GetPosition();
/// sf::Vector2i position = sf::Mouse::getPosition();
///
/// // set mouse position relative to a window
/// sf::Mouse::SetPosition(sf::Vector2i(100, 200), window);
/// sf::Mouse::setPosition(sf::Vector2i(100, 200), window);
/// \endcode
///
/// \see sf::Joystick, sf::Keyboard

View file

@ -66,7 +66,7 @@ public :
/// \return Current desktop video mode
///
////////////////////////////////////////////////////////////
static VideoMode GetDesktopMode();
static VideoMode getDesktopMode();
////////////////////////////////////////////////////////////
/// \brief Retrieve all the video modes supported in fullscreen mode
@ -82,7 +82,7 @@ public :
/// \return Array containing all the supported fullscreen modes
///
////////////////////////////////////////////////////////////
static const std::vector<VideoMode>& GetFullscreenModes();
static const std::vector<VideoMode>& getFullscreenModes();
////////////////////////////////////////////////////////////
/// \brief Tell whether or not the video mode is valid
@ -94,14 +94,14 @@ public :
/// \return True if the video mode is valid for fullscreen mode
///
////////////////////////////////////////////////////////////
bool IsValid() const;
bool isValid() const;
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
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
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
};
////////////////////////////////////////////////////////////
@ -198,31 +198,31 @@ SFML_WINDOW_API bool operator >=(const VideoMode& left, const VideoMode& right);
///
/// sf::VideoMode provides a static function for retrieving
/// the list of all the video modes supported by the system:
/// GetFullscreenModes().
/// getFullscreenModes().
///
/// A custom video mode can also be checked directly for
/// fullscreen compatibility with its IsValid() function.
///
/// Additionnally, sf::VideoMode provides a static function
/// to get the mode currently used by the desktop: GetDesktopMode().
/// to get the mode currently used by the desktop: getDesktopMode().
/// This allows to build windows with the same size or pixel
/// depth as the current resolution.
///
/// Usage example:
/// \code
/// // Display the list of all the video modes available for fullscreen
/// std::vector<sf::VideoMode> modes = sf::VideoMode::GetFullscreenModes();
/// std::vector<sf::VideoMode> modes = sf::VideoMode::getFullscreenModes();
/// for (std::size_t i = 0; i < modes.size(); ++i)
/// {
/// sf::VideoMode mode = modes[i];
/// std::cout << "Mode #" << i << ": "
/// << mode.Width << "x" << mode.Height << " - "
/// << mode.BitsPerPixel << " bpp" << std::endl;
/// << mode.width << "x" << mode.height << " - "
/// << mode.bitsPerPixel << " bpp" << std::endl;
/// }
///
/// // Create a window with the same pixel depth as the desktop
/// sf::VideoMode desktop = sf::VideoMode::GetDesktopMode();
/// window.Create(sf::VideoMode(1024, 768, desktop.BitsPerPixel), "SFML window");
/// sf::VideoMode desktop = sf::VideoMode::getDesktopMode();
/// window.create(sf::VideoMode(1024, 768, desktop.bitsPerPixel), "SFML window");
/// \endcode
///
////////////////////////////////////////////////////////////

View file

@ -62,7 +62,7 @@ public :
/// \brief Default constructor
///
/// This constructor doesn't actually create the window,
/// use the other constructors or call Create to do so.
/// use the other constructors or call create to do so.
///
////////////////////////////////////////////////////////////
Window();
@ -125,7 +125,7 @@ public :
/// \param settings Additional settings for the underlying OpenGL context
///
////////////////////////////////////////////////////////////
void Create(VideoMode mode, const std::string& title, Uint32 style = Style::Default, const ContextSettings& settings = ContextSettings());
void create(VideoMode mode, const std::string& title, Uint32 style = Style::Default, const ContextSettings& settings = ContextSettings());
////////////////////////////////////////////////////////////
/// \brief Create (or recreate) the window from an existing control
@ -138,44 +138,44 @@ public :
/// \param settings Additional settings for the underlying OpenGL context
///
////////////////////////////////////////////////////////////
void Create(WindowHandle handle, const ContextSettings& settings = ContextSettings());
void create(WindowHandle handle, const ContextSettings& settings = ContextSettings());
////////////////////////////////////////////////////////////
/// \brief Close the window and destroy all the attached resources
///
/// After calling this function, the sf::Window instance remains
/// valid and you can call Create() to recreate the window.
/// All other functions such as PollEvent() or Display() will
/// still work (i.e. you don't have to test IsOpen() every time),
/// valid and you can call create() to recreate the window.
/// All other functions such as pollEvent() or display() will
/// still work (i.e. you don't have to test isOpen() every time),
/// and will have no effect on closed windows.
///
////////////////////////////////////////////////////////////
void Close();
void close();
////////////////////////////////////////////////////////////
/// \brief Tell whether or not the window is open
///
/// This function returns whether or not the window exists.
/// Note that a hidden window (SetVisible(false)) is open
/// Note that a hidden window (setVisible(false)) is open
/// (therefore this function would return true).
///
/// \return True if the window is open, false if it has been closed
///
////////////////////////////////////////////////////////////
bool IsOpen() const;
bool isOpen() const;
////////////////////////////////////////////////////////////
/// \brief Get the settings of the OpenGL context of the window
///
/// Note that these settings may be different from what was
/// passed to the constructor or the Create() function,
/// passed to the constructor or the create() function,
/// if one or more settings were not supported. In this case,
/// SFML chose the closest match.
///
/// \return Structure containing the OpenGL context settings
///
////////////////////////////////////////////////////////////
const ContextSettings& GetSettings() const;
const ContextSettings& getSettings() const;
////////////////////////////////////////////////////////////
/// \brief Pop the event on top of events stack, if any, and return it
@ -187,7 +187,7 @@ public :
/// to make sure that you process every pending event.
/// \code
/// sf::Event event;
/// while (window.PollEvent(event))
/// while (window.pollEvent(event))
/// {
/// // process event...
/// }
@ -197,10 +197,10 @@ public :
///
/// \return True if an event was returned, or false if the events stack was empty
///
/// \see WaitEvent
/// \see waitEvent
///
////////////////////////////////////////////////////////////
bool PollEvent(Event& event);
bool pollEvent(Event& event);
////////////////////////////////////////////////////////////
/// \brief Wait for an event and return it
@ -214,7 +214,7 @@ public :
/// sleep as long as no new event is received.
/// \code
/// sf::Event event;
/// if (window.WaitEvent(event))
/// if (window.waitEvent(event))
/// {
/// // process event...
/// }
@ -224,20 +224,20 @@ public :
///
/// \return False if any error occured
///
/// \see PollEvent
/// \see pollEvent
///
////////////////////////////////////////////////////////////
bool WaitEvent(Event& event);
bool waitEvent(Event& event);
////////////////////////////////////////////////////////////
/// \brief Get the position of the window
///
/// \return Position of the window, in pixels
///
/// \see SetPosition
/// \see setPosition
///
////////////////////////////////////////////////////////////
Vector2i GetPosition() const;
Vector2i getPosition() const;
////////////////////////////////////////////////////////////
/// \brief Change the position of the window on screen
@ -248,10 +248,10 @@ public :
///
/// \param position New position, in pixels
///
/// \see GetPosition
/// \see getPosition
///
////////////////////////////////////////////////////////////
void SetPosition(const Vector2i& position);
void setPosition(const Vector2i& position);
////////////////////////////////////////////////////////////
/// \brief Get the size of the rendering region of the window
@ -261,30 +261,30 @@ public :
///
/// \return Size in pixels
///
/// \see SetSize
/// \see setSize
///
////////////////////////////////////////////////////////////
Vector2u GetSize() const;
Vector2u getSize() const;
////////////////////////////////////////////////////////////
/// \brief Change the size of the rendering region of the window
///
/// \param size New size, in pixels
///
/// \see GetSize
/// \see getSize
///
////////////////////////////////////////////////////////////
void SetSize(const Vector2u size);
void setSize(const Vector2u size);
////////////////////////////////////////////////////////////
/// \brief Change the title of the window
///
/// \param title New title
///
/// \see SetIcon
/// \see setIcon
///
////////////////////////////////////////////////////////////
void SetTitle(const std::string& title);
void setTitle(const std::string& title);
////////////////////////////////////////////////////////////
/// \brief Change the window's icon
@ -298,10 +298,10 @@ public :
/// \param height Icon's height, in pixels
/// \param pixels Pointer to the array of pixels in memory
///
/// \see SetTitle
/// \see setTitle
///
////////////////////////////////////////////////////////////
void SetIcon(unsigned int width, unsigned int height, const Uint8* pixels);
void setIcon(unsigned int width, unsigned int height, const Uint8* pixels);
////////////////////////////////////////////////////////////
/// \brief Show or hide the window
@ -311,7 +311,7 @@ public :
/// \param visible True to show the window, false to hide it
///
////////////////////////////////////////////////////////////
void SetVisible(bool visible);
void setVisible(bool visible);
////////////////////////////////////////////////////////////
/// \brief Enable or disable vertical synchronization
@ -326,7 +326,7 @@ public :
/// \param enabled True to enable v-sync, false to deactivate it
///
////////////////////////////////////////////////////////////
void SetVerticalSyncEnabled(bool enabled);
void setVerticalSyncEnabled(bool enabled);
////////////////////////////////////////////////////////////
/// \brief Show or hide the mouse cursor
@ -336,7 +336,7 @@ public :
/// \param visible True to show the mouse cursor, false to hide it
///
////////////////////////////////////////////////////////////
void SetMouseCursorVisible(bool visible);
void setMouseCursorVisible(bool visible);
////////////////////////////////////////////////////////////
/// \brief Enable or disable automatic key-repeat
@ -350,16 +350,16 @@ public :
/// \param enabled True to enable, false to disable
///
////////////////////////////////////////////////////////////
void SetKeyRepeatEnabled(bool enabled);
void setKeyRepeatEnabled(bool enabled);
////////////////////////////////////////////////////////////
/// \brief Limit the framerate to a maximum fixed frequency
///
/// If a limit is set, the window will use a small delay after
/// each call to Display() to ensure that the current frame
/// each call to display() to ensure that the current frame
/// lasted long enough to match the framerate limit.
/// SFML will try to match the given limit as much as it can,
/// but since it internally uses sf::Sleep, whose precision
/// but since it internally uses sf::sleep, whose precision
/// depends on the underlying OS, the results may be a little
/// unprecise as well (for example, you can get 65 FPS when
/// requesting 60).
@ -367,20 +367,20 @@ public :
/// \param limit Framerate limit, in frames per seconds (use 0 to disable limit)
///
////////////////////////////////////////////////////////////
void SetFramerateLimit(unsigned int limit);
void setFramerateLimit(unsigned int limit);
////////////////////////////////////////////////////////////
/// \brief Change the joystick threshold
///
/// The joystick threshold is the value below which
/// no JoyMoved event will be generated.
/// no JoystickMoved event will be generated.
///
/// The threshold value is 0.1 by default.
///
/// \param threshold New threshold, in the range [0, 100]
///
////////////////////////////////////////////////////////////
void SetJoystickThreshold(float threshold);
void setJoystickThreshold(float threshold);
////////////////////////////////////////////////////////////
/// \brief Activate or deactivate the window as the current target
@ -397,7 +397,7 @@ public :
/// \return True if operation was successful, false otherwise
///
////////////////////////////////////////////////////////////
bool SetActive(bool active = true) const;
bool setActive(bool active = true) const;
////////////////////////////////////////////////////////////
/// \brief Display on screen what has been rendered to the window so far
@ -407,7 +407,7 @@ public :
/// it on screen.
///
////////////////////////////////////////////////////////////
void Display();
void display();
////////////////////////////////////////////////////////////
/// \brief Get the OS-specific handle of the window
@ -421,7 +421,7 @@ public :
/// \return System handle of the window
///
////////////////////////////////////////////////////////////
WindowHandle GetSystemHandle() const;
WindowHandle getSystemHandle() const;
private :
@ -433,7 +433,7 @@ private :
/// the window is created.
///
////////////////////////////////////////////////////////////
virtual void OnCreate();
virtual void onCreate();
////////////////////////////////////////////////////////////
/// \brief Function called after the window has been resized
@ -442,13 +442,13 @@ private :
/// perform custom actions when the size of the window changes.
///
////////////////////////////////////////////////////////////
virtual void OnResize();
virtual void onResize();
////////////////////////////////////////////////////////////
/// \brief Processes an event before it is sent to the user
///
/// This function is called every time an event is received
/// from the internal window (through PollEvent or WaitEvent).
/// from the internal window (through pollEvent or waitEvent).
/// It filters out unwanted events, and performs whatever internal
/// stuff the window needs before the event is returned to the
/// user.
@ -456,13 +456,13 @@ private :
/// \param event Event to filter
///
////////////////////////////////////////////////////////////
bool FilterEvent(const Event& event);
bool filterEvent(const Event& event);
////////////////////////////////////////////////////////////
/// \brief Perform some common internal initializations
///
////////////////////////////////////////////////////////////
void Initialize();
void initialize();
////////////////////////////////////////////////////////////
// Member data
@ -487,7 +487,7 @@ private :
/// an OS window that is able to receive an OpenGL rendering.
///
/// A sf::Window can create its own new window, or be embedded into
/// an already existing control using the Create(handle) function.
/// an already existing control using the create(handle) function.
/// This can be useful for embedding an OpenGL rendering area into
/// a view which is part of a bigger GUI with existing windows,
/// controls, etc. It can also serve as embedding an OpenGL rendering
@ -496,7 +496,7 @@ private :
///
/// The sf::Window class provides a simple interface for manipulating
/// the window: move, resize, show/hide, control mouse cursor, etc.
/// It also provides event handling through its PollEvent() and WaitEvent()
/// It also provides event handling through its pollEvent() and waitEvent()
/// functions.
///
/// Note that OpenGL experts can pass their own parameters (antialiasing
@ -511,27 +511,27 @@ private :
/// sf::Window window(sf::VideoMode(800, 600), "SFML window");
///
/// // Limit the framerate to 60 frames per second (this step is optional)
/// window.SetFramerateLimit(60);
/// window.setFramerateLimit(60);
///
/// // The main loop - ends as soon as the window is closed
/// while (window.IsOpen())
/// while (window.isOpen())
/// {
/// // Event processing
/// sf::Event event;
/// while (window.PollEvent(event))
/// while (window.pollEvent(event))
/// {
/// // Request for closing the window
/// if (event.Type == sf::Event::Closed)
/// window.Close();
/// if (event.type == sf::Event::Closed)
/// window.close();
/// }
///
/// // Activate the window for OpenGL rendering
/// window.SetActive();
/// window.setActive();
///
/// // OpenGL drawing commands go here...
///
/// // End the current frame and display its contents on screen
/// window.Display();
/// window.display();
/// }
/// \endcode
///