Corrected the name of some functions/variable

This commit is contained in:
Laurent Gomila 2011-12-25 23:42:43 +01:00
parent c817f882e6
commit aaa21dfaf6
32 changed files with 203 additions and 203 deletions

View File

@ -20,9 +20,9 @@ void PlaySound()
// Display sound informations // Display sound informations
std::cout << "canary.wav :" << std::endl; std::cout << "canary.wav :" << std::endl;
std::cout << " " << buffer.GetDuration() / 1000.f << " seconds" << std::endl; std::cout << " " << buffer.GetDuration() / 1000.f << " seconds" << std::endl;
std::cout << " " << buffer.GetSampleRate() << " samples / sec" << std::endl; std::cout << " " << buffer.GetSampleRate() << " samples / sec" << std::endl;
std::cout << " " << buffer.GetChannelsCount() << " channels" << std::endl; std::cout << " " << buffer.GetChannelCount() << " channels" << std::endl;
// Create a sound instance and play it // Create a sound instance and play it
sf::Sound sound(buffer); sf::Sound sound(buffer);
@ -57,7 +57,7 @@ void PlayMusic()
std::cout << "orchestral.ogg :" << std::endl; std::cout << "orchestral.ogg :" << std::endl;
std::cout << " " << music.GetDuration() / 1000.f << " seconds" << std::endl; std::cout << " " << music.GetDuration() / 1000.f << " seconds" << std::endl;
std::cout << " " << music.GetSampleRate() << " samples / sec" << std::endl; std::cout << " " << music.GetSampleRate() << " samples / sec" << std::endl;
std::cout << " " << music.GetChannelsCount() << " channels" << std::endl; std::cout << " " << music.GetChannelCount() << " channels" << std::endl;
// Play it // Play it
music.Play(); music.Play();

View File

@ -46,9 +46,9 @@ int main()
// Display captured sound informations // Display captured sound informations
std::cout << "Sound information :" << std::endl; std::cout << "Sound information :" << std::endl;
std::cout << " " << buffer.GetDuration() / 1000.f << " seconds" << std::endl; std::cout << " " << buffer.GetDuration() / 1000.f << " seconds" << std::endl;
std::cout << " " << buffer.GetSampleRate() << " samples / seconds" << std::endl; std::cout << " " << buffer.GetSampleRate() << " samples / seconds" << std::endl;
std::cout << " " << buffer.GetChannelsCount() << " channels" << std::endl; std::cout << " " << buffer.GetChannelCount() << " channels" << std::endl;
// Choose what to do with the recorded sound data // Choose what to do with the recorded sound data
char choice; char choice;

View File

@ -55,12 +55,12 @@ private :
/// /see SoundRecorder::ProcessSamples /// /see SoundRecorder::ProcessSamples
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual bool OnProcessSamples(const sf::Int16* samples, std::size_t samplesCount) virtual bool OnProcessSamples(const sf::Int16* samples, std::size_t sampleCount)
{ {
// Pack the audio samples into a network packet // Pack the audio samples into a network packet
sf::Packet packet; sf::Packet packet;
packet << audioData; packet << audioData;
packet.Append(samples, samplesCount * sizeof(sf::Int16)); packet.Append(samples, sampleCount * sizeof(sf::Int16));
// Send the audio packet to the server // Send the audio packet to the server
return mySocket.Send(packet) == sf::Socket::Done; return mySocket.Send(packet) == sf::Socket::Done;

View File

@ -103,7 +103,7 @@ private :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual void OnSeek(sf::Uint32 timeOffset) virtual void OnSeek(sf::Uint32 timeOffset)
{ {
myOffset = timeOffset * GetSampleRate() * GetChannelsCount() / 1000; myOffset = timeOffset * GetSampleRate() * GetChannelCount() / 1000;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -129,7 +129,7 @@ private :
const sf::Int16* samples = reinterpret_cast<const sf::Int16*>(packet.GetData() + 1); const sf::Int16* samples = reinterpret_cast<const sf::Int16*>(packet.GetData() + 1);
std::size_t nbSamples = (packet.GetDataSize() - 1) / sizeof(sf::Int16); std::size_t nbSamples = (packet.GetDataSize() - 1) / sizeof(sf::Int16);
// Don't forget that the other thread can access the samples array at any time // Don't forget that the other thread can access the sample array at any time
// (so we protect any operation on it with the mutex) // (so we protect any operation on it with the mutex)
{ {
sf::Lock lock(myMutex); sf::Lock lock(myMutex);

View File

@ -127,17 +127,17 @@ public :
/// The assumed format of the audio samples is 16 bits signed integer /// The assumed format of the audio samples is 16 bits signed integer
/// (sf::Int16). /// (sf::Int16).
/// ///
/// \param samples Pointer to the array of samples in memory /// \param samples Pointer to the array of samples in memory
/// \param samplesCount Number of samples in the array /// \param sampleCount Number of samples in the array
/// \param channelsCount Number of channels (1 = mono, 2 = stereo, ...) /// \param channelCount Number of channels (1 = mono, 2 = stereo, ...)
/// \param sampleRate Sample rate (number of samples to play per second) /// \param sampleRate Sample rate (number of samples to play per second)
/// ///
/// \return True if loading succeeded, false if it failed /// \return True if loading succeeded, false if it failed
/// ///
/// \see LoadFromFile, LoadFromMemory, SaveToFile /// \see LoadFromFile, LoadFromMemory, SaveToFile
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool LoadFromSamples(const Int16* samples, std::size_t samplesCount, unsigned int channelsCount, unsigned int sampleRate); bool LoadFromSamples(const Int16* samples, std::size_t sampleCount, unsigned int channelCount, unsigned int sampleRate);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Save the sound buffer to an audio file /// \brief Save the sound buffer to an audio file
@ -160,11 +160,11 @@ public :
/// ///
/// The format of the returned samples is 16 bits signed integer /// The format of the returned samples is 16 bits signed integer
/// (sf::Int16). The total number of samples in this array /// (sf::Int16). The total number of samples in this array
/// is given by the GetSamplesCount() function. /// is given by the GetSampleCount() function.
/// ///
/// \return Read-only pointer to the array of sound samples /// \return Read-only pointer to the array of sound samples
/// ///
/// \see GetSamplesCount /// \see GetSampleCount
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
const Int16* GetSamples() const; const Int16* GetSamples() const;
@ -180,7 +180,7 @@ public :
/// \see GetSamples /// \see GetSamples
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
std::size_t GetSamplesCount() const; std::size_t GetSampleCount() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the sample rate of the sound /// \brief Get the sample rate of the sound
@ -191,7 +191,7 @@ public :
/// ///
/// \return Sample rate (number of samples per second) /// \return Sample rate (number of samples per second)
/// ///
/// \see GetChannelsCount, GetDuration /// \see GetChannelCount, GetDuration
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int GetSampleRate() const; unsigned int GetSampleRate() const;
@ -207,14 +207,14 @@ public :
/// \see GetSampleRate, GetDuration /// \see GetSampleRate, GetDuration
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int GetChannelsCount() const; unsigned int GetChannelCount() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the total duration of the sound /// \brief Get the total duration of the sound
/// ///
/// \return Sound duration, in milliseconds /// \return Sound duration, in milliseconds
/// ///
/// \see GetSampleRate, GetChannelsCount /// \see GetSampleRate, GetChannelCount
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Uint32 GetDuration() const; Uint32 GetDuration() const;
@ -246,13 +246,13 @@ private :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Update the internal buffer with the cached audio samples /// \brief Update the internal buffer with the cached audio samples
/// ///
/// \param channelsCount Number of channels /// \param channelCount Number of channels
/// \param sampleRate Sample rate (number of samples per second) /// \param sampleRate Sample rate (number of samples per second)
/// ///
/// \return True on success, false if any error happened /// \return True on success, false if any error happened
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Update(unsigned int channelsCount, unsigned int sampleRate); bool Update(unsigned int channelCount, unsigned int sampleRate);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Add a sound to the list of sounds that use this buffer /// \brief Add a sound to the list of sounds that use this buffer

View File

@ -70,13 +70,13 @@ private :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Process a new chunk of recorded samples /// \brief Process a new chunk of recorded samples
/// ///
/// \param samples Pointer to the new chunk of recorded samples /// \param samples Pointer to the new chunk of recorded samples
/// \param samplesCount Number of samples pointed by \a samples /// \param sampleCount Number of samples pointed by \a samples
/// ///
/// \return True to continue the capture, or false to stop it /// \return True to continue the capture, or false to stop it
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual bool OnProcessSamples(const Int16* samples, std::size_t samplesCount); virtual bool OnProcessSamples(const Int16* samples, std::size_t sampleCount);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Stop capturing audio data /// \brief Stop capturing audio data

View File

@ -131,13 +131,13 @@ private :
/// whatever it wants with it (storing it, playing it, sending /// whatever it wants with it (storing it, playing it, sending
/// it over the network, etc.). /// it over the network, etc.).
/// ///
/// \param samples Pointer to the new chunk of recorded samples /// \param samples Pointer to the new chunk of recorded samples
/// \param samplesCount Number of samples pointed by \a samples /// \param sampleCount Number of samples pointed by \a samples
/// ///
/// \return True to continue the capture, or false to stop it /// \return True to continue the capture, or false to stop it
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual bool OnProcessSamples(const Int16* samples, std::size_t samplesCount) = 0; virtual bool OnProcessSamples(const Int16* samples, std::size_t sampleCount) = 0;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Stop capturing audio data /// \brief Stop capturing audio data
@ -238,7 +238,7 @@ private :
/// return true; /// return true;
/// } /// }
/// ///
/// virtual bool OnProcessSamples(const Int16* samples, std::size_t samplesCount) /// virtual bool OnProcessSamples(const Int16* samples, std::size_t sampleCount)
/// { /// {
/// // Do something with the new chunk of samples (store them, send them, ...) /// // Do something with the new chunk of samples (store them, send them, ...)
/// ... /// ...

View File

@ -104,7 +104,7 @@ public :
/// \return Number of channels /// \return Number of channels
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int GetChannelsCount() const; unsigned int GetChannelCount() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the stream sample rate of the stream /// \brief Get the stream sample rate of the stream
@ -193,11 +193,11 @@ protected :
/// It can be called multiple times if the settings of the /// It can be called multiple times if the settings of the
/// audio stream change, but only when the stream is stopped. /// audio stream change, but only when the stream is stopped.
/// ///
/// \param channelsCount Number of channels of the stream /// \param channelCount Number of channels of the stream
/// \param sampleRate Sample rate, in samples per second /// \param sampleRate Sample rate, in samples per second
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Initialize(unsigned int channelsCount, unsigned int sampleRate); void Initialize(unsigned int channelCount, unsigned int sampleRate);
private : private :
@ -245,7 +245,7 @@ private :
/// consumed; it fills it again and inserts it back into the /// consumed; it fills it again and inserts it back into the
/// playing queue. /// playing queue.
/// ///
/// \param buffer Number of the buffer to fill (in [0, BuffersCount]) /// \param buffer Number of the buffer to fill (in [0, BufferCount])
/// ///
/// \return True if the stream source has requested to stop, false otherwise /// \return True if the stream source has requested to stop, false otherwise
/// ///
@ -273,21 +273,21 @@ private :
enum enum
{ {
BuffersCount = 3 ///< Number of audio buffers used by the streaming loop BufferCount = 3 ///< Number of audio buffers used by the streaming loop
}; };
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Thread myThread; ///< Thread running the background tasks Thread myThread; ///< Thread running the background tasks
bool myIsStreaming; ///< Streaming state (true = playing, false = stopped) bool myIsStreaming; ///< Streaming state (true = playing, false = stopped)
unsigned int myBuffers[BuffersCount]; ///< Sound buffers used to store temporary audio data unsigned int myBuffers[BufferCount]; ///< Sound buffers used to store temporary audio data
unsigned int myChannelsCount; ///< Number of channels (1 = mono, 2 = stereo, ...) unsigned int myChannelCount; ///< Number of channels (1 = mono, 2 = stereo, ...)
unsigned int mySampleRate; ///< Frequency (samples / second) unsigned int mySampleRate; ///< Frequency (samples / second)
Uint32 myFormat; ///< Format of the internal sound buffers Uint32 myFormat; ///< Format of the internal sound buffers
bool myLoop; ///< Loop flag (true to loop, false to play once) bool myLoop; ///< Loop flag (true to loop, false to play once)
Uint64 mySamplesProcessed; ///< Number of buffers processed since beginning of the stream Uint64 mySamplesProcessed; ///< Number of buffers processed since beginning of the stream
bool myEndBuffers[BuffersCount]; ///< Each buffer is marked as "end buffer" or not, for proper duration calculation bool myEndBuffers[BufferCount]; ///< Each buffer is marked as "end buffer" or not, for proper duration calculation
}; };
} // namespace sf } // namespace sf
@ -338,11 +338,11 @@ private :
/// { /// {
/// // Open the source and get audio settings /// // Open the source and get audio settings
/// ... /// ...
/// unsigned int channelsCount = ...; /// unsigned int channelCount = ...;
/// unsigned int sampleRate = ...; /// unsigned int sampleRate = ...;
/// ///
/// // Initialize the stream -- important! /// // Initialize the stream -- important!
/// Initialize(channelsCount, sampleRate); /// Initialize(channelCount, sampleRate);
/// } /// }
/// ///
/// private : /// private :

View File

@ -44,11 +44,11 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor
/// ///
/// \param radius Radius of the circle /// \param radius Radius of the circle
/// \param pointsCount Number of points composing the circle /// \param pointCount Number of points composing the circle
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
explicit CircleShape(float radius = 0, unsigned int pointsCount = 30); explicit CircleShape(float radius = 0, unsigned int pointCount = 30);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Set the radius of the circle /// \brief Set the radius of the circle
@ -75,20 +75,20 @@ public :
/// ///
/// \param count New number of points of the circle /// \param count New number of points of the circle
/// ///
/// \see GetPointsCount /// \see GetPointCount
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void SetPointsCount(unsigned int count); void SetPointCount(unsigned int count);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the number of points of the shape /// \brief Get the number of points of the shape
/// ///
/// \return Number of points of the shape /// \return Number of points of the shape
/// ///
/// \see SetPointsCount /// \see SetPointCount
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual unsigned int GetPointsCount() const; virtual unsigned int GetPointCount() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get a point of the shape /// \brief Get a point of the shape
@ -105,8 +105,8 @@ private :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
float myRadius; ///< Radius of the circle float myRadius; ///< Radius of the circle
unsigned int myPointsCount; ///< Number of points composing the circle unsigned int myPointCount; ///< Number of points composing the circle
}; };
} // namespace sf } // namespace sf

View File

@ -45,30 +45,30 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor
/// ///
/// \param pointsCount Number of points of the polygon /// \param pointCount Number of points of the polygon
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
explicit ConvexShape(unsigned int pointsCount = 0); explicit ConvexShape(unsigned int pointCount = 0);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Set the number of points of the polygon /// \brief Set the number of points of the polygon
/// ///
/// \param count New number of points of the polygon /// \param count New number of points of the polygon
/// ///
/// \see GetPointsCount /// \see GetPointCount
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void SetPointsCount(unsigned int count); void SetPointCount(unsigned int count);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the number of points of the polygon /// \brief Get the number of points of the polygon
/// ///
/// \return Number of points of the polygon /// \return Number of points of the polygon
/// ///
/// \see SetPointsCount /// \see SetPointCount
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual unsigned int GetPointsCount() const; virtual unsigned int GetPointCount() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Set the position of a point /// \brief Set the position of a point
@ -126,7 +126,7 @@ private :
/// Usage example: /// Usage example:
/// \code /// \code
/// sf::ConvexShape polygon; /// sf::ConvexShape polygon;
/// polygon.SetPointsCount(3); /// polygon.SetPointCount(3);
/// polygon.SetPoint(0, sf::Vector2f(0, 0)); /// polygon.SetPoint(0, sf::Vector2f(0, 0));
/// polygon.SetPoint(1, sf::Vector2f(0, 10)); /// polygon.SetPoint(1, sf::Vector2f(0, 10));
/// polygon.SetPoint(2, sf::Vector2f(25, 5)); /// polygon.SetPoint(2, sf::Vector2f(25, 5));

View File

@ -67,7 +67,7 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Create the image from an arry of pixels /// \brief Create the image from an arry of pixels
/// ///
/// The \a pixels array is assumed to contain 32-bits RGBA pixels, /// The \a pixel array is assumed to contain 32-bits RGBA pixels,
/// and have the given \a width and \a height. If not, this is /// and have the given \a width and \a height. If not, this is
/// an undefined behaviour. /// an undefined behaviour.
/// If \a pixels is null, an empty image is created. /// If \a pixels is null, an empty image is created.

View File

@ -75,7 +75,7 @@ public :
/// \return Number of points of the shape /// \return Number of points of the shape
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual unsigned int GetPointsCount() const; virtual unsigned int GetPointCount() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get a point of the shape /// \brief Get a point of the shape

View File

@ -189,13 +189,13 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Draw primitives defined by an array of vertices /// \brief Draw primitives defined by an array of vertices
/// ///
/// \param vertices Pointer to the vertices /// \param vertices Pointer to the vertices
/// \param verticesCount Number of vertices in the array /// \param vertexCount Number of vertices in the array
/// \param type Type of primitives to draw /// \param type Type of primitives to draw
/// \param states Render states to use for drawing /// \param states Render states to use for drawing
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Draw(const Vertex* vertices, unsigned int verticesCount, void Draw(const Vertex* vertices, unsigned int vertexCount,
PrimitiveType type, const RenderStates& states = RenderStates::Default); PrimitiveType type, const RenderStates& states = RenderStates::Default);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -190,12 +190,12 @@ public :
/// \return Number of points of the shape /// \return Number of points of the shape
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual unsigned int GetPointsCount() const = 0; virtual unsigned int GetPointCount() const = 0;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get a point of the shape /// \brief Get a point of the shape
/// ///
/// \param index Index of the point to get, in range [0 .. GetPointsCount() - 1] /// \param index Index of the point to get, in range [0 .. GetPointCount() - 1]
/// ///
/// \return Index-th point of the shape /// \return Index-th point of the shape
/// ///
@ -243,7 +243,7 @@ protected :
/// ///
/// This function must be called by the derived class everytime /// This function must be called by the derived class everytime
/// the shape's points change (ie. the result of either /// the shape's points change (ie. the result of either
/// GetPointsCount or GetPoint is different). /// GetPointCount or GetPoint is different).
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Update(); void Update();
@ -330,7 +330,7 @@ private :
/// ///
/// You can write your own derived shape class, there are only /// You can write your own derived shape class, there are only
/// two virtual functions to override: /// two virtual functions to override:
/// \li GetOutlinePointsCount must return the number of points of the shape /// \li GetOutlinePointCount must return the number of points of the shape
/// \li GetOutlinePoint must return the points of the shape /// \li GetOutlinePoint must return the points of the shape
/// ///
/// \see sf::LineShape, sf::RectangleShape, sf::CircleShape, sf::ConvexShape, sf::Transformable /// \see sf::LineShape, sf::RectangleShape, sf::CircleShape, sf::ConvexShape, sf::Transformable

View File

@ -250,7 +250,7 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Update the whole texture from an array of pixels /// \brief Update the whole texture from an array of pixels
/// ///
/// The \a pixels array is assumed to have the same size as /// The \a pixel array is assumed to have the same size as
/// the \a area rectangle, and to contain 32-bits RGBA pixels. /// the \a area rectangle, and to contain 32-bits RGBA pixels.
/// ///
/// No additional check is performed on the size of the pixel /// No additional check is performed on the size of the pixel
@ -268,7 +268,7 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Update a part of the texture from an array of pixels /// \brief Update a part of the texture from an array of pixels
/// ///
/// The size of the \a pixels array must match the \a width and /// The size of the \a pixel array must match the \a width and
/// \a height arguments, and it must contain 32-bits RGBA pixels. /// \a height arguments, and it must contain 32-bits RGBA pixels.
/// ///
/// No additional check is performed on the size of the pixel /// No additional check is performed on the size of the pixel

View File

@ -56,11 +56,11 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Construct the vertex array with a type and an initial number of vertices /// \brief Construct the vertex array with a type and an initial number of vertices
/// ///
/// \param type Type of primitives /// \param type Type of primitives
/// \param verticesCount Initial number of vertices in the array /// \param vertexCount Initial number of vertices in the array
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
VertexArray(PrimitiveType type, unsigned int verticesCount = 0); VertexArray(PrimitiveType type, unsigned int vertexCount = 0);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Return the vertices count /// \brief Return the vertices count
@ -68,19 +68,19 @@ public :
/// \return Number of vertices in the array /// \return Number of vertices in the array
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int GetVerticesCount() const; unsigned int GetVertexCount() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get a read-write access to a vertex by its index /// \brief Get a read-write access to a vertex by its index
/// ///
/// This function doesn't check \a index, it must be in range /// This function doesn't check \a index, it must be in range
/// [0, GetVerticesCount() - 1]. /// [0, GetVertexCount() - 1].
/// ///
/// \param index Index of the vertex to get /// \param index Index of the vertex to get
/// ///
/// \return Reference to the index-th vertex /// \return Reference to the index-th vertex
/// ///
/// \see GetVerticesCount /// \see GetVertexCount
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vertex& operator [](unsigned int index); Vertex& operator [](unsigned int index);
@ -89,13 +89,13 @@ public :
/// \brief Get a read-only access to a vertex by its index /// \brief Get a read-only access to a vertex by its index
/// ///
/// This function doesn't check \a index, it must be in range /// This function doesn't check \a index, it must be in range
/// [0, GetVerticesCount() - 1]. /// [0, GetVertexCount() - 1].
/// ///
/// \param index Index of the vertex to get /// \param index Index of the vertex to get
/// ///
/// \return Const reference to the index-th vertex /// \return Const reference to the index-th vertex
/// ///
/// \see GetVerticesCount /// \see GetVertexCount
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
const Vertex& operator [](unsigned int index) const; const Vertex& operator [](unsigned int index) const;
@ -120,10 +120,10 @@ public :
/// If \a count is less than the current size, existing vertices /// If \a count is less than the current size, existing vertices
/// are removed from the array. /// are removed from the array.
/// ///
/// \param verticesCount New size of the array (number of vertices) /// \param vertexCount New size of the array (number of vertices)
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Resize(unsigned int verticesCount); void Resize(unsigned int vertexCount);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Add a vertex to the array /// \brief Add a vertex to the array

View File

@ -99,12 +99,12 @@ bool AudioDevice::IsExtensionSupported(const std::string& extension)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
int AudioDevice::GetFormatFromChannelsCount(unsigned int channelsCount) int AudioDevice::GetFormatFromChannelCount(unsigned int channelCount)
{ {
EnsureALInit(); EnsureALInit();
// Find the good format according to the number of channels // Find the good format according to the number of channels
switch (channelsCount) switch (channelCount)
{ {
case 1 : return AL_FORMAT_MONO16; case 1 : return AL_FORMAT_MONO16;
case 2 : return AL_FORMAT_STEREO16; case 2 : return AL_FORMAT_STEREO16;

View File

@ -75,12 +75,12 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the OpenAL format that matches the given number of channels /// \brief Get the OpenAL format that matches the given number of channels
/// ///
/// \param channelsCount Number of channels /// \param channelCount Number of channels
/// ///
/// \return Corresponding format /// \return Corresponding format
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
static int GetFormatFromChannelsCount(unsigned int channelsCount); static int GetFormatFromChannelCount(unsigned int channelCount);
}; };
} // namespace priv } // namespace priv

View File

@ -139,14 +139,14 @@ void Music::OnSeek(Uint32 timeOffset)
void Music::Initialize() void Music::Initialize()
{ {
// Compute the music duration // Compute the music duration
Uint64 samples = myFile->GetSamplesCount(); Uint64 samples = myFile->GetSampleCount();
myDuration = static_cast<Uint32>(1000 * samples / myFile->GetSampleRate() / myFile->GetChannelsCount()); myDuration = static_cast<Uint32>(1000 * samples / myFile->GetSampleRate() / myFile->GetChannelCount());
// Resize the internal buffer so that it can contain 1 second of audio samples // Resize the internal buffer so that it can contain 1 second of audio samples
mySamples.resize(myFile->GetSampleRate() * myFile->GetChannelsCount()); mySamples.resize(myFile->GetSampleRate() * myFile->GetChannelCount());
// Initialize the stream // Initialize the stream
SoundStream::Initialize(myFile->GetChannelsCount(), myFile->GetSampleRate()); SoundStream::Initialize(myFile->GetChannelCount(), myFile->GetSampleRate());
} }
} // namespace sf } // namespace sf

View File

@ -59,7 +59,7 @@ mySounds () // don't copy the attached sounds
ALCheck(alGenBuffers(1, &myBuffer)); ALCheck(alGenBuffers(1, &myBuffer));
// Update the internal buffer with the new samples // Update the internal buffer with the new samples
Update(copy.GetChannelsCount(), copy.GetSampleRate()); Update(copy.GetChannelCount(), copy.GetSampleRate());
} }
@ -110,24 +110,24 @@ bool SoundBuffer::LoadFromStream(InputStream& stream)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool SoundBuffer::LoadFromSamples(const Int16* samples, std::size_t samplesCount, unsigned int channelsCount, unsigned int sampleRate) bool SoundBuffer::LoadFromSamples(const Int16* samples, std::size_t sampleCount, unsigned int channelCount, unsigned int sampleRate)
{ {
if (samples && samplesCount && channelsCount && sampleRate) if (samples && sampleCount && channelCount && sampleRate)
{ {
// Copy the new audio samples // Copy the new audio samples
mySamples.assign(samples, samples + samplesCount); mySamples.assign(samples, samples + sampleCount);
// Update the internal buffer with the new samples // Update the internal buffer with the new samples
return Update(channelsCount, sampleRate); return Update(channelCount, sampleRate);
} }
else else
{ {
// Error... // Error...
Err() << "Failed to load sound buffer from samples (" Err() << "Failed to load sound buffer from samples ("
<< "array: " << samples << ", " << "array: " << samples << ", "
<< "count: " << samplesCount << ", " << "count: " << sampleCount << ", "
<< "channels: " << channelsCount << ", " << "channels: " << channelCount << ", "
<< "samplerate: " << sampleRate << ")" << "samplerate: " << sampleRate << ")"
<< std::endl; << std::endl;
return false; return false;
@ -140,7 +140,7 @@ bool SoundBuffer::SaveToFile(const std::string& filename) const
{ {
// Create the sound file in write mode // Create the sound file in write mode
priv::SoundFile file; priv::SoundFile file;
if (file.OpenWrite(filename, GetChannelsCount(), GetSampleRate())) if (file.OpenWrite(filename, GetChannelCount(), GetSampleRate()))
{ {
// Write the samples to the opened file // Write the samples to the opened file
file.Write(&mySamples[0], mySamples.size()); file.Write(&mySamples[0], mySamples.size());
@ -162,7 +162,7 @@ const Int16* SoundBuffer::GetSamples() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
std::size_t SoundBuffer::GetSamplesCount() const std::size_t SoundBuffer::GetSampleCount() const
{ {
return mySamples.size(); return mySamples.size();
} }
@ -179,12 +179,12 @@ unsigned int SoundBuffer::GetSampleRate() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int SoundBuffer::GetChannelsCount() const unsigned int SoundBuffer::GetChannelCount() const
{ {
ALint channelsCount; ALint channelCount;
ALCheck(alGetBufferi(myBuffer, AL_CHANNELS, &channelsCount)); ALCheck(alGetBufferi(myBuffer, AL_CHANNELS, &channelCount));
return channelsCount; return channelCount;
} }
@ -213,16 +213,16 @@ SoundBuffer& SoundBuffer::operator =(const SoundBuffer& right)
bool SoundBuffer::Initialize(priv::SoundFile& file) bool SoundBuffer::Initialize(priv::SoundFile& file)
{ {
// Retrieve the sound parameters // Retrieve the sound parameters
std::size_t nbSamples = file.GetSamplesCount(); std::size_t nbSamples = file.GetSampleCount();
unsigned int channelsCount = file.GetChannelsCount(); unsigned int channelCount = file.GetChannelCount();
unsigned int sampleRate = file.GetSampleRate(); unsigned int sampleRate = file.GetSampleRate();
// Read the samples from the provided file // Read the samples from the provided file
mySamples.resize(nbSamples); mySamples.resize(nbSamples);
if (file.Read(&mySamples[0], nbSamples) == nbSamples) if (file.Read(&mySamples[0], nbSamples) == nbSamples)
{ {
// Update the internal buffer with the new samples // Update the internal buffer with the new samples
return Update(channelsCount, sampleRate); return Update(channelCount, sampleRate);
} }
else else
{ {
@ -232,19 +232,19 @@ bool SoundBuffer::Initialize(priv::SoundFile& file)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool SoundBuffer::Update(unsigned int channelsCount, unsigned int sampleRate) bool SoundBuffer::Update(unsigned int channelCount, unsigned int sampleRate)
{ {
// Check parameters // Check parameters
if (!channelsCount || !sampleRate || mySamples.empty()) if (!channelCount || !sampleRate || mySamples.empty())
return false; return false;
// Find the good format according to the number of channels // Find the good format according to the number of channels
ALenum format = priv::AudioDevice::GetFormatFromChannelsCount(channelsCount); ALenum format = priv::AudioDevice::GetFormatFromChannelCount(channelCount);
// Check if the format is valid // Check if the format is valid
if (format == 0) if (format == 0)
{ {
Err() << "Failed to load sound buffer (unsupported number of channels: " << channelsCount << ")" << std::endl; Err() << "Failed to load sound buffer (unsupported number of channels: " << channelCount << ")" << std::endl;
return false; return false;
} }
@ -253,7 +253,7 @@ bool SoundBuffer::Update(unsigned int channelsCount, unsigned int sampleRate)
ALCheck(alBufferData(myBuffer, format, &mySamples[0], size, sampleRate)); ALCheck(alBufferData(myBuffer, format, &mySamples[0], size, sampleRate));
// Compute the duration // Compute the duration
myDuration = static_cast<Uint32>(1000 * mySamples.size() / sampleRate / channelsCount); myDuration = static_cast<Uint32>(1000 * mySamples.size() / sampleRate / channelCount);
return true; return true;
} }

View File

@ -43,9 +43,9 @@ bool SoundBufferRecorder::OnStart()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool SoundBufferRecorder::OnProcessSamples(const Int16* samples, std::size_t samplesCount) bool SoundBufferRecorder::OnProcessSamples(const Int16* samples, std::size_t sampleCount)
{ {
std::copy(samples, samples + samplesCount, std::back_inserter(mySamples)); std::copy(samples, samples + sampleCount, std::back_inserter(mySamples));
return true; return true;
} }

View File

@ -53,10 +53,10 @@ namespace priv
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
SoundFile::SoundFile() : SoundFile::SoundFile() :
myFile (NULL), myFile (NULL),
myNbSamples (0), myNbSamples (0),
myChannelsCount(0), myChannelCount(0),
mySampleRate (0) mySampleRate (0)
{ {
} }
@ -71,16 +71,16 @@ SoundFile::~SoundFile()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
std::size_t SoundFile::GetSamplesCount() const std::size_t SoundFile::GetSampleCount() const
{ {
return myNbSamples; return myNbSamples;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int SoundFile::GetChannelsCount() const unsigned int SoundFile::GetChannelCount() const
{ {
return myChannelsCount; return myChannelCount;
} }
@ -108,9 +108,9 @@ bool SoundFile::OpenRead(const std::string& filename)
} }
// Set the sound parameters // Set the sound parameters
myChannelsCount = fileInfos.channels; myChannelCount = fileInfos.channels;
mySampleRate = fileInfos.samplerate; mySampleRate = fileInfos.samplerate;
myNbSamples = static_cast<std::size_t>(fileInfos.frames) * myChannelsCount; myNbSamples = static_cast<std::size_t>(fileInfos.frames) * myChannelCount;
return true; return true;
} }
@ -145,9 +145,9 @@ bool SoundFile::OpenRead(const void* data, std::size_t sizeInBytes)
} }
// Set the sound parameters // Set the sound parameters
myChannelsCount = fileInfos.channels; myChannelCount = fileInfos.channels;
mySampleRate = fileInfos.samplerate; mySampleRate = fileInfos.samplerate;
myNbSamples = static_cast<std::size_t>(fileInfos.frames) * myChannelsCount; myNbSamples = static_cast<std::size_t>(fileInfos.frames) * myChannelCount;
return true; return true;
} }
@ -177,16 +177,16 @@ bool SoundFile::OpenRead(InputStream& stream)
} }
// Set the sound parameters // Set the sound parameters
myChannelsCount = fileInfos.channels; myChannelCount = fileInfos.channels;
mySampleRate = fileInfos.samplerate; mySampleRate = fileInfos.samplerate;
myNbSamples = static_cast<std::size_t>(fileInfos.frames) * myChannelsCount; myNbSamples = static_cast<std::size_t>(fileInfos.frames) * myChannelCount;
return true; return true;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool SoundFile::OpenWrite(const std::string& filename, unsigned int channelsCount, unsigned int sampleRate) bool SoundFile::OpenWrite(const std::string& filename, unsigned int channelCount, unsigned int sampleRate)
{ {
// If the file is already opened, first close it // If the file is already opened, first close it
if (myFile) if (myFile)
@ -203,7 +203,7 @@ bool SoundFile::OpenWrite(const std::string& filename, unsigned int channelsCoun
// Fill the sound infos with parameters // Fill the sound infos with parameters
SF_INFO fileInfos; SF_INFO fileInfos;
fileInfos.channels = channelsCount; fileInfos.channels = channelCount;
fileInfos.samplerate = sampleRate; fileInfos.samplerate = sampleRate;
fileInfos.format = format | (format == SF_FORMAT_OGG ? SF_FORMAT_VORBIS : SF_FORMAT_PCM_16); fileInfos.format = format | (format == SF_FORMAT_OGG ? SF_FORMAT_VORBIS : SF_FORMAT_PCM_16);
@ -216,9 +216,9 @@ bool SoundFile::OpenWrite(const std::string& filename, unsigned int channelsCoun
} }
// Set the sound parameters // Set the sound parameters
myChannelsCount = channelsCount; myChannelCount = channelCount;
mySampleRate = sampleRate; mySampleRate = sampleRate;
myNbSamples = 0; myNbSamples = 0;
return true; return true;
} }

View File

@ -65,7 +65,7 @@ public :
/// \return Number of samples /// \return Number of samples
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
std::size_t GetSamplesCount() const; std::size_t GetSampleCount() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the number of channels used by the sound /// \brief Get the number of channels used by the sound
@ -73,7 +73,7 @@ public :
/// \return Number of channels (1 = mono, 2 = stereo) /// \return Number of channels (1 = mono, 2 = stereo)
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int GetChannelsCount() const; unsigned int GetChannelCount() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the sample rate of the sound /// \brief Get the sample rate of the sound
@ -117,19 +117,19 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief a the sound file for writing /// \brief a the sound file for writing
/// ///
/// \param filename Path of the sound file to write /// \param filename Path of the sound file to write
/// \param channelsCount Number of channels in the sound /// \param channelCount Number of channels in the sound
/// \param sampleRate Sample rate of the sound /// \param sampleRate Sample rate of the sound
/// ///
/// \return True if the file was successfully opened /// \return True if the file was successfully opened
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool OpenWrite(const std::string& filename, unsigned int channelsCount, unsigned int sampleRate); bool OpenWrite(const std::string& filename, unsigned int channelCount, unsigned int sampleRate);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Read audio samples from the loaded sound /// \brief Read audio samples from the loaded sound
/// ///
/// \param data Pointer to the samples array to fill /// \param data Pointer to the sample array to fill
/// \param nbSamples Number of samples to read /// \param nbSamples Number of samples to read
/// ///
/// \return Number of samples actually read (may be less than \a nbSamples) /// \return Number of samples actually read (may be less than \a nbSamples)
@ -140,7 +140,7 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Write audio samples to the file /// \brief Write audio samples to the file
/// ///
/// \param data Pointer to the samples array to write /// \param data Pointer to the sample array to write
/// \param nbSamples Number of samples to write /// \param nbSamples Number of samples to write
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -198,11 +198,11 @@ private :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
SNDFILE* myFile; ///< File descriptor SNDFILE* myFile; ///< File descriptor
Memory myMemory; ///< Memory reading info Memory myMemory; ///< Memory reading info
std::size_t myNbSamples; ///< Total number of samples in the file std::size_t myNbSamples; ///< Total number of samples in the file
unsigned int myChannelsCount; ///< Number of channels used by the sound unsigned int myChannelCount; ///< Number of channels used by the sound
unsigned int mySampleRate; ///< Number of samples per second unsigned int mySampleRate; ///< Number of samples per second
}; };
} // namespace priv } // namespace priv

View File

@ -42,7 +42,7 @@ namespace sf
SoundStream::SoundStream() : SoundStream::SoundStream() :
myThread (&SoundStream::Stream, this), myThread (&SoundStream::Stream, this),
myIsStreaming (false), myIsStreaming (false),
myChannelsCount (0), myChannelCount (0),
mySampleRate (0), mySampleRate (0),
myFormat (0), myFormat (0),
myLoop (false), myLoop (false),
@ -61,20 +61,20 @@ SoundStream::~SoundStream()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void SoundStream::Initialize(unsigned int channelsCount, unsigned int sampleRate) void SoundStream::Initialize(unsigned int channelCount, unsigned int sampleRate)
{ {
myChannelsCount = channelsCount; myChannelCount = channelCount;
mySampleRate = sampleRate; mySampleRate = sampleRate;
// Deduce the format from the number of channels // Deduce the format from the number of channels
myFormat = priv::AudioDevice::GetFormatFromChannelsCount(channelsCount); myFormat = priv::AudioDevice::GetFormatFromChannelCount(channelCount);
// Check if the format is valid // Check if the format is valid
if (myFormat == 0) if (myFormat == 0)
{ {
myChannelsCount = 0; myChannelCount = 0;
mySampleRate = 0; mySampleRate = 0;
Err() << "Unsupported number of channels (" << myChannelsCount << ")" << std::endl; Err() << "Unsupported number of channels (" << myChannelCount << ")" << std::endl;
} }
} }
@ -123,9 +123,9 @@ void SoundStream::Stop()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int SoundStream::GetChannelsCount() const unsigned int SoundStream::GetChannelCount() const
{ {
return myChannelsCount; return myChannelCount;
} }
@ -159,7 +159,7 @@ void SoundStream::SetPlayingOffset(Uint32 timeOffset)
OnSeek(timeOffset); OnSeek(timeOffset);
// Restart streaming // Restart streaming
mySamplesProcessed = static_cast<Uint64>(timeOffset) * mySampleRate * myChannelsCount / 1000; mySamplesProcessed = static_cast<Uint64>(timeOffset) * mySampleRate * myChannelCount / 1000;
myIsStreaming = true; myIsStreaming = true;
myThread.Launch(); myThread.Launch();
} }
@ -171,7 +171,7 @@ Uint32 SoundStream::GetPlayingOffset() const
ALfloat seconds = 0.f; ALfloat seconds = 0.f;
ALCheck(alGetSourcef(mySource, AL_SEC_OFFSET, &seconds)); ALCheck(alGetSourcef(mySource, AL_SEC_OFFSET, &seconds));
return static_cast<Uint32>(1000 * seconds + 1000 * mySamplesProcessed / mySampleRate / myChannelsCount); return static_cast<Uint32>(1000 * seconds + 1000 * mySamplesProcessed / mySampleRate / myChannelCount);
} }
@ -193,8 +193,8 @@ bool SoundStream::GetLoop() const
void SoundStream::Stream() void SoundStream::Stream()
{ {
// Create the buffers // Create the buffers
ALCheck(alGenBuffers(BuffersCount, myBuffers)); ALCheck(alGenBuffers(BufferCount, myBuffers));
for (int i = 0; i < BuffersCount; ++i) for (int i = 0; i < BufferCount; ++i)
myEndBuffers[i] = false; myEndBuffers[i] = false;
// Fill the queue // Fill the queue
@ -232,7 +232,7 @@ void SoundStream::Stream()
// Find its number // Find its number
unsigned int bufferNum = 0; unsigned int bufferNum = 0;
for (int i = 0; i < BuffersCount; ++i) for (int i = 0; i < BufferCount; ++i)
if (myBuffers[i] == buffer) if (myBuffers[i] == buffer)
{ {
bufferNum = i; bufferNum = i;
@ -275,7 +275,7 @@ void SoundStream::Stream()
// Delete the buffers // Delete the buffers
ALCheck(alSourcei(mySource, AL_BUFFER, 0)); ALCheck(alSourcei(mySource, AL_BUFFER, 0));
ALCheck(alDeleteBuffers(BuffersCount, myBuffers)); ALCheck(alDeleteBuffers(BufferCount, myBuffers));
} }
@ -332,7 +332,7 @@ bool SoundStream::FillQueue()
{ {
// Fill and enqueue all the available buffers // Fill and enqueue all the available buffers
bool requestStop = false; bool requestStop = false;
for (int i = 0; (i < BuffersCount) && !requestStop; ++i) for (int i = 0; (i < BufferCount) && !requestStop; ++i)
{ {
if (FillAndPushBuffer(i)) if (FillAndPushBuffer(i))
requestStop = true; requestStop = true;

View File

@ -32,9 +32,9 @@
namespace sf namespace sf
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
CircleShape::CircleShape(float radius, unsigned int pointsCount) : CircleShape::CircleShape(float radius, unsigned int pointCount) :
myRadius (radius), myRadius (radius),
myPointsCount(pointsCount) myPointCount(pointCount)
{ {
Update(); Update();
} }
@ -56,16 +56,16 @@ float CircleShape::GetRadius() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void CircleShape::SetPointsCount(unsigned int count) void CircleShape::SetPointCount(unsigned int count)
{ {
myPointsCount = count; myPointCount = count;
Update(); Update();
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int CircleShape::GetPointsCount() const unsigned int CircleShape::GetPointCount() const
{ {
return myPointsCount; return myPointCount;
} }
@ -74,7 +74,7 @@ Vector2f CircleShape::GetPoint(unsigned int index) const
{ {
static const float pi = 3.141592654f; static const float pi = 3.141592654f;
float angle = index * 2 * pi / myPointsCount - pi / 2; float angle = index * 2 * pi / myPointCount - pi / 2;
float x = std::cos(angle) * myRadius; float x = std::cos(angle) * myRadius;
float y = std::sin(angle) * myRadius; float y = std::sin(angle) * myRadius;

View File

@ -31,14 +31,14 @@
namespace sf namespace sf
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
ConvexShape::ConvexShape(unsigned int pointsCount) ConvexShape::ConvexShape(unsigned int pointCount)
{ {
SetPointsCount(pointsCount); SetPointCount(pointCount);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void ConvexShape::SetPointsCount(unsigned int count) void ConvexShape::SetPointCount(unsigned int count)
{ {
myPoints.resize(count); myPoints.resize(count);
Update(); Update();
@ -46,7 +46,7 @@ void ConvexShape::SetPointsCount(unsigned int count)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int ConvexShape::GetPointsCount() const unsigned int ConvexShape::GetPointCount() const
{ {
return myPoints.size(); return myPoints.size();
} }

View File

@ -54,7 +54,7 @@ const Vector2f& RectangleShape::GetSize() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int RectangleShape::GetPointsCount() const unsigned int RectangleShape::GetPointCount() const
{ {
return 4; return 4;
} }

View File

@ -127,21 +127,21 @@ void RenderTarget::Draw(const Drawable& drawable, const RenderStates& states)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void RenderTarget::Draw(const Vertex* vertices, unsigned int verticesCount, void RenderTarget::Draw(const Vertex* vertices, unsigned int vertexCount,
PrimitiveType type, const RenderStates& states) PrimitiveType type, const RenderStates& states)
{ {
// Nothing to draw? // Nothing to draw?
if (!vertices || (verticesCount == 0)) if (!vertices || (vertexCount == 0))
return; return;
if (Activate(true)) if (Activate(true))
{ {
// Check if the vertex count is low enough so that we can pre-transform them // Check if the vertex count is low enough so that we can pre-transform them
bool useVertexCache = (verticesCount <= StatesCache::VertexCacheSize); bool useVertexCache = (vertexCount <= StatesCache::VertexCacheSize);
if (useVertexCache) if (useVertexCache)
{ {
// Pre-transform the vertices and store them into the vertex cache // Pre-transform the vertices and store them into the vertex cache
for (unsigned int i = 0; i < verticesCount; ++i) for (unsigned int i = 0; i < vertexCount; ++i)
{ {
Vertex& vertex = myCache.VertexCache[i]; Vertex& vertex = myCache.VertexCache[i];
vertex.Position = states.Transform * vertices[i].Position; vertex.Position = states.Transform * vertices[i].Position;
@ -200,7 +200,7 @@ void RenderTarget::Draw(const Vertex* vertices, unsigned int verticesCount,
GLenum mode = modes[type]; GLenum mode = modes[type];
// Draw the primitives // Draw the primitives
GLCheck(glDrawArrays(mode, 0, verticesCount)); GLCheck(glDrawArrays(mode, 0, vertexCount));
// Unbind the shader, if any // Unbind the shader, if any
if (states.Shader) if (states.Shader)

View File

@ -169,7 +169,7 @@ myBounds ()
void Shape::Update() void Shape::Update()
{ {
// Get the total number of points of the shape // Get the total number of points of the shape
unsigned int count = GetPointsCount(); unsigned int count = GetPointCount();
if (count < 3) if (count < 3)
{ {
myVertices.Resize(0); myVertices.Resize(0);
@ -227,7 +227,7 @@ void Shape::Draw(RenderTarget& target, RenderStates states) const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shape::UpdateFillColors() void Shape::UpdateFillColors()
{ {
for (unsigned int i = 0; i < myVertices.GetVerticesCount(); ++i) for (unsigned int i = 0; i < myVertices.GetVertexCount(); ++i)
myVertices[i].Color = myFillColor; myVertices[i].Color = myFillColor;
} }
@ -235,7 +235,7 @@ void Shape::UpdateFillColors()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shape::UpdateTexCoords() void Shape::UpdateTexCoords()
{ {
for (unsigned int i = 0; i < myVertices.GetVerticesCount(); ++i) for (unsigned int i = 0; i < myVertices.GetVertexCount(); ++i)
{ {
float xratio = (myVertices[i].Position.x - myInsideBounds.Left) / myInsideBounds.Width; float xratio = (myVertices[i].Position.x - myInsideBounds.Left) / myInsideBounds.Width;
float yratio = (myVertices[i].Position.y - myInsideBounds.Top) / myInsideBounds.Height; float yratio = (myVertices[i].Position.y - myInsideBounds.Top) / myInsideBounds.Height;
@ -248,7 +248,7 @@ void Shape::UpdateTexCoords()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shape::UpdateOutline() void Shape::UpdateOutline()
{ {
unsigned int count = myVertices.GetVerticesCount() - 2; unsigned int count = myVertices.GetVertexCount() - 2;
myOutlineVertices.Resize((count + 1) * 2); myOutlineVertices.Resize((count + 1) * 2);
for (unsigned int i = 0; i < count; ++i) for (unsigned int i = 0; i < count; ++i)
@ -288,7 +288,7 @@ void Shape::UpdateOutline()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shape::UpdateOutlineColors() void Shape::UpdateOutlineColors()
{ {
for (unsigned int i = 0; i < myOutlineVertices.GetVerticesCount(); ++i) for (unsigned int i = 0; i < myOutlineVertices.GetVertexCount(); ++i)
myOutlineVertices[i].Color = myOutlineColor; myOutlineVertices[i].Color = myOutlineColor;
} }

View File

@ -106,7 +106,7 @@ void Text::SetColor(const Color& color)
if (color != myColor) if (color != myColor)
{ {
myColor = color; myColor = color;
for (unsigned int i = 0; i < myVertices.GetVerticesCount(); ++i) for (unsigned int i = 0; i < myVertices.GetVertexCount(); ++i)
myVertices[i].Color = myColor; myVertices[i].Color = myColor;
} }
} }

View File

@ -40,15 +40,15 @@ myPrimitiveType(Points)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
VertexArray::VertexArray(PrimitiveType type, unsigned int verticesCount) : VertexArray::VertexArray(PrimitiveType type, unsigned int vertexCount) :
myVertices (verticesCount), myVertices (vertexCount),
myPrimitiveType(type) myPrimitiveType(type)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int VertexArray::GetVerticesCount() const unsigned int VertexArray::GetVertexCount() const
{ {
return myVertices.size(); return myVertices.size();
} }
@ -76,9 +76,9 @@ void VertexArray::Clear()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void VertexArray::Resize(unsigned int verticesCount) void VertexArray::Resize(unsigned int vertexCount)
{ {
myVertices.resize(verticesCount); myVertices.resize(vertexCount);
} }

View File

@ -290,7 +290,7 @@ void WindowImplWin32::SetIcon(unsigned int width, unsigned int height, const Uin
iconPixels[i * 4 + 3] = pixels[i * 4 + 3]; iconPixels[i * 4 + 3] = pixels[i * 4 + 3];
} }
// Create the icon from the pixels array // Create the icon from the pixel array
myIcon = CreateIcon(GetModuleHandle(NULL), width, height, 1, 32, NULL, &iconPixels[0]); myIcon = CreateIcon(GetModuleHandle(NULL), width, height, 1, 32, NULL, &iconPixels[0]);
// Set it as both big and small icon of the window // Set it as both big and small icon of the window