Changed internal naming convention (local variables now start with a lower case character)
Removed the AudioResource class git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1166 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
7cc00085d8
commit
45b150648d
245 changed files with 7865 additions and 8065 deletions
|
@ -1,67 +0,0 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_AUDIORESOURCE_HPP
|
||||
#define SFML_AUDIORESOURCE_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.hpp>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Abstract base class for every class that owns a
|
||||
/// device-dependant resource -- allow them to initialize / shutdown
|
||||
/// even when the audio context is not created
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_API AudioResource
|
||||
{
|
||||
protected :
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Default constructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
AudioResource();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy constructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
AudioResource(const AudioResource&);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual ~AudioResource();
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_AUDIORESOURCE_HPP
|
|
@ -47,10 +47,10 @@ public :
|
|||
/// Change the global volume of all the sounds.
|
||||
/// The default volume is 100
|
||||
///
|
||||
/// \param Volume : New global volume, in the range [0, 100]
|
||||
/// \param volume : New global volume, in the range [0, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void SetGlobalVolume(float Volume);
|
||||
static void SetGlobalVolume(float volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current value of the global volume of all the sounds
|
||||
|
@ -64,19 +64,19 @@ public :
|
|||
/// Change the position of the listener (take 3 values).
|
||||
/// The default position is (0, 0, 0)
|
||||
///
|
||||
/// \param X, Y, Z : Position of the listener in the world
|
||||
/// \param x, y, z : Position of the listener in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void SetPosition(float X, float Y, float Z);
|
||||
static void SetPosition(float x, float y, float z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of the listener (take a 3D vector).
|
||||
/// The default position is (0, 0, 0)
|
||||
///
|
||||
/// \param Position : Position of the listener in the world
|
||||
/// \param position : Position of the listener in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void SetPosition(const Vector3f& Position);
|
||||
static void SetPosition(const Vector3f& position);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current position of the listener
|
||||
|
@ -91,20 +91,20 @@ public :
|
|||
/// he must look at) (take 3 values).
|
||||
/// The default target is (0, 0, -1)
|
||||
///
|
||||
/// \param X, Y, Z : Position of the point the listener must look at
|
||||
/// \param x, y, z : Position of the point the listener must look at
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void SetTarget(float X, float Y, float Z);
|
||||
static void SetTarget(float x, float y, float z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the orientation of the listener (the point
|
||||
/// he must look at) (take a 3D vector).
|
||||
/// The default target is (0, 0, -1)
|
||||
///
|
||||
/// \param Target : Position of the point the listener must look at
|
||||
/// \param target : Position of the point the listener must look at
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void SetTarget(const Vector3f& Target);
|
||||
static void SetTarget(const Vector3f& target);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current orientation of the listener (the point
|
||||
|
|
|
@ -52,11 +52,11 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the music with a buffer size
|
||||
///
|
||||
/// \param BufferSize : Size of the internal buffer, expressed in number of samples
|
||||
/// \param bufferSize : Size of the internal buffer, expressed in number of samples
|
||||
/// (ie. size taken by the music in memory) (44100 by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Music(std::size_t BufferSize = 44100);
|
||||
Music(std::size_t bufferSize = 44100);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destructor
|
||||
|
@ -67,23 +67,23 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Open a music file (doesn't play it -- call Play() for that)
|
||||
///
|
||||
/// \param Filename : Path of the music file to open
|
||||
/// \param filename : Path of the music file to open
|
||||
///
|
||||
/// \return True if loading has been successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool OpenFromFile(const std::string& Filename);
|
||||
bool OpenFromFile(const std::string& filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Open a music file from memory (doesn't play it -- call Play() for that)
|
||||
///
|
||||
/// \param Data : Pointer to the file data in memory
|
||||
/// \param SizeInBytes : Size of the data to load, in bytes
|
||||
/// \param data : Pointer to the file data in memory
|
||||
/// \param sizeInBytes : Size of the data to load, in bytes
|
||||
///
|
||||
/// \return True if loading has been successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool OpenFromMemory(const char* Data, std::size_t SizeInBytes);
|
||||
bool OpenFromMemory(const char* data, std::size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the music duration
|
||||
|
@ -99,13 +99,13 @@ private :
|
|||
/// /see SoundStream::OnGetData
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual bool OnGetData(Chunk& Data);
|
||||
virtual bool OnGetData(Chunk& data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// /see SoundStream::OnSeek
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void OnSeek(float TimeOffset);
|
||||
virtual void OnSeek(float timeOffset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.hpp>
|
||||
#include <SFML/System/Resource.hpp>
|
||||
#include <SFML/System/Vector3.hpp>
|
||||
#include <SFML/Audio/AudioResource.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ class SoundBuffer;
|
|||
/// Sound defines the properties of a sound such as position,
|
||||
/// volume, pitch, etc.
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_API Sound : public AudioResource
|
||||
class SFML_API Sound
|
||||
{
|
||||
public :
|
||||
|
||||
|
@ -65,22 +65,22 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the sound from its parameters
|
||||
///
|
||||
/// \param Buffer : Sound buffer to play (NULL by default)
|
||||
/// \param Loop : Loop flag (false by default)
|
||||
/// \param Pitch : Value of the pitch (1 by default)
|
||||
/// \param Volume : Volume (100 by default)
|
||||
/// \param Position : Position (0, 0, 0 by default)
|
||||
/// \param buffer : Sound buffer to play (NULL by default)
|
||||
/// \param loop : Loop flag (false by default)
|
||||
/// \param pitch : Value of the pitch (1 by default)
|
||||
/// \param volume : Volume (100 by default)
|
||||
/// \param position : Position (0, 0, 0 by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Sound(const SoundBuffer& Buffer, bool Loop = false, float Pitch = 1.f, float Volume = 100.f, const Vector3f& Position = Vector3f(0, 0, 0));
|
||||
Sound(const SoundBuffer& buffer, bool loop = false, float pitch = 1.f, float volume = 100.f, const Vector3f& position = Vector3f(0, 0, 0));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy constructor
|
||||
///
|
||||
/// \param Copy : Instance to copy
|
||||
/// \param copy : Instance to copy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Sound(const Sound& Copy);
|
||||
Sound(const Sound& copy);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destructor
|
||||
|
@ -109,93 +109,93 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Set the source buffer
|
||||
///
|
||||
/// \param Buffer : New sound buffer to bind to the sound
|
||||
/// \param buffer : New sound buffer to bind to the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetBuffer(const SoundBuffer& Buffer);
|
||||
void SetBuffer(const SoundBuffer& buffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the sound loop state.
|
||||
/// This parameter is disabled by default
|
||||
///
|
||||
/// \param Loop : True to play in loop, false to play once
|
||||
/// \param loop : True to play in loop, false to play once
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetLoop(bool Loop);
|
||||
void SetLoop(bool loop);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the sound pitch.
|
||||
/// The default pitch is 1
|
||||
///
|
||||
/// \param Pitch : New pitch
|
||||
/// \param pitch : New pitch
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPitch(float Pitch);
|
||||
void SetPitch(float pitch);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the sound volume.
|
||||
/// The default volume is 100
|
||||
///
|
||||
/// \param Volume : Volume (in range [0, 100])
|
||||
/// \param volume : Volume (in range [0, 100])
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetVolume(float Volume);
|
||||
void SetVolume(float volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the sound position (take 3 values).
|
||||
/// The default position is (0, 0, 0)
|
||||
///
|
||||
/// \param X, Y, Z : Position of the sound in the world
|
||||
/// \param x, y, z : Position of the sound in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPosition(float X, float Y, float Z);
|
||||
void SetPosition(float x, float y, float z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the sound position (take a 3D vector).
|
||||
/// The default position is (0, 0, 0)
|
||||
///
|
||||
/// \param Position : Position of the sound in the world
|
||||
/// \param position : Position of the sound in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPosition(const Vector3f& Position);
|
||||
void SetPosition(const Vector3f& position);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Make the sound's position relative to the listener's
|
||||
/// position, or absolute.
|
||||
/// The default value is false (absolute)
|
||||
///
|
||||
/// \param Relative : True to set the position relative, false to set it absolute
|
||||
/// \param relative : True to set the position relative, false to set it absolute
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetRelativeToListener(bool Relative);
|
||||
void SetRelativeToListener(bool relative);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the minimum distance - closer than this distance,
|
||||
/// the listener will hear the sound at its maximum volume.
|
||||
/// The default minimum distance is 1.0
|
||||
///
|
||||
/// \param MinDistance : New minimum distance for the sound
|
||||
/// \param distance : New minimum distance for the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetMinDistance(float MinDistance);
|
||||
void SetMinDistance(float distance);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the attenuation factor - the higher the attenuation, the
|
||||
/// more the sound will be attenuated with distance from listener.
|
||||
/// The default attenuation factor 1.0
|
||||
///
|
||||
/// \param Attenuation : New attenuation factor for the sound
|
||||
/// \param attenuation : New attenuation factor for the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetAttenuation(float Attenuation);
|
||||
void SetAttenuation(float attenuation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the current playing position of the sound
|
||||
///
|
||||
/// \param TimeOffset : New playing position, expressed in seconds
|
||||
/// \param timeOffset : New playing position, expressed in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPlayingOffset(float TimeOffset);
|
||||
void SetPlayingOffset(float timeOffset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the source buffer
|
||||
|
@ -286,7 +286,7 @@ public :
|
|||
/// \return Reference to the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Sound& operator =(const Sound& Other);
|
||||
Sound& operator =(const Sound& other);
|
||||
|
||||
private :
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.hpp>
|
||||
#include <SFML/System/Resource.hpp>
|
||||
#include <SFML/Audio/AudioResource.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace sf
|
|||
/// SoundBuffer is the low-level for loading and manipulating
|
||||
/// sound buffers
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_API SoundBuffer : public AudioResource, public Resource<SoundBuffer>
|
||||
class SFML_API SoundBuffer : public Resource<SoundBuffer>
|
||||
{
|
||||
public :
|
||||
|
||||
|
@ -53,10 +53,10 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Copy constructor
|
||||
///
|
||||
/// \param Copy : Instance to copy
|
||||
/// \param copy : Instance to copy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SoundBuffer(const SoundBuffer& Copy);
|
||||
SoundBuffer(const SoundBuffer& copy);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destructor
|
||||
|
@ -67,47 +67,47 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Load the sound buffer from a file
|
||||
///
|
||||
/// \param Filename : Path of the sound file to load
|
||||
/// \param filename : Path of the sound file to load
|
||||
///
|
||||
/// \return True if loading has been successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromFile(const std::string& Filename);
|
||||
bool LoadFromFile(const std::string& filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Load the sound buffer from a file in memory
|
||||
///
|
||||
/// \param Data : Pointer to the file data in memory
|
||||
/// \param SizeInBytes : Size of the data to load, in bytes
|
||||
/// \param data : Pointer to the file data in memory
|
||||
/// \param sizeInBytes : Size of the data to load, in bytes
|
||||
///
|
||||
/// \return True if loading has been successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromMemory(const char* Data, std::size_t SizeInBytes);
|
||||
bool LoadFromMemory(const char* data, std::size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Load the sound buffer from an array of samples - assumed format for
|
||||
/// samples is 16 bits signed integer
|
||||
///
|
||||
/// \param Samples : Pointer to the samples in memory
|
||||
/// \param SamplesCount : Number of samples pointed by Samples
|
||||
/// \param ChannelsCount : Number of channels (1 = mono, 2 = stereo, ...)
|
||||
/// \param SampleRate : Frequency (number of samples to play per second)
|
||||
/// \param samples : Pointer to the samples in memory
|
||||
/// \param samplesCount : Number of samples pointed by Samples
|
||||
/// \param channelsCount : Number of channels (1 = mono, 2 = stereo, ...)
|
||||
/// \param sampleRate : Frequency (number of samples to play per second)
|
||||
///
|
||||
/// \return True if loading has been successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromSamples(const Int16* Samples, std::size_t SamplesCount, unsigned int ChannelsCount, unsigned int SampleRate);
|
||||
bool LoadFromSamples(const Int16* samples, std::size_t samplesCount, unsigned int channelsCount, unsigned int sampleRate);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Save the sound buffer to a file
|
||||
///
|
||||
/// \param Filename : Path of the sound file to write
|
||||
/// \param filename : Path of the sound file to write
|
||||
///
|
||||
/// \return True if saving has been successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool SaveToFile(const std::string& Filename) const;
|
||||
bool SaveToFile(const std::string& filename) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the sound samples
|
||||
|
@ -152,12 +152,12 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Assignment operator
|
||||
///
|
||||
/// \param Other : Instance to assign
|
||||
/// \param other : Instance to assign
|
||||
///
|
||||
/// \return Reference to the sound buffer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SoundBuffer& operator =(const SoundBuffer& Other);
|
||||
SoundBuffer& operator =(const SoundBuffer& other);
|
||||
|
||||
private :
|
||||
|
||||
|
@ -166,13 +166,13 @@ private :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Update the internal buffer with the audio samples
|
||||
///
|
||||
/// \param ChannelsCount : Number of channels
|
||||
/// \param SampleRate : Sample rate
|
||||
/// \param channelsCount : Number of channels
|
||||
/// \param sampleRate : Sample rate
|
||||
///
|
||||
/// \return True on success
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Update(unsigned int ChannelsCount, unsigned int SampleRate);
|
||||
bool Update(unsigned int channelsCount, unsigned int sampleRate);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
|
|
@ -63,7 +63,7 @@ private :
|
|||
/// /see SoundBuffer::OnProcessSamples
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual bool OnProcessSamples(const Int16* Samples, std::size_t SamplesCount);
|
||||
virtual bool OnProcessSamples(const Int16* samples, std::size_t samplesCount);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// /see SoundBuffer::OnStop
|
||||
|
|
|
@ -52,11 +52,11 @@ public :
|
|||
/// Start the capture.
|
||||
/// Warning : only one capture can happen at the same time
|
||||
///
|
||||
/// \param SampleRate : Sound frequency (the more samples, the higher the quality)
|
||||
/// \param sampleRate : Sound frequency (the more samples, the higher the quality)
|
||||
/// (44100 by default = CD quality)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Start(unsigned int SampleRate = 44100);
|
||||
void Start(unsigned int sampleRate = 44100);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop the capture
|
||||
|
@ -102,13 +102,13 @@ private :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Process a new chunk of recorded samples
|
||||
///
|
||||
/// \param Samples : Pointer to the new chunk of recorded samples
|
||||
/// \param SamplesCount : Number of samples pointed by Samples
|
||||
/// \param samples : Pointer to the new chunk of recorded samples
|
||||
/// \param samplesCount : Number of samples pointed by Samples
|
||||
///
|
||||
/// \return False to stop recording audio data, true to continue
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual bool OnProcessSamples(const Int16* Samples, std::size_t SamplesCount) = 0;
|
||||
virtual bool OnProcessSamples(const Int16* samples, std::size_t samplesCount) = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop recording audio data
|
||||
|
|
|
@ -117,10 +117,10 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Set the current playing position of the stream
|
||||
///
|
||||
/// \param TimeOffset : New playing position, expressed in seconds
|
||||
/// \param timeOffset : New playing position, expressed in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPlayingOffset(float TimeOffset);
|
||||
void SetPlayingOffset(float timeOffset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current playing position of the stream
|
||||
|
@ -134,10 +134,10 @@ public :
|
|||
/// Set the stream loop state.
|
||||
/// This parameter is disabled by default
|
||||
///
|
||||
/// \param Loop : True to play in loop, false to play once
|
||||
/// \param loop : True to play in loop, false to play once
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetLoop(bool Loop);
|
||||
void SetLoop(bool loop);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not the stream is looping
|
||||
|
@ -158,11 +158,11 @@ protected :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Set the audio stream parameters, you must call it before Play()
|
||||
///
|
||||
/// \param ChannelsCount : Number of channels
|
||||
/// \param SampleRate : Sample rate
|
||||
/// \param channelsCount : Number of channels
|
||||
/// \param sampleRate : Sample rate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Initialize(unsigned int ChannelsCount, unsigned int SampleRate);
|
||||
void Initialize(unsigned int channelsCount, unsigned int sampleRate);
|
||||
|
||||
private :
|
||||
|
||||
|
@ -175,31 +175,31 @@ private :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Called each time new audio data is needed to feed the stream
|
||||
///
|
||||
/// \param Data : New chunk of data to stream
|
||||
/// \param data : New chunk of data to stream
|
||||
///
|
||||
/// \return True to continue playback, false to stop
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual bool OnGetData(Chunk& Data) = 0;
|
||||
virtual bool OnGetData(Chunk& data) = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Called to move the current reading position
|
||||
///
|
||||
/// \param TimeOffset : New read position, expressed in seconds
|
||||
/// \param timeOffset : New read position, expressed in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void OnSeek(float TimeOffset) = 0;
|
||||
virtual void OnSeek(float timeOffset) = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Fill a new buffer with audio data, and push it to the
|
||||
/// playing queue
|
||||
///
|
||||
/// \param Buffer : Buffer to fill
|
||||
/// \param buffer : Buffer to fill
|
||||
///
|
||||
/// \return True if the derived class has requested to stop
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool FillAndPushBuffer(unsigned int Buffer);
|
||||
bool FillAndPushBuffer(unsigned int buffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Fill the buffers queue with all available buffers
|
||||
|
|
|
@ -50,53 +50,13 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the color from its 4 RGBA components
|
||||
///
|
||||
/// \param R : Red component (0 .. 255)
|
||||
/// \param G : Green component (0 .. 255)
|
||||
/// \param B : Blue component (0 .. 255)
|
||||
/// \param A : Alpha component (0 .. 255) (255 by default)
|
||||
/// \param red : Red component (0 .. 255)
|
||||
/// \param green : Green component (0 .. 255)
|
||||
/// \param blue : Blue component (0 .. 255)
|
||||
/// \param alpha : Alpha (opacity) component (0 .. 255) (255 by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Color(Uint8 R, Uint8 G, Uint8 B, Uint8 A = 255);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator += overload to add a color
|
||||
///
|
||||
/// \param Other : Color to add
|
||||
///
|
||||
/// \return Component-wise saturated addition of the two colors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Color& operator +=(const Color& Other);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator *= overload to modulate a color
|
||||
///
|
||||
/// \param Other : Color to modulate
|
||||
///
|
||||
/// \return Component-wise multiplication of the two colors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Color& operator *=(const Color& Other);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Compare two colors (for equality)
|
||||
///
|
||||
/// \param Other : Color to compare
|
||||
///
|
||||
/// \return True if colors are equal
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator ==(const Color& Other) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Compare two colors (for difference)
|
||||
///
|
||||
/// \param Other : Color to compare
|
||||
///
|
||||
/// \return True if colors are different
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator !=(const Color& Other) const;
|
||||
Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = 255);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Static member data
|
||||
|
@ -119,27 +79,71 @@ public :
|
|||
Uint8 a; ///< Alpha (transparency) component
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Compare two colors (for equality)
|
||||
///
|
||||
/// \param left : Left operand
|
||||
/// \param right : Right operand
|
||||
///
|
||||
/// \return True if colors are equal
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator ==(const Color& left, const Color& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Compare two colors (for difference)
|
||||
///
|
||||
/// \param left : Left operand
|
||||
/// \param right : Right operand
|
||||
///
|
||||
/// \return True if colors are different
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator !=(const Color& left, const Color& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator + overload to add two colors
|
||||
///
|
||||
/// \param Color1 : First color
|
||||
/// \param Color2 : Second color
|
||||
/// \param left : Left operand
|
||||
/// \param right : Right operand
|
||||
///
|
||||
/// \return Component-wise saturated addition of the two colors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_API Color operator +(const Color& Color1, const Color& Color2);
|
||||
SFML_API Color operator +(const Color& left, const Color& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator * overload to modulate two colors
|
||||
///
|
||||
/// \param Color1 : First color
|
||||
/// \param Color2 : Second color
|
||||
/// \param left : Left operand
|
||||
/// \param right : Right operand
|
||||
///
|
||||
/// \return Component-wise multiplication of the two colors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_API Color operator *(const Color& Color1, const Color& Color2);
|
||||
SFML_API Color operator *(const Color& left, const Color& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator += overload to add a color
|
||||
///
|
||||
/// \param left : Left operand
|
||||
/// \param right : Right operand
|
||||
///
|
||||
/// \return Component-wise saturated addition of the two colors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Color& operator +=(Color& left, const Color& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator *= overload to modulate a color
|
||||
///
|
||||
/// \param left : Left operand
|
||||
/// \param right : Right operand
|
||||
///
|
||||
/// \return Component-wise multiplication of the two colors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Color& operator *=(Color& left, const Color& right);
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
|
|
@ -62,13 +62,13 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Default constructor
|
||||
///
|
||||
/// \param Position : Position of the object (0, 0 by default)
|
||||
/// \param Scale : Scale factor (1, 1 by default)
|
||||
/// \param Rotation : Orientation, in degrees (0 by default)
|
||||
/// \param Col : Color of the object (white by default)
|
||||
/// \param position : Position of the object ((0, 0) by default)
|
||||
/// \param scale : Scale factor ((1, 1) by default)
|
||||
/// \param rotation : Orientation, in degrees (0 by default)
|
||||
/// \param color : Color of the object (white by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Drawable(const Vector2f& Position = Vector2f(0, 0), const Vector2f& Scale = Vector2f(1, 1), float Rotation = 0.f, const Color& Col = Color(255, 255, 255, 255));
|
||||
Drawable(const Vector2f& position = Vector2f(0, 0), const Vector2f& scale = Vector2f(1, 1), float rotation = 0.f, const Color& color = Color(255, 255, 255));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Virtual destructor
|
||||
|
@ -79,44 +79,44 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of the object (take 2 values)
|
||||
///
|
||||
/// \param X : New X coordinate
|
||||
/// \param Y : New Y coordinate
|
||||
/// \param x : New X coordinate
|
||||
/// \param y : New Y coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPosition(float X, float Y);
|
||||
void SetPosition(float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of the object (take a 2D vector)
|
||||
///
|
||||
/// \param Position : New position
|
||||
/// \param position : New position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPosition(const Vector2f& Position);
|
||||
void SetPosition(const Vector2f& position);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the X position of the object
|
||||
///
|
||||
/// \param X : New X coordinate
|
||||
/// \param x : New X coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetX(float X);
|
||||
void SetX(float x);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the Y position of the object
|
||||
///
|
||||
/// \param Y : New Y coordinate
|
||||
/// \param y : New Y coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetY(float Y);
|
||||
void SetY(float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the scale of the object (take 2 values)
|
||||
///
|
||||
/// \param ScaleX : New horizontal scale (must be strictly positive)
|
||||
/// \param ScaleY : New vertical scale (must be strictly positive)
|
||||
/// \param factorX : New horizontal scale (must be strictly positive)
|
||||
/// \param factorY : New vertical scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetScale(float ScaleX, float ScaleY);
|
||||
void SetScale(float factorX, float factorY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the scale of the object (take a 2D vector)
|
||||
|
@ -124,70 +124,70 @@ public :
|
|||
/// \param Scale : New scale (both values must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetScale(const Vector2f& Scale);
|
||||
void SetScale(const Vector2f& scale);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the X scale factor of the object
|
||||
///
|
||||
/// \param X : New X scale factor
|
||||
/// \param factor : New X scale factor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetScaleX(float FactorX);
|
||||
void SetScaleX(float factor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the Y scale factor of the object
|
||||
///
|
||||
/// \param Y : New Y scale factor
|
||||
/// \param factor : New Y scale factor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetScaleY(float FactorY);
|
||||
void SetScaleY(float factor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the local origin of the object, in coordinates relative to the
|
||||
/// top-left of the object (take 2 values).
|
||||
/// The default origin is (0, 0)
|
||||
///
|
||||
/// \param OriginX : X coordinate of the origin
|
||||
/// \param OriginY : Y coordinate of the origin
|
||||
/// \param x : X coordinate of the origin
|
||||
/// \param y : Y coordinate of the origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetOrigin(float OriginX, float OriginY);
|
||||
void SetOrigin(float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the local origin of the object, in coordinates relative to the
|
||||
/// top-left of the object (take a 2D vector).
|
||||
/// The default origin is (0, 0)
|
||||
///
|
||||
/// \param Origin : New origin
|
||||
/// \param origin : New origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetOrigin(const Vector2f& Origin);
|
||||
void SetOrigin(const Vector2f& origin);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the orientation of the object
|
||||
///
|
||||
/// \param Rotation : Angle of rotation, in degrees
|
||||
/// \param angle : Angle of rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetRotation(float Rotation);
|
||||
void SetRotation(float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the color of the object.
|
||||
/// The default color is white
|
||||
///
|
||||
/// \param Col : New color
|
||||
/// \param color : New color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetColor(const Color& Col);
|
||||
void SetColor(const Color& color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the blending mode for the object.
|
||||
/// The default blend mode is Blend::Alpha
|
||||
///
|
||||
/// \param Mode : New blending mode
|
||||
/// \param mode : New blending mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetBlendMode(Blend::Mode Mode);
|
||||
void SetBlendMode(Blend::Mode mode);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the position of the object
|
||||
|
@ -241,36 +241,36 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Move the object of a given offset (take 2 values)
|
||||
///
|
||||
/// \param OffsetX : X offset
|
||||
/// \param OffsetY : Y offset
|
||||
/// \param offsetX : X offset
|
||||
/// \param offsetY : Y offset
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Move(float OffsetX, float OffsetY);
|
||||
void Move(float offsetX, float offsetY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Move the object of a given offset (take a 2D vector)
|
||||
///
|
||||
/// \param Offset : Amount of units to move the object of
|
||||
/// \param offset : Amount of units to move the object of
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Move(const Vector2f& Offset);
|
||||
void Move(const Vector2f& offset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Scale the object (take 2 values)
|
||||
///
|
||||
/// \param FactorX : Scaling factor on X (must be strictly positive)
|
||||
/// \param FactorY : Scaling factor on Y (must be strictly positive)
|
||||
/// \param factorX : Scaling factor on X (must be strictly positive)
|
||||
/// \param factorY : Scaling factor on Y (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Scale(float FactorX, float FactorY);
|
||||
void Scale(float factorX, float factorY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Scale the object (take a 2D vector)
|
||||
///
|
||||
/// \param Factor : Scaling factors (both values must be strictly positive)
|
||||
/// \param factor : Scaling factors (both values must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Scale(const Vector2f& Factor);
|
||||
void Scale(const Vector2f& factor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Rotate the object
|
||||
|
@ -284,23 +284,23 @@ public :
|
|||
/// Transform a point from global coordinates into local coordinates
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param Point : Point to transform
|
||||
/// \param point : Point to transform
|
||||
///
|
||||
/// \return Transformed point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
sf::Vector2f TransformToLocal(const sf::Vector2f& Point) const;
|
||||
sf::Vector2f TransformToLocal(const sf::Vector2f& point) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from local coordinates into global coordinates
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param Point : Point to transform
|
||||
/// \param point : Point to transform
|
||||
///
|
||||
/// \return Transformed point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
sf::Vector2f TransformToGlobal(const sf::Vector2f& Point) const;
|
||||
sf::Vector2f TransformToGlobal(const sf::Vector2f& point) const;
|
||||
|
||||
protected :
|
||||
|
||||
|
@ -327,18 +327,18 @@ private :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Draw the object into the specified window
|
||||
///
|
||||
/// \param Target : Target into which render the object
|
||||
/// \param target : Target into which render the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Draw(RenderTarget& Target) const;
|
||||
void Draw(RenderTarget& target) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Render the specific geometry of the object
|
||||
///
|
||||
/// \param Target : Target into which render the object
|
||||
/// \param target : Target into which render the object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void Render(RenderTarget& Target) const = 0;
|
||||
virtual void Render(RenderTarget& target) const = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
|
|
@ -64,27 +64,27 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Load the font from a file
|
||||
///
|
||||
/// \param Filename : Font file to load
|
||||
/// \param CharSize : Size of characters in bitmap - the bigger, the higher quality (30 by default)
|
||||
/// \param Charset : Characters set to generate (by default, contains the ISO-8859-1 printable characters)
|
||||
/// \param filename : Font file to load
|
||||
/// \param charSize : Size of characters in bitmap - the bigger, the higher quality (30 by default)
|
||||
/// \param charset : Characters set to generate (by default, contains the ISO-8859-1 printable characters)
|
||||
///
|
||||
/// \return True if loading was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromFile(const std::string& Filename, unsigned int CharSize = 30, const Unicode::Text& Charset = ourDefaultCharset);
|
||||
bool LoadFromFile(const std::string& filename, unsigned int charSize = 30, const Unicode::Text& charset = ourDefaultCharset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Load the font from a file in memory
|
||||
///
|
||||
/// \param Data : Pointer to the data to load
|
||||
/// \param SizeInBytes : Size of the data, in bytes
|
||||
/// \param CharSize : Size of characters in bitmap - the bigger, the higher quality (30 by default)
|
||||
/// \param Charset : Characters set to generate (by default, contains the ISO-8859-1 printable characters)
|
||||
/// \param data : Pointer to the data to load
|
||||
/// \param sizeInBytes : Size of the data, in bytes
|
||||
/// \param charSize : Size of characters in bitmap - the bigger, the higher quality (30 by default)
|
||||
/// \param charset : Characters set to generate (by default, contains the ISO-8859-1 printable characters)
|
||||
///
|
||||
/// \return True if loading was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromMemory(const char* Data, std::size_t SizeInBytes, unsigned int CharSize = 30, const Unicode::Text& Charset = ourDefaultCharset);
|
||||
bool LoadFromMemory(const char* data, std::size_t sizeInBytes, unsigned int charSize = 30, const Unicode::Text& charset = ourDefaultCharset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the base size of characters in the font;
|
||||
|
@ -99,12 +99,12 @@ public :
|
|||
/// Get the description of a glyph (character)
|
||||
/// given by its unicode value
|
||||
///
|
||||
/// \param CodePoint : Unicode value of the character to get
|
||||
/// \param codePoint : Unicode value of the character to get
|
||||
///
|
||||
/// \return Glyph's visual settings, or an invalid glyph if character not found
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Glyph& GetGlyph(Uint32 CodePoint) const;
|
||||
const Glyph& GetGlyph(Uint32 codePoint) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the image containing the rendered characters (glyphs)
|
||||
|
|
|
@ -57,30 +57,30 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Copy constructor
|
||||
///
|
||||
/// \param Copy : instance to copy
|
||||
/// \param copy : instance to copy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Image(const Image& Copy);
|
||||
Image(const Image& copy);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct an empty image
|
||||
///
|
||||
/// \param Width : Image width
|
||||
/// \param Height : Image height
|
||||
/// \param Col : Image color (black by default)
|
||||
/// \param width : Image width
|
||||
/// \param height : Image height
|
||||
/// \param color : Image color (black by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Image(unsigned int Width, unsigned int Height, const Color& Col = Color(0, 0, 0, 255));
|
||||
Image(unsigned int width, unsigned int height, const Color& color = Color(0, 0, 0));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct the image from pixels in memory
|
||||
///
|
||||
/// \param Width : Image width
|
||||
/// \param Height : Image height
|
||||
/// \param Data : Pointer to the pixels in memory (assumed format is RGBA)
|
||||
/// \param width : Image width
|
||||
/// \param height : Image height
|
||||
/// \param pixels : Pointer to the pixels in memory (assumed format is RGBA)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Image(unsigned int Width, unsigned int Height, const Uint8* Data);
|
||||
Image(unsigned int width, unsigned int height, const Uint8* pixels);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destructor
|
||||
|
@ -96,108 +96,108 @@ public :
|
|||
/// \return True if loading was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromFile(const std::string& Filename);
|
||||
bool LoadFromFile(const std::string& filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Load the image from a file in memory
|
||||
///
|
||||
/// \param Data : Pointer to the file data in memory
|
||||
/// \param SizeInBytes : Size of the data to load, in bytes
|
||||
/// \param data : Pointer to the file data in memory
|
||||
/// \param sizeInBytes : Size of the data to load, in bytes
|
||||
///
|
||||
/// \return True if loading was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromMemory(const char* Data, std::size_t SizeInBytes);
|
||||
bool LoadFromMemory(const char* data, std::size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Load the image directly from an array of pixels
|
||||
///
|
||||
/// \param Width : Image width
|
||||
/// \param Height : Image height
|
||||
/// \param Data : Pointer to the pixels in memory (assumed format is RGBA)
|
||||
/// \param width : Image width
|
||||
/// \param height : Image height
|
||||
/// \param pixels : Pointer to the pixels in memory (assumed format is RGBA)
|
||||
///
|
||||
/// \return True if loading was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromPixels(unsigned int Width, unsigned int Height, const Uint8* Data);
|
||||
bool LoadFromPixels(unsigned int width, unsigned int height, const Uint8* pixels);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Save the content of the image to a file
|
||||
///
|
||||
/// \param Filename : Path of the file to save (overwritten if already exist)
|
||||
/// \param filename : Path of the file to save (overwritten if already exist)
|
||||
///
|
||||
/// \return True if saving was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool SaveToFile(const std::string& Filename) const;
|
||||
bool SaveToFile(const std::string& filename) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create an empty image
|
||||
///
|
||||
/// \param Width : Image width
|
||||
/// \param Height : Image height
|
||||
/// \param Col : Image color (black by default)
|
||||
/// \param width : Image width
|
||||
/// \param height : Image height
|
||||
/// \param color : Image color (black by default)
|
||||
///
|
||||
/// \return True if creation was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Create(unsigned int Width, unsigned int Height, Color Col = Color(0, 0, 0, 255));
|
||||
bool Create(unsigned int width, unsigned int height, const Color& color = Color(0, 0, 0));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create transparency mask from a specified colorkey
|
||||
///
|
||||
/// \param ColorKey : Color to become transparent
|
||||
/// \param Alpha : Alpha value to use for transparent pixels (0 by default)
|
||||
/// \param transparentColor : Color to become transparent
|
||||
/// \param alpha : Alpha value to assign to transparent pixels (0 by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void CreateMaskFromColor(Color ColorKey, Uint8 Alpha = 0);
|
||||
void CreateMaskFromColor(const Color& transparentColor, Uint8 alpha = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy pixels from another image onto this one.
|
||||
/// This function does a slow pixel copy and should only
|
||||
/// be used at initialization time
|
||||
///
|
||||
/// \param Source : Source image to copy
|
||||
/// \param DestX : X coordinate of the destination position
|
||||
/// \param DestY : Y coordinate of the destination position
|
||||
/// \param SourceRect : Sub-rectangle of the source image to copy (empty by default - entire image)
|
||||
/// \param ApplyAlpha : Should the copy take in account the source transparency? (false by default)
|
||||
/// \param source : Source image to copy
|
||||
/// \param destX : X coordinate of the destination position
|
||||
/// \param destY : Y coordinate of the destination position
|
||||
/// \param sourceRect : Sub-rectangle of the source image to copy (empty by default - entire image)
|
||||
/// \param applyAlpha : Should the copy take in account the source transparency? (false by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Copy(const Image& Source, unsigned int DestX, unsigned int DestY, const IntRect& SourceRect = IntRect(0, 0, 0, 0), bool ApplyAlpha = false);
|
||||
void Copy(const Image& source, unsigned int destX, unsigned int destY, const IntRect& sourceRect = IntRect(0, 0, 0, 0), bool applyAlpha = false);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create the image from the current contents of the
|
||||
/// given window
|
||||
///
|
||||
/// \param Window : Window to capture
|
||||
/// \param SourceRect : Sub-rectangle of the screen to copy (empty by default - entire image)
|
||||
/// \param window : Window to capture
|
||||
/// \param sourceRect : Sub-rectangle of the screen to copy (empty by default - entire image)
|
||||
///
|
||||
/// \return True if copy was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool CopyScreen(RenderWindow& Window, const IntRect& SourceRect = IntRect(0, 0, 0, 0));
|
||||
bool CopyScreen(RenderWindow& window, const IntRect& sourceRect = IntRect(0, 0, 0, 0));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the color of a pixel
|
||||
///
|
||||
/// \param X : X coordinate of pixel in the image
|
||||
/// \param Y : Y coordinate of pixel in the image
|
||||
/// \param Col : New color for pixel (X, Y)
|
||||
/// \param x : X coordinate of pixel in the image
|
||||
/// \param y : Y coordinate of pixel in the image
|
||||
/// \param color : New color for pixel (x, y)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPixel(unsigned int X, unsigned int Y, const Color& Col);
|
||||
void SetPixel(unsigned int x, unsigned int y, const Color& color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a pixel from the image
|
||||
///
|
||||
/// \param X : X coordinate of pixel in the image
|
||||
/// \param Y : Y coordinate of pixel in the image
|
||||
/// \param x : X coordinate of pixel in the image
|
||||
/// \param y : Y coordinate of pixel in the image
|
||||
///
|
||||
/// \return Color of pixel (X, Y)
|
||||
/// \return Color of pixel (x, y)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Color& GetPixel(unsigned int X, unsigned int Y) const;
|
||||
const Color& GetPixel(unsigned int x, unsigned int y) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a read-only pointer to the array of pixels (RGBA 8 bits integers components)
|
||||
|
@ -219,10 +219,10 @@ public :
|
|||
/// Enable or disable image smooth filter.
|
||||
/// This parameter is enabled by default
|
||||
///
|
||||
/// \param Smooth : True to enable smoothing filter, false to disable it
|
||||
/// \param smooth : True to enable smoothing filter, false to disable it
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetSmooth(bool Smooth);
|
||||
void SetSmooth(bool smooth);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the width of the image
|
||||
|
@ -252,33 +252,33 @@ public :
|
|||
/// Convert a subrect expressed in pixels, into float
|
||||
/// texture coordinates
|
||||
///
|
||||
/// \param Rect : Sub-rectangle of image to convert
|
||||
/// \param Adjust : Pass true to apply the half-texel adjustment
|
||||
/// \param rectangle : Sub-rectangle of image to convert
|
||||
/// \param adjust : Pass true to apply the half-texel adjustment (true by default)
|
||||
///
|
||||
/// \return Texture coordinates corresponding to the sub-rectangle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
FloatRect GetTexCoords(const IntRect& Rect, bool Adjust = true) const;
|
||||
FloatRect GetTexCoords(const IntRect& rectangle, bool adjust = true) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a valid texture size according to hardware support
|
||||
///
|
||||
/// \param Size : Size to convert
|
||||
/// \param Size : size to convert
|
||||
///
|
||||
/// \return Valid nearest size (greater than or equal to specified size)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static unsigned int GetValidTextureSize(unsigned int Size);
|
||||
static unsigned int GetValidTextureSize(unsigned int size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Assignment operator
|
||||
///
|
||||
/// \param Other : instance to assign
|
||||
/// \param other : instance to assign
|
||||
///
|
||||
/// \return Reference to the image
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Image& operator =(const Image& Other);
|
||||
Image& operator =(const Image& other);
|
||||
|
||||
private :
|
||||
|
||||
|
@ -309,10 +309,10 @@ private :
|
|||
/// its content.
|
||||
/// For internal use only (see RenderImage class).
|
||||
///
|
||||
/// \param Source : RenderImage that will update the image
|
||||
/// \param source : RenderImage that will update the image
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void ExternalUpdate(RenderImage& Source);
|
||||
void ExternalUpdate(RenderImage& source);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Reset the image attributes
|
||||
|
|
|
@ -61,33 +61,33 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Build a matrix from a set of transformations
|
||||
///
|
||||
/// \param Center : Origin for the transformations
|
||||
/// \param Translation : Translation offset
|
||||
/// \param Rotation : Rotation angle in degrees
|
||||
/// \param Scale : Scaling factors
|
||||
/// \param origin : Origin for the transformations
|
||||
/// \param translation : Translation offset
|
||||
/// \param rotation : Rotation angle in degrees
|
||||
/// \param scale : Scaling factors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetFromTransformations(const Vector2f& Center, const Vector2f& Translation, float Rotation, const Vector2f& Scale);
|
||||
void SetFromTransformations(const Vector2f& origin, const Vector2f& translation, float rotation, const Vector2f& scale);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Build a matrix from a projection
|
||||
///
|
||||
/// \param Center : Center of the view
|
||||
/// \param Size : Size of the view
|
||||
/// \param Rotation : Angle of rotation of the view rectangle, in degrees
|
||||
/// \param center : Center of the view
|
||||
/// \param size : Size of the view
|
||||
/// \param rotation : Angle of rotation of the view rectangle, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetFromProjection(const Vector2f& Center, const Vector2f& Size, float Rotation);
|
||||
void SetFromProjection(const Vector2f& center, const Vector2f& size, float rotation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point by the matrix
|
||||
///
|
||||
/// \param Point : Point to transform
|
||||
/// \param point : Point to transform
|
||||
///
|
||||
/// \return Transformed point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2f Transform(const Vector2f& Point) const;
|
||||
Vector2f Transform(const Vector2f& point) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the inverse of the matrix
|
||||
|
@ -109,34 +109,34 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Operator () overloads to access the matrix elements
|
||||
///
|
||||
/// \param Row : Element row (0 based)
|
||||
/// \param Col : Element column (0 based)
|
||||
/// \param row : Element row (0 based)
|
||||
/// \param column : Element column (0 based)
|
||||
///
|
||||
/// \return Matrix element (Row, Col)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
float operator ()(unsigned int Row, unsigned int Col) const;
|
||||
float& operator ()(unsigned int Row, unsigned int Col);
|
||||
float operator ()(unsigned int row, unsigned int column) const;
|
||||
float& operator ()(unsigned int row, unsigned int column);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator * overload to multiply two matrices
|
||||
///
|
||||
/// \param Mat : Matrix to multiply
|
||||
/// \param right : Matrix to multiply
|
||||
///
|
||||
/// \return this * Mat
|
||||
/// \return this * right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Matrix3 operator *(const Matrix3& Mat) const;
|
||||
Matrix3 operator *(const Matrix3& right) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator *= overload to multiply-assign two matrices
|
||||
///
|
||||
/// \param Mat : Matrix to multiply
|
||||
/// \param right : Matrix to multiply
|
||||
///
|
||||
/// \return this * Mat
|
||||
/// \return this * right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Matrix3& operator *=(const Matrix3& Mat);
|
||||
Matrix3& operator *=(const Matrix3& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Static member data
|
||||
|
|
|
@ -52,22 +52,22 @@ inline Matrix3::Matrix3(float a00, float a01, float a02,
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Build a matrix from a set of transformations
|
||||
////////////////////////////////////////////////////////////
|
||||
inline void Matrix3::SetFromTransformations(const Vector2f& Center, const Vector2f& Translation, float Rotation, const Vector2f& Scale)
|
||||
inline void Matrix3::SetFromTransformations(const Vector2f& origin, const Vector2f& translation, float rotation, const Vector2f& scale)
|
||||
{
|
||||
// Combine the transformations
|
||||
float Angle = Rotation * 3.141592654f / 180.f;
|
||||
float Cos = static_cast<float>(cos(Angle));
|
||||
float Sin = static_cast<float>(sin(Angle));
|
||||
float SxCos = Scale.x * Cos;
|
||||
float SyCos = Scale.y * Cos;
|
||||
float SxSin = Scale.x * Sin;
|
||||
float SySin = Scale.y * Sin;
|
||||
float Tx = -Center.x * SxCos - Center.y * SySin + Translation.x;
|
||||
float Ty = Center.x * SxSin - Center.y * SyCos + Translation.y;
|
||||
float angle = rotation * 3.141592654f / 180.f;
|
||||
float cosine = static_cast<float>(cos(angle));
|
||||
float sine = static_cast<float>(sin(angle));
|
||||
float sxCos = scale.x * cosine;
|
||||
float syCos = scale.y * cosine;
|
||||
float sxSin = scale.x * sine;
|
||||
float sySin = scale.y * sine;
|
||||
float tx = -origin.x * sxCos - origin.y * sySin + translation.x;
|
||||
float ty = origin.x * sxSin - origin.y * syCos + translation.y;
|
||||
|
||||
// Rebuild the matrix
|
||||
myData[0] = SxCos; myData[4] = SySin; myData[8] = 0.f; myData[12] = Tx;
|
||||
myData[1] = -SxSin; myData[5] = SyCos; myData[9] = 0.f; myData[13] = Ty;
|
||||
myData[0] = sxCos; myData[4] = sySin; myData[8] = 0.f; myData[12] = tx;
|
||||
myData[1] = -sxSin; myData[5] = syCos; myData[9] = 0.f; myData[13] = ty;
|
||||
myData[2] = 0.f; myData[6] = 0.f; myData[10] = 1.f; myData[14] = 0.f;
|
||||
myData[3] = 0.f; myData[7] = 0.f; myData[11] = 0.f; myData[15] = 1.f;
|
||||
}
|
||||
|
@ -76,36 +76,36 @@ inline void Matrix3::SetFromTransformations(const Vector2f& Center, const Vector
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Build a matrix from a projection
|
||||
////////////////////////////////////////////////////////////
|
||||
inline void Matrix3::SetFromProjection(const Vector2f& Center, const Vector2f& Size, float Rotation)
|
||||
inline void Matrix3::SetFromProjection(const Vector2f& center, const Vector2f& size, float rotation)
|
||||
{
|
||||
// Rotation components
|
||||
float Angle = Rotation * 3.141592654f / 180.f;
|
||||
float Cos = static_cast<float>(cos(Angle));
|
||||
float Sin = static_cast<float>(sin(Angle));
|
||||
float Tx = -Center.x * Cos - Center.y * Sin + Center.x;
|
||||
float Ty = Center.x * Sin - Center.y * Cos + Center.y;
|
||||
float angle = rotation * 3.141592654f / 180.f;
|
||||
float cosine = static_cast<float>(cos(angle));
|
||||
float sine = static_cast<float>(sin(angle));
|
||||
float tx = -center.x * cosine - center.y * sine + center.x;
|
||||
float ty = center.x * sine - center.y * cosine + center.y;
|
||||
|
||||
// Projection components
|
||||
float A = 2.f / Size.x;
|
||||
float B = -2.f / Size.y;
|
||||
float C = -A * Center.x;
|
||||
float D = -B * Center.y;
|
||||
float a = 2.f / size.x;
|
||||
float b = -2.f / size.y;
|
||||
float c = -a * center.x;
|
||||
float d = -b * center.y;
|
||||
|
||||
// Rebuild the projection matrix
|
||||
myData[0] = A * Cos; myData[4] = A * Sin; myData[8] = 0.f; myData[12] = A * Tx + C;
|
||||
myData[1] = -B * Sin; myData[5] = B * Cos; myData[9] = 0.f; myData[13] = B * Ty + D;
|
||||
myData[2] = 0.f; myData[6] = 0.f; myData[10] = 1.f; myData[14] = 0.f;
|
||||
myData[3] = 0.f; myData[7] = 0.f; myData[11] = 0.f; myData[15] = 1.f;
|
||||
myData[0] = a * cosine; myData[4] = a * sine; myData[8] = 0.f; myData[12] = a * tx + c;
|
||||
myData[1] = -b * sine; myData[5] = b * cosine; myData[9] = 0.f; myData[13] = b * ty + d;
|
||||
myData[2] = 0.f; myData[6] = 0.f; myData[10] = 1.f; myData[14] = 0.f;
|
||||
myData[3] = 0.f; myData[7] = 0.f; myData[11] = 0.f; myData[15] = 1.f;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point by the matrix
|
||||
////////////////////////////////////////////////////////////
|
||||
inline Vector2f Matrix3::Transform(const Vector2f& Point) const
|
||||
inline Vector2f Matrix3::Transform(const Vector2f& point) const
|
||||
{
|
||||
return Vector2f(myData[0] * Point.x + myData[4] * Point.y + myData[12],
|
||||
myData[1] * Point.x + myData[5] * Point.y + myData[13]);
|
||||
return Vector2f(myData[0] * point.x + myData[4] * point.y + myData[12],
|
||||
myData[1] * point.x + myData[5] * point.y + myData[13]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -115,22 +115,22 @@ inline Vector2f Matrix3::Transform(const Vector2f& Point) const
|
|||
inline Matrix3 Matrix3::GetInverse() const
|
||||
{
|
||||
// Compute the determinant
|
||||
float Det = myData[0] * (myData[15] * myData[5] - myData[7] * myData[13]) -
|
||||
float det = myData[0] * (myData[15] * myData[5] - myData[7] * myData[13]) -
|
||||
myData[1] * (myData[15] * myData[4] - myData[7] * myData[12]) +
|
||||
myData[3] * (myData[13] * myData[4] - myData[5] * myData[12]);
|
||||
|
||||
// Compute the inverse if determinant is not zero
|
||||
if ((Det < -1E-7f) || (Det > 1E-7f))
|
||||
if ((det < -1E-7f) || (det > 1E-7f))
|
||||
{
|
||||
return Matrix3( (myData[15] * myData[5] - myData[7] * myData[13]) / Det,
|
||||
-(myData[15] * myData[4] - myData[7] * myData[12]) / Det,
|
||||
(myData[13] * myData[4] - myData[5] * myData[12]) / Det,
|
||||
-(myData[15] * myData[1] - myData[3] * myData[13]) / Det,
|
||||
(myData[15] * myData[0] - myData[3] * myData[12]) / Det,
|
||||
-(myData[13] * myData[0] - myData[1] * myData[12]) / Det,
|
||||
(myData[7] * myData[1] - myData[3] * myData[5]) / Det,
|
||||
-(myData[7] * myData[0] - myData[3] * myData[4]) / Det,
|
||||
(myData[5] * myData[0] - myData[1] * myData[4]) / Det);
|
||||
return Matrix3( (myData[15] * myData[5] - myData[7] * myData[13]) / det,
|
||||
-(myData[15] * myData[4] - myData[7] * myData[12]) / det,
|
||||
(myData[13] * myData[4] - myData[5] * myData[12]) / det,
|
||||
-(myData[15] * myData[1] - myData[3] * myData[13]) / det,
|
||||
(myData[15] * myData[0] - myData[3] * myData[12]) / det,
|
||||
-(myData[13] * myData[0] - myData[1] * myData[12]) / det,
|
||||
(myData[7] * myData[1] - myData[3] * myData[5]) / det,
|
||||
-(myData[7] * myData[0] - myData[3] * myData[4]) / det,
|
||||
(myData[5] * myData[0] - myData[1] * myData[4]) / det);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -152,9 +152,9 @@ inline const float* Matrix3::Get4x4Elements() const
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Operator () overloads to access the matrix elements
|
||||
////////////////////////////////////////////////////////////
|
||||
inline float Matrix3::operator ()(unsigned int Row, unsigned int Col) const
|
||||
inline float Matrix3::operator ()(unsigned int row, unsigned int column) const
|
||||
{
|
||||
switch (Row + Col * 3)
|
||||
switch (row + column * 3)
|
||||
{
|
||||
case 0 : return myData[0];
|
||||
case 1 : return myData[1];
|
||||
|
@ -169,9 +169,9 @@ inline float Matrix3::operator ()(unsigned int Row, unsigned int Col) const
|
|||
default : return myData[0];
|
||||
}
|
||||
}
|
||||
inline float& Matrix3::operator ()(unsigned int Row, unsigned int Col)
|
||||
inline float& Matrix3::operator ()(unsigned int row, unsigned int column)
|
||||
{
|
||||
switch (Row + Col * 3)
|
||||
switch (row + column * 3)
|
||||
{
|
||||
case 0 : return myData[0];
|
||||
case 1 : return myData[1];
|
||||
|
@ -191,24 +191,24 @@ inline float& Matrix3::operator ()(unsigned int Row, unsigned int Col)
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Operator * overload to multiply two matrices
|
||||
////////////////////////////////////////////////////////////
|
||||
inline Matrix3 Matrix3::operator *(const Matrix3& Mat) const
|
||||
inline Matrix3 Matrix3::operator *(const Matrix3& right) const
|
||||
{
|
||||
return Matrix3(myData[0] * Mat.myData[0] + myData[4] * Mat.myData[1] + myData[12] * Mat.myData[3],
|
||||
myData[0] * Mat.myData[4] + myData[4] * Mat.myData[5] + myData[12] * Mat.myData[7],
|
||||
myData[0] * Mat.myData[12] + myData[4] * Mat.myData[13] + myData[12] * Mat.myData[15],
|
||||
myData[1] * Mat.myData[0] + myData[5] * Mat.myData[1] + myData[13] * Mat.myData[3],
|
||||
myData[1] * Mat.myData[4] + myData[5] * Mat.myData[5] + myData[13] * Mat.myData[7],
|
||||
myData[1] * Mat.myData[12] + myData[5] * Mat.myData[13] + myData[13] * Mat.myData[15],
|
||||
myData[3] * Mat.myData[0] + myData[7] * Mat.myData[1] + myData[15] * Mat.myData[3],
|
||||
myData[3] * Mat.myData[4] + myData[7] * Mat.myData[5] + myData[15] * Mat.myData[7],
|
||||
myData[3] * Mat.myData[12] + myData[7] * Mat.myData[13] + myData[15] * Mat.myData[15]);
|
||||
return Matrix3(myData[0] * right.myData[0] + myData[4] * right.myData[1] + myData[12] * right.myData[3],
|
||||
myData[0] * right.myData[4] + myData[4] * right.myData[5] + myData[12] * right.myData[7],
|
||||
myData[0] * right.myData[12] + myData[4] * right.myData[13] + myData[12] * right.myData[15],
|
||||
myData[1] * right.myData[0] + myData[5] * right.myData[1] + myData[13] * right.myData[3],
|
||||
myData[1] * right.myData[4] + myData[5] * right.myData[5] + myData[13] * right.myData[7],
|
||||
myData[1] * right.myData[12] + myData[5] * right.myData[13] + myData[13] * right.myData[15],
|
||||
myData[3] * right.myData[0] + myData[7] * right.myData[1] + myData[15] * right.myData[3],
|
||||
myData[3] * right.myData[4] + myData[7] * right.myData[5] + myData[15] * right.myData[7],
|
||||
myData[3] * right.myData[12] + myData[7] * right.myData[13] + myData[15] * right.myData[15]);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator *= overload to multiply-assign two matrices
|
||||
////////////////////////////////////////////////////////////
|
||||
inline Matrix3& Matrix3::operator *=(const Matrix3& Mat)
|
||||
inline Matrix3& Matrix3::operator *=(const Matrix3& right)
|
||||
{
|
||||
return *this = *this * Mat;
|
||||
return *this = *this * right;
|
||||
}
|
||||
|
|
|
@ -53,10 +53,10 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Copy constructor
|
||||
///
|
||||
/// \param Copy : Instance to copy
|
||||
/// \param copy : Instance to copy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
PostFX(const PostFX& Copy);
|
||||
PostFX(const PostFX& copy);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destructor
|
||||
|
@ -67,77 +67,77 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Load the effect from a file
|
||||
///
|
||||
/// \param Filename : Path of the effect file to load
|
||||
/// \param filename : Path of the effect file to load
|
||||
///
|
||||
/// \return True on success
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromFile(const std::string& Filename);
|
||||
bool LoadFromFile(const std::string& filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Load the effect from a text in memory
|
||||
///
|
||||
/// \param Effect : String containing the effect code
|
||||
/// \param effect : String containing the code of the effect
|
||||
///
|
||||
/// \return True on success
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromMemory(const std::string& Effect);
|
||||
bool LoadFromMemory(const std::string& effect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change a parameter of the effect (1 float)
|
||||
///
|
||||
/// \param Name : Parameter name in the effect
|
||||
/// \param X : Value to assign
|
||||
/// \param name : Name of the parameter in the effect
|
||||
/// \param x : Value to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetParameter(const std::string& Name, float X);
|
||||
void SetParameter(const std::string& name, float x);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change a parameter of the effect (2 floats)
|
||||
///
|
||||
/// \param Name : Parameter name in the effect
|
||||
/// \param X, Y : Values to assign
|
||||
/// \param name : Name of the parameter in the effect
|
||||
/// \param x, y : Values to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetParameter(const std::string& Name, float X, float Y);
|
||||
void SetParameter(const std::string& Name, float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change a parameter of the effect (3 floats)
|
||||
///
|
||||
/// \param Name : Parameter name in the effect
|
||||
/// \param X, Y, Z : Values to assign
|
||||
/// \param name : Name of the parameter in the effect
|
||||
/// \param x, y, z : Values to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetParameter(const std::string& Name, float X, float Y, float Z);
|
||||
void SetParameter(const std::string& Name, float x, float y, float z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change a parameter of the effect (4 floats)
|
||||
///
|
||||
/// \param Name : Parameter name in the effect
|
||||
/// \param X, Y, Z, W : Values to assign
|
||||
/// \param name : Name of the parameter in the effect
|
||||
/// \param x, y, z, w : Values to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetParameter(const std::string& Name, float X, float Y, float Z, float W);
|
||||
void SetParameter(const std::string& Name, float x, float y, float Z, float w);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a texture parameter
|
||||
///
|
||||
/// \param Name : Texture name in the effect
|
||||
/// \param Texture : Image to set (pass NULL to use content of current framebuffer)
|
||||
/// \param name : Name of the texture in the effect
|
||||
/// \param texture : Image to set (pass NULL to use content of current framebuffer)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetTexture(const std::string& Name, const Image* Texture);
|
||||
void SetTexture(const std::string& name, const Image* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Assignment operator
|
||||
///
|
||||
/// \param Other : Instance to assign
|
||||
/// \param other : Instance to assign
|
||||
///
|
||||
/// \return Reference to the post-effect
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
PostFX& operator =(const PostFX& Other);
|
||||
PostFX& operator =(const PostFX& other);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not the system supports post-effects
|
||||
|
@ -153,7 +153,7 @@ protected :
|
|||
/// /see Drawable::Render
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void Render(RenderTarget& Target) const;
|
||||
virtual void Render(RenderTarget& target) const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -161,12 +161,12 @@ private :
|
|||
/// Preprocess a SFML effect file
|
||||
/// to convert it to a valid GLSL fragment shader
|
||||
///
|
||||
/// \param File : Stream containing the code to process
|
||||
/// \param file : Stream containing the code to process
|
||||
///
|
||||
/// \return Valid fragment shader source code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static std::string PreprocessEffect(std::istream& File);
|
||||
static std::string PreprocessEffect(std::istream& file);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create the program and attach the shaders
|
||||
|
|
|
@ -52,13 +52,13 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the rectangle from its coordinates
|
||||
///
|
||||
/// \param LeftCoord : Left coordinate of the rectangle
|
||||
/// \param TopCoord : Top coordinate of the rectangle
|
||||
/// \param RightCoord : Right coordinate of the rectangle
|
||||
/// \param BottomCoord : Bottom coordinate of the rectangle
|
||||
/// \param left : Left coordinate of the rectangle
|
||||
/// \param top : Top coordinate of the rectangle
|
||||
/// \param right : Right coordinate of the rectangle
|
||||
/// \param bottom : Bottom coordinate of the rectangle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Rect(T LeftCoord, T TopCoord, T RightCoord, T BottomCoord);
|
||||
Rect(T left, T top, T right, T bottom);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the size of the rectangle
|
||||
|
@ -79,62 +79,62 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Move the whole rectangle by the given offset
|
||||
///
|
||||
/// \param OffsetX : Horizontal offset
|
||||
/// \param OffsetY : Vertical offset
|
||||
/// \param offsetX : Horizontal offset
|
||||
/// \param offsetY : Vertical offset
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Offset(T OffsetX, T OffsetY);
|
||||
void Offset(T offsetX, T offsetY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Move the whole rectangle by the given offset
|
||||
///
|
||||
/// \param Off : Offset to apply to the current position
|
||||
/// \param offset : Offset to apply to the current position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Offset(const Vector2<T>& Off);
|
||||
void Offset(const Vector2<T>& offset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check if a point is inside the rectangle's area
|
||||
///
|
||||
/// \param X : X coordinate of the point to test
|
||||
/// \param Y : Y coordinate of the point to test
|
||||
/// \param x : X coordinate of the point to test
|
||||
/// \param y : Y coordinate of the point to test
|
||||
///
|
||||
/// \return True if the point is inside
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Contains(T X, T Y) const;
|
||||
bool Contains(T x, T y) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check if a point is inside the rectangle's area
|
||||
///
|
||||
/// \param Point : Point to test
|
||||
/// \param point : Point to test
|
||||
///
|
||||
/// \return True if the point is inside
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Contains(const Vector2<T>& Point) const;
|
||||
bool Contains(const Vector2<T>& point) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check intersection between two rectangles
|
||||
///
|
||||
/// \param Rectangle : Rectangle to test
|
||||
/// \param rectangle : Rectangle to test
|
||||
///
|
||||
/// \return True if rectangles overlap
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Intersects(const Rect<T>& Rectangle) const;
|
||||
bool Intersects(const Rect<T>& rectangle) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check intersection between two rectangles and return the
|
||||
/// resulting rectangle
|
||||
///
|
||||
/// \param Rectangle : Rectangle to test
|
||||
/// \param OverlappingRect : Rectangle to be filled with the overlapping rect
|
||||
/// \param rectangle : Rectangle to test
|
||||
/// \param intersection : Rectangle to be filled with the intersection of both rectangles
|
||||
///
|
||||
/// \return True if rectangles overlap
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Intersects(const Rect<T>& Rectangle, Rect<T>& OverlappingRect) const;
|
||||
bool Intersects(const Rect<T>& rectangle, Rect<T>& intersection) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
|
|
@ -41,11 +41,11 @@ Bottom(0)
|
|||
/// Construct the color from its coordinates
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Rect<T>::Rect(T LeftCoord, T TopCoord, T RightCoord, T BottomCoord) :
|
||||
Left (LeftCoord),
|
||||
Top (TopCoord),
|
||||
Right (RightCoord),
|
||||
Bottom(BottomCoord)
|
||||
Rect<T>::Rect(T left, T top, T right, T bottom) :
|
||||
Left (left),
|
||||
Top (top),
|
||||
Right (right),
|
||||
Bottom(bottom)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -75,12 +75,12 @@ Vector2<T> Rect<T>::GetCenter() const
|
|||
/// Move the whole rectangle by the given offset
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
void Rect<T>::Offset(T OffsetX, T OffsetY)
|
||||
void Rect<T>::Offset(T offsetX, T offsetY)
|
||||
{
|
||||
Left += OffsetX;
|
||||
Right += OffsetX;
|
||||
Top += OffsetY;
|
||||
Bottom += OffsetY;
|
||||
Left += offsetX;
|
||||
Right += offsetX;
|
||||
Top += offsetY;
|
||||
Bottom += offsetY;
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,9 +88,9 @@ void Rect<T>::Offset(T OffsetX, T OffsetY)
|
|||
/// Move the whole rectangle by the given offset
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
void Rect<T>::Offset(const Vector2<T>& Off)
|
||||
void Rect<T>::Offset(const Vector2<T>& offset)
|
||||
{
|
||||
Offset(Off.x, Off.y);
|
||||
Offset(offset.x, offset.y);
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,9 +98,9 @@ void Rect<T>::Offset(const Vector2<T>& Off)
|
|||
/// Check if a point is inside the rectangle's area
|
||||
////////////////////////////////////////////////////////////
|
||||
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 <= Right) && (Y >= Top) && (Y <= Bottom);
|
||||
return (x >= Left) && (x <= Right) && (y >= Top) && (y <= Bottom);
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,9 +108,9 @@ bool Rect<T>::Contains(T X, T Y) const
|
|||
/// Check if a point is inside the rectangle's area
|
||||
////////////////////////////////////////////////////////////
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -118,16 +118,16 @@ bool Rect<T>::Contains(const Vector2<T>& Point) const
|
|||
/// Check intersection between two rectangles
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool Rect<T>::Intersects(const Rect<T>& Rectangle) const
|
||||
bool Rect<T>::Intersects(const Rect<T>& rectangle) const
|
||||
{
|
||||
// Compute overlapping rect
|
||||
Rect<T> Overlapping(std::max(Left, Rectangle.Left),
|
||||
std::max(Top, Rectangle.Top),
|
||||
std::min(Right, Rectangle.Right),
|
||||
std::min(Bottom, Rectangle.Bottom));
|
||||
Rect<T> overlapping(std::max(Left, rectangle.Left),
|
||||
std::max(Top, rectangle.Top),
|
||||
std::min(Right, rectangle.Right),
|
||||
std::min(Bottom, rectangle.Bottom));
|
||||
|
||||
// If overlapping rect is valid, then there is intersection
|
||||
return (Overlapping.Left < Overlapping.Right) && (Overlapping.Top < Overlapping.Bottom);
|
||||
return (overlapping.Left < overlapping.Right) && (overlapping.Top < overlapping.Bottom);
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,23 +136,23 @@ bool Rect<T>::Intersects(const Rect<T>& Rectangle) const
|
|||
/// resulting rectangle
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool Rect<T>::Intersects(const Rect<T>& Rectangle, Rect<T>& OverlappingRect) const
|
||||
bool Rect<T>::Intersects(const Rect<T>& rectangle, Rect<T>& intersection) const
|
||||
{
|
||||
// Compute overlapping rect
|
||||
Rect<T> Overlapping(std::max(Left, Rectangle.Left),
|
||||
std::max(Top, Rectangle.Top),
|
||||
std::min(Right, Rectangle.Right),
|
||||
std::min(Bottom, Rectangle.Bottom));
|
||||
Rect<T> overlapping(std::max(Left, rectangle.Left),
|
||||
std::max(Top, rectangle.Top),
|
||||
std::min(Right, rectangle.Right),
|
||||
std::min(Bottom, rectangle.Bottom));
|
||||
|
||||
// If overlapping rect is valid, then there is intersection
|
||||
if ((Overlapping.Left < Overlapping.Right) && (Overlapping.Top < Overlapping.Bottom))
|
||||
if ((overlapping.Left < overlapping.Right) && (overlapping.Top < overlapping.Bottom))
|
||||
{
|
||||
OverlappingRect = Overlapping;
|
||||
intersection = overlapping;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
OverlappingRect = Rect<T>(0, 0, 0, 0);
|
||||
intersection = Rect<T>(0, 0, 0, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,25 +63,25 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Create the render image from its dimensions
|
||||
///
|
||||
/// \param Width : Width of the render image
|
||||
/// \param Height : Height of the render image
|
||||
/// \param DepthBuffer : Do you want a depth buffer attached? (false by default)
|
||||
/// \param width : Width of the render image
|
||||
/// \param height : Height of the render image
|
||||
/// \param depthBuffer : Do you want a depth buffer attached? (false by default)
|
||||
///
|
||||
/// \return True if creation has been successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Create(unsigned int Width, unsigned int Height, bool DepthBuffer = false);
|
||||
bool Create(unsigned int width, unsigned int height, bool depthBuffer = false);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Activate of deactivate the render-image as the current target
|
||||
/// for rendering
|
||||
///
|
||||
/// \param Active : True to activate, false to deactivate (true by default)
|
||||
/// \param active : True to activate, false to deactivate (true by default)
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool SetActive(bool Active = true);
|
||||
bool SetActive(bool active = true);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the width of the rendering region of the image
|
||||
|
@ -123,19 +123,19 @@ private :
|
|||
/// /see RenderTarget::Activate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual bool Activate(bool Active);
|
||||
virtual bool Activate(bool active);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Update the pixels of the target image.
|
||||
/// This function is called automatically by the image when it
|
||||
/// needs to update its pixels, and is only meant for internal use.
|
||||
///
|
||||
/// \param Target : Target image to update
|
||||
/// \param target : Target image to update
|
||||
///
|
||||
/// \return True if the new pixels are flipped vertically
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool UpdateImage(Image& Target);
|
||||
bool UpdateImage(Image& target);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
|
|
@ -53,18 +53,18 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Clear the entire target with a single color
|
||||
///
|
||||
/// \param FillColor : Color to use to clear the render target
|
||||
/// \param color : Color to use to clear the render target
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Clear(const Color& FillColor = Color(0, 0, 0));
|
||||
void Clear(const Color& color = Color(0, 0, 0));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Draw something into the target
|
||||
///
|
||||
/// \param Object : Object to draw
|
||||
/// \param object : Object to draw
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void Draw(const Drawable& Object);
|
||||
virtual void Draw(const Drawable& object);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the width of the rendering region of the target
|
||||
|
@ -85,10 +85,10 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Change the current active view.
|
||||
///
|
||||
/// \param NewView : New view to use (pass GetDefaultView() to set the default view)
|
||||
/// \param view : New view to use (pass GetDefaultView() to set the default view)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetView(const View& NewView);
|
||||
void SetView(const View& view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current view
|
||||
|
@ -114,10 +114,10 @@ public :
|
|||
/// SFML to do internal optimizations and improve performances.
|
||||
/// This parameter is false by default
|
||||
///
|
||||
/// \param Preserve : True to preserve OpenGL states, false to let SFML optimize
|
||||
/// \param preserve : True to preserve OpenGL states, false to let SFML optimize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void PreserveOpenGLStates(bool Preserve);
|
||||
void PreserveOpenGLStates(bool preserve);
|
||||
|
||||
protected :
|
||||
|
||||
|
@ -138,12 +138,12 @@ private :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Activate the target for rendering
|
||||
///
|
||||
/// \param Active : True to activate rendering, false to deactivate
|
||||
/// \param active : True to activate rendering, false to deactivate
|
||||
///
|
||||
/// \return True if activation succeeded
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual bool Activate(bool Active) = 0;
|
||||
virtual bool Activate(bool active) = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the OpenGL render states needed for the SFML rendering
|
||||
|
|
|
@ -55,22 +55,22 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the window
|
||||
///
|
||||
/// \param Mode : Video mode to use
|
||||
/// \param Title : Title of the window
|
||||
/// \param WindowStyle : Window style (Resize | Close by default)
|
||||
/// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
||||
/// \param mode : Video mode to use
|
||||
/// \param title : Title of the window
|
||||
/// \param style : Window style (Resize | Close by default)
|
||||
/// \param settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderWindow(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const ContextSettings& Settings = ContextSettings());
|
||||
RenderWindow(VideoMode mode, const std::string& title, unsigned long style = Style::Resize | Style::Close, const ContextSettings& settings = ContextSettings());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct the window from an existing control
|
||||
///
|
||||
/// \param Handle : Platform-specific handle of the control
|
||||
/// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
||||
/// \param handle : Platform-specific handle of the control
|
||||
/// \param settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderWindow(WindowHandle Handle, const ContextSettings& Settings = ContextSettings());
|
||||
RenderWindow(WindowHandle handle, const ContextSettings& settings = ContextSettings());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destructor
|
||||
|
@ -106,26 +106,26 @@ public :
|
|||
/// Convert a point in window coordinates into view coordinates
|
||||
/// This version uses the current view of the window
|
||||
///
|
||||
/// \param WindowX : X coordinate of the point to convert, relative to the window
|
||||
/// \param WindowY : Y coordinate of the point to convert, relative to the window
|
||||
/// \param x : X coordinate of the point to convert, relative to the window
|
||||
/// \param y : Y coordinate of the point to convert, relative to the window
|
||||
///
|
||||
/// \return Converted point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
sf::Vector2f ConvertCoords(unsigned int WindowX, unsigned int WindowY) const;
|
||||
sf::Vector2f ConvertCoords(unsigned int x, unsigned int y) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Convert a point in window coordinates into view coordinates
|
||||
/// This version uses the given view
|
||||
///
|
||||
/// \param WindowX : X coordinate of the point to convert, relative to the window
|
||||
/// \param WindowY : Y coordinate of the point to convert, relative to the window
|
||||
/// \param TargetView : Target view to convert the point to
|
||||
/// \param x : X coordinate of the point to convert, relative to the window
|
||||
/// \param y : Y coordinate of the point to convert, relative to the window
|
||||
/// \param view : Target view to convert the point to
|
||||
///
|
||||
/// \return Converted point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
sf::Vector2f ConvertCoords(unsigned int WindowX, unsigned int WindowY, const View& TargetView) const;
|
||||
sf::Vector2f ConvertCoords(unsigned int x, unsigned int y, const View& view) const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -139,7 +139,7 @@ private :
|
|||
/// /see RenderTarget::Activate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual bool Activate(bool Active);
|
||||
virtual bool Activate(bool active);
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace sf
|
|||
/// helper functions to draw simple shapes like
|
||||
/// lines, rectangles, circles, etc.
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_API Shape : public sf::Drawable
|
||||
class SFML_API Shape : public Drawable
|
||||
{
|
||||
public :
|
||||
|
||||
|
@ -53,22 +53,22 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Add a point to the shape
|
||||
///
|
||||
/// \param X, Y : Position of the point
|
||||
/// \param Col : Color of the point (white by default)
|
||||
/// \param OutlineCol : Outline color of the point (black by default)
|
||||
/// \param x, y : Position of the point
|
||||
/// \param color : Color of the point (white by default)
|
||||
/// \param outlineColor : Outline color of the point (black by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void AddPoint(float X, float Y, const Color& Col = Color(255, 255, 255), const Color& OutlineCol = Color(0, 0, 0));
|
||||
void AddPoint(float x, float y, const Color& color = Color(255, 255, 255), const Color& outlineColor = Color(0, 0, 0));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Add a point to the shape
|
||||
///
|
||||
/// \param Position : Position of the point
|
||||
/// \param Col : Color of the point (white by default)
|
||||
/// \param OutlineCol : Outline color of the point (black by default)
|
||||
/// \param position : Position of the point
|
||||
/// \param color : Color of the point (white by default)
|
||||
/// \param outlineColor : Outline color of the point (black by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void AddPoint(const Vector2f& Position, const Color& Col = Color(255, 255, 255), const Color& OutlineCol = Color(0, 0, 0));
|
||||
void AddPoint(const Vector2f& position, const Color& color = Color(255, 255, 255), const Color& outlineColor = Color(0, 0, 0));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the number of points composing the shape
|
||||
|
@ -82,94 +82,94 @@ public :
|
|||
/// Enable or disable filling the shape.
|
||||
/// Fill is enabled by default
|
||||
///
|
||||
/// \param Enable : True to enable, false to disable
|
||||
/// \param enable : True to enable, false to disable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void EnableFill(bool Enable);
|
||||
void EnableFill(bool enable);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable or disable drawing the shape outline.
|
||||
/// Outline is enabled by default
|
||||
///
|
||||
/// \param Enable : True to enable, false to disable
|
||||
/// \param enable : True to enable, false to disable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void EnableOutline(bool Enable);
|
||||
void EnableOutline(bool enable);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a point
|
||||
///
|
||||
/// \param Index : Index of the point, in range [0, GetNbPoints() - 1]
|
||||
/// \param Position : New position of the Index-th point
|
||||
/// \param index : Index of the point, in range [0, GetNbPoints() - 1]
|
||||
/// \param position : New position of the index-th point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPointPosition(unsigned int Index, const Vector2f& Position);
|
||||
void SetPointPosition(unsigned int index, const Vector2f& position);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a point
|
||||
///
|
||||
/// \param Index : Index of the point, in range [0, GetNbPoints() - 1]
|
||||
/// \param X : New X coordinate of the Index-th point
|
||||
/// \param Y : New Y coordinate of the Index-th point
|
||||
/// \param index : Index of the point, in range [0, GetNbPoints() - 1]
|
||||
/// \param x : New X coordinate of the index-th point
|
||||
/// \param y : New Y coordinate of the index-th point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPointPosition(unsigned int Index, float X, float Y);
|
||||
void SetPointPosition(unsigned int index, float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the color of a point
|
||||
///
|
||||
/// \param Index : Index of the point, in range [0, GetNbPoints() - 1]
|
||||
/// \param Col : New color of the Index-th point
|
||||
/// \param index : Index of the point, in range [0, GetNbPoints() - 1]
|
||||
/// \param color : New color of the index-th point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPointColor(unsigned int Index, const Color& Col);
|
||||
void SetPointColor(unsigned int index, const Color& color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the outline color of a point
|
||||
///
|
||||
/// \param Index : Index of the point, in range [0, GetNbPoints() - 1]
|
||||
/// \param OutlineCol : New outline color of the Index-th point
|
||||
/// \param index : Index of the point, in range [0, GetNbPoints() - 1]
|
||||
/// \param outlineColor : New outline color of the index-th point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPointOutlineColor(unsigned int Index, const Color& OutlineCol);
|
||||
void SetPointOutlineColor(unsigned int index, const Color& outlineColor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the width of the shape outline
|
||||
///
|
||||
/// \param Width : New width
|
||||
/// \param width : New width
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetOutlineWidth(float Width);
|
||||
void SetOutlineWidth(float width);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the position of a point
|
||||
///
|
||||
/// \param Index : Index of the point, in range [0, GetNbPoints() - 1]
|
||||
/// \param index : Index of the point, in range [0, GetNbPoints() - 1]
|
||||
///
|
||||
/// \return Position of the Index-th point
|
||||
/// \return Position of the index-th point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Vector2f& GetPointPosition(unsigned int Index) const;
|
||||
const Vector2f& GetPointPosition(unsigned int index) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the color of a point
|
||||
///
|
||||
/// \param Index : Index of the point, in range [0, GetNbPoints() - 1]
|
||||
/// \param Index : index of the point, in range [0, GetNbPoints() - 1]
|
||||
///
|
||||
/// \return Color of the Index-th point
|
||||
/// \return Color of the index-th point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Color& GetPointColor(unsigned int Index) const;
|
||||
const Color& GetPointColor(unsigned int index) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the outline color of a point
|
||||
///
|
||||
/// \param Index : Index of the point, in range [0, GetNbPoints() - 1]
|
||||
/// \param index : Index of the point, in range [0, GetNbPoints() - 1]
|
||||
///
|
||||
/// \return Outline color of the Index-th point
|
||||
/// \return Outline color of the index-th point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Color& GetPointOutlineColor(unsigned int Index) const;
|
||||
const Color& GetPointOutlineColor(unsigned int index) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the width of the shape outline
|
||||
|
@ -182,76 +182,76 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Create a shape made of a single line (use floats)
|
||||
///
|
||||
/// \param P1X, P1Y : Position of the first point
|
||||
/// \param P2X, P2Y : Position second point
|
||||
/// \param Thickness : Line thickness
|
||||
/// \param Col : Color used to draw the line
|
||||
/// \param Outline : Outline width (0 by default)
|
||||
/// \param OutlineCol : Color used to draw the outline (black by default)
|
||||
/// \param p1x, p1y : Position of the first point
|
||||
/// \param p2x, p2y : Position second point
|
||||
/// \param thickness : Line thickness
|
||||
/// \param color : Color used to draw the line
|
||||
/// \param outline : Outline width (0 by default)
|
||||
/// \param outlineColor : Color used to draw the outline (black by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Shape Line(float P1X, float P1Y, float P2X, float P2Y, float Thickness, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0));
|
||||
static Shape Line(float p1x, float p1y, float p2x, float p2y, float thickness, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a shape made of a single line (use vectors)
|
||||
///
|
||||
/// \param P1X, P1Y : Position of the first point
|
||||
/// \param P2X, P2Y : Position second point
|
||||
/// \param Thickness : Line thickness
|
||||
/// \param Col : Color used to draw the line
|
||||
/// \param Outline : Outline width (0 by default)
|
||||
/// \param OutlineCol : Color used to draw the outline (black by default)
|
||||
/// \param p1 : Position of the first point
|
||||
/// \param p2 : Position second point
|
||||
/// \param thickness : Line thickness
|
||||
/// \param color : Color used to draw the line
|
||||
/// \param outline : Outline width (0 by default)
|
||||
/// \param outlineColor : Color used to draw the outline (black by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Shape Line(const Vector2f& P1, const Vector2f& P2, float Thickness, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0));
|
||||
static Shape Line(const Vector2f& p1, const Vector2f& p2, float thickness, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a shape made of a single rectangle (use floats)
|
||||
///
|
||||
/// \param P1X, P1Y : Position of the first point
|
||||
/// \param P2X, P2Y : Position second point
|
||||
/// \param Col : Color used to fill the rectangle
|
||||
/// \param Outline : Outline width (0 by default)
|
||||
/// \param OutlineCol : Color used to draw the outline (black by default)
|
||||
/// \param p1x, p1y : Position of the first point
|
||||
/// \param p2x, p2y : Position second point
|
||||
/// \param color : Color used to fill the rectangle
|
||||
/// \param outline : Outline width (0 by default)
|
||||
/// \param outlineColor : Color used to draw the outline (black by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Shape Rectangle(float P1X, float P1Y, float P2X, float P2Y, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0));
|
||||
static Shape Rectangle(float p1x, float p1y, float p2x, float p2y, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a shape made of a single rectangle (use vectors)
|
||||
///
|
||||
/// \param P1 : Position of the first point
|
||||
/// \param P2 : Position second point
|
||||
/// \param Col : Color used to fill the rectangle
|
||||
/// \param Outline : Outline width (0 by default)
|
||||
/// \param OutlineCol : Color used to draw the outline (black by default)
|
||||
/// \param p1 : Position of the first point
|
||||
/// \param p2 : Position second point
|
||||
/// \param color : Color used to fill the rectangle
|
||||
/// \param outline : Outline width (0 by default)
|
||||
/// \param outlineColor : Color used to draw the outline (black by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Shape Rectangle(const Vector2f& P1, const Vector2f& P2, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0));
|
||||
static Shape Rectangle(const Vector2f& p1, const Vector2f& p2, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a shape made of a single circle (use floats)
|
||||
///
|
||||
/// \param X, Y : Position of the center
|
||||
/// \param Radius : Radius
|
||||
/// \param Col : Color used to fill the circle
|
||||
/// \param Outline : Outline width (0 by default)
|
||||
/// \param OutlineCol : Color used to draw the outline (black by default)
|
||||
/// \param x, y : Position of the center
|
||||
/// \param radius : Radius
|
||||
/// \param color : Color used to fill the circle
|
||||
/// \param outline : Outline width (0 by default)
|
||||
/// \param outlineColor : Color used to draw the outline (black by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Shape Circle(float X, float Y, float Radius, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0));
|
||||
static Shape Circle(float x, float y, float radius, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a shape made of a single circle (use vectors)
|
||||
///
|
||||
/// \param Center : Position of the center
|
||||
/// \param Radius : Radius
|
||||
/// \param Col : Color used to fill the circle
|
||||
/// \param Outline : Outline width (0 by default)
|
||||
/// \param OutlineCol : Color used to draw the outline (black by default)
|
||||
/// \param center : Position of the center
|
||||
/// \param radius : Radius
|
||||
/// \param color : Color used to fill the circle
|
||||
/// \param outline : Outline width (0 by default)
|
||||
/// \param outlineColor : Color used to draw the outline (black by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Shape Circle(const Vector2f& Center, float Radius, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0));
|
||||
static Shape Circle(const Vector2f& center, float radius, const Color& color, float outline = 0.f, const Color& outlineColor = sf::Color(0, 0, 0));
|
||||
|
||||
protected :
|
||||
|
||||
|
@ -259,7 +259,7 @@ protected :
|
|||
/// /see Drawable::Render
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void Render(RenderTarget& Target) const;
|
||||
virtual void Render(RenderTarget& target) const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -272,21 +272,21 @@ private :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Compute the normal of a given 2D segment
|
||||
///
|
||||
/// \param P1 : First point of the segment
|
||||
/// \param P2 : Second point of the segment
|
||||
/// \param Normal : Calculated normal
|
||||
/// \param p1 : First point of the segment
|
||||
/// \param p2 : Second point of the segment
|
||||
/// \param normal : Calculated normal
|
||||
///
|
||||
/// \return False if the normal couldn't be calculated (segment is null)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static bool ComputeNormal(const Vector2f& P1, const Vector2f& P2, Vector2f& Normal);
|
||||
static bool ComputeNormal(const Vector2f& p1, const Vector2f& p2, Vector2f& normal);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Defines a simple 2D point
|
||||
////////////////////////////////////////////////////////////
|
||||
struct Point
|
||||
{
|
||||
Point(const Vector2f& Pos = Vector2f(0, 0), const Color& C = Color(255, 255, 255), const Color& OutlineC = Color(255, 255, 255));
|
||||
Point(const Vector2f& position = Vector2f(0, 0), const Color& color = Color(255, 255, 255), const Color& outlineColor = Color(255, 255, 255));
|
||||
|
||||
Vector2f Position; ///< Position
|
||||
Vector2f Normal; ///< Extruded normal
|
||||
|
|
|
@ -54,66 +54,66 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the sprite from a source image
|
||||
///
|
||||
/// \param Img : Image of the sprite
|
||||
/// \param Position : Position of the sprite (0, 0 by default)
|
||||
/// \param Scale : Scale factor (1, 1 by default)
|
||||
/// \param Rotation : Orientation, in degrees (0 by default)
|
||||
/// \param Col : Color of the sprite (white by default)
|
||||
/// \param image : Image of the sprite
|
||||
/// \param position : Position of the sprite (0, 0 by default)
|
||||
/// \param scale : Scale factor (1, 1 by default)
|
||||
/// \param rotation : Orientation, in degrees (0 by default)
|
||||
/// \param color : Color of the sprite (white by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Sprite(const Image& Img, const Vector2f& Position = Vector2f(0, 0), const Vector2f& Scale = Vector2f(1, 1), float Rotation = 0.f, const Color& Col = Color(255, 255, 255, 255));
|
||||
Sprite(const Image& image, const Vector2f& position = Vector2f(0, 0), const Vector2f& scale = Vector2f(1, 1), float rotation = 0.f, const Color& color = Color(255, 255, 255, 255));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the image of the sprite
|
||||
///
|
||||
/// \param Img : New image
|
||||
/// \param image : New image
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetImage(const Image& Img);
|
||||
void SetImage(const Image& image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the sub-rectangle of the sprite inside the source image.
|
||||
/// By default, the subrect covers the entire source image
|
||||
///
|
||||
/// \param SubRect : New sub-rectangle
|
||||
/// \param rectangle : New sub-rectangle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetSubRect(const IntRect& SubRect);
|
||||
void SetSubRect(const IntRect& rectangle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Resize the sprite (by changing its scale factors) (take 2 values).
|
||||
/// The default size is defined by the subrect
|
||||
///
|
||||
/// \param Width : New width (must be strictly positive)
|
||||
/// \param Height : New height (must be strictly positive)
|
||||
/// \param width : New width (must be strictly positive)
|
||||
/// \param height : New height (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Resize(float Width, float Height);
|
||||
void Resize(float width, float height);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Resize the sprite (by changing its scale factors) (take a 2D vector).
|
||||
/// The default size is defined by the subrect
|
||||
///
|
||||
/// \param Size : New size (both coordinates must be strictly positive)
|
||||
/// \param size : New size (both coordinates must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Resize(const Vector2f& Size);
|
||||
void Resize(const Vector2f& size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Flip the sprite horizontally
|
||||
///
|
||||
/// \param Flipped : True to flip the sprite
|
||||
/// \param flipped : True to flip the sprite
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void FlipX(bool Flipped);
|
||||
void FlipX(bool flipped);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Flip the sprite vertically
|
||||
///
|
||||
/// \param Flipped : True to flip the sprite
|
||||
/// \param flipped : True to flip the sprite
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void FlipY(bool Flipped);
|
||||
void FlipY(bool flipped);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the source image of the sprite
|
||||
|
@ -143,13 +143,13 @@ public :
|
|||
/// Get the color of a given pixel in the sprite
|
||||
/// (point is in local coordinates)
|
||||
///
|
||||
/// \param X : X coordinate of the pixel to get
|
||||
/// \param Y : Y coordinate of the pixel to get
|
||||
/// \param x : X coordinate of the pixel to get
|
||||
/// \param y : Y coordinate of the pixel to get
|
||||
///
|
||||
/// \return Color of pixel (X, Y)
|
||||
/// \return Color of pixel (x, y)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Color GetPixel(unsigned int X, unsigned int Y) const;
|
||||
Color GetPixel(unsigned int x, unsigned int y) const;
|
||||
|
||||
protected :
|
||||
|
||||
|
@ -157,7 +157,7 @@ protected :
|
|||
/// /see Drawable::Render
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void Render(RenderTarget& Target) const;
|
||||
virtual void Render(RenderTarget& target) const;
|
||||
|
||||
private :
|
||||
|
||||
|
|
|
@ -65,46 +65,46 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the string from any kind of text
|
||||
///
|
||||
/// \param Text : Text assigned to the string
|
||||
/// \param Font : Font used to draw the string (SFML built-in font by default)
|
||||
/// \param Size : Characters size (30 by default)
|
||||
/// \param text : Text assigned to the string
|
||||
/// \param font : Font used to draw the string (SFML built-in font by default)
|
||||
/// \param size : Characters size (30 by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
explicit String(const Unicode::Text& Text, const Font& CharFont = Font::GetDefaultFont(), float Size = 30.f);
|
||||
explicit String(const Unicode::Text& text, const Font& font = Font::GetDefaultFont(), float size = 30.f);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the text (from any kind of string)
|
||||
///
|
||||
/// \param Text : New text
|
||||
/// \param text : New text
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetText(const Unicode::Text& Text);
|
||||
void SetText(const Unicode::Text& text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the font of the string
|
||||
///
|
||||
/// \param Font : Font to use
|
||||
/// \param font : Font to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetFont(const Font& CharFont);
|
||||
void SetFont(const Font& font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the size of the string
|
||||
/// The default size is 30
|
||||
///
|
||||
/// \param Size : New size, in pixels
|
||||
/// \param size : New size, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetSize(float Size);
|
||||
void SetSize(float size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the style of the text
|
||||
/// The default style is Regular
|
||||
///
|
||||
/// \param TextStyle : New text style, (combination of Style enum values)
|
||||
/// \param style : New text style (combination of Style enum values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetStyle(unsigned long TextStyle);
|
||||
void SetStyle(unsigned long style);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the text (the returned text can be converted implicitely to any kind of string)
|
||||
|
@ -143,12 +143,12 @@ public :
|
|||
/// in coordinates relative to the string
|
||||
/// (note : translation, center, rotation and scale are not applied)
|
||||
///
|
||||
/// \param Index : Index of the character
|
||||
/// \param index : Index of the character
|
||||
///
|
||||
/// \return Position of the Index-th character (end of string if Index is out of range)
|
||||
/// \return Position of the index-th character (end of string if Index is out of range)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
sf::Vector2f GetCharacterPos(std::size_t Index) const;
|
||||
sf::Vector2f GetCharacterPos(std::size_t index) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the string rectangle on screen
|
||||
|
@ -164,7 +164,7 @@ protected :
|
|||
/// /see Drawable::Render
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void Render(RenderTarget& Target) const;
|
||||
virtual void Render(RenderTarget& target) const;
|
||||
|
||||
private :
|
||||
|
||||
|
|
|
@ -60,61 +60,61 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the view from a rectangle
|
||||
///
|
||||
/// \param Rectangle : Rectangle defining the view
|
||||
/// \param rectangle : Rectangle defining the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
explicit View(const FloatRect& Rectangle);
|
||||
explicit View(const FloatRect& rectangle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct the view from its center and size
|
||||
///
|
||||
/// \param Center : Center of the view
|
||||
/// \param HalfSize : Size of the view
|
||||
/// \param center : Center of the view
|
||||
/// \param size : Size of the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
View(const Vector2f& Center, const Vector2f& Size);
|
||||
View(const Vector2f& center, const Vector2f& size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the center of the view
|
||||
///
|
||||
/// \param X : X coordinate of the new center
|
||||
/// \param Y : Y coordinate of the new center
|
||||
/// \param x : X coordinate of the new center
|
||||
/// \param y : Y coordinate of the new center
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetCenter(float X, float Y);
|
||||
void SetCenter(float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the center of the view
|
||||
///
|
||||
/// \param Center : New center
|
||||
/// \param center : New center
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetCenter(const Vector2f& Center);
|
||||
void SetCenter(const Vector2f& center);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the size of the view
|
||||
///
|
||||
/// \param Width : New width
|
||||
/// \param Height : New height
|
||||
/// \param width : New width
|
||||
/// \param height : New height
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetSize(float Width, float Height);
|
||||
void SetSize(float width, float height);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the size of the view
|
||||
///
|
||||
/// \param HalfSize : New half-size
|
||||
/// \param size : New half-size
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetSize(const Vector2f& Size);
|
||||
void SetSize(const Vector2f& size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the angle of rotation of the view
|
||||
///
|
||||
/// \param Angle : New angle, in degrees
|
||||
/// \param angle : New angle, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetRotation(float Angle);
|
||||
void SetRotation(float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the target viewport
|
||||
|
@ -126,19 +126,19 @@ public :
|
|||
/// For example, a view which takes the left side of the target would
|
||||
/// be defined with View.SetViewport(sf::FloatRect(0, 0, 0.5, 1)).
|
||||
///
|
||||
/// \param Viewport : New viewport
|
||||
/// \param viewport : New viewport
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetViewport(const FloatRect& Viewport);
|
||||
void SetViewport(const FloatRect& viewport);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Reset the view to the given rectangle.
|
||||
/// Note: this function resets the rotation angle to 0.
|
||||
///
|
||||
/// \param Rectangle : Rectangle defining the view
|
||||
/// \param rectangle : Rectangle defining the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Reset(const FloatRect& Rectangle);
|
||||
void Reset(const FloatRect& rectangle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the center of the view
|
||||
|
@ -175,35 +175,35 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Move the view
|
||||
///
|
||||
/// \param OffsetX : Offset to move the view, on X axis
|
||||
/// \param OffsetY : Offset to move the view, on Y axis
|
||||
/// \param offsetX : Offset to move the view, on X axis
|
||||
/// \param offsetY : Offset to move the view, on Y axis
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Move(float OffsetX, float OffsetY);
|
||||
void Move(float offsetX, float offsetY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Move the view
|
||||
///
|
||||
/// \param Offset : Offset to move the view
|
||||
/// \param offset : Offset to move the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Move(const Vector2f& Offset);
|
||||
void Move(const Vector2f& offset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Rotate the view
|
||||
///
|
||||
/// \param Angle : Angle to rotate, in degrees
|
||||
/// \param angle : Angle to rotate, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Rotate(float Angle);
|
||||
void Rotate(float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Resize the view rectangle to simulate a zoom / unzoom effect
|
||||
///
|
||||
/// \param Factor : Zoom factor to apply, relative to the current size
|
||||
/// \param factor : Zoom factor to apply, relative to the current size
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Zoom(float Factor);
|
||||
void Zoom(float factor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the projection matrix of the view
|
||||
|
|
|
@ -136,11 +136,11 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Default constructor
|
||||
///
|
||||
/// \param Code : Response status code (InvalidResponse by default)
|
||||
/// \param Message : Response message (empty by default)
|
||||
/// \param code : Response status code (InvalidResponse by default)
|
||||
/// \param message : Response message (empty by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response(Status Code = InvalidResponse, const std::string& Message = "");
|
||||
Response(Status code = InvalidResponse, const std::string& message = "");
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Convenience function to check if the response status code
|
||||
|
@ -186,10 +186,10 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Default constructor
|
||||
///
|
||||
/// \param Resp : Source response
|
||||
/// \param response : Source response
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
DirectoryResponse(Response Resp);
|
||||
DirectoryResponse(Response response);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the directory returned in the response
|
||||
|
@ -218,11 +218,11 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Default constructor
|
||||
///
|
||||
/// \param Resp : Source response
|
||||
/// \param Data : Data containing the raw listing
|
||||
/// \param response : Source response
|
||||
/// \param data : Data containing the raw listing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ListingResponse(Response Resp, const std::vector<char>& Data);
|
||||
ListingResponse(Response response, const std::vector<char>& data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the number of filenames in the listing
|
||||
|
@ -235,12 +235,12 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Get the Index-th filename in the directory
|
||||
///
|
||||
/// \param Index : Index of the filename to get
|
||||
/// \param index : Index of the filename to get
|
||||
///
|
||||
/// \return Index-th filename
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const std::string& GetFilename(std::size_t Index) const;
|
||||
const std::string& GetFilename(std::size_t index) const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -260,14 +260,14 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Connect to the specified FTP server
|
||||
///
|
||||
/// \param Server : FTP server to connect to
|
||||
/// \param Port : Port used for connection (21 by default, standard FTP port)
|
||||
/// \param Timeout : Maximum time to wait, in seconds (0 by default, means no timeout)
|
||||
/// \param server : FTP server to connect to
|
||||
/// \param port : Port used for connection (21 by default, standard FTP port)
|
||||
/// \param timeout : Maximum time to wait, in seconds (0 by default, means no timeout)
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response Connect(const IPAddress& Server, unsigned short Port = 21, float Timeout = 0.f);
|
||||
Response Connect(const IPAddress& server, unsigned short port = 21, float timeout = 0.f);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Log in using anonymous account
|
||||
|
@ -280,13 +280,13 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Log in using a username and a password
|
||||
///
|
||||
/// \param UserName : User name
|
||||
/// \param Password : Password
|
||||
/// \param name : User name
|
||||
/// \param password : Password
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response Login(const std::string& UserName, const std::string& Password);
|
||||
Response Login(const std::string& name, const std::string& password);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Close the connection with FTP server
|
||||
|
@ -316,22 +316,22 @@ public :
|
|||
/// Get the contents of the given directory
|
||||
/// (subdirectories and files)
|
||||
///
|
||||
/// \param Directory : Directory to list ("" by default, the current one)
|
||||
/// \param directory : Directory to list ("" by default, the current one)
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ListingResponse GetDirectoryListing(const std::string& Directory = "");
|
||||
ListingResponse GetDirectoryListing(const std::string& directory = "");
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the current working directory
|
||||
///
|
||||
/// \param Directory : New directory, relative to the current one
|
||||
/// \param directory : New directory, relative to the current one
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response ChangeDirectory(const std::string& Directory);
|
||||
Response ChangeDirectory(const std::string& directory);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Go to the parent directory of the current one
|
||||
|
@ -344,12 +344,12 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Create a new directory
|
||||
///
|
||||
/// \param Name : Name of the directory to create
|
||||
/// \param name : Name of the directory to create
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response MakeDirectory(const std::string& Name);
|
||||
Response MakeDirectory(const std::string& name);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove an existing directory
|
||||
|
@ -359,65 +359,65 @@ public :
|
|||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response DeleteDirectory(const std::string& Name);
|
||||
Response DeleteDirectory(const std::string& name);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Rename a file
|
||||
///
|
||||
/// \param File : File to rename
|
||||
/// \param NewName : New name
|
||||
/// \param file : File to rename
|
||||
/// \param newName : New name
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response RenameFile(const std::string& File, const std::string& NewName);
|
||||
Response RenameFile(const std::string& file, const std::string& newName);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove an existing file
|
||||
///
|
||||
/// \param Name : File to remove
|
||||
/// \param name : File to remove
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response DeleteFile(const std::string& Name);
|
||||
Response DeleteFile(const std::string& name);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Download a file from the server
|
||||
///
|
||||
/// \param DistantFile : Path of the distant file to download
|
||||
/// \param DestPath : Where to put to file on the local computer
|
||||
/// \param Mode : Transfer mode (binary by default)
|
||||
/// \param distantFile : Path of the distant file to download
|
||||
/// \param destPath : Where to put to file on the local computer
|
||||
/// \param mode : Transfer mode (binary by default)
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response Download(const std::string& DistantFile, const std::string& DestPath, TransferMode Mode = Binary);
|
||||
Response Download(const std::string& distantFile, const std::string& destPath, TransferMode mode = Binary);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Upload a file to the server
|
||||
///
|
||||
/// \param LocalFile : Path of the local file to upload
|
||||
/// \param DestPath : Where to put to file on the server
|
||||
/// \param Mode : Transfer mode (binary by default)
|
||||
/// \param localFile : Path of the local file to upload
|
||||
/// \param destPath : Where to put to file on the server
|
||||
/// \param mode : Transfer mode (binary by default)
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response Upload(const std::string& LocalFile, const std::string& DestPath, TransferMode Mode = Binary);
|
||||
Response Upload(const std::string& localFile, const std::string& destPath, TransferMode mode = Binary);
|
||||
|
||||
private :
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send a command to the FTP server
|
||||
///
|
||||
/// \param Command : Command to send
|
||||
/// \param Parameter : Command parameter ("" by default)
|
||||
/// \param command : Command to send
|
||||
/// \param parameter : Command parameter ("" by default)
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response SendCommand(const std::string& Command, const std::string& Parameter = "");
|
||||
Response SendCommand(const std::string& command, const std::string& parameter = "");
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Receive a response from the server
|
||||
|
|
|
@ -68,30 +68,30 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Default constructor
|
||||
///
|
||||
/// \param RequestMethod : Method to use for the request (Get by default)
|
||||
/// \param URI : Target URI ("/" by default -- index page)
|
||||
/// \param Body : Content of the request's body (empty by default)
|
||||
/// \param method : Method to use for the request (Get by default)
|
||||
/// \param URI : Target URI ("/" by default -- index page)
|
||||
/// \param body : Content of the request's body (empty by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Request(Method RequestMethod = Get, const std::string& URI = "/", const std::string& Body = "");
|
||||
Request(Method method = Get, const std::string& URI = "/", const std::string& body = "");
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the value of a field; the field is added if it doesn't exist
|
||||
///
|
||||
/// \param Field : Name of the field to set (case-insensitive)
|
||||
/// \param Value : Value of the field
|
||||
/// \param field : Name of the field to set (case-insensitive)
|
||||
/// \param value : Value of the field
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetField(const std::string& Field, const std::string& Value);
|
||||
void SetField(const std::string& field, const std::string& value);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the request method.
|
||||
/// This parameter is Http::Request::Get by default
|
||||
///
|
||||
/// \param RequestMethod : Method to use for the request
|
||||
/// \param method : Method to use for the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetMethod(Method RequestMethod);
|
||||
void SetMethod(Method method);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the target URI of the request.
|
||||
|
@ -106,21 +106,21 @@ public :
|
|||
/// Set the HTTP version of the request.
|
||||
/// This parameter is 1.0 by default
|
||||
///
|
||||
/// \param Major : Major version number
|
||||
/// \param Minor : Minor version number
|
||||
/// \param major : Major version number
|
||||
/// \param minor : Minor version number
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetHttpVersion(unsigned int Major, unsigned int Minor);
|
||||
void SetHttpVersion(unsigned int major, unsigned int minor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the body of the request. This parameter is optional and
|
||||
/// makes sense only for POST requests.
|
||||
/// This parameter is empty by default
|
||||
///
|
||||
/// \param Body : Content of the request body
|
||||
/// \param body : Content of the request body
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetBody(const std::string& Body);
|
||||
void SetBody(const std::string& body);
|
||||
|
||||
private :
|
||||
|
||||
|
@ -137,12 +137,12 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Check if the given field has been defined
|
||||
///
|
||||
/// \param Field : Name of the field to check (case-insensitive)
|
||||
/// \param field : Name of the field to check (case-insensitive)
|
||||
///
|
||||
/// \return True if the field exists
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool HasField(const std::string& Field) const;
|
||||
bool HasField(const std::string& field) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Types
|
||||
|
@ -213,12 +213,12 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Get the value of a field
|
||||
///
|
||||
/// \param Field : Name of the field to get (case-insensitive)
|
||||
/// \param field : Name of the field to get (case-insensitive)
|
||||
///
|
||||
/// \return Value of the field, or empty string if not found
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const std::string& GetField(const std::string& Field) const;
|
||||
const std::string& GetField(const std::string& field) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the header's status code
|
||||
|
@ -263,10 +263,10 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the header from a response string
|
||||
///
|
||||
/// \param Data : Content of the response's header to parse
|
||||
/// \param data : Content of the response's header to parse
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void FromString(const std::string& Data);
|
||||
void FromString(const std::string& data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Types
|
||||
|
@ -292,20 +292,20 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the Http instance with the target host
|
||||
///
|
||||
/// \param Host : Web server to connect to
|
||||
/// \param Port : Port to use for connection (0 by default -- use the standard port of the protocol used)
|
||||
/// \param host : Web server to connect to
|
||||
/// \param port : Port to use for connection (0 by default -- use the standard port of the protocol used)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Http(const std::string& Host, unsigned short Port = 0);
|
||||
Http(const std::string& host, unsigned short port = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the target host
|
||||
///
|
||||
/// \param Host : Web server to connect to
|
||||
/// \param Port : Port to use for connection (0 by default -- use the standard port of the protocol used)
|
||||
/// \param host : Web server to connect to
|
||||
/// \param port : Port to use for connection (0 by default -- use the standard port of the protocol used)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetHost(const std::string& Host, unsigned short Port = 0);
|
||||
void SetHost(const std::string& host, unsigned short port = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send a HTTP request and return the server's response.
|
||||
|
@ -315,13 +315,13 @@ public :
|
|||
/// not return instantly; use a thread if you don't want to block your
|
||||
/// application.
|
||||
///
|
||||
/// \param Req : Request to send
|
||||
/// \param Timeout : Maximum time to wait, in seconds (0 by default, means no timeout)
|
||||
/// \param request : Request to send
|
||||
/// \param timeout : Maximum time to wait, in seconds (0 by default, means no timeout)
|
||||
///
|
||||
/// \return Server's response
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Response SendRequest(const Request& Req, float Timeout = 0.f);
|
||||
Response SendRequest(const Request& request, float timeout = 0.f);
|
||||
|
||||
private :
|
||||
|
||||
|
|
|
@ -52,38 +52,38 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the address from a string
|
||||
///
|
||||
/// \param Address : IP address ("xxx.xxx.xxx.xxx") or network name
|
||||
/// \param address : IP address ("xxx.xxx.xxx.xxx") or network name
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
IPAddress(const std::string& Address);
|
||||
IPAddress(const std::string& address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct the address from a C-style string ;
|
||||
/// Needed for implicit conversions from literal strings to IPAddress to work
|
||||
///
|
||||
/// \param Address : IP address ("xxx.xxx.xxx.xxx") or network name
|
||||
/// \param address : IP address ("xxx.xxx.xxx.xxx") or network name
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
IPAddress(const char* Address);
|
||||
IPAddress(const char* address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct the address from 4 bytes
|
||||
///
|
||||
/// \param Byte0 : First byte of the address
|
||||
/// \param Byte1 : Second byte of the address
|
||||
/// \param Byte2 : Third byte of the address
|
||||
/// \param Byte3 : Fourth byte of the address
|
||||
/// \param byte0 : First byte of the address
|
||||
/// \param byte1 : Second byte of the address
|
||||
/// \param byte2 : Third byte of the address
|
||||
/// \param byte3 : Fourth byte of the address
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3);
|
||||
IPAddress(Uint8 byte0, Uint8 byte1, Uint8 byte2, Uint8 byte3);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct the address from a 32-bits integer
|
||||
///
|
||||
/// \param Address : 4 bytes of the address packed into a 32-bits integer
|
||||
/// \param address : 4 bytes of the address packed into a 32-bits integer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
IPAddress(Uint32 Address);
|
||||
IPAddress(Uint32 address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell if the address is a valid one
|
||||
|
@ -123,72 +123,72 @@ public :
|
|||
/// distant website ; as a consequence, this function may be
|
||||
/// very slow -- use it as few as possible !
|
||||
///
|
||||
/// \param Timeout : Maximum time to wait, in seconds (0 by default : no timeout)
|
||||
/// \param timeout : Maximum time to wait, in seconds (0 by default : no timeout)
|
||||
///
|
||||
/// \return Public IP address
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static IPAddress GetPublicAddress(float Timeout = 0.f);
|
||||
static IPAddress GetPublicAddress(float timeout = 0.f);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Comparison operator ==
|
||||
///
|
||||
/// \param Other : Address to compare
|
||||
/// \param other : Address to compare
|
||||
///
|
||||
/// \return True if *this == Other
|
||||
/// \return True if *this == other
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator ==(const IPAddress& Other) const;
|
||||
bool operator ==(const IPAddress& other) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Comparison operator !=
|
||||
///
|
||||
/// \param Other : Address to compare
|
||||
/// \param other : Address to compare
|
||||
///
|
||||
/// \return True if *this != Other
|
||||
/// \return True if *this != other
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator !=(const IPAddress& Other) const;
|
||||
bool operator !=(const IPAddress& other) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Comparison operator <
|
||||
///
|
||||
/// \param Other : Address to compare
|
||||
/// \param other : Address to compare
|
||||
///
|
||||
/// \return True if *this < Other
|
||||
/// \return True if *this < other
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator <(const IPAddress& Other) const;
|
||||
bool operator <(const IPAddress& other) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Comparison operator >
|
||||
///
|
||||
/// \param Other : Address to compare
|
||||
/// \param other : Address to compare
|
||||
///
|
||||
/// \return True if *this > Other
|
||||
/// \return True if *this > other
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator >(const IPAddress& Other) const;
|
||||
bool operator >(const IPAddress& other) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Comparison operator <=
|
||||
///
|
||||
/// \param Other : Address to compare
|
||||
/// \param other : Address to compare
|
||||
///
|
||||
/// \return True if *this <= Other
|
||||
/// \return True if *this <= other
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator <=(const IPAddress& Other) const;
|
||||
bool operator <=(const IPAddress& other) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Comparison operator >=
|
||||
///
|
||||
/// \param Other : Address to compare
|
||||
/// \param other : Address to compare
|
||||
///
|
||||
/// \return True if *this >= Other
|
||||
/// \return True if *this >= other
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator >=(const IPAddress& Other) const;
|
||||
bool operator >=(const IPAddress& other) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Static member data
|
||||
|
@ -212,7 +212,7 @@ private :
|
|||
/// \return Reference to the input stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_API std::istream& operator >>(std::istream& Stream, IPAddress& Address);
|
||||
SFML_API std::istream& operator >>(std::istream& stream, IPAddress& address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator << overload to print an address to an output stream
|
||||
|
@ -223,7 +223,7 @@ SFML_API std::istream& operator >>(std::istream& Stream, IPAddress& Address);
|
|||
/// \return Reference to the output stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_API std::ostream& operator <<(std::ostream& Stream, const IPAddress& Address);
|
||||
SFML_API std::ostream& operator <<(std::ostream& stream, const IPAddress& address);
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
|
|
@ -57,11 +57,11 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Append data to the end of the packet
|
||||
///
|
||||
/// \param Data : Pointer to the bytes to append
|
||||
/// \param SizeInBytes : Number of bytes to append
|
||||
/// \param data : Pointer to the bytes to append
|
||||
/// \param sizeInBytes : Number of bytes to append
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Append(const void* Data, std::size_t SizeInBytes);
|
||||
void Append(const void* data, std::size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Clear the packet data
|
||||
|
@ -107,37 +107,37 @@ public :
|
|||
/// Operator >> overloads to extract data from the packet
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator >>(bool& Data);
|
||||
Packet& operator >>(Int8& Data);
|
||||
Packet& operator >>(Uint8& Data);
|
||||
Packet& operator >>(Int16& Data);
|
||||
Packet& operator >>(Uint16& Data);
|
||||
Packet& operator >>(Int32& Data);
|
||||
Packet& operator >>(Uint32& Data);
|
||||
Packet& operator >>(float& Data);
|
||||
Packet& operator >>(double& Data);
|
||||
Packet& operator >>(char* Data);
|
||||
Packet& operator >>(std::string& Data);
|
||||
Packet& operator >>(wchar_t* Data);
|
||||
Packet& operator >>(std::wstring& Data);
|
||||
Packet& operator >>(bool& data);
|
||||
Packet& operator >>(Int8& data);
|
||||
Packet& operator >>(Uint8& data);
|
||||
Packet& operator >>(Int16& data);
|
||||
Packet& operator >>(Uint16& data);
|
||||
Packet& operator >>(Int32& data);
|
||||
Packet& operator >>(Uint32& data);
|
||||
Packet& operator >>(float& data);
|
||||
Packet& operator >>(double& data);
|
||||
Packet& operator >>(char* data);
|
||||
Packet& operator >>(std::string& data);
|
||||
Packet& operator >>(wchar_t* data);
|
||||
Packet& operator >>(std::wstring& data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator << overloads to put data into the packet
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Packet& operator <<(bool Data);
|
||||
Packet& operator <<(Int8 Data);
|
||||
Packet& operator <<(Uint8 Data);
|
||||
Packet& operator <<(Int16 Data);
|
||||
Packet& operator <<(Uint16 Data);
|
||||
Packet& operator <<(Int32 Data);
|
||||
Packet& operator <<(Uint32 Data);
|
||||
Packet& operator <<(float Data);
|
||||
Packet& operator <<(double Data);
|
||||
Packet& operator <<(const char* Data);
|
||||
Packet& operator <<(const std::string& Data);
|
||||
Packet& operator <<(const wchar_t* Data);
|
||||
Packet& operator <<(const std::wstring& Data);
|
||||
Packet& operator <<(bool data);
|
||||
Packet& operator <<(Int8 data);
|
||||
Packet& operator <<(Uint8 data);
|
||||
Packet& operator <<(Int16 data);
|
||||
Packet& operator <<(Uint16 data);
|
||||
Packet& operator <<(Int32 data);
|
||||
Packet& operator <<(Uint32 data);
|
||||
Packet& operator <<(float data);
|
||||
Packet& operator <<(double data);
|
||||
Packet& operator <<(const char* data);
|
||||
Packet& operator <<(const std::string& data);
|
||||
Packet& operator <<(const wchar_t* data);
|
||||
Packet& operator <<(const std::wstring& data);
|
||||
|
||||
private :
|
||||
|
||||
|
@ -147,31 +147,31 @@ private :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Check if the packet can extract a given size of bytes
|
||||
///
|
||||
/// \param Size : Size to check
|
||||
/// \param size : Size to check
|
||||
///
|
||||
/// \return True if Size bytes can be read from the packet's data
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool CheckSize(std::size_t Size);
|
||||
bool CheckSize(std::size_t size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Called before the packet is sent to the network
|
||||
///
|
||||
/// \param DataSize : Variable to fill with the size of data to send
|
||||
/// \param dataSize : Variable to fill with the size of data to send
|
||||
///
|
||||
/// \return Pointer to the array of bytes to send
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual const char* OnSend(std::size_t& DataSize);
|
||||
virtual const char* OnSend(std::size_t& dataSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Called after the packet has been received from the network
|
||||
///
|
||||
/// \param Data : Pointer to the array of received bytes
|
||||
/// \param DataSize : Size of the array of bytes
|
||||
/// \param data : Pointer to the array of received bytes
|
||||
/// \param dataSize : Size of the array of bytes
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void OnReceive(const char* Data, std::size_t DataSize);
|
||||
virtual void OnReceive(const char* data, std::size_t dataSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
|
|
@ -48,18 +48,18 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Add a socket to watch
|
||||
///
|
||||
/// \param Socket : Socket to add
|
||||
/// \param socket : Socket to add
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Add(Type Socket);
|
||||
void Add(Type socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove a socket
|
||||
///
|
||||
/// \param Socket : Socket to remove
|
||||
/// \param socket : Socket to remove
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Remove(Type Socket);
|
||||
void Remove(Type socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove all sockets
|
||||
|
@ -72,24 +72,24 @@ public :
|
|||
/// This functions will return either when at least one socket
|
||||
/// is ready, or when the given time is out
|
||||
///
|
||||
/// \param Timeout : Timeout, in seconds (0 by default : no timeout)
|
||||
/// \param timeout : Timeout, in seconds (0 by default : no timeout)
|
||||
///
|
||||
/// \return Number of sockets ready to be read
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int Wait(float Timeout = 0.f);
|
||||
unsigned int Wait(float timeout = 0.f);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// After a call to Wait(), get the Index-th socket which is
|
||||
/// ready for reading. The total number of sockets ready
|
||||
/// is the integer returned by the previous call to Wait()
|
||||
///
|
||||
/// \param Index : Index of the socket to get
|
||||
/// \param index : Index of the socket to get
|
||||
///
|
||||
/// \return The Index-th socket
|
||||
/// \return The index-th socket
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Type GetSocketReady(unsigned int Index);
|
||||
Type GetSocketReady(unsigned int index);
|
||||
|
||||
private :
|
||||
|
||||
|
|
|
@ -27,12 +27,12 @@
|
|||
/// Add a socket to watch
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename Type>
|
||||
void Selector<Type>::Add(Type Socket)
|
||||
void Selector<Type>::Add(Type socket)
|
||||
{
|
||||
if (Socket.IsValid())
|
||||
if (socket.IsValid())
|
||||
{
|
||||
SelectorBase::Add(Socket.mySocket);
|
||||
mySockets[Socket.mySocket] = Socket;
|
||||
SelectorBase::Add(socket.mySocket);
|
||||
mySockets[socket.mySocket] = socket;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,13 +41,13 @@ void Selector<Type>::Add(Type Socket)
|
|||
/// Remove a socket
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename Type>
|
||||
void Selector<Type>::Remove(Type Socket)
|
||||
void Selector<Type>::Remove(Type socket)
|
||||
{
|
||||
typename SocketTable::iterator It = mySockets.find(Socket.mySocket);
|
||||
if (It != mySockets.end())
|
||||
typename SocketTable::iterator it = mySockets.find(socket.mySocket);
|
||||
if (it != mySockets.end())
|
||||
{
|
||||
SelectorBase::Remove(Socket.mySocket);
|
||||
mySockets.erase(It);
|
||||
SelectorBase::Remove(socket.mySocket);
|
||||
mySockets.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,13 +69,13 @@ void Selector<Type>::Clear()
|
|||
/// is ready, or when the given time is out
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename Type>
|
||||
unsigned int Selector<Type>::Wait(float Timeout)
|
||||
unsigned int Selector<Type>::Wait(float timeout)
|
||||
{
|
||||
// No socket in the selector : return 0
|
||||
if (mySockets.empty())
|
||||
return 0;
|
||||
|
||||
return SelectorBase::Wait(Timeout);
|
||||
return SelectorBase::Wait(timeout);
|
||||
}
|
||||
|
||||
|
||||
|
@ -85,13 +85,13 @@ unsigned int Selector<Type>::Wait(float Timeout)
|
|||
/// is the integer returned by the previous call to Wait()
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename Type>
|
||||
Type Selector<Type>::GetSocketReady(unsigned int Index)
|
||||
Type Selector<Type>::GetSocketReady(unsigned int index)
|
||||
{
|
||||
SocketHelper::SocketType Socket = SelectorBase::GetSocketReady(Index);
|
||||
SocketHelper::SocketType socket = SelectorBase::GetSocketReady(index);
|
||||
|
||||
typename SocketTable::const_iterator It = mySockets.find(Socket);
|
||||
if (It != mySockets.end())
|
||||
return It->second;
|
||||
typename SocketTable::const_iterator it = mySockets.find(socket);
|
||||
if (it != mySockets.end())
|
||||
return it->second;
|
||||
else
|
||||
return Type(Socket);
|
||||
return Type(socket);
|
||||
}
|
||||
|
|
|
@ -53,18 +53,18 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Add a socket to watch
|
||||
///
|
||||
/// \param Socket : Socket to add
|
||||
/// \param socket : Socket to add
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Add(SocketHelper::SocketType Socket);
|
||||
void Add(SocketHelper::SocketType socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove a socket
|
||||
///
|
||||
/// \param Socket : Socket to remove
|
||||
/// \param socket : Socket to remove
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Remove(SocketHelper::SocketType Socket);
|
||||
void Remove(SocketHelper::SocketType socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove all sockets
|
||||
|
@ -77,24 +77,24 @@ public :
|
|||
/// This functions will return either when at least one socket
|
||||
/// is ready, or when the given time is out
|
||||
///
|
||||
/// \param Timeout : Timeout, in seconds (0 by default : no timeout)
|
||||
/// \param timeout : Timeout, in seconds (0 by default : no timeout)
|
||||
///
|
||||
/// \return Number of sockets ready to be read
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int Wait(float Timeout = 0.f);
|
||||
unsigned int Wait(float timeout = 0.f);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// After a call to Wait(), get the Index-th socket which is
|
||||
/// ready for reading. The total number of sockets ready
|
||||
/// is the integer returned by the previous call to Wait()
|
||||
///
|
||||
/// \param Index : Index of the socket to get
|
||||
/// \param index : Index of the socket to get
|
||||
///
|
||||
/// \return The Index-th socket
|
||||
/// \return The index-th socket
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SocketHelper::SocketType GetSocketReady(unsigned int Index);
|
||||
SocketHelper::SocketType GetSocketReady(unsigned int index);
|
||||
|
||||
private :
|
||||
|
||||
|
|
|
@ -56,89 +56,89 @@ public :
|
|||
/// Change the blocking state of the socket.
|
||||
/// The default behaviour of a socket is blocking
|
||||
///
|
||||
/// \param Blocking : Pass true to set the socket as blocking, or false for non-blocking
|
||||
/// \param blocking : Pass true to set the socket as blocking, or false for non-blocking
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetBlocking(bool Blocking);
|
||||
void SetBlocking(bool blocking);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Connect to another computer on a specified port
|
||||
///
|
||||
/// \param Port : Port to use for transfers (warning : ports < 1024 are reserved)
|
||||
/// \param HostAddress : IP Address of the host to connect to
|
||||
/// \param Timeout : Maximum time to wait, in seconds (0 by default : no timeout) (this parameter is ignored for non-blocking sockets)
|
||||
/// \param port : Port to use for transfers (warning : ports < 1024 are reserved)
|
||||
/// \param host : IP Address of the host to connect to
|
||||
/// \param timeout : Maximum time to wait, in seconds (0 by default : no timeout) (this parameter is ignored for non-blocking sockets)
|
||||
///
|
||||
/// \return True if operation has been successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Socket::Status Connect(unsigned short Port, const IPAddress& HostAddress, float Timeout = 0.f);
|
||||
Socket::Status Connect(unsigned short port, const IPAddress& host, float timeout = 0.f);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Listen to a specified port for incoming data or connections
|
||||
///
|
||||
/// \param Port : Port to listen to
|
||||
/// \param port : Port to listen to
|
||||
///
|
||||
/// \return True if operation has been successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Listen(unsigned short Port);
|
||||
bool Listen(unsigned short port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Wait for a connection (must be listening to a port).
|
||||
/// This function will block if the socket is blocking
|
||||
///
|
||||
/// \param Connected : Socket containing the connection with the connected client
|
||||
/// \param Address : Pointer to an address to fill with client infos (NULL by default)
|
||||
/// \param connected : Socket containing the connection with the connected client
|
||||
/// \param address : Pointer to an address to fill with client infos (NULL by default)
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Socket::Status Accept(SocketTCP& Connected, IPAddress* Address = NULL);
|
||||
Socket::Status Accept(SocketTCP& connected, IPAddress* address = NULL);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send an array of bytes to the host (must be connected first)
|
||||
///
|
||||
/// \param Data : Pointer to the bytes to send
|
||||
/// \param Size : Number of bytes to send
|
||||
/// \param data : Pointer to the bytes to send
|
||||
/// \param size : Number of bytes to send
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Socket::Status Send(const char* Data, std::size_t Size);
|
||||
Socket::Status Send(const char* data, std::size_t size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Receive an array of bytes from the host (must be connected first).
|
||||
/// This function will block if the socket is blocking
|
||||
///
|
||||
/// \param Data : Pointer to a byte array to fill (make sure it is big enough)
|
||||
/// \param MaxSize : Maximum number of bytes to read
|
||||
/// \param SizeReceived : Number of bytes received
|
||||
/// \param data : Pointer to a byte array to fill (make sure it is big enough)
|
||||
/// \param maxSize : Maximum number of bytes to read
|
||||
/// \param sizeReceived : Number of bytes received
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Socket::Status Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived);
|
||||
Socket::Status Receive(char* data, std::size_t maxSize, std::size_t& sizeReceived);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send a packet of data to the host (must be connected first)
|
||||
///
|
||||
/// \param PacketToSend : Packet to send
|
||||
/// \param packet : Packet to send
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Socket::Status Send(Packet& PacketToSend);
|
||||
Socket::Status Send(Packet& packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Receive a packet from the host (must be connected first).
|
||||
/// This function will block if the socket is blocking
|
||||
///
|
||||
/// \param PacketToReceive : Packet to fill with received data
|
||||
/// \param packet : Packet to fill with received data
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Socket::Status Receive(Packet& PacketToReceive);
|
||||
Socket::Status Receive(Packet& packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Close the socket
|
||||
|
@ -160,34 +160,34 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Comparison operator ==
|
||||
///
|
||||
/// \param Other : Socket to compare
|
||||
/// \param other : Socket to compare
|
||||
///
|
||||
/// \return True if *this == Other
|
||||
/// \return True if *this == other
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator ==(const SocketTCP& Other) const;
|
||||
bool operator ==(const SocketTCP& other) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Comparison operator !=
|
||||
///
|
||||
/// \param Other : Socket to compare
|
||||
/// \param other : Socket to compare
|
||||
///
|
||||
/// \return True if *this != Other
|
||||
/// \return True if *this != other
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator !=(const SocketTCP& Other) const;
|
||||
bool operator !=(const SocketTCP& other) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Comparison operator <.
|
||||
/// Provided for compatibility with standard containers, as
|
||||
/// comparing two sockets doesn't make much sense...
|
||||
///
|
||||
/// \param Other : Socket to compare
|
||||
/// \param other : Socket to compare
|
||||
///
|
||||
/// \return True if *this < Other
|
||||
/// \return True if *this < other
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator <(const SocketTCP& Other) const;
|
||||
bool operator <(const SocketTCP& other) const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -197,18 +197,18 @@ private :
|
|||
/// Construct the socket from a socket descriptor
|
||||
/// (for internal use only)
|
||||
///
|
||||
/// \param Descriptor : Socket descriptor
|
||||
/// \param descriptor : Socket descriptor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SocketTCP(SocketHelper::SocketType Descriptor);
|
||||
SocketTCP(SocketHelper::SocketType descriptor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create the socket
|
||||
///
|
||||
/// \param Descriptor : System socket descriptor to use (0 by default -- create a new socket)
|
||||
/// \param descriptor : System socket descriptor to use (0 by default -- create a new socket)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Create(SocketHelper::SocketType Descriptor = 0);
|
||||
void Create(SocketHelper::SocketType descriptor = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
|
|
@ -56,20 +56,20 @@ public :
|
|||
/// Change the blocking state of the socket.
|
||||
/// The default behaviour of a socket is blocking
|
||||
///
|
||||
/// \param Blocking : Pass true to set the socket as blocking, or false for non-blocking
|
||||
/// \param blocking : Pass true to set the socket as blocking, or false for non-blocking
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetBlocking(bool Blocking);
|
||||
void SetBlocking(bool blocking);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Bind the socket to a specific port
|
||||
///
|
||||
/// \param Port : Port to bind the socket to
|
||||
/// \param port : Port to bind the socket to
|
||||
///
|
||||
/// \return True if operation has been successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Bind(unsigned short Port);
|
||||
bool Bind(unsigned short port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Unbind the socket from its previous port, if any
|
||||
|
@ -82,55 +82,55 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Send an array of bytes
|
||||
///
|
||||
/// \param Data : Pointer to the bytes to send
|
||||
/// \param Size : Number of bytes to send
|
||||
/// \param Address : Address of the computer to send the packet to
|
||||
/// \param Port : Port to send the data to
|
||||
/// \param data : Pointer to the bytes to send
|
||||
/// \param size : Number of bytes to send
|
||||
/// \param address : Address of the computer to send the packet to
|
||||
/// \param port : Port to send the data to
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Socket::Status Send(const char* Data, std::size_t Size, const IPAddress& Address, unsigned short Port);
|
||||
Socket::Status Send(const char* data, std::size_t size, const IPAddress& address, unsigned short port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Receive an array of bytes.
|
||||
/// This function will block if the socket is blocking
|
||||
///
|
||||
/// \param Data : Pointer to a byte array to fill (make sure it is big enough)
|
||||
/// \param MaxSize : Maximum number of bytes to read
|
||||
/// \param SizeReceived : Number of bytes received
|
||||
/// \param Address : Address of the computer which sent the data
|
||||
/// \param Port : Port on which the remote computer sent the data
|
||||
/// \param data : Pointer to a byte array to fill (make sure it is big enough)
|
||||
/// \param maxSize : Maximum number of bytes to read
|
||||
/// \param sizeReceived : Number of bytes received
|
||||
/// \param address : Address of the computer which sent the data
|
||||
/// \param port : Port on which the remote computer sent the data
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Socket::Status Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived, IPAddress& Address, unsigned short& Port);
|
||||
Socket::Status Receive(char* data, std::size_t maxSize, std::size_t& sizeReceived, IPAddress& address, unsigned short& port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send a packet of data
|
||||
///
|
||||
/// \param PacketToSend : Packet to send
|
||||
/// \param Address : Address of the computer to send the packet to
|
||||
/// \param Port : Port to send the data to
|
||||
/// \param packet : Packet to send
|
||||
/// \param address : Address of the computer to send the packet to
|
||||
/// \param port : Port to send the data to
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Socket::Status Send(Packet& PacketToSend, const IPAddress& Address, unsigned short Port);
|
||||
Socket::Status Send(Packet& packet, const IPAddress& address, unsigned short port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Receive a packet.
|
||||
/// This function will block if the socket is blocking
|
||||
///
|
||||
/// \param PacketToReceive : Packet to fill with received data
|
||||
/// \param Address : Address of the computer which sent the packet
|
||||
/// \param Port : Port on which the remote computer sent the data
|
||||
/// \param packet : Packet to fill with received data
|
||||
/// \param Address : Address of the computer which sent the packet
|
||||
/// \param Port : Port on which the remote computer sent the data
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Socket::Status Receive(Packet& PacketToReceive, IPAddress& Address, unsigned short& Port);
|
||||
Socket::Status Receive(Packet& packet, IPAddress& address, unsigned short& port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Close the socket
|
||||
|
@ -160,34 +160,34 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Comparison operator ==
|
||||
///
|
||||
/// \param Other : Socket to compare
|
||||
/// \param other : Socket to compare
|
||||
///
|
||||
/// \return True if *this == Other
|
||||
/// \return True if *this == other
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator ==(const SocketUDP& Other) const;
|
||||
bool operator ==(const SocketUDP& other) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Comparison operator !=
|
||||
///
|
||||
/// \param Other : Socket to compare
|
||||
/// \param other : Socket to compare
|
||||
///
|
||||
/// \return True if *this != Other
|
||||
/// \return True if *this != other
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator !=(const SocketUDP& Other) const;
|
||||
bool operator !=(const SocketUDP& other) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Comparison operator <.
|
||||
/// Provided for compatibility with standard containers, as
|
||||
/// comparing two sockets doesn't make much sense...
|
||||
///
|
||||
/// \param Other : Socket to compare
|
||||
/// \param other : Socket to compare
|
||||
///
|
||||
/// \return True if *this < Other
|
||||
/// \return True if *this < other
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator <(const SocketUDP& Other) const;
|
||||
bool operator <(const SocketUDP& other) const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -197,18 +197,18 @@ private :
|
|||
/// Construct the socket from a socket descriptor
|
||||
/// (for internal use only)
|
||||
///
|
||||
/// \param Descriptor : Socket descriptor
|
||||
/// \param descriptor : Socket descriptor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SocketUDP(SocketHelper::SocketType Descriptor);
|
||||
SocketUDP(SocketHelper::SocketType descriptor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create the socket
|
||||
///
|
||||
/// \param Descriptor : System socket descriptor to use (0 by default -- create a new socket)
|
||||
/// \param descriptor : System socket descriptor to use (0 by default -- create a new socket)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Create(SocketHelper::SocketType Descriptor = 0);
|
||||
void Create(SocketHelper::SocketType descriptor = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
|
|
@ -59,21 +59,21 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Close / destroy a socket
|
||||
///
|
||||
/// \param Socket : Socket to close
|
||||
/// \param socket : Socket to close
|
||||
///
|
||||
/// \return True on success
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static bool Close(SocketType Socket);
|
||||
static bool Close(SocketType socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a socket as blocking or non-blocking
|
||||
///
|
||||
/// \param Socket : Socket to modify
|
||||
/// \param Block : New blocking state of the socket
|
||||
/// \param socket : Socket to modify
|
||||
/// \param block : New blocking state of the socket
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void SetBlocking(SocketType Socket, bool Block);
|
||||
static void SetBlocking(SocketType socket, bool block);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the last socket error status
|
||||
|
|
|
@ -46,10 +46,10 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the lock with a target mutex (lock it)
|
||||
///
|
||||
/// @param Mutex : Mutex to lock
|
||||
/// \param mutex : Mutex to lock
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Lock(Mutex& Mutex);
|
||||
Lock(Mutex& mutex);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destructor (unlocks the mutex)
|
||||
|
|
|
@ -45,10 +45,10 @@ public :
|
|||
/// Set the seed for the generator. Using a known seed
|
||||
/// allows you to reproduce the same sequence of random number
|
||||
///
|
||||
/// \param Seed : Number to use as the seed
|
||||
/// \param seed : Number to use as the seed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void SetSeed(unsigned int Seed);
|
||||
static void SetSeed(unsigned int seed);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the seed used to generate random numbers the generator.
|
||||
|
@ -61,24 +61,24 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Get a random float number in a given range
|
||||
///
|
||||
/// \return Start : Start of the range
|
||||
/// \return End : End of the range
|
||||
/// \return begin : Beginning of the range
|
||||
/// \return end : End of the range
|
||||
///
|
||||
/// \return Random number in [Begin, End]
|
||||
/// \return Random number in [begin, end]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static float Random(float Begin, float End);
|
||||
static float Random(float begin, float end);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a random integer number in a given range
|
||||
///
|
||||
/// \return Start : Start of the range
|
||||
/// \return End : End of the range
|
||||
/// \return begin : Beginning of the range
|
||||
/// \return end : End of the range
|
||||
///
|
||||
/// \return Random number in [Begin, End]
|
||||
/// \return Random number in [begin, end]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static int Random(int Begin, int End);
|
||||
static int Random(int begin, int end);
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
|
|
@ -60,10 +60,10 @@ protected :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Copy constructor
|
||||
///
|
||||
/// \param Copy : Resource to copy
|
||||
/// \param copy : Resource to copy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Resource(const Resource<T>& Copy);
|
||||
Resource(const Resource<T>& copy);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destructor
|
||||
|
@ -74,12 +74,12 @@ protected :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Assignment operator
|
||||
///
|
||||
/// \param Other : Resource to copy
|
||||
/// \param other : Resource to copy
|
||||
///
|
||||
/// \return Reference to this
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Resource<T>& operator =(const Resource<T>& Other);
|
||||
Resource<T>& operator =(const Resource<T>& other);
|
||||
|
||||
private :
|
||||
|
||||
|
@ -88,18 +88,18 @@ private :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Connect a ResourcePtr to this resource
|
||||
///
|
||||
/// \param Observer : Observer to add
|
||||
/// \param observer : Observer to add
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Connect(ResourcePtr<T>& Observer) const;
|
||||
void Connect(ResourcePtr<T>& observer) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Disconnect a ResourcePtr from this resource
|
||||
///
|
||||
/// \param Observer : Observer to remove
|
||||
/// \param observer : Observer to remove
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Disconnect(ResourcePtr<T>& Observer) const;
|
||||
void Disconnect(ResourcePtr<T>& observer) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
@ -126,18 +126,18 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct from a raw resource
|
||||
///
|
||||
/// \param Resource : Internal resource
|
||||
/// \param resource : Internal resource
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ResourcePtr(const T* Resource);
|
||||
ResourcePtr(const T* resource);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy constructor
|
||||
///
|
||||
/// \param Copy : Instance to copy
|
||||
/// \param copy : Instance to copy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ResourcePtr(const ResourcePtr<T>& Copy);
|
||||
ResourcePtr(const ResourcePtr<T>& copy);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destructor
|
||||
|
@ -148,22 +148,22 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Assignment operator from another ResourcePtr
|
||||
///
|
||||
/// \param Other : Resource pointer to assign
|
||||
/// \param other : Resource pointer to assign
|
||||
///
|
||||
/// \return Reference to this
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ResourcePtr<T>& operator =(const ResourcePtr<T>& Other);
|
||||
ResourcePtr<T>& operator =(const ResourcePtr<T>& other);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Assignment operator from a raw resource
|
||||
///
|
||||
/// \param Resource : Resource to assign
|
||||
/// \param resource : Resource to assign
|
||||
///
|
||||
/// \return Reference to this
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ResourcePtr<T>& operator =(const T* Resource);
|
||||
ResourcePtr<T>& operator =(const T* resource);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Cast operator to implicitely convert the resource pointer to
|
||||
|
|
|
@ -72,9 +72,9 @@ Resource<T>& Resource<T>::operator =(const Resource<T>&)
|
|||
/// Connect a ResourcePtr to this resource
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
void Resource<T>::Connect(ResourcePtr<T>& Observer) const
|
||||
void Resource<T>::Connect(ResourcePtr<T>& observer) const
|
||||
{
|
||||
myObservers.insert(&Observer);
|
||||
myObservers.insert(&observer);
|
||||
}
|
||||
|
||||
|
||||
|
@ -82,7 +82,7 @@ void Resource<T>::Connect(ResourcePtr<T>& Observer) const
|
|||
/// Disconnect a ResourcePtr from this resource
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
void Resource<T>::Disconnect(ResourcePtr<T>& Observer) const
|
||||
void Resource<T>::Disconnect(ResourcePtr<T>& observer) const
|
||||
{
|
||||
myObservers.erase(&Observer);
|
||||
myObservers.erase(&observer);
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ myResource(NULL)
|
|||
/// Construct from a raw resource
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
ResourcePtr<T>::ResourcePtr(const T* Resource) :
|
||||
myResource(Resource)
|
||||
ResourcePtr<T>::ResourcePtr(const T* resource) :
|
||||
myResource(resource)
|
||||
{
|
||||
if (myResource)
|
||||
myResource->Connect(*this);
|
||||
|
@ -50,8 +50,8 @@ myResource(Resource)
|
|||
/// Copy constructor
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
ResourcePtr<T>::ResourcePtr(const ResourcePtr<T>& Copy) :
|
||||
myResource(Copy.myResource)
|
||||
ResourcePtr<T>::ResourcePtr(const ResourcePtr<T>& copy) :
|
||||
myResource(copy.myResource)
|
||||
{
|
||||
if (myResource)
|
||||
myResource->Connect(*this);
|
||||
|
@ -73,12 +73,12 @@ ResourcePtr<T>::~ResourcePtr()
|
|||
/// Assignment operator from another ResourcePtr
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
ResourcePtr<T>& ResourcePtr<T>::operator =(const ResourcePtr<T>& Other)
|
||||
ResourcePtr<T>& ResourcePtr<T>::operator =(const ResourcePtr<T>& other)
|
||||
{
|
||||
if (myResource)
|
||||
myResource->Disconnect(*this);
|
||||
|
||||
myResource = Other.myResource;
|
||||
myResource = other.myResource;
|
||||
|
||||
if (myResource)
|
||||
myResource->Connect(*this);
|
||||
|
@ -91,12 +91,12 @@ ResourcePtr<T>& ResourcePtr<T>::operator =(const ResourcePtr<T>& Other)
|
|||
/// Assignment operator from a raw resource
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
ResourcePtr<T>& ResourcePtr<T>::operator =(const T* Resource)
|
||||
ResourcePtr<T>& ResourcePtr<T>::operator =(const T* resource)
|
||||
{
|
||||
if (myResource)
|
||||
myResource->Disconnect(*this);
|
||||
|
||||
myResource = Resource;
|
||||
myResource = resource;
|
||||
|
||||
if (myResource)
|
||||
myResource->Connect(*this);
|
||||
|
|
|
@ -36,10 +36,10 @@ namespace sf
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Make the current thread sleep for a given time
|
||||
///
|
||||
/// \param Duration : Time to sleep, in seconds (must be >= 0)
|
||||
/// \param duration : Time to sleep, in seconds (must be >= 0)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SFML_API Sleep(float Duration);
|
||||
void SFML_API Sleep(float duration);
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
|
|
@ -56,11 +56,11 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the thread from a function pointer
|
||||
///
|
||||
/// \param Function : Entry point of the thread
|
||||
/// \param UserData : Data to pass to the thread function (NULL by default)
|
||||
/// \param function : Entry point of the thread
|
||||
/// \param userData : Data to pass to the thread function (NULL by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Thread(FuncType Function, void* UserData = NULL);
|
||||
Thread(FuncType function, void* userData = NULL);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Virtual destructor
|
||||
|
|
|
@ -54,10 +54,10 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Default constructor
|
||||
///
|
||||
/// \param Value : Optional value to initalize the variable (NULL by default)
|
||||
/// \param value : Optional value to initalize the variable (NULL by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ThreadLocal(void* Value = NULL);
|
||||
ThreadLocal(void* value = NULL);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destructor
|
||||
|
@ -71,7 +71,7 @@ public :
|
|||
/// \param Value : Value of the variable for this thread
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetValue(void* Value);
|
||||
void SetValue(void* value);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Retrieve the thread-specific value of the variable
|
||||
|
|
|
@ -44,10 +44,10 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Default constructor
|
||||
///
|
||||
/// \param Value : Optional value to initalize the variable (NULL by default)
|
||||
/// \param value : Optional value to initalize the variable (NULL by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ThreadLocalPtr(T* Value = NULL);
|
||||
ThreadLocalPtr(T* value = NULL);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator * overload to return a reference to the variable
|
||||
|
@ -76,22 +76,22 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Assignment operator
|
||||
///
|
||||
/// \param Value : New pointer value to assign for this thread
|
||||
/// \param value : New pointer value to assign for this thread
|
||||
///
|
||||
/// \return Reference to this
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ThreadLocalPtr<T>& operator =(T* Value);
|
||||
ThreadLocalPtr<T>& operator =(T* value);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Assignment operator
|
||||
///
|
||||
/// \param Other : Other thread-local pointer value to assign
|
||||
/// \param other : Other thread-local pointer value to assign
|
||||
///
|
||||
/// \return Reference to this
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ThreadLocalPtr<T>& operator =(const ThreadLocalPtr<T>& Other);
|
||||
ThreadLocalPtr<T>& operator =(const ThreadLocalPtr<T>& other);
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
|
|
@ -73,19 +73,19 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the unicode text from any type of string
|
||||
///
|
||||
/// \param Str : String to convert
|
||||
/// \param str : String to convert
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Text(const char* Str);
|
||||
Text(const wchar_t* Str);
|
||||
Text(const Uint8* Str);
|
||||
Text(const Uint16* Str);
|
||||
Text(const Uint32* Str);
|
||||
Text(const std::string& Str);
|
||||
Text(const std::wstring& Str);
|
||||
Text(const Unicode::UTF8String& Str);
|
||||
Text(const Unicode::UTF16String& Str);
|
||||
Text(const Unicode::UTF32String& Str);
|
||||
Text(const char* str);
|
||||
Text(const wchar_t* str);
|
||||
Text(const Uint8* str);
|
||||
Text(const Uint16* str);
|
||||
Text(const Uint32* str);
|
||||
Text(const std::string& str);
|
||||
Text(const std::wstring& str);
|
||||
Text(const Unicode::UTF8String& str);
|
||||
Text(const Unicode::UTF16String& str);
|
||||
Text(const Unicode::UTF32String& str);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator to cast the text to any type of string
|
||||
|
@ -111,158 +111,158 @@ public :
|
|||
/// Generic function to convert an UTF-32 characters range
|
||||
/// to an ANSI characters range, using the given locale
|
||||
///
|
||||
/// \param Begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param End : Iterator pointing to the end of the input sequence
|
||||
/// \param Output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||
/// \param Locale : Locale to use for conversion (uses the current one by default)
|
||||
/// \param begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param end : Iterator pointing to the end of the input sequence
|
||||
/// \param output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||
/// \param locale : Locale to use for conversion (uses the current one by default)
|
||||
///
|
||||
/// \return Iterator to the end of the output sequence which has been written
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
static Out UTF32ToANSI(In Begin, In End, Out Output, char Replacement = '?', const std::locale& Locale = GetDefaultLocale());
|
||||
static Out UTF32ToANSI(In begin, In end, Out output, char replacement = '?', const std::locale& locale = GetDefaultLocale());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Generic function to convert an ANSI characters range
|
||||
/// to an UTF-32 characters range, using the given locale
|
||||
///
|
||||
/// \param Begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param End : Iterator pointing to the end of the input sequence
|
||||
/// \param Output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param Locale : Locale to use for conversion (uses the current one by default)
|
||||
/// \param begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param end : Iterator pointing to the end of the input sequence
|
||||
/// \param output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param locale : Locale to use for conversion (uses the current one by default)
|
||||
///
|
||||
/// \return Iterator to the end of the output sequence which has been written
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
static Out ANSIToUTF32(In Begin, In End, Out Output, const std::locale& Locale = GetDefaultLocale());
|
||||
static Out ANSIToUTF32(In begin, In end, Out output, const std::locale& locale = GetDefaultLocale());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Generic function to convert an UTF-8 characters range
|
||||
/// to an UTF-16 characters range, using the given locale
|
||||
///
|
||||
/// \param Begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param End : Iterator pointing to the end of the input sequence
|
||||
/// \param Output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||
/// \param begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param end : Iterator pointing to the end of the input sequence
|
||||
/// \param output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||
///
|
||||
/// \return Iterator to the end of the output sequence which has been written
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
static Out UTF8ToUTF16(In Begin, In End, Out Output, Uint16 Replacement = '?');
|
||||
static Out UTF8ToUTF16(In begin, In end, Out output, Uint16 replacement = '?');
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Generic function to convert an UTF-8 characters range
|
||||
/// to an UTF-32 characters range, using the given locale
|
||||
///
|
||||
/// \param Begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param End : Iterator pointing to the end of the input sequence
|
||||
/// \param Output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||
/// \param begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param end : Iterator pointing to the end of the input sequence
|
||||
/// \param output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||
///
|
||||
/// \return Iterator to the end of the output sequence which has been written
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
static Out UTF8ToUTF32(In Begin, In End, Out Output, Uint32 Replacement = '?');
|
||||
static Out UTF8ToUTF32(In begin, In end, Out output, Uint32 replacement = '?');
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Generic function to convert an UTF-16 characters range
|
||||
/// to an UTF-8 characters range, using the given locale
|
||||
///
|
||||
/// \param Begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param End : Iterator pointing to the end of the input sequence
|
||||
/// \param Output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||
/// \param begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param end : Iterator pointing to the end of the input sequence
|
||||
/// \param output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||
///
|
||||
/// \return Iterator to the end of the output sequence which has been written
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
static Out UTF16ToUTF8(In Begin, In End, Out Output, Uint8 Replacement = '?');
|
||||
static Out UTF16ToUTF8(In begin, In end, Out output, Uint8 replacement = '?');
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Generic function to convert an UTF-16 characters range
|
||||
/// to an UTF-32 characters range, using the given locale
|
||||
///
|
||||
/// \param Begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param End : Iterator pointing to the end of the input sequence
|
||||
/// \param Output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||
/// \param begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param end : Iterator pointing to the end of the input sequence
|
||||
/// \param output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||
///
|
||||
/// \return Iterator to the end of the output sequence which has been written
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
static Out UTF16ToUTF32(In Begin, In End, Out Output, Uint32 Replacement = '?');
|
||||
static Out UTF16ToUTF32(In begin, In end, Out output, Uint32 replacement = '?');
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Generic function to convert an UTF-32 characters range
|
||||
/// to an UTF-8 characters range, using the given locale
|
||||
///
|
||||
/// \param Begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param End : Iterator pointing to the end of the input sequence
|
||||
/// \param Output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||
/// \param begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param end : Iterator pointing to the end of the input sequence
|
||||
/// \param output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||
///
|
||||
/// \return Iterator to the end of the output sequence which has been written
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
static Out UTF32ToUTF8(In Begin, In End, Out Output, Uint8 Replacement = '?');
|
||||
static Out UTF32ToUTF8(In begin, In end, Out output, Uint8 replacement = '?');
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Generic function to convert an UTF-32 characters range
|
||||
/// to an UTF-16 characters range, using the given locale
|
||||
///
|
||||
/// \param Begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param End : Iterator pointing to the end of the input sequence
|
||||
/// \param Output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||
/// \param begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param end : Iterator pointing to the end of the input sequence
|
||||
/// \param output : Iterator pointing to the beginning of the output sequence
|
||||
/// \param replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character)
|
||||
///
|
||||
/// \return Iterator to the end of the output sequence which has been written
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
static Out UTF32ToUTF16(In Begin, In End, Out Output, Uint16 Replacement = '?');
|
||||
static Out UTF32ToUTF16(In begin, In end, Out output, Uint16 replacement = '?');
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the number of characters composing an UTF-8 string
|
||||
///
|
||||
/// \param Begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param End : Iterator pointing to the end of the input sequence
|
||||
/// \param begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param end : Iterator pointing to the end of the input sequence
|
||||
///
|
||||
/// \return Count of the characters in the string
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
static std::size_t GetUTF8Length(In Begin, In End);
|
||||
static std::size_t GetUTF8Length(In begin, In end);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the number of characters composing an UTF-16 string
|
||||
///
|
||||
/// \param Begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param End : Iterator pointing to the end of the input sequence
|
||||
/// \param begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param end : Iterator pointing to the end of the input sequence
|
||||
///
|
||||
/// \return Count of the characters in the string
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
static std::size_t GetUTF16Length(In Begin, In End);
|
||||
static std::size_t GetUTF16Length(In begin, In end);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the number of characters composing an UTF-32 string
|
||||
///
|
||||
/// \param Begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param End : Iterator pointing to the end of the input sequence
|
||||
/// \param begin : Iterator pointing to the beginning of the input sequence
|
||||
/// \param end : Iterator pointing to the end of the input sequence
|
||||
///
|
||||
/// \return Count of the characters in the string
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
static std::size_t GetUTF32Length(In Begin, In End);
|
||||
static std::size_t GetUTF32Length(In begin, In end);
|
||||
|
||||
private :
|
||||
|
||||
|
|
|
@ -28,34 +28,34 @@
|
|||
/// to an ANSI characters range, using the given locale
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
inline Out Unicode::UTF32ToANSI(In Begin, In End, Out Output, char Replacement, const std::locale& Locale)
|
||||
inline Out Unicode::UTF32ToANSI(In begin, In end, Out output, char replacement, const std::locale& locale)
|
||||
{
|
||||
#ifdef __MINGW32__
|
||||
|
||||
// MinGW has a almost no support for unicode stuff
|
||||
// As a consequence, the MinGW version of this function can only use the default locale
|
||||
// and ignores the one passed as parameter
|
||||
while (Begin < End)
|
||||
while (begin < end)
|
||||
{
|
||||
char Char = 0;
|
||||
if (wctomb(&Char, static_cast<wchar_t>(*Begin++)) >= 0)
|
||||
*Output++ = Char;
|
||||
else if (Replacement)
|
||||
*Output++ = Replacement;
|
||||
char character = 0;
|
||||
if (wctomb(&character, static_cast<wchar_t>(*begin++)) >= 0)
|
||||
*output++ = character;
|
||||
else if (replacement)
|
||||
*output++ = replacement;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// Get the facet of the locale which deals with character conversion
|
||||
const std::ctype<wchar_t>& Facet = std::use_facet< std::ctype<wchar_t> >(Locale);
|
||||
const std::ctype<wchar_t>& facet = std::use_facet< std::ctype<wchar_t> >(locale);
|
||||
|
||||
// Use the facet to convert each character of the input string
|
||||
while (Begin < End)
|
||||
*Output++ = Facet.narrow(static_cast<wchar_t>(*Begin++), Replacement);
|
||||
while (begin < end)
|
||||
*output++ = facet.narrow(static_cast<wchar_t>(*begin++), replacement);
|
||||
|
||||
#endif
|
||||
|
||||
return Output;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,33 +64,33 @@ inline Out Unicode::UTF32ToANSI(In Begin, In End, Out Output, char Replacement,
|
|||
/// to an UTF-32 characters range, using the given locale
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
inline Out Unicode::ANSIToUTF32(In Begin, In End, Out Output, const std::locale& Locale)
|
||||
inline Out Unicode::ANSIToUTF32(In begin, In end, Out output, const std::locale& locale)
|
||||
{
|
||||
#ifdef __MINGW32__
|
||||
|
||||
// MinGW has a almost no support for unicode stuff
|
||||
// As a consequence, the MinGW version of this function can only use the default locale
|
||||
// and ignores the one passed as parameter
|
||||
while (Begin < End)
|
||||
while (begin < end)
|
||||
{
|
||||
wchar_t Char = 0;
|
||||
mbtowc(&Char, &*Begin, 1);
|
||||
wchar_t character = 0;
|
||||
mbtowc(&character, &*begin, 1);
|
||||
Begin++;
|
||||
*Output++ = static_cast<Uint32>(Char);
|
||||
*output++ = static_cast<Uint32>(character);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// Get the facet of the locale which deals with character conversion
|
||||
const std::ctype<wchar_t>& Facet = std::use_facet< std::ctype<wchar_t> >(Locale);
|
||||
const std::ctype<wchar_t>& facet = std::use_facet< std::ctype<wchar_t> >(locale);
|
||||
|
||||
// Use the facet to convert each character of the input string
|
||||
while (Begin < End)
|
||||
*Output++ = static_cast<Uint32>(Facet.widen(*Begin++));
|
||||
while (begin < end)
|
||||
*output++ = static_cast<Uint32>(facet.widen(*begin++));
|
||||
|
||||
#endif
|
||||
|
||||
return Output;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,59 +99,59 @@ inline Out Unicode::ANSIToUTF32(In Begin, In End, Out Output, const std::locale&
|
|||
/// to an UTF-16 characters range, using the given locale
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
inline Out Unicode::UTF8ToUTF16(In Begin, In End, Out Output, Uint16 Replacement)
|
||||
inline Out Unicode::UTF8ToUTF16(In begin, In end, Out output, Uint16 replacement)
|
||||
{
|
||||
while (Begin < End)
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 c = 0;
|
||||
int TrailingBytes = UTF8TrailingBytes[static_cast<int>(*Begin)];
|
||||
if (Begin + TrailingBytes < End)
|
||||
Uint32 character = 0;
|
||||
int trailingBytes = UTF8TrailingBytes[static_cast<int>(*begin)];
|
||||
if (begin + trailingBytes < end)
|
||||
{
|
||||
// First decode the UTF-8 character
|
||||
switch (TrailingBytes)
|
||||
switch (trailingBytes)
|
||||
{
|
||||
case 5 : c += *Begin++; c <<= 6;
|
||||
case 4 : c += *Begin++; c <<= 6;
|
||||
case 3 : c += *Begin++; c <<= 6;
|
||||
case 2 : c += *Begin++; c <<= 6;
|
||||
case 1 : c += *Begin++; c <<= 6;
|
||||
case 0 : c += *Begin++;
|
||||
case 5 : character += *begin++; character <<= 6;
|
||||
case 4 : character += *begin++; character <<= 6;
|
||||
case 3 : character += *begin++; character <<= 6;
|
||||
case 2 : character += *begin++; character <<= 6;
|
||||
case 1 : character += *begin++; character <<= 6;
|
||||
case 0 : character += *begin++;
|
||||
}
|
||||
c -= UTF8Offsets[TrailingBytes];
|
||||
character -= UTF8Offsets[trailingBytes];
|
||||
|
||||
// Then encode it in UTF-16
|
||||
if (c < 0xFFFF)
|
||||
if (character < 0xFFFF)
|
||||
{
|
||||
// Character can be converted directly to 16 bits, just need to check it's in the valid range
|
||||
if ((c >= 0xD800) && (c <= 0xDFFF))
|
||||
if ((character >= 0xD800) && (character <= 0xDFFF))
|
||||
{
|
||||
// Invalid character (this range is reserved)
|
||||
if (Replacement)
|
||||
*Output++ = Replacement;
|
||||
if (replacement)
|
||||
*output++ = replacement;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Valid character directly convertible to 16 bits
|
||||
*Output++ = static_cast<Uint16>(c);
|
||||
*Output++ = static_cast<Uint16>(character);
|
||||
}
|
||||
}
|
||||
else if (c > 0x0010FFFF)
|
||||
else if (character > 0x0010FFFF)
|
||||
{
|
||||
// Invalid character (greater than the maximum unicode value)
|
||||
if (Replacement)
|
||||
*Output++ = Replacement;
|
||||
if (replacement)
|
||||
*output++ = replacement;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Character will be converted to 2 UTF-16 elements
|
||||
c -= 0x0010000;
|
||||
*Output++ = static_cast<Uint16>((c >> 10) + 0xD800);
|
||||
*Output++ = static_cast<Uint16>((c & 0x3FFUL) + 0xDC00);
|
||||
character -= 0x0010000;
|
||||
*output++ = static_cast<Uint16>((character >> 10) + 0xD800);
|
||||
*output++ = static_cast<Uint16>((character & 0x3FFUL) + 0xDC00);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Output;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
|
@ -160,42 +160,42 @@ inline Out Unicode::UTF8ToUTF16(In Begin, In End, Out Output, Uint16 Replacement
|
|||
/// to an UTF-32 characters range, using the given locale
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
inline Out Unicode::UTF8ToUTF32(In Begin, In End, Out Output, Uint32 Replacement)
|
||||
inline Out Unicode::UTF8ToUTF32(In begin, In end, Out output, Uint32 replacement)
|
||||
{
|
||||
while (Begin < End)
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 c = 0;
|
||||
int TrailingBytes = UTF8TrailingBytes[static_cast<int>(*Begin)];
|
||||
if (Begin + TrailingBytes < End)
|
||||
Uint32 character = 0;
|
||||
int trailingBytes = UTF8TrailingBytes[static_cast<int>(*begin)];
|
||||
if (begin + trailingBytes < end)
|
||||
{
|
||||
// First decode the UTF-8 character
|
||||
switch (TrailingBytes)
|
||||
switch (trailingBytes)
|
||||
{
|
||||
case 5 : c += *Begin++; c <<= 6;
|
||||
case 4 : c += *Begin++; c <<= 6;
|
||||
case 3 : c += *Begin++; c <<= 6;
|
||||
case 2 : c += *Begin++; c <<= 6;
|
||||
case 1 : c += *Begin++; c <<= 6;
|
||||
case 0 : c += *Begin++;
|
||||
case 5 : character += *begin++; character <<= 6;
|
||||
case 4 : character += *begin++; character <<= 6;
|
||||
case 3 : character += *begin++; character <<= 6;
|
||||
case 2 : character += *begin++; character <<= 6;
|
||||
case 1 : character += *begin++; character <<= 6;
|
||||
case 0 : character += *begin++;
|
||||
}
|
||||
c -= UTF8Offsets[TrailingBytes];
|
||||
character -= UTF8Offsets[trailingBytes];
|
||||
|
||||
// Then write it if valid
|
||||
if ((c < 0xD800) || (c > 0xDFFF))
|
||||
if ((character < 0xD800) || (character > 0xDFFF))
|
||||
{
|
||||
// Valid UTF-32 character
|
||||
*Output++ = c;
|
||||
*output++ = character;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Invalid UTF-32 character
|
||||
if (Replacement)
|
||||
*Output++ = Replacement;
|
||||
if (replacement)
|
||||
*output++ = replacement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Output;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
|
@ -204,71 +204,71 @@ inline Out Unicode::UTF8ToUTF32(In Begin, In End, Out Output, Uint32 Replacement
|
|||
/// to an UTF-8 characters range, using the given locale
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
inline Out Unicode::UTF16ToUTF8(In Begin, In End, Out Output, Uint8 Replacement)
|
||||
inline Out Unicode::UTF16ToUTF8(In begin, In end, Out output, Uint8 replacement)
|
||||
{
|
||||
while (Begin < End)
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 c = *Begin++;
|
||||
Uint32 character = *begin++;
|
||||
|
||||
// If it's a surrogate pair, first convert to a single UTF-32 character
|
||||
if ((c >= 0xD800) && (c <= 0xDBFF))
|
||||
if ((character >= 0xD800) && (character <= 0xDBFF))
|
||||
{
|
||||
if (Begin < End)
|
||||
if (begin < end)
|
||||
{
|
||||
// The second element is valid : convert the two elements to a UTF-32 character
|
||||
Uint32 d = *Begin++;
|
||||
Uint32 d = *begin++;
|
||||
if ((d >= 0xDC00) && (d <= 0xDFFF))
|
||||
c = static_cast<Uint32>(((c - 0xD800) << 10) + (d - 0xDC00) + 0x0010000);
|
||||
character = static_cast<Uint32>(((character - 0xD800) << 10) + (d - 0xDC00) + 0x0010000);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Invalid second element
|
||||
if (Replacement)
|
||||
*Output++ = Replacement;
|
||||
if (replacement)
|
||||
*output++ = replacement;
|
||||
}
|
||||
}
|
||||
|
||||
// Then convert to UTF-8
|
||||
if (c > 0x0010FFFF)
|
||||
if (character > 0x0010FFFF)
|
||||
{
|
||||
// Invalid character (greater than the maximum unicode value)
|
||||
if (Replacement)
|
||||
*Output++ = Replacement;
|
||||
if (replacement)
|
||||
*output++ = replacement;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Valid character
|
||||
|
||||
// Get number of bytes to write
|
||||
int BytesToWrite = 1;
|
||||
if (c < 0x80) BytesToWrite = 1;
|
||||
else if (c < 0x800) BytesToWrite = 2;
|
||||
else if (c < 0x10000) BytesToWrite = 3;
|
||||
else if (c <= 0x0010FFFF) BytesToWrite = 4;
|
||||
int bytesToWrite = 1;
|
||||
if (character < 0x80) bytesToWrite = 1;
|
||||
else if (character < 0x800) bytesToWrite = 2;
|
||||
else if (character < 0x10000) bytesToWrite = 3;
|
||||
else if (character <= 0x0010FFFF) bytesToWrite = 4;
|
||||
|
||||
// Extract bytes to write
|
||||
Uint8 Bytes[4];
|
||||
switch (BytesToWrite)
|
||||
Uint8 bytes[4];
|
||||
switch (bytesToWrite)
|
||||
{
|
||||
case 4 : Bytes[3] = static_cast<Uint8>((c | 0x80) & 0xBF); c >>= 6;
|
||||
case 3 : Bytes[2] = static_cast<Uint8>((c | 0x80) & 0xBF); c >>= 6;
|
||||
case 2 : Bytes[1] = static_cast<Uint8>((c | 0x80) & 0xBF); c >>= 6;
|
||||
case 1 : Bytes[0] = static_cast<Uint8> (c | UTF8FirstBytes[BytesToWrite]);
|
||||
case 4 : bytes[3] = static_cast<Uint8>((character | 0x80) & 0xBF); character >>= 6;
|
||||
case 3 : bytes[2] = static_cast<Uint8>((character | 0x80) & 0xBF); character >>= 6;
|
||||
case 2 : bytes[1] = static_cast<Uint8>((character | 0x80) & 0xBF); character >>= 6;
|
||||
case 1 : bytes[0] = static_cast<Uint8> (character | UTF8FirstBytes[bytesToWrite]);
|
||||
}
|
||||
|
||||
// Add them to the output
|
||||
const Uint8* CurByte = Bytes;
|
||||
switch (BytesToWrite)
|
||||
const Uint8* currentByte = bytes;
|
||||
switch (bytesToWrite)
|
||||
{
|
||||
case 4 : *Output++ = *CurByte++;
|
||||
case 3 : *Output++ = *CurByte++;
|
||||
case 2 : *Output++ = *CurByte++;
|
||||
case 1 : *Output++ = *CurByte++;
|
||||
case 4 : *output++ = *currentByte++;
|
||||
case 3 : *output++ = *currentByte++;
|
||||
case 2 : *output++ = *currentByte++;
|
||||
case 1 : *output++ = *currentByte++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Output;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
|
@ -277,44 +277,44 @@ inline Out Unicode::UTF16ToUTF8(In Begin, In End, Out Output, Uint8 Replacement)
|
|||
/// to an UTF-32 characters range, using the given locale
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
inline Out Unicode::UTF16ToUTF32(In Begin, In End, Out Output, Uint32 Replacement)
|
||||
inline Out Unicode::UTF16ToUTF32(In begin, In end, Out output, Uint32 replacement)
|
||||
{
|
||||
while (Begin < End)
|
||||
while (begin < end)
|
||||
{
|
||||
Uint16 c = *Begin++;
|
||||
if ((c >= 0xD800) && (c <= 0xDBFF))
|
||||
Uint16 character = *begin++;
|
||||
if ((character >= 0xD800) && (character <= 0xDBFF))
|
||||
{
|
||||
// We have a surrogate pair, ie. a character composed of two elements
|
||||
if (Begin < End)
|
||||
if (begin < end)
|
||||
{
|
||||
Uint16 d = *Begin++;
|
||||
Uint16 d = *begin++;
|
||||
if ((d >= 0xDC00) && (d <= 0xDFFF))
|
||||
{
|
||||
// The second element is valid : convert the two elements to a UTF-32 character
|
||||
*Output++ = static_cast<Uint32>(((c - 0xD800) << 10) + (d - 0xDC00) + 0x0010000);
|
||||
*output++ = static_cast<Uint32>(((character - 0xD800) << 10) + (d - 0xDC00) + 0x0010000);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Invalid second element
|
||||
if (Replacement)
|
||||
*Output++ = Replacement;
|
||||
if (replacement)
|
||||
*output++ = replacement;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((c >= 0xDC00) && (c <= 0xDFFF))
|
||||
else if ((character >= 0xDC00) && (character <= 0xDFFF))
|
||||
{
|
||||
// Invalid character
|
||||
if (Replacement)
|
||||
*Output++ = Replacement;
|
||||
if (replacement)
|
||||
*output++ = replacement;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Valid character directly convertible to UTF-32
|
||||
*Output++ = static_cast<Uint32>(c);
|
||||
*output++ = static_cast<Uint32>(character);
|
||||
}
|
||||
}
|
||||
|
||||
return Output;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
|
@ -323,51 +323,51 @@ inline Out Unicode::UTF16ToUTF32(In Begin, In End, Out Output, Uint32 Replacemen
|
|||
/// to an UTF-8 characters range, using the given locale
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
inline Out Unicode::UTF32ToUTF8(In Begin, In End, Out Output, Uint8 Replacement)
|
||||
inline Out Unicode::UTF32ToUTF8(In begin, In end, Out output, Uint8 replacement)
|
||||
{
|
||||
while (Begin < End)
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 c = *Begin++;
|
||||
if (c > 0x0010FFFF)
|
||||
Uint32 character = *begin++;
|
||||
if (character > 0x0010FFFF)
|
||||
{
|
||||
// Invalid character (greater than the maximum unicode value)
|
||||
if (Replacement)
|
||||
*Output++ = Replacement;
|
||||
if (replacement)
|
||||
*output++ = replacement;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Valid character
|
||||
|
||||
// Get number of bytes to write
|
||||
int BytesToWrite = 1;
|
||||
if (c < 0x80) BytesToWrite = 1;
|
||||
else if (c < 0x800) BytesToWrite = 2;
|
||||
else if (c < 0x10000) BytesToWrite = 3;
|
||||
else if (c <= 0x0010FFFF) BytesToWrite = 4;
|
||||
int bytesToWrite = 1;
|
||||
if (character < 0x80) bytesToWrite = 1;
|
||||
else if (character < 0x800) bytesToWrite = 2;
|
||||
else if (character < 0x10000) bytesToWrite = 3;
|
||||
else if (character <= 0x0010FFFF) bytesToWrite = 4;
|
||||
|
||||
// Extract bytes to write
|
||||
Uint8 Bytes[4];
|
||||
switch (BytesToWrite)
|
||||
Uint8 bytes[4];
|
||||
switch (bytesToWrite)
|
||||
{
|
||||
case 4 : Bytes[3] = static_cast<Uint8>((c | 0x80) & 0xBF); c >>= 6;
|
||||
case 3 : Bytes[2] = static_cast<Uint8>((c | 0x80) & 0xBF); c >>= 6;
|
||||
case 2 : Bytes[1] = static_cast<Uint8>((c | 0x80) & 0xBF); c >>= 6;
|
||||
case 1 : Bytes[0] = static_cast<Uint8> (c | UTF8FirstBytes[BytesToWrite]);
|
||||
case 4 : bytes[3] = static_cast<Uint8>((character | 0x80) & 0xBF); character >>= 6;
|
||||
case 3 : bytes[2] = static_cast<Uint8>((character | 0x80) & 0xBF); character >>= 6;
|
||||
case 2 : bytes[1] = static_cast<Uint8>((character | 0x80) & 0xBF); character >>= 6;
|
||||
case 1 : bytes[0] = static_cast<Uint8> (character | UTF8FirstBytes[bytesToWrite]);
|
||||
}
|
||||
|
||||
// Add them to the output
|
||||
const Uint8* CurByte = Bytes;
|
||||
switch (BytesToWrite)
|
||||
const Uint8* currentByte = bytes;
|
||||
switch (bytesToWrite)
|
||||
{
|
||||
case 4 : *Output++ = *CurByte++;
|
||||
case 3 : *Output++ = *CurByte++;
|
||||
case 2 : *Output++ = *CurByte++;
|
||||
case 1 : *Output++ = *CurByte++;
|
||||
case 4 : *output++ = *currentByte++;
|
||||
case 3 : *output++ = *currentByte++;
|
||||
case 2 : *output++ = *currentByte++;
|
||||
case 1 : *output++ = *currentByte++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Output;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
|
@ -376,42 +376,42 @@ inline Out Unicode::UTF32ToUTF8(In Begin, In End, Out Output, Uint8 Replacement)
|
|||
/// to an UTF-16 characters range, using the given locale
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In, typename Out>
|
||||
inline Out Unicode::UTF32ToUTF16(In Begin, In End, Out Output, Uint16 Replacement)
|
||||
inline Out Unicode::UTF32ToUTF16(In begin, In end, Out output, Uint16 replacement)
|
||||
{
|
||||
while (Begin < End)
|
||||
while (begin < end)
|
||||
{
|
||||
Uint32 c = *Begin++;
|
||||
if (c < 0xFFFF)
|
||||
Uint32 character = *begin++;
|
||||
if (character < 0xFFFF)
|
||||
{
|
||||
// Character can be converted directly to 16 bits, just need to check it's in the valid range
|
||||
if ((c >= 0xD800) && (c <= 0xDFFF))
|
||||
if ((character >= 0xD800) && (character <= 0xDFFF))
|
||||
{
|
||||
// Invalid character (this range is reserved)
|
||||
if (Replacement)
|
||||
*Output++ = Replacement;
|
||||
if (replacement)
|
||||
*output++ = replacement;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Valid character directly convertible to 16 bits
|
||||
*Output++ = static_cast<Uint16>(c);
|
||||
*output++ = static_cast<Uint16>(character);
|
||||
}
|
||||
}
|
||||
else if (c > 0x0010FFFF)
|
||||
else if (character > 0x0010FFFF)
|
||||
{
|
||||
// Invalid character (greater than the maximum unicode value)
|
||||
if (Replacement)
|
||||
*Output++ = Replacement;
|
||||
if (replacement)
|
||||
*output++ = replacement;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Character will be converted to 2 UTF-16 elements
|
||||
c -= 0x0010000;
|
||||
*Output++ = static_cast<Uint16>((c >> 10) + 0xD800);
|
||||
*Output++ = static_cast<Uint16>((c & 0x3FFUL) + 0xDC00);
|
||||
character -= 0x0010000;
|
||||
*output++ = static_cast<Uint16>((character >> 10) + 0xD800);
|
||||
*output++ = static_cast<Uint16>((character & 0x3FFUL) + 0xDC00);
|
||||
}
|
||||
}
|
||||
|
||||
return Output;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
|
@ -419,19 +419,19 @@ inline Out Unicode::UTF32ToUTF16(In Begin, In End, Out Output, Uint16 Replacemen
|
|||
/// Get the number of characters composing an UTF-8 string
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
inline std::size_t Unicode::GetUTF8Length(In Begin, In End)
|
||||
inline std::size_t Unicode::GetUTF8Length(In begin, In end)
|
||||
{
|
||||
std::size_t Length = 0;
|
||||
while (Begin < End)
|
||||
std::size_t length = 0;
|
||||
while (begin < end)
|
||||
{
|
||||
int NbBytes = UTF8TrailingBytes[static_cast<int>(*Begin)];
|
||||
if (Begin + NbBytes < End)
|
||||
++Length;
|
||||
int nbBytes = UTF8TrailingBytes[static_cast<int>(*begin)];
|
||||
if (begin + nbBytes < end)
|
||||
++length;
|
||||
|
||||
Begin += NbBytes + 1;
|
||||
begin += nbBytes + 1;
|
||||
}
|
||||
|
||||
return Length;
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
|
@ -439,28 +439,28 @@ inline std::size_t Unicode::GetUTF8Length(In Begin, In End)
|
|||
/// Get the number of characters composing an UTF-16 string
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
inline std::size_t Unicode::GetUTF16Length(In Begin, In End)
|
||||
inline std::size_t Unicode::GetUTF16Length(In begin, In end)
|
||||
{
|
||||
std::size_t Length = 0;
|
||||
while (Begin < End)
|
||||
std::size_t length = 0;
|
||||
while (begin < end)
|
||||
{
|
||||
if ((*Begin >= 0xD800) && (*Begin <= 0xDBFF))
|
||||
if ((*begin >= 0xD800) && (*begin <= 0xDBFF))
|
||||
{
|
||||
++Begin;
|
||||
if ((Begin < End) && ((*Begin >= 0xDC00) && (*Begin <= 0xDFFF)))
|
||||
++begin;
|
||||
if ((begin < end) && ((*begin >= 0xDC00) && (*begin <= 0xDFFF)))
|
||||
{
|
||||
++Length;
|
||||
++length;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++Length;
|
||||
++length;
|
||||
}
|
||||
|
||||
++Begin;
|
||||
++begin;
|
||||
}
|
||||
|
||||
return Length;
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
|
@ -468,7 +468,7 @@ inline std::size_t Unicode::GetUTF16Length(In Begin, In End)
|
|||
/// Get the number of characters composing an UTF-32 string
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename In>
|
||||
inline std::size_t Unicode::GetUTF32Length(In Begin, In End)
|
||||
inline std::size_t Unicode::GetUTF32Length(In begin, In end)
|
||||
{
|
||||
return End - Begin;
|
||||
return end - begin;
|
||||
}
|
||||
|
|
|
@ -63,145 +63,145 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Operator - overload ; returns the opposite of a vector
|
||||
///
|
||||
/// \param V : Vector to negate
|
||||
/// \param left : Vector to negate
|
||||
///
|
||||
/// \return -V
|
||||
/// \return -left
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T> operator -(const Vector2<T>& V);
|
||||
Vector2<T> operator -(const Vector2<T>& left);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator += overload ; add two vectors and assign to the first op
|
||||
///
|
||||
/// \param V1 : First vector
|
||||
/// \param V2 : Second vector
|
||||
/// \param left : First vector
|
||||
/// \param right : Second vector
|
||||
///
|
||||
/// \return V1 + V2
|
||||
/// \return left + right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T>& operator +=(Vector2<T>& V1, const Vector2<T>& V2);
|
||||
Vector2<T>& operator +=(Vector2<T>& left, const Vector2<T>& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator -= overload ; subtract two vectors and assign to the first op
|
||||
///
|
||||
/// \param V1 : First vector
|
||||
/// \param V2 : Second vector
|
||||
/// \param left : First vector
|
||||
/// \param right : Second vector
|
||||
///
|
||||
/// \return V1 - V2
|
||||
/// \return left - right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T>& operator -=(Vector2<T>& V1, const Vector2<T>& V2);
|
||||
Vector2<T>& operator -=(Vector2<T>& left, const Vector2<T>& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator + overload ; adds two vectors
|
||||
///
|
||||
/// \param V1 : First vector
|
||||
/// \param V2 : Second vector
|
||||
/// \param left : First vector
|
||||
/// \param right : Second vector
|
||||
///
|
||||
/// \return V1 + V2
|
||||
/// \return left + right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T> operator +(const Vector2<T>& V1, const Vector2<T>& V2);
|
||||
Vector2<T> operator +(const Vector2<T>& left, const Vector2<T>& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator - overload ; subtracts two vectors
|
||||
///
|
||||
/// \param V1 : First vector
|
||||
/// \param V2 : Second vector
|
||||
/// \param left : First vector
|
||||
/// \param right : Second vector
|
||||
///
|
||||
/// \return V1 - V2
|
||||
/// \return left - right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T> operator -(const Vector2<T>& V1, const Vector2<T>& V2);
|
||||
Vector2<T> operator -(const Vector2<T>& left, const Vector2<T>& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator * overload ; multiply a vector by a scalar value
|
||||
///
|
||||
/// \param V : Vector
|
||||
/// \param X : Scalar value
|
||||
/// \param left : Vector
|
||||
/// \param right : Scalar value
|
||||
///
|
||||
/// \return V * X
|
||||
/// \return left * right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T> operator *(const Vector2<T>& V, T X);
|
||||
Vector2<T> operator *(const Vector2<T>& left, T right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator * overload ; multiply a scalar value by a vector
|
||||
///
|
||||
/// \param X : Scalar value
|
||||
/// \param V : Vector
|
||||
/// \param left : Scalar value
|
||||
/// \param right : Vector
|
||||
///
|
||||
/// \return X * V
|
||||
/// \return left * right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T> operator *(T X, const Vector2<T>& V);
|
||||
Vector2<T> operator *(T left, const Vector2<T>& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator *= overload ; multiply-assign a vector by a scalar value
|
||||
///
|
||||
/// \param V : Vector
|
||||
/// \param X : Scalar value
|
||||
/// \param left : Vector
|
||||
/// \param right : Scalar value
|
||||
///
|
||||
/// \return V * X
|
||||
/// \return left * right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T>& operator *=(Vector2<T>& V, T X);
|
||||
Vector2<T>& operator *=(Vector2<T>& left, T right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator / overload ; divide a vector by a scalar value
|
||||
///
|
||||
/// \param V : Vector
|
||||
/// \param X : Scalar value
|
||||
/// \param left : Vector
|
||||
/// \param right : Scalar value
|
||||
///
|
||||
/// \return V / X
|
||||
/// \return left / right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T> operator /(const Vector2<T>& V, T X);
|
||||
Vector2<T> operator /(const Vector2<T>& left, T right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator /= overload ; divide-assign a vector by a scalar value
|
||||
///
|
||||
/// \param V : Vector
|
||||
/// \param X : Scalar value
|
||||
/// \param left : Vector
|
||||
/// \param right : Scalar value
|
||||
///
|
||||
/// \return V / X
|
||||
/// \return left / right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T>& operator /=(Vector2<T>& V, T X);
|
||||
Vector2<T>& operator /=(Vector2<T>& left, T right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator == overload ; compares the equality of two vectors
|
||||
///
|
||||
/// \param V1 : First vector
|
||||
/// \param V2 : Second vector
|
||||
/// \param left : First vector
|
||||
/// \param right : Second vector
|
||||
///
|
||||
/// \return True if V1 is equal to V2
|
||||
/// \return True if left is equal to right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool operator ==(const Vector2<T>& V1, const Vector2<T>& V2);
|
||||
bool operator ==(const Vector2<T>& left, const Vector2<T>& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator != overload ; compares the difference of two vectors
|
||||
///
|
||||
/// \param V1 : First vector
|
||||
/// \param V2 : Second vector
|
||||
/// \param left : First vector
|
||||
/// \param right : Second vector
|
||||
///
|
||||
/// \return True if V1 is different than V2
|
||||
/// \return True if left is different than right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool operator !=(const Vector2<T>& V1, const Vector2<T>& V2);
|
||||
bool operator !=(const Vector2<T>& left, const Vector2<T>& right);
|
||||
|
||||
#include <SFML/System/Vector2.inl>
|
||||
|
||||
|
|
|
@ -51,9 +51,9 @@ y(Y)
|
|||
/// Operator - overload ; returns the opposite of a vector
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T> operator -(const Vector2<T>& V)
|
||||
Vector2<T> operator -(const Vector2<T>& left)
|
||||
{
|
||||
return Vector2<T>(-V.x, -V.y);
|
||||
return Vector2<T>(-left.x, -left.y);
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,12 +61,12 @@ Vector2<T> operator -(const Vector2<T>& V)
|
|||
/// Operator += overload ; add two vectors and assign to the first op
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T>& operator +=(Vector2<T>& V1, const Vector2<T>& V2)
|
||||
Vector2<T>& operator +=(Vector2<T>& left, const Vector2<T>& right)
|
||||
{
|
||||
V1.x += V2.x;
|
||||
V1.y += V2.y;
|
||||
left.x += right.x;
|
||||
left.y += right.y;
|
||||
|
||||
return V1;
|
||||
return left;
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,12 +74,12 @@ Vector2<T>& operator +=(Vector2<T>& V1, const Vector2<T>& V2)
|
|||
/// Operator -= overload ; subtract two vectors and assign to the first op
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T>& operator -=(Vector2<T>& V1, const Vector2<T>& V2)
|
||||
Vector2<T>& operator -=(Vector2<T>& left, const Vector2<T>& right)
|
||||
{
|
||||
V1.x -= V2.x;
|
||||
V1.y -= V2.y;
|
||||
left.x -= right.x;
|
||||
left.y -= right.y;
|
||||
|
||||
return V1;
|
||||
return left;
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,9 +87,9 @@ Vector2<T>& operator -=(Vector2<T>& V1, const Vector2<T>& V2)
|
|||
/// Operator + overload ; adds two vectors
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T> operator +(const Vector2<T>& V1, const Vector2<T>& V2)
|
||||
Vector2<T> operator +(const Vector2<T>& left, const Vector2<T>& right)
|
||||
{
|
||||
return Vector2<T>(V1.x + V2.x, V1.y + V2.y);
|
||||
return Vector2<T>(left.x + right.x, left.y + right.y);
|
||||
}
|
||||
|
||||
|
||||
|
@ -97,9 +97,9 @@ Vector2<T> operator +(const Vector2<T>& V1, const Vector2<T>& V2)
|
|||
/// Operator - overload ; subtracts two vectors
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T> operator -(const Vector2<T>& V1, const Vector2<T>& V2)
|
||||
Vector2<T> operator -(const Vector2<T>& left, const Vector2<T>& right)
|
||||
{
|
||||
return Vector2<T>(V1.x - V2.x, V1.y - V2.y);
|
||||
return Vector2<T>(left.x - right.x, left.y - right.y);
|
||||
}
|
||||
|
||||
|
||||
|
@ -107,9 +107,9 @@ Vector2<T> operator -(const Vector2<T>& V1, const Vector2<T>& V2)
|
|||
/// Operator * overload ; multiply a vector by a scalar value
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T> operator *(const Vector2<T>& V, T X)
|
||||
Vector2<T> operator *(const Vector2<T>& left, T right)
|
||||
{
|
||||
return Vector2<T>(V.x * X, V.y * X);
|
||||
return Vector2<T>(left.x * right, left.y * right);
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,9 +117,9 @@ Vector2<T> operator *(const Vector2<T>& V, T X)
|
|||
/// Operator * overload ; multiply a scalar value by a vector
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T> operator *(T X, const Vector2<T>& V)
|
||||
Vector2<T> operator *(T left, const Vector2<T>& right)
|
||||
{
|
||||
return Vector2<T>(V.x * X, V.y * X);
|
||||
return Vector2<T>(right.x * left, right.y * left);
|
||||
}
|
||||
|
||||
|
||||
|
@ -127,12 +127,12 @@ Vector2<T> operator *(T X, const Vector2<T>& V)
|
|||
/// Operator *= overload ; multiply-assign a vector by a scalar value
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T>& operator *=(Vector2<T>& V, T X)
|
||||
Vector2<T>& operator *=(Vector2<T>& left, T right)
|
||||
{
|
||||
V.x *= X;
|
||||
V.y *= X;
|
||||
left.x *= right;
|
||||
left.y *= right;
|
||||
|
||||
return V;
|
||||
return left;
|
||||
}
|
||||
|
||||
|
||||
|
@ -140,9 +140,9 @@ Vector2<T>& operator *=(Vector2<T>& V, T X)
|
|||
/// Operator / overload ; divide a vector by a scalar value
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T> operator /(const Vector2<T>& V, T X)
|
||||
Vector2<T> operator /(const Vector2<T>& left, T right)
|
||||
{
|
||||
return Vector2<T>(V.x / X, V.y / X);
|
||||
return Vector2<T>(left.x / right, left.y / right);
|
||||
}
|
||||
|
||||
|
||||
|
@ -150,12 +150,12 @@ Vector2<T> operator /(const Vector2<T>& V, T X)
|
|||
/// Operator /= overload ; divide-assign a vector by a scalar value
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector2<T>& operator /=(Vector2<T>& V, T X)
|
||||
Vector2<T>& operator /=(Vector2<T>& left, T right)
|
||||
{
|
||||
V.x /= X;
|
||||
V.y /= X;
|
||||
left.x /= right;
|
||||
left.y /= right;
|
||||
|
||||
return V;
|
||||
return left;
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,9 +163,9 @@ Vector2<T>& operator /=(Vector2<T>& V, T X)
|
|||
/// Operator == overload ; compares the equality of two vectors
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool operator ==(const Vector2<T>& V1, const Vector2<T>& V2)
|
||||
bool operator ==(const Vector2<T>& left, const Vector2<T>& right)
|
||||
{
|
||||
return (V1.x == V2.x) && (V1.y == V2.y);
|
||||
return (left.x == right.x) && (left.y == right.y);
|
||||
}
|
||||
|
||||
|
||||
|
@ -173,7 +173,7 @@ bool operator ==(const Vector2<T>& V1, const Vector2<T>& V2)
|
|||
/// Operator != overload ; compares the difference of two vectors
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool operator !=(const Vector2<T>& V1, const Vector2<T>& V2)
|
||||
bool operator !=(const Vector2<T>& left, const Vector2<T>& right)
|
||||
{
|
||||
return (V1.x != V2.x) || (V1.y != V2.y);
|
||||
return (left.x != right.x) || (left.y != right.y);
|
||||
}
|
||||
|
|
|
@ -65,145 +65,145 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Operator - overload ; returns the opposite of a vector
|
||||
///
|
||||
/// \param V : Vector to negate
|
||||
/// \param left : Vector to negate
|
||||
///
|
||||
/// \return -V
|
||||
/// \return -left
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T> operator -(const Vector3<T>& V);
|
||||
Vector3<T> operator -(const Vector3<T>& left);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator += overload ; add two vectors and assign to the first op
|
||||
///
|
||||
/// \param V1 : First vector
|
||||
/// \param V2 : Second vector
|
||||
/// \param left : First vector
|
||||
/// \param right : Second vector
|
||||
///
|
||||
/// \return V1 + V2
|
||||
/// \return left + V2
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T>& operator +=(Vector3<T>& V1, const Vector3<T>& V2);
|
||||
Vector3<T>& operator +=(Vector3<T>& left, const Vector3<T>& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator -= overload ; subtract two vectors and assign to the first op
|
||||
///
|
||||
/// \param V1 : First vector
|
||||
/// \param V2 : Second vector
|
||||
/// \param left : First vector
|
||||
/// \param right : Second vector
|
||||
///
|
||||
/// \return V1 - V2
|
||||
/// \return left - right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T>& operator -=(Vector3<T>& V1, const Vector3<T>& V2);
|
||||
Vector3<T>& operator -=(Vector3<T>& left, const Vector3<T>& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator + overload ; adds two vectors
|
||||
///
|
||||
/// \param V1 : First vector
|
||||
/// \param V2 : Second vector
|
||||
/// \param left : First vector
|
||||
/// \param right : Second vector
|
||||
///
|
||||
/// \return V1 + V2
|
||||
/// \return left + right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T> operator +(const Vector3<T>& V1, const Vector3<T>& V2);
|
||||
Vector3<T> operator +(const Vector3<T>& left, const Vector3<T>& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator - overload ; subtracts two vectors
|
||||
///
|
||||
/// \param V1 : First vector
|
||||
/// \param V2 : Second vector
|
||||
/// \param left : First vector
|
||||
/// \param right : Second vector
|
||||
///
|
||||
/// \return V1 - V2
|
||||
/// \return left - rightright
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T> operator -(const Vector3<T>& V1, const Vector3<T>& V2);
|
||||
Vector3<T> operator -(const Vector3<T>& left, const Vector3<T>& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator * overload ; multiply a vector by a scalar value
|
||||
///
|
||||
/// \param V : Vector
|
||||
/// \param X : Scalar value
|
||||
/// \param left : Vector
|
||||
/// \param right : Scalar value
|
||||
///
|
||||
/// \return V * X
|
||||
/// \return left * right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T> operator *(const Vector3<T>& V, T X);
|
||||
Vector3<T> operator *(const Vector3<T>& left, T right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator * overload ; multiply a scalar value by a vector
|
||||
///
|
||||
/// \param X : Scalar value
|
||||
/// \param V : Vector
|
||||
/// \param left : Scalar value
|
||||
/// \param right : Vector
|
||||
///
|
||||
/// \return X * V
|
||||
/// \return left * right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T> operator *(T X, const Vector3<T>& V);
|
||||
Vector3<T> operator *(T left, const Vector3<T>& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator *= overload ; multiply-assign a vector by a scalar value
|
||||
///
|
||||
/// \param V : Vector
|
||||
/// \param X : Scalar value
|
||||
/// \param left : Vector
|
||||
/// \param right : Scalar value
|
||||
///
|
||||
/// \return V * X
|
||||
/// \return left * right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T>& operator *=(Vector3<T>& V, T X);
|
||||
Vector3<T>& operator *=(Vector3<T>& left, T right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator / overload ; divide a vector by a scalar value
|
||||
///
|
||||
/// \param V : Vector
|
||||
/// \param X : Scalar value
|
||||
/// \param left : Vector
|
||||
/// \param right : Scalar value
|
||||
///
|
||||
/// \return V / X
|
||||
/// \return left / right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T> operator /(const Vector3<T>& V, T X);
|
||||
Vector3<T> operator /(const Vector3<T>& left, T right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator /= overload ; divide-assign a vector by a scalar value
|
||||
///
|
||||
/// \param V : Vector
|
||||
/// \param X : Scalar value
|
||||
/// \param left : Vector
|
||||
/// \param right : Scalar value
|
||||
///
|
||||
/// \return V / X
|
||||
/// \return left / right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T>& operator /=(Vector3<T>& V, T X);
|
||||
Vector3<T>& operator /=(Vector3<T>& left, T right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator == overload ; compares the equality of two vectors
|
||||
///
|
||||
/// \param V1 : First vector
|
||||
/// \param V2 : Second vector
|
||||
/// \param left : First vector
|
||||
/// \param right : Second vector
|
||||
///
|
||||
/// \return True if V1 is equal to V2
|
||||
/// \return True if left is equal to right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool operator ==(const Vector3<T>& V1, const Vector3<T>& V2);
|
||||
bool operator ==(const Vector3<T>& left, const Vector3<T>& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Operator != overload ; compares the difference of two vectors
|
||||
///
|
||||
/// \param V1 : First vector
|
||||
/// \param V2 : Second vector
|
||||
/// \param left : First vector
|
||||
/// \param right : Second vector
|
||||
///
|
||||
/// \return True if V1 is different than V2
|
||||
/// \return True if left is different than right
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool operator !=(const Vector3<T>& V1, const Vector3<T>& V2);
|
||||
bool operator !=(const Vector3<T>& left, const Vector3<T>& right);
|
||||
|
||||
#include <SFML/System/Vector3.inl>
|
||||
|
||||
|
|
|
@ -53,9 +53,9 @@ z(Z)
|
|||
/// Operator - overload ; returns the opposite of a vector
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T> operator -(const Vector3<T>& V)
|
||||
Vector3<T> operator -(const Vector3<T>& left)
|
||||
{
|
||||
return Vector3<T>(-V.x, -V.y, -V.z);
|
||||
return Vector3<T>(-left.x, -left.y, -left.z);
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,13 +63,13 @@ Vector3<T> operator -(const Vector3<T>& V)
|
|||
/// Operator += overload ; add two vectors and assign to the first op
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T>& operator +=(Vector3<T>& V1, const Vector3<T>& V2)
|
||||
Vector3<T>& operator +=(Vector3<T>& left, const Vector3<T>& right)
|
||||
{
|
||||
V1.x += V2.x;
|
||||
V1.y += V2.y;
|
||||
V1.z += V2.z;
|
||||
left.x += right.x;
|
||||
left.y += right.y;
|
||||
left.z += right.z;
|
||||
|
||||
return V1;
|
||||
return left;
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,13 +77,13 @@ Vector3<T>& operator +=(Vector3<T>& V1, const Vector3<T>& V2)
|
|||
/// Operator -= overload ; subtract two vectors and assign to the first op
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T>& operator -=(Vector3<T>& V1, const Vector3<T>& V2)
|
||||
Vector3<T>& operator -=(Vector3<T>& left, const Vector3<T>& right)
|
||||
{
|
||||
V1.x -= V2.x;
|
||||
V1.y -= V2.y;
|
||||
V1.z -= V2.z;
|
||||
left.x -= right.x;
|
||||
left.y -= right.y;
|
||||
left.z -= right.z;
|
||||
|
||||
return V1;
|
||||
return left;
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,9 +91,9 @@ Vector3<T>& operator -=(Vector3<T>& V1, const Vector3<T>& V2)
|
|||
/// Operator + overload ; adds two vectors
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T> operator +(const Vector3<T>& V1, const Vector3<T>& V2)
|
||||
Vector3<T> operator +(const Vector3<T>& left, const Vector3<T>& right)
|
||||
{
|
||||
return Vector3<T>(V1.x + V2.x, V1.y + V2.y, V1.z + V2.z);
|
||||
return Vector3<T>(left.x + right.x, left.y + right.y, left.z + right.z);
|
||||
}
|
||||
|
||||
|
||||
|
@ -101,9 +101,9 @@ Vector3<T> operator +(const Vector3<T>& V1, const Vector3<T>& V2)
|
|||
/// Operator - overload ; subtracts two vectors
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T> operator -(const Vector3<T>& V1, const Vector3<T>& V2)
|
||||
Vector3<T> operator -(const Vector3<T>& left, const Vector3<T>& right)
|
||||
{
|
||||
return Vector3<T>(V1.x - V2.x, V1.y - V2.y, V1.z - V2.z);
|
||||
return Vector3<T>(left.x - right.x, left.y - right.y, left.z - right.z);
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,9 +111,9 @@ Vector3<T> operator -(const Vector3<T>& V1, const Vector3<T>& V2)
|
|||
/// Operator * overload ; multiply a vector by a scalar value
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T> operator *(const Vector3<T>& V, T X)
|
||||
Vector3<T> operator *(const Vector3<T>& left, T right)
|
||||
{
|
||||
return Vector3<T>(V.x * X, V.y * X, V.z * X);
|
||||
return Vector3<T>(left.x * right, left.y * right, left.z * right);
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,9 +121,9 @@ Vector3<T> operator *(const Vector3<T>& V, T X)
|
|||
/// Operator * overload ; multiply a scalar value by a vector
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T> operator *(T X, const Vector3<T>& V)
|
||||
Vector3<T> operator *(T left, const Vector3<T>& right)
|
||||
{
|
||||
return Vector3<T>(V.x * X, V.y * X, V.z * X);
|
||||
return Vector3<T>(right.x * left, right.y * left, right.z * left);
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,13 +131,13 @@ Vector3<T> operator *(T X, const Vector3<T>& V)
|
|||
/// Operator *= overload ; multiply-assign a vector by a scalar value
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T>& operator *=(Vector3<T>& V, T X)
|
||||
Vector3<T>& operator *=(Vector3<T>& left, T right)
|
||||
{
|
||||
V.x *= X;
|
||||
V.y *= X;
|
||||
V.z *= X;
|
||||
left.x *= right;
|
||||
left.y *= right;
|
||||
left.z *= right;
|
||||
|
||||
return V;
|
||||
return left;
|
||||
}
|
||||
|
||||
|
||||
|
@ -145,9 +145,9 @@ Vector3<T>& operator *=(Vector3<T>& V, T X)
|
|||
/// Operator / overload ; divide a vector by a scalar value
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T> operator /(const Vector3<T>& V, T X)
|
||||
Vector3<T> operator /(const Vector3<T>& left, T right)
|
||||
{
|
||||
return Vector3<T>(V.x / X, V.y / X, V.z / X);
|
||||
return Vector3<T>(left.x / right, left.y / right, left.z / right);
|
||||
}
|
||||
|
||||
|
||||
|
@ -155,13 +155,13 @@ Vector3<T> operator /(const Vector3<T>& V, T X)
|
|||
/// Operator /= overload ; divide-assign a vector by a scalar value
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Vector3<T>& operator /=(Vector3<T>& V, T X)
|
||||
Vector3<T>& operator /=(Vector3<T>& left, T right)
|
||||
{
|
||||
V.x /= X;
|
||||
V.y /= X;
|
||||
V.z /= X;
|
||||
left.x /= right;
|
||||
left.y /= right;
|
||||
left.z /= right;
|
||||
|
||||
return V;
|
||||
return left;
|
||||
}
|
||||
|
||||
|
||||
|
@ -169,9 +169,9 @@ Vector3<T>& operator /=(Vector3<T>& V, T X)
|
|||
/// Operator == overload ; compares the equality of two vectors
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool operator ==(const Vector3<T>& V1, const Vector3<T>& V2)
|
||||
bool operator ==(const Vector3<T>& left, const Vector3<T>& V2)
|
||||
{
|
||||
return (V1.x == V2.x) && (V1.y == V2.y) && (V1.z == V2.z);
|
||||
return (left.x == right.x) && (left.y == right.y) && (left.z == right.z);
|
||||
}
|
||||
|
||||
|
||||
|
@ -179,7 +179,7 @@ bool operator ==(const Vector3<T>& V1, const Vector3<T>& V2)
|
|||
/// Operator != overload ; compares the difference of two vectors
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool operator !=(const Vector3<T>& V1, const Vector3<T>& V2)
|
||||
bool operator !=(const Vector3<T>& left, const Vector3<T>& right)
|
||||
{
|
||||
return (V1.x != V2.x) || (V1.y != V2.y) || (V1.z != V2.z);
|
||||
return (left.x != right.x) || (left.y != right.y) || (left.z != right.z);
|
||||
}
|
||||
|
|
|
@ -54,9 +54,9 @@ namespace priv
|
|||
/// by default.
|
||||
///
|
||||
/// \code
|
||||
/// void ThreadedFunc(void*)
|
||||
/// void ThreadFunction(void*)
|
||||
/// {
|
||||
/// sf::Context Ctx;
|
||||
/// sf::Context context;
|
||||
/// // from now on, you have a valid context
|
||||
///
|
||||
/// // you can make OpenGL calls
|
||||
|
@ -89,10 +89,10 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Activate or deactivate explicitely the context
|
||||
///
|
||||
/// \param Active True to activate, false to deactivate
|
||||
/// \param active : True to activate, false to deactivate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetActive(bool Active);
|
||||
void SetActive(bool active);
|
||||
|
||||
private :
|
||||
|
||||
|
|
|
@ -37,15 +37,15 @@ struct ContextSettings
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Default constructor
|
||||
///
|
||||
/// \param Depth : Depth buffer bits (24 by default)
|
||||
/// \param Stencil : Stencil buffer bits (8 by default)
|
||||
/// \param Antialiasing : Antialiasing level (0 by default)
|
||||
/// \param depth : Depth buffer bits (24 by default)
|
||||
/// \param stencil : Stencil buffer bits (8 by default)
|
||||
/// \param antialiasing : Antialiasing level (0 by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
explicit ContextSettings(unsigned int Depth = 24, unsigned int Stencil = 8, unsigned int Antialiasing = 0) :
|
||||
DepthBits (Depth),
|
||||
StencilBits (Stencil),
|
||||
AntialiasingLevel(Antialiasing)
|
||||
explicit ContextSettings(unsigned int depth = 24, unsigned int stencil = 8, unsigned int antialiasing = 0) :
|
||||
DepthBits (depth),
|
||||
StencilBits (stencil),
|
||||
AntialiasingLevel(antialiasing)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -54,33 +54,33 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Get the state of a key
|
||||
///
|
||||
/// \param KeyCode : Key to check
|
||||
/// \param key : Key to check
|
||||
///
|
||||
/// \return True if key is down, false if key is up
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool IsKeyDown(Key::Code KeyCode) const;
|
||||
bool IsKeyDown(Key::Code key) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the state of a mouse button
|
||||
///
|
||||
/// \param Button : Button to check
|
||||
/// \param button : Button to check
|
||||
///
|
||||
/// \return True if button is down, false if button is up
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool IsMouseButtonDown(Mouse::Button Button) const;
|
||||
bool IsMouseButtonDown(Mouse::Button button) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the state of a joystick button
|
||||
///
|
||||
/// \param JoyId : Identifier of the joystick to check (0 or 1)
|
||||
/// \param Button : Button to check
|
||||
/// \param joystick : Identifier of the joystick to check (0 or 1)
|
||||
/// \param button : Button to check
|
||||
///
|
||||
/// \return True if button is down, false if button is up
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool IsJoystickButtonDown(unsigned int JoyId, unsigned int Button) const;
|
||||
bool IsJoystickButtonDown(unsigned int joystick, unsigned int button) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the mouse X position
|
||||
|
@ -101,13 +101,13 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Get a joystick axis position
|
||||
///
|
||||
/// \param JoyId : Identifier of the joystick to check (0 or 1)
|
||||
/// \param Axis : Axis to get
|
||||
/// \param joystick : Identifier of the joystick to check (0 or 1)
|
||||
/// \param axis : Axis to get
|
||||
///
|
||||
/// \return Current axis position, in the range [-100, 100] (except for POV, which is [0, 360])
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
float GetJoystickAxis(unsigned int JoyId, Joy::Axis Axis) const;
|
||||
float GetJoystickAxis(unsigned int joystick, Joy::Axis axis) const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -115,7 +115,7 @@ private :
|
|||
/// /see WindowListener::OnEvent
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void OnEvent(const Event& EventReceived);
|
||||
virtual void OnEvent(const Event& event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
|
|
@ -52,12 +52,12 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the video mode with its attributes
|
||||
///
|
||||
/// \param ModeWidth : Width in pixels
|
||||
/// \param ModeHeight : Height in pixels
|
||||
/// \param ModeBpp : Pixel depths in bits per pixel (32 by default)
|
||||
/// \param width : Width in pixels
|
||||
/// \param height : Height in pixels
|
||||
/// \param bitsPerPixel : Pixel depths in bits per pixel (32 by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
VideoMode(unsigned int ModeWidth, unsigned int ModeHeight, unsigned int ModeBpp = 32);
|
||||
VideoMode(unsigned int width, unsigned int height, unsigned int bitsPerPixel = 32);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current desktop video mode
|
||||
|
@ -72,12 +72,12 @@ public :
|
|||
/// Index must be in range [0, GetModesCount()[
|
||||
/// Modes are sorted from best to worst
|
||||
///
|
||||
/// \param Index : Index of video mode to get
|
||||
/// \param index : Index of video mode to get
|
||||
///
|
||||
/// \return Corresponding video mode (invalid mode if index is out of range)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static VideoMode GetMode(std::size_t Index);
|
||||
static VideoMode GetMode(std::size_t index);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get valid video modes count
|
||||
|
@ -98,22 +98,22 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Comparison operator overload -- tell if two video modes are equal
|
||||
///
|
||||
/// \param Other : Video mode to compare
|
||||
/// \param other : Video mode to compare
|
||||
///
|
||||
/// \return True if modes are equal
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator ==(const VideoMode& Other) const;
|
||||
bool operator ==(const VideoMode& other) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Comparison operator overload -- tell if two video modes are different
|
||||
///
|
||||
/// \param Other : Video mode to compare
|
||||
/// \param other : Video mode to compare
|
||||
///
|
||||
/// \return True if modes are different
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool operator !=(const VideoMode& Other) const;
|
||||
bool operator !=(const VideoMode& other) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
@ -121,13 +121,6 @@ public :
|
|||
unsigned int Width; ///< Video mode width, in pixels
|
||||
unsigned int Height; ///< Video mode height, in pixels
|
||||
unsigned int BitsPerPixel; ///< Video mode pixel depth, in bits per pixels
|
||||
|
||||
private :
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get and sort valid video modes
|
||||
////////////////////////////////////////////////////////////
|
||||
static void InitializeModes();
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
|
|
@ -66,22 +66,22 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new window
|
||||
///
|
||||
/// \param Mode : Video mode to use
|
||||
/// \param Title : Title of the window
|
||||
/// \param WindowStyle : Window style (Resize | Close by default)
|
||||
/// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
||||
/// \param mode : Video mode to use
|
||||
/// \param title : Title of the window
|
||||
/// \param style : Window style (Resize | Close by default)
|
||||
/// \param settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Window(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const ContextSettings& Settings = ContextSettings());
|
||||
Window(VideoMode mode, const std::string& title, unsigned long style = Style::Resize | Style::Close, const ContextSettings& settings = ContextSettings());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct the window from an existing control
|
||||
///
|
||||
/// \param Handle : Platform-specific handle of the control
|
||||
/// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
||||
/// \param handle : Platform-specific handle of the control
|
||||
/// \param settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Window(WindowHandle Handle, const ContextSettings& Settings = ContextSettings());
|
||||
Window(WindowHandle handle, const ContextSettings& settings = ContextSettings());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destructor
|
||||
|
@ -92,22 +92,22 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Create (or recreate) the window
|
||||
///
|
||||
/// \param Mode : Video mode to use
|
||||
/// \param Title : Title of the window
|
||||
/// \param WindowStyle : Window style (Resize | Close by default)
|
||||
/// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
||||
/// \param mode : Video mode to use
|
||||
/// \param title : Title of the window
|
||||
/// \param style : Window style (Resize | Close by default)
|
||||
/// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Create(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const ContextSettings& Settings = ContextSettings());
|
||||
void Create(VideoMode mode, const std::string& title, unsigned long style = Style::Resize | Style::Close, const ContextSettings& settings = ContextSettings());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create (or recreate) the window from an existing control
|
||||
///
|
||||
/// \param Handle : Platform-specific handle of the control
|
||||
/// \param Settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
||||
/// \param handle : Platform-specific handle of the control
|
||||
/// \param settings : Additional settings for the underlying OpenGL context (see default constructor for default values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Create(WindowHandle Handle, const ContextSettings& Settings = ContextSettings());
|
||||
void Create(WindowHandle handle, const ContextSettings& settings = ContextSettings());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Close (destroy) the window.
|
||||
|
@ -154,64 +154,64 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Get the event on top of events stack, if any, and pop it
|
||||
///
|
||||
/// \param EventReceived : Event to fill, if any
|
||||
/// \param event : Event to fill, if any
|
||||
///
|
||||
/// \return True if an event was returned, false if events stack was empty
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool GetEvent(Event& EventReceived);
|
||||
bool GetEvent(Event& event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable / disable vertical synchronization
|
||||
///
|
||||
/// \param Enabled : True to enable v-sync, false to deactivate
|
||||
/// \param enabled : True to enable v-sync, false to deactivate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void UseVerticalSync(bool Enabled);
|
||||
void UseVerticalSync(bool enabled);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Show or hide the mouse cursor
|
||||
///
|
||||
/// \param Show : True to show, false to hide
|
||||
/// \param show : True to show, false to hide
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void ShowMouseCursor(bool Show);
|
||||
void ShowMouseCursor(bool show);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of the mouse cursor
|
||||
///
|
||||
/// \param Left : Left coordinate of the cursor, relative to the window
|
||||
/// \param Top : Top coordinate of the cursor, relative to the window
|
||||
/// \param left : Left coordinate of the cursor, relative to the window
|
||||
/// \param top : Top coordinate of the cursor, relative to the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetCursorPosition(unsigned int Left, unsigned int Top);
|
||||
void SetCursorPosition(unsigned int left, unsigned int top);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of the window on screen.
|
||||
/// Only works for top-level windows
|
||||
///
|
||||
/// \param Left : Left position
|
||||
/// \param Top : Top position
|
||||
/// \param left : Left position
|
||||
/// \param top : Top position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPosition(int Left, int Top);
|
||||
void SetPosition(int left, int top);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the size of the rendering region of the window
|
||||
///
|
||||
/// \param Width : New width
|
||||
/// \param Height : New height
|
||||
/// \param width : New width
|
||||
/// \param height : New height
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetSize(unsigned int Width, unsigned int Height);
|
||||
void SetSize(unsigned int width, unsigned int height);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Show or hide the window
|
||||
///
|
||||
/// \param State : True to show, false to hide
|
||||
/// \param show : True to show, false to hide
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Show(bool State);
|
||||
void Show(bool show);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable or disable automatic key-repeat.
|
||||
|
@ -225,23 +225,23 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Change the window's icon
|
||||
///
|
||||
/// \param Width : Icon's width, in pixels
|
||||
/// \param Height : Icon's height, in pixels
|
||||
/// \param Pixels : Pointer to the pixels in memory, format must be RGBA 32 bits
|
||||
/// \param width : Icon's width, in pixels
|
||||
/// \param height : Icon's height, in pixels
|
||||
/// \param pixels : Pointer to the pixels in memory, format must be RGBA 32 bits
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels);
|
||||
void SetIcon(unsigned int width, unsigned int height, const Uint8* pixels);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Activate or deactivate the window as the current target
|
||||
/// for rendering
|
||||
///
|
||||
/// \param Active : True to activate, false to deactivate (true by default)
|
||||
/// \param active : True to activate, false to deactivate (true by default)
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool SetActive(bool Active = true) const;
|
||||
bool SetActive(bool active = true) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Display the window on screen
|
||||
|
@ -260,10 +260,10 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Limit the framerate to a maximum fixed frequency
|
||||
///
|
||||
/// \param Limit : Framerate limit, in frames per seconds (use 0 to disable limit)
|
||||
/// \param limit : Framerate limit, in frames per seconds (use 0 to disable limit)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetFramerateLimit(unsigned int Limit);
|
||||
void SetFramerateLimit(unsigned int limit);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get time elapsed since last frame
|
||||
|
@ -277,10 +277,10 @@ public :
|
|||
/// Change the joystick threshold, ie. the value below which
|
||||
/// no move event will be generated
|
||||
///
|
||||
/// \param Threshold : New threshold, in range [0, 100]
|
||||
/// \param threshold : New threshold, in range [0, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetJoystickThreshold(float Threshold);
|
||||
void SetJoystickThreshold(float threshold);
|
||||
|
||||
private :
|
||||
|
||||
|
@ -293,10 +293,10 @@ private :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// /see WindowListener::OnEvent
|
||||
///
|
||||
/// \param EventReceived : Event received
|
||||
/// \param event : Event received
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void OnEvent(const Event& EventReceived);
|
||||
virtual void OnEvent(const Event& event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Do some common internal initializations
|
||||
|
|
|
@ -46,10 +46,10 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Called each time an event is received from attached window
|
||||
///
|
||||
/// \param EventReceived : Event received
|
||||
/// \param event : Event received
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void OnEvent(const Event& EventReceived) = 0;
|
||||
virtual void OnEvent(const Event& event) = 0;
|
||||
|
||||
protected :
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue