Fixed various minor warnings

This commit is contained in:
Laurent Gomila 2012-03-17 17:00:19 +01:00
parent 78e7dcea38
commit ee7cd94220
18 changed files with 96 additions and 89 deletions

View File

@ -225,9 +225,10 @@ public :
// Update the position of the moving entities // Update the position of the moving entities
for (std::size_t i = 0; i < m_entities.size(); ++i) for (std::size_t i = 0; i < m_entities.size(); ++i)
{ {
float x = std::cos(0.25f * (time * i + (m_entities.size() - i))) * 300 + 350; sf::Vector2f position;
float y = std::sin(0.25f * (time * (m_entities.size() - i) + i)) * 200 + 250; position.x = std::cos(0.25f * (time * i + (m_entities.size() - i))) * 300 + 350;
m_entities[i].setPosition(x, y); position.y = std::sin(0.25f * (time * (m_entities.size() - i) + i)) * 200 + 250;
m_entities[i].setPosition(position);
} }
// Render the updated scene to the off-screen surface // Render the updated scene to the off-screen surface

View File

@ -210,7 +210,7 @@ private :
/// only when the sound is stopped. /// only when the sound is stopped.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void stream(); void streamData();
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Request a new chunk of audio samples from the stream source /// \brief Request a new chunk of audio samples from the stream source

View File

@ -219,7 +219,7 @@ private :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
struct Row struct Row
{ {
Row(unsigned int top, unsigned int height) : width(0), top(top), height(height) {} Row(unsigned int rowTop, unsigned int rowHeight) : width(0), top(rowTop), height(rowHeight) {}
unsigned int width; ///< Current width of the row unsigned int width; ///< Current width of the row
unsigned int top; ///< Y position of the row into the texture unsigned int top; ///< Y position of the row into the texture

View File

@ -58,13 +58,13 @@ public :
/// Be careful, the last two parameters are the width /// Be careful, the last two parameters are the width
/// and height, not the right and bottom coordinates! /// and height, not the right and bottom coordinates!
/// ///
/// \param left Left coordinate of the rectangle /// \param rectLeft Left coordinate of the rectangle
/// \param top Top coordinate of the rectangle /// \param rectTop Top coordinate of the rectangle
/// \param width Width of the rectangle /// \param rectWidth Width of the rectangle
/// \param height Height of the rectangle /// \param rectHeight Height of the rectangle
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Rect(T left, T top, T width, T height); Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Construct the rectangle from position and size /// \brief Construct the rectangle from position and size

View File

@ -37,11 +37,11 @@ height(0)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename T> template <typename T>
Rect<T>::Rect(T left, T top, T width, T height) : Rect<T>::Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight) :
left (left), left (rectLeft),
top (top), top (rectTop),
width (width), width (rectWidth),
height(height) height(rectHeight)
{ {
} }

View File

@ -63,46 +63,46 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Construct a default set of render states with a custom blend mode /// \brief Construct a default set of render states with a custom blend mode
/// ///
/// \param blendMode Blend mode to use /// \param theBlendMode Blend mode to use
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
RenderStates(BlendMode blendMode); RenderStates(BlendMode theBlendMode);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Construct a default set of render states with a custom transform /// \brief Construct a default set of render states with a custom transform
/// ///
/// \param transform Transform to use /// \param theTransform Transform to use
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
RenderStates(const Transform& transform); RenderStates(const Transform& theTransform);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Construct a default set of render states with a custom texture /// \brief Construct a default set of render states with a custom texture
/// ///
/// \param texture Texture to use /// \param theTexture Texture to use
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
RenderStates(const Texture* texture); RenderStates(const Texture* theTexture);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Construct a default set of render states with a custom shader /// \brief Construct a default set of render states with a custom shader
/// ///
/// \param shader Shader to use /// \param theShader Shader to use
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
RenderStates(const Shader* shader); RenderStates(const Shader* theShader);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Construct a set of render states with all its attributes /// \brief Construct a set of render states with all its attributes
/// ///
/// \param blendMode Blend mode to use /// \param theBlendMode Blend mode to use
/// \param transform Transform to use /// \param theTransform Transform to use
/// \param texture Texture to use /// \param theTexture Texture to use
/// \param shader Shader to use /// \param theShader Shader to use
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
RenderStates(BlendMode blendMode, const Transform& transform, RenderStates(BlendMode theBlendMode, const Transform& theTransform,
const Texture* texture, const Shader* shader); const Texture* theTexture, const Shader* theShader);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Static member data // Static member data

View File

@ -54,42 +54,42 @@ public :
/// ///
/// The vertex color is white and texture coordinates are (0, 0). /// The vertex color is white and texture coordinates are (0, 0).
/// ///
/// \param position Vertex position /// \param thePosition Vertex position
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vertex(const Vector2f& position); Vertex(const Vector2f& thePosition);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Construct the vertex from its position and color /// \brief Construct the vertex from its position and color
/// ///
/// The texture coordinates are (0, 0). /// The texture coordinates are (0, 0).
/// ///
/// \param position Vertex position /// \param thePosition Vertex position
/// \param color Vertex color /// \param theColor Vertex color
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vertex(const Vector2f& position, const Color& color); Vertex(const Vector2f& thePosition, const Color& theColor);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Construct the vertex from its position and texture coordinates /// \brief Construct the vertex from its position and texture coordinates
/// ///
/// The vertex color is white. /// The vertex color is white.
/// ///
/// \param position Vertex position /// \param thePosition Vertex position
/// \param texCoords Vertex texture coordinates /// \param theTexCoords Vertex texture coordinates
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vertex(const Vector2f& position, const Vector2f& texCoords); Vertex(const Vector2f& thePosition, const Vector2f& theTexCoords);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Construct the vertex from its position, color and texture coordinates /// \brief Construct the vertex from its position, color and texture coordinates
/// ///
/// \param position Vertex position /// \param thePosition Vertex position
/// \param color Vertex color /// \param theColor Vertex color
/// \param texCoords Vertex texture coordinates /// \param theTexCoords Vertex texture coordinates
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vertex(const Vector2f& position, const Color& color, const Vector2f& texCoords); Vertex(const Vector2f& thePosition, const Color& theColor, const Vector2f& theTexCoords);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data

View File

@ -519,7 +519,7 @@ Out Utf<16>::toUtf32(In begin, In end, Out output)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename In> template <typename In>
In Utf<32>::decode(In begin, In end, Uint32& output, Uint32) In Utf<32>::decode(In begin, In /*end*/, Uint32& output, Uint32 /*replacement*/)
{ {
output = *begin++; output = *begin++;
return begin; return begin;
@ -528,7 +528,7 @@ In Utf<32>::decode(In begin, In end, Uint32& output, Uint32)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename Out> template <typename Out>
Out Utf<32>::encode(Uint32 input, Out output, Uint32 replacement) Out Utf<32>::encode(Uint32 input, Out output, Uint32 /*replacement*/)
{ {
*output++ = input; *output++ = input;
return output; return output;
@ -537,7 +537,7 @@ Out Utf<32>::encode(Uint32 input, Out output, Uint32 replacement)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename In> template <typename In>
In Utf<32>::next(In begin, In end) In Utf<32>::next(In begin, In /*end*/)
{ {
return ++begin; return ++begin;
} }
@ -669,6 +669,8 @@ Uint32 Utf<32>::decodeAnsi(In input, const std::locale& locale)
(defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \ (defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \
!(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */ !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */
(void)locale; // to avoid warnings
wchar_t character = 0; wchar_t character = 0;
mbtowc(&character, &input, 1); mbtowc(&character, &input, 1);
return static_cast<Uint32>(character); return static_cast<Uint32>(character);
@ -712,6 +714,8 @@ Out Utf<32>::encodeAnsi(Uint32 codepoint, Out output, char replacement, const st
(defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \ (defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \
!(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */ !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */
(void)locale; // to avoid warnings
char character = 0; char character = 0;
if (wctomb(&character, static_cast<wchar_t>(codepoint)) >= 0) if (wctomb(&character, static_cast<wchar_t>(codepoint)) >= 0)
*output++ = character; *output++ = character;

View File

@ -53,12 +53,12 @@ public :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Construct the video mode with its attributes /// \brief Construct the video mode with its attributes
/// ///
/// \param width Width in pixels /// \param modeWidth Width in pixels
/// \param height Height in pixels /// \param modeHeight Height in pixels
/// \param bitsPerPixel Pixel depths in bits per pixel /// \param modeBitsPerPixel Pixel depths in bits per pixel
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
VideoMode(unsigned int width, unsigned int height, unsigned int bitsPerPixel = 32); VideoMode(unsigned int modeWidth, unsigned int modeHeight, unsigned int modeBitsPerPixel = 32);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the current desktop video mode /// \brief Get the current desktop video mode

View File

@ -40,7 +40,7 @@ namespace sf
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
SoundStream::SoundStream() : SoundStream::SoundStream() :
m_thread (&SoundStream::stream, this), m_thread (&SoundStream::streamData, this),
m_isStreaming (false), m_isStreaming (false),
m_channelCount (0), m_channelCount (0),
m_sampleRate (0), m_sampleRate (0),
@ -190,7 +190,7 @@ bool SoundStream::getLoop() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void SoundStream::stream() void SoundStream::streamData()
{ {
// Create the buffers // Create the buffers
alCheck(alGenBuffers(BufferCount, m_buffers)); alCheck(alGenBuffers(BufferCount, m_buffers));

View File

@ -489,11 +489,11 @@ Glyph Font::loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) c
} }
// Write the pixels to the texture // Write the pixels to the texture
unsigned int x = glyph.textureRect.left + padding; unsigned int x = glyph.textureRect.left + padding;
unsigned int y = glyph.textureRect.top + padding; unsigned int y = glyph.textureRect.top + padding;
unsigned int width = glyph.textureRect.width - 2 * padding; unsigned int w = glyph.textureRect.width - 2 * padding;
unsigned int height = glyph.textureRect.height - 2 * padding; unsigned int h = glyph.textureRect.height - 2 * padding;
page.texture.update(&m_pixelBuffer[0], width, height, x, y); page.texture.update(&m_pixelBuffer[0], w, h, x, y);
} }
// Delete the FT glyph // Delete the FT glyph

View File

@ -46,9 +46,9 @@ shader (NULL)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
RenderStates::RenderStates(const Transform& transform) : RenderStates::RenderStates(const Transform& theTransform) :
blendMode(BlendAlpha), blendMode(BlendAlpha),
transform(transform), transform(theTransform),
texture (NULL), texture (NULL),
shader (NULL) shader (NULL)
{ {
@ -56,8 +56,8 @@ shader (NULL)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
RenderStates::RenderStates(BlendMode blendMode) : RenderStates::RenderStates(BlendMode theBlendMode) :
blendMode(blendMode), blendMode(theBlendMode),
transform(), transform(),
texture (NULL), texture (NULL),
shader (NULL) shader (NULL)
@ -66,32 +66,32 @@ shader (NULL)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
RenderStates::RenderStates(const Texture* texture) : RenderStates::RenderStates(const Texture* theTexture) :
blendMode(BlendAlpha), blendMode(BlendAlpha),
transform(), transform(),
texture (texture), texture (theTexture),
shader (NULL) shader (NULL)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
RenderStates::RenderStates(const Shader* shader) : RenderStates::RenderStates(const Shader* theShader) :
blendMode(BlendAlpha), blendMode(BlendAlpha),
transform(), transform(),
texture (NULL), texture (NULL),
shader (shader) shader (theShader)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
RenderStates::RenderStates(BlendMode blendMode, const Transform& transform, RenderStates::RenderStates(BlendMode theBlendMode, const Transform& theTransform,
const Texture* texture, const Shader* shader) : const Texture* theTexture, const Shader* theShader) :
blendMode(blendMode), blendMode(theBlendMode),
transform(transform), transform(theTransform),
texture (texture), texture (theTexture),
shader (shader) shader (theShader)
{ {
} }

View File

@ -95,8 +95,8 @@ Texture::~Texture()
{ {
ensureGlContext(); ensureGlContext();
GLuint Texture = static_cast<GLuint>(m_texture); GLuint texture = static_cast<GLuint>(m_texture);
glCheck(glDeleteTextures(1, &Texture)); glCheck(glDeleteTextures(1, &texture));
} }
} }

View File

@ -40,8 +40,8 @@ texCoords(0, 0)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vertex::Vertex(const Vector2f& position) : Vertex::Vertex(const Vector2f& thePosition) :
position (position), position (thePosition),
color (255, 255, 255), color (255, 255, 255),
texCoords(0, 0) texCoords(0, 0)
{ {
@ -49,28 +49,28 @@ texCoords(0, 0)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vertex::Vertex(const Vector2f& position, const Color& color) : Vertex::Vertex(const Vector2f& thePosition, const Color& theColor) :
position (position), position (thePosition),
color (color), color (theColor),
texCoords(0, 0) texCoords(0, 0)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vertex::Vertex(const Vector2f& position, const Vector2f& texCoords) : Vertex::Vertex(const Vector2f& thePosition, const Vector2f& theTexCoords) :
position (position), position (thePosition),
color (255, 255, 255), color (255, 255, 255),
texCoords(texCoords) texCoords(theTexCoords)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vertex::Vertex(const Vector2f& position, const Color& color, const Vector2f& texCoords) : Vertex::Vertex(const Vector2f& thePosition, const Color& theColor, const Vector2f& theTexCoords) :
position (position), position (thePosition),
color (color), color (theColor),
texCoords(texCoords) texCoords(theTexCoords)
{ {
} }

View File

@ -44,10 +44,10 @@ bitsPerPixel(0)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
VideoMode::VideoMode(unsigned int width, unsigned int height, unsigned int bitsPerPixel) : VideoMode::VideoMode(unsigned int modeWidth, unsigned int modeHeight, unsigned int modeBitsPerPixel) :
width (width), width (modeWidth),
height (height), height (modeHeight),
bitsPerPixel(bitsPerPixel) bitsPerPixel(modeBitsPerPixel)
{ {
} }

View File

@ -42,6 +42,7 @@ bool InputImpl::isKeyPressed(Keyboard::Key key)
int vkey = 0; int vkey = 0;
switch (key) switch (key)
{ {
default: vkey = 0; break;
case Keyboard::A: vkey = 'A'; break; case Keyboard::A: vkey = 'A'; break;
case Keyboard::B: vkey = 'B'; break; case Keyboard::B: vkey = 'B'; break;
case Keyboard::C: vkey = 'C'; break; case Keyboard::C: vkey = 'C'; break;
@ -155,6 +156,7 @@ bool InputImpl::isMouseButtonPressed(Mouse::Button button)
int vkey = 0; int vkey = 0;
switch (button) switch (button)
{ {
default: vkey = 0; break;
case Mouse::Left: vkey = VK_LBUTTON; break; case Mouse::Left: vkey = VK_LBUTTON; break;
case Mouse::Right: vkey = VK_RBUTTON; break; case Mouse::Right: vkey = VK_RBUTTON; break;
case Mouse::Middle: vkey = VK_MBUTTON; break; case Mouse::Middle: vkey = VK_MBUTTON; break;