Config.hpp   Config.hpp 
skipping to change at line 32 skipping to change at line 32
// //
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#ifndef SFML_CONFIG_HPP #ifndef SFML_CONFIG_HPP
#define SFML_CONFIG_HPP #define SFML_CONFIG_HPP
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Define the SFML version // Define the SFML version
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#define SFML_VERSION_MAJOR 2 #define SFML_VERSION_MAJOR 2
#define SFML_VERSION_MINOR 0 #define SFML_VERSION_MINOR 1
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Identify the operating system // Identify the operating system
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#if defined(_WIN32) || defined(__WIN32__) #if defined(_WIN32) || defined(__WIN32__)
// Windows // Windows
#define SFML_SYSTEM_WINDOWS #define SFML_SYSTEM_WINDOWS
#ifndef NOMINMAX #ifndef NOMINMAX
#define NOMINMAX #define NOMINMAX
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 Image.hpp   Image.hpp 
skipping to change at line 298 skipping to change at line 298
/// ///
/// Usage example: /// Usage example:
/// \code /// \code
/// // Load an image file from a file /// // Load an image file from a file
/// sf::Image background; /// sf::Image background;
/// if (!background.loadFromFile("background.jpg")) /// if (!background.loadFromFile("background.jpg"))
/// return -1; /// return -1;
/// ///
/// // Create a 20x20 image filled with black color /// // Create a 20x20 image filled with black color
/// sf::Image image; /// sf::Image image;
/// if (!image.create(20, 20, sf::Color::Black)) /// image.create(20, 20, sf::Color::Black);
/// return -1;
/// ///
/// // Copy image1 on image2 at position (10, 10) /// // Copy image1 on image2 at position (10, 10)
/// image.copy(background, 10, 10); /// image.copy(background, 10, 10);
/// ///
/// // Make the top-left pixel transparent /// // Make the top-left pixel transparent
/// sf::Color color = image.getPixel(0, 0); /// sf::Color color = image.getPixel(0, 0);
/// color.a = 0; /// color.a = 0;
/// image.setPixel(0, 0, color); /// image.setPixel(0, 0, color);
/// ///
/// // Save the image to a file /// // Save the image to a file
 End of changes. 1 change blocks. 
2 lines changed or deleted 1 lines changed or added


 InputStream.hpp   InputStream.hpp 
skipping to change at line 52 skipping to change at line 52
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Virtual destructor /// \brief Virtual destructor
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual ~InputStream() {} virtual ~InputStream() {}
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Read data from the stream /// \brief Read data from the stream
/// ///
/// After reading, the stream's reading position must be
/// advanced by the amount of bytes read.
///
/// \param data Buffer where to copy the read data /// \param data Buffer where to copy the read data
/// \param size Desired number of bytes to read /// \param size Desired number of bytes to read
/// ///
/// \return The number of bytes actually read, or -1 on error /// \return The number of bytes actually read, or -1 on error
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual Int64 read(void* data, Int64 size) = 0; virtual Int64 read(void* data, Int64 size) = 0;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Change the current reading position /// \brief Change the current reading position
 End of changes. 1 change blocks. 
0 lines changed or deleted 3 lines changed or added


 Rect.inl   Rect.inl 
skipping to change at line 73 skipping to change at line 73
top (static_cast<T>(rectangle.top)), top (static_cast<T>(rectangle.top)),
width (static_cast<T>(rectangle.width)), width (static_cast<T>(rectangle.width)),
height(static_cast<T>(rectangle.height)) height(static_cast<T>(rectangle.height))
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename T> template <typename T>
bool Rect<T>::contains(T x, T y) const bool Rect<T>::contains(T x, T y) const
{ {
return (x >= left) && (x < left + width) && (y >= top) && (y < top + he // Rectangles with negative dimensions are allowed, so we must handle t
ight); hem correctly
// Compute the real min and max of the rectangle on both axes
T minX = std::min(left, left + width);
T maxX = std::max(left, left + width);
T minY = std::min(top, top + height);
T maxY = std::max(top, top + height);
return (x >= minX) && (x < maxX) && (y >= minY) && (y < maxY);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename T> 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);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
skipping to change at line 95 skipping to change at line 103
bool Rect<T>::intersects(const Rect<T>& rectangle) const bool Rect<T>::intersects(const Rect<T>& rectangle) const
{ {
Rect<T> intersection; Rect<T> intersection;
return intersects(rectangle, intersection); return intersects(rectangle, intersection);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename T> template <typename T>
bool Rect<T>::intersects(const Rect<T>& rectangle, Rect<T>& intersection) c onst bool Rect<T>::intersects(const Rect<T>& rectangle, Rect<T>& intersection) c onst
{ {
// Rectangles with negative dimensions are allowed, so we must handle t
hem correctly
// Compute the min and max of the first rectangle on both axes
T r1MinX = std::min(left, left + width);
T r1MaxX = std::max(left, left + width);
T r1MinY = std::min(top, top + height);
T r1MaxY = std::max(top, top + height);
// Compute the min and max of the second rectangle on both axes
T r2MinX = std::min(rectangle.left, rectangle.left + rectangle.width);
T r2MaxX = std::max(rectangle.left, rectangle.left + rectangle.width);
T r2MinY = std::min(rectangle.top, rectangle.top + rectangle.height);
T r2MaxY = std::max(rectangle.top, rectangle.top + rectangle.height);
// Compute the intersection boundaries // Compute the intersection boundaries
T interLeft = std::max(left, rectangle.left); T interLeft = std::max(r1MinX, r2MinX);
T interTop = std::max(top, rectangle.top); T interTop = std::max(r1MinY, r2MinY);
T interRight = std::min(left + width, rectangle.left + rectangle.width T interRight = std::min(r1MaxX, r2MaxX);
); T interBottom = std::min(r1MaxY, r2MaxY);
T interBottom = std::min(top + height, rectangle.top + rectangle.height
);
// If the intersection is valid (positive non zero area), then there is an intersection // If the intersection is valid (positive non zero area), then there is an intersection
if ((interLeft < interRight) && (interTop < interBottom)) if ((interLeft < interRight) && (interTop < interBottom))
{ {
intersection = Rect<T>(interLeft, interTop, interRight - interLeft, interBottom - interTop); intersection = Rect<T>(interLeft, interTop, interRight - interLeft, interBottom - interTop);
return true; return true;
} }
else else
{ {
intersection = Rect<T>(0, 0, 0, 0); intersection = Rect<T>(0, 0, 0, 0);
 End of changes. 3 change blocks. 
8 lines changed or deleted 29 lines changed or added


 Shader.hpp   Shader.hpp 
skipping to change at line 510 skipping to change at line 510
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Bind all the textures used by the shader /// \brief Bind all the textures used by the shader
/// ///
/// This function each texture to a different unit, and /// This function each texture to a different unit, and
/// updates the corresponding variables in the shader accordingly. /// updates the corresponding variables in the shader accordingly.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void bindTextures() const; void bindTextures() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the location ID of a shader parameter
///
/// \param name Name of the parameter to search
///
/// \return Location ID of the parameter, or -1 if not found
///
////////////////////////////////////////////////////////////
int getParamLocation(const std::string& name);
////////////////////////////////////////////////////////////
// Types // Types
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef std::map<int, const Texture*> TextureTable; typedef std::map<int, const Texture*> TextureTable;
typedef std::map<std::string, int> ParamTable;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int m_shaderProgram; ///< OpenGL identifier for the program unsigned int m_shaderProgram; ///< OpenGL identifier for the program
int m_currentTexture; ///< Location of the current texture in the shader int m_currentTexture; ///< Location of the current texture in the shader
TextureTable m_textures; ///< Texture variables in the shader, ma pped to their location TextureTable m_textures; ///< Texture variables in the shader, ma pped to their location
ParamTable m_params; ///< Parameters location cache
}; };
} // namespace sf } // namespace sf
#endif // SFML_SHADER_HPP #endif // SFML_SHADER_HPP
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \class sf::Shader /// \class sf::Shader
/// \ingroup graphics /// \ingroup graphics
/// ///
 End of changes. 3 change blocks. 
0 lines changed or deleted 12 lines changed or added


 Transformable.hpp   Transformable.hpp 
skipping to change at line 359 skipping to change at line 359
/// ///
/// That's exactly what sf::Transformable was written for: it hides /// That's exactly what sf::Transformable was written for: it hides
/// these variables and the composed transform behind an easy to use /// these variables and the composed transform behind an easy to use
/// interface. You can set or get any of the individual components /// interface. You can set or get any of the individual components
/// without worrying about the others. It also provides the composed /// without worrying about the others. It also provides the composed
/// transform (as a sf::Transform), and keeps it up-to-date. /// transform (as a sf::Transform), and keeps it up-to-date.
/// ///
/// In addition to the position, rotation and scale, sf::Transformable /// In addition to the position, rotation and scale, sf::Transformable
/// provides an "origin" component, which represents the local origin /// provides an "origin" component, which represents the local origin
/// of the three other components. Let's take an example with a 10x10 /// of the three other components. Let's take an example with a 10x10
/// pixels sprite. By default, the sprite is positionned/rotated/scaled /// pixels sprite. By default, the sprite is positioned/rotated/scaled
/// relatively to its top-left corner, because it is the local point /// relatively to its top-left corner, because it is the local point
/// (0, 0). But if we change the origin to be (5, 5), the sprite will /// (0, 0). But if we change the origin to be (5, 5), the sprite will
/// be positionned/rotated/scaled around its center instead. And if /// be positioned/rotated/scaled around its center instead. And if
/// we set the origin to (10, 10), it will be transformed around its /// we set the origin to (10, 10), it will be transformed around its
/// bottom-right corner. /// bottom-right corner.
/// ///
/// To keep the sf::Transformable class simple, there's only one /// To keep the sf::Transformable class simple, there's only one
/// origin for all the components. You cannot position the sprite /// origin for all the components. You cannot position the sprite
/// relatively to its top-left corner while rotating it around its /// relatively to its top-left corner while rotating it around its
/// center, for example. To do such things, use sf::Transform directly. /// center, for example. To do such things, use sf::Transform directly.
/// ///
/// sf::Transformable can be used as a base class. It is often /// sf::Transformable can be used as a base class. It is often
/// combined with sf::Drawable -- that's what SFML's sprites, /// combined with sf::Drawable -- that's what SFML's sprites,
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 Utf.inl   Utf.inl 
skipping to change at line 104 skipping to change at line 104
{ {
// Invalid character // Invalid character
if (replacement) if (replacement)
*output++ = replacement; *output++ = replacement;
} }
else else
{ {
// Valid character // Valid character
// Get the number of bytes to write // Get the number of bytes to write
int bytestoWrite = 1; std::size_t bytestoWrite = 1;
if (input < 0x80) bytestoWrite = 1; if (input < 0x80) bytestoWrite = 1;
else if (input < 0x800) bytestoWrite = 2; else if (input < 0x800) bytestoWrite = 2;
else if (input < 0x10000) bytestoWrite = 3; else if (input < 0x10000) bytestoWrite = 3;
else if (input <= 0x0010FFFF) bytestoWrite = 4; else if (input <= 0x0010FFFF) bytestoWrite = 4;
// Extract the bytes to write // Extract the bytes to write
Uint8 bytes[4]; Uint8 bytes[4];
switch (bytestoWrite) switch (bytestoWrite)
{ {
case 4 : bytes[3] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6; case 4 : bytes[3] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6;
case 3 : bytes[2] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6; case 3 : bytes[2] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6;
case 2 : bytes[1] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6; case 2 : bytes[1] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6;
case 1 : bytes[0] = static_cast<Uint8> (input | firstBytes[byte stoWrite]); case 1 : bytes[0] = static_cast<Uint8> (input | firstBytes[byte stoWrite]);
} }
// Add them to the output // Add them to the output
const Uint8* currentByte = bytes; output = std::copy(bytes, bytes + bytestoWrite, output);
switch (bytestoWrite)
{
case 4 : *output++ = *currentByte++;
case 3 : *output++ = *currentByte++;
case 2 : *output++ = *currentByte++;
case 1 : *output++ = *currentByte++;
}
} }
return output; return output;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename In> template <typename In>
In Utf<8>::next(In begin, In end) In Utf<8>::next(In begin, In end)
{ {
Uint32 codepoint; Uint32 codepoint;
skipping to change at line 242 skipping to change at line 235
*output++ = codepoint < 256 ? static_cast<char>(codepoint) : replac ement; *output++ = codepoint < 256 ? static_cast<char>(codepoint) : replac ement;
} }
return output; return output;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename In, typename Out> template <typename In, typename Out>
Out Utf<8>::toUtf8(In begin, In end, Out output) Out Utf<8>::toUtf8(In begin, In end, Out output)
{ {
while (begin < end) return std::copy(begin, end, output);
*output++ = *begin++;
return output;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename In, typename Out> template <typename In, typename Out>
Out Utf<8>::toUtf16(In begin, In end, Out output) Out Utf<8>::toUtf16(In begin, In end, Out output)
{ {
while (begin < end) while (begin < end)
{ {
Uint32 codepoint; Uint32 codepoint;
begin = decode(begin, end, codepoint); begin = decode(begin, end, codepoint);
skipping to change at line 405 skipping to change at line 395
return output; return output;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename In, typename Out> template <typename In, typename Out>
Out Utf<16>::fromLatin1(In begin, In end, Out output) Out Utf<16>::fromLatin1(In begin, In end, Out output)
{ {
// Latin-1 is directly compatible with Unicode encodings, // Latin-1 is directly compatible with Unicode encodings,
// and can thus be treated as (a sub-range of) UTF-32 // and can thus be treated as (a sub-range of) UTF-32
while (begin < end) return std::copy(begin, end, output);
*output++ = *begin++;
return output;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename In, typename Out> template <typename In, typename Out>
Out Utf<16>::toAnsi(In begin, In end, Out output, char replacement, const s td::locale& locale) Out Utf<16>::toAnsi(In begin, In end, Out output, char replacement, const s td::locale& locale)
{ {
while (begin < end) while (begin < end)
{ {
Uint32 codepoint; Uint32 codepoint;
begin = decode(begin, end, codepoint); begin = decode(begin, end, codepoint);
skipping to change at line 472 skipping to change at line 459
output = Utf<8>::encode(codepoint, output); output = Utf<8>::encode(codepoint, output);
} }
return output; return output;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename In, typename Out> template <typename In, typename Out>
Out Utf<16>::toUtf16(In begin, In end, Out output) Out Utf<16>::toUtf16(In begin, In end, Out output)
{ {
while (begin < end) return std::copy(begin, end, output);
*output++ = *begin++;
return output;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename In, typename Out> template <typename In, typename Out>
Out Utf<16>::toUtf32(In begin, In end, Out output) Out Utf<16>::toUtf32(In begin, In end, Out output)
{ {
while (begin < end) while (begin < end)
{ {
Uint32 codepoint; Uint32 codepoint;
begin = decode(begin, end, codepoint); begin = decode(begin, end, codepoint);
skipping to change at line 548 skipping to change at line 532
return output; return output;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename In, typename Out> template <typename In, typename Out>
Out Utf<32>::fromLatin1(In begin, In end, Out output) Out Utf<32>::fromLatin1(In begin, In end, Out output)
{ {
// Latin-1 is directly compatible with Unicode encodings, // Latin-1 is directly compatible with Unicode encodings,
// and can thus be treated as (a sub-range of) UTF-32 // and can thus be treated as (a sub-range of) UTF-32
while (begin < end) return std::copy(begin, end, output);
*output++ = *begin++;
return output;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename In, typename Out> template <typename In, typename Out>
Out Utf<32>::toAnsi(In begin, In end, Out output, char replacement, const s td::locale& locale) Out Utf<32>::toAnsi(In begin, In end, Out output, char replacement, const s td::locale& locale)
{ {
while (begin < end) while (begin < end)
output = encodeAnsi(*begin++, output, replacement, locale); output = encodeAnsi(*begin++, output, replacement, locale);
return output; return output;
skipping to change at line 613 skipping to change at line 594
while (begin < end) while (begin < end)
output = Utf<16>::encode(*begin++, output); output = Utf<16>::encode(*begin++, output);
return output; return output;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename In, typename Out> template <typename In, typename Out>
Out Utf<32>::toUtf32(In begin, In end, Out output) Out Utf<32>::toUtf32(In begin, In end, Out output)
{ {
while (begin < end) return std::copy(begin, end, output);
*output++ = *begin++;
return output;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
template <typename In> template <typename In>
Uint32 Utf<32>::decodeAnsi(In input, const std::locale& locale) Uint32 Utf<32>::decodeAnsi(In input, const std::locale& locale)
{ {
// On Windows, gcc's standard library (glibc++) has almost // On Windows, gcc's standard library (glibc++) has almost
// no support for Unicode stuff. As a consequence, in this // no support for Unicode stuff. As a consequence, in this
// context we can only use the default locale and ignore // context we can only use the default locale and ignore
// the one passed as parameter. // the one passed as parameter.
 End of changes. 7 change blocks. 
29 lines changed or deleted 7 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/