| Config.hpp | | Config.hpp | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 60 | |
| #define SFML_SYSTEM_MACOS | | #define SFML_SYSTEM_MACOS | |
| | | | |
| #else | | #else | |
| | | | |
| // Unsupported system | | // Unsupported system | |
| #error This operating system is not supported by SFML library | | #error This operating system is not supported by SFML library | |
| | | | |
| #endif | | #endif | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| // Identify the platform | | | |
| //////////////////////////////////////////////////////////// | | | |
| #if defined(__i386__) || defined(_M_IX86) || defined(_X86_) || defined(__IN | | | |
| TEL__) || defined(__i386) | | | |
| | | | |
| // Intel x86 | | | |
| #define SFML_PLATFORM_X86 | | | |
| | | | |
| #elif defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || def | | | |
| ined(_M_AMD64) | | | |
| | | | |
| // AMD64 | | | |
| #define SFML_PLATFORM_AMD64 | | | |
| | | | |
| #elif defined(__IA64__) || defined(_M_IA64) | | | |
| | | | |
| // Intel IA64 | | | |
| #define SFML_PLATFORM_IA64 | | | |
| | | | |
| #elif defined(__powerpc__) || defined(_M_PPC) || defined(_ARCH_PPC) | | | |
| | | | |
| // Apple PowerPC | | | |
| #define SFML_PLATFORM_POWERPC | | | |
| | | | |
| #else | | | |
| | | | |
| // Unsupported platform | | | |
| #error This platform is not supported by SFML library | | | |
| | | | |
| #endif | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| // Define a portable debug macro | | // Define a portable debug macro | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #if !defined(NDEBUG) | | #if !defined(NDEBUG) | |
| | | | |
| #define SFML_DEBUG | | #define SFML_DEBUG | |
| | | | |
| #endif | | #endif | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Define portable import / export macros | | // Define portable import / export macros | |
| | | | |
| skipping to change at line 142 | | skipping to change at line 112 | |
| #endif | | #endif | |
| | | | |
| #else | | #else | |
| | | | |
| // Other platforms don't need to define anything | | // Other platforms don't need to define anything | |
| #define SFML_API | | #define SFML_API | |
| | | | |
| #endif | | #endif | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| // Define endianness depending on current platform | | // Define portable fixed-size types | |
| //////////////////////////////////////////////////////////// | | | |
| #ifdef SFML_PLATFORM_POWERPC | | | |
| | | | |
| // Apple PowerPC processors are big endian | | | |
| #define SFML_BIG_ENDIAN | | | |
| | | | |
| #else | | | |
| | | | |
| // The other supported processors (x86, IA64, AMD64) are little endian | | | |
| #define SFML_LITTLE_ENDIAN | | | |
| | | | |
| #endif | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| // Define portable types | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <climits> | | #include <climits> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
| // 8 bits integer types | | // 8 bits integer types | |
| #if UCHAR_MAX == 0xFF | | #if UCHAR_MAX == 0xFF | |
|
| typedef char Int8; | | typedef signed char Int8; | |
| typedef unsigned char Uint8; | | typedef unsigned char Uint8; | |
| #else | | #else | |
| #error No 8 bits integer type for this platform | | #error No 8 bits integer type for this platform | |
| #endif | | #endif | |
| | | | |
| // 16 bits integer types | | // 16 bits integer types | |
| #if USHRT_MAX == 0xFFFF | | #if USHRT_MAX == 0xFFFF | |
|
| typedef short Int16; | | typedef signed short Int16; | |
| typedef unsigned short Uint16; | | typedef unsigned short Uint16; | |
| #elif UINT_MAX == 0xFFFF | | #elif UINT_MAX == 0xFFFF | |
|
| typedef int Int16; | | typedef signed int Int16; | |
| typedef unsigned int Uint16; | | typedef unsigned int Uint16; | |
| #elif ULONG_MAX == 0xFFFF | | #elif ULONG_MAX == 0xFFFF | |
|
| typedef long Int16; | | typedef signed long Int16; | |
| typedef unsigned long Uint16; | | typedef unsigned long Uint16; | |
| #else | | #else | |
| #error No 16 bits integer type for this platform | | #error No 16 bits integer type for this platform | |
| #endif | | #endif | |
| | | | |
| // 32 bits integer types | | // 32 bits integer types | |
| #if USHRT_MAX == 0xFFFFFFFF | | #if USHRT_MAX == 0xFFFFFFFF | |
|
| typedef short Int32; | | typedef signed short Int32; | |
| typedef unsigned short Uint32; | | typedef unsigned short Uint32; | |
| #elif UINT_MAX == 0xFFFFFFFF | | #elif UINT_MAX == 0xFFFFFFFF | |
|
| typedef int Int32; | | typedef signed int Int32; | |
| typedef unsigned int Uint32; | | typedef unsigned int Uint32; | |
| #elif ULONG_MAX == 0xFFFFFFFF | | #elif ULONG_MAX == 0xFFFFFFFF | |
|
| typedef long Int32; | | typedef signed long Int32; | |
| typedef unsigned long Uint32; | | typedef unsigned long Uint32; | |
| #else | | #else | |
| #error No 32 bits integer type for this platform | | #error No 32 bits integer type for this platform | |
| #endif | | #endif | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_CONFIG_HPP | | #endif // SFML_CONFIG_HPP | |
| | | | |
End of changes. 9 change blocks. |
| 55 lines changed or deleted | | 8 lines changed or added | |
|
| Drawable.hpp | | Drawable.hpp | |
| | | | |
| skipping to change at line 37 | | skipping to change at line 37 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/System/Vector2.hpp> | | #include <SFML/System/Vector2.hpp> | |
| #include <SFML/Graphics/Color.hpp> | | #include <SFML/Graphics/Color.hpp> | |
| #include <SFML/Graphics/Matrix3.hpp> | | #include <SFML/Graphics/Matrix3.hpp> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
|
| class RenderWindow; | | class RenderTarget; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Enumerate the blending modes for drawable objects | | /// Enumerate the blending modes for drawable objects | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| namespace Blend | | namespace Blend | |
| { | | { | |
| enum Mode | | enum Mode | |
| { | | { | |
| Alpha, ///< Pixel = Src * a + Dest * (1 - a) | | Alpha, ///< Pixel = Src * a + Dest * (1 - a) | |
| Add, ///< Pixel = Src + Dest | | Add, ///< Pixel = Src + Dest | |
| | | | |
| skipping to change at line 282 | | skipping to change at line 282 | |
| void Scale(const Vector2f& Factor); | | void Scale(const Vector2f& Factor); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Rotate the object | | /// Rotate the object | |
| /// | | /// | |
| /// \param Angle : Angle of rotation, in degrees | | /// \param Angle : Angle of rotation, in degrees | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Rotate(float Angle); | | void Rotate(float Angle); | |
| | | | |
|
| | | //////////////////////////////////////////////////////////// | |
| | | /// Transform a point from global coordinates into local coordinates | |
| | | /// (ie it applies the inverse of object's center, translation, rotatio | |
| | | n and scale to the point) | |
| | | /// | |
| | | /// \param Point : Point to transform | |
| | | /// | |
| | | /// \return Transformed point | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | sf::Vector2f TransformToLocal(const sf::Vector2f& Point) const; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Transform a point from local coordinates into global coordinates | |
| | | /// (ie it applies the object's center, translation, rotation and scale | |
| | | to the point) | |
| | | /// | |
| | | /// \param Point : Point to transform | |
| | | /// | |
| | | /// \return Transformed point | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | sf::Vector2f TransformToGlobal(const sf::Vector2f& Point) const; | |
| | | | |
| protected : | | protected : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the transform matrix of the drawable | | /// Get the transform matrix of the drawable | |
| /// | | /// | |
| /// \return Transform matrix | | /// \return Transform matrix | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| const Matrix3& GetMatrix() const; | | const Matrix3& GetMatrix() const; | |
| | | | |
|
| | | //////////////////////////////////////////////////////////// | |
| | | /// Get the inverse transform matrix of the drawable | |
| | | /// | |
| | | /// \return Inverse transform matrix | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | const Matrix3& GetInverseMatrix() const; | |
| | | | |
| private : | | private : | |
| | | | |
|
| friend class RenderWindow; | | friend class RenderTarget; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Draw the object into the specified window | | /// Draw the object into the specified window | |
| /// | | /// | |
|
| /// \param Window : Window into which draw the object | | /// \param Target : Target into which render the object | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Draw(const RenderWindow& Window) const; | | void Draw(RenderTarget& Target) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Render the specific geometry of the object | | /// Render the specific geometry of the object | |
| /// | | /// | |
|
| /// \param Window : Window into which render the object | | /// \param Target : Target into which render the object | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void Render(const RenderWindow& Window) const = 0; | | virtual void Render(RenderTarget& Target) const = 0; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| Vector2f myPosition; ///< Position of the object on screen | | Vector2f myPosition; ///< Position of the object on screen | |
| Vector2f myScale; ///< Scale of the object | | Vector2f myScale; ///< Scale of the object | |
| Vector2f myCenter; ///< Origin of translation / rotation / s | | Vector2f myCenter; ///< Origin of translation / rotation | |
| caling of the object | | / scaling of the object | |
| float myRotation; ///< Orientation of the object, in degree | | float myRotation; ///< Orientation of the object, in deg | |
| s | | rees | |
| Color myColor; ///< Overlay color of the object | | Color myColor; ///< Overlay color of the object | |
| Blend::Mode myBlendMode; ///< Blending mode | | Blend::Mode myBlendMode; ///< Blending mode | |
| mutable bool myNeedUpdate; ///< Do we need to recompute the transfor | | mutable bool myNeedUpdate; ///< Do we need to recompute the trans | |
| m matrix ? | | form matrix ? | |
| mutable Matrix3 myMatrix; ///< Precomputed transform matrix gatheri | | mutable bool myInvNeedUpdate; ///< Do we need to recompute the inver | |
| ng the translation / rotation / scale / center | | se transform matrix ? | |
| | | mutable Matrix3 myMatrix; ///< Precomputed transform matrix gath | |
| | | ering the translation / rotation / scale / center | |
| | | mutable Matrix3 myInvMatrix; ///< Precomputed inverse transform mat | |
| | | rix gathering the translation / rotation / scale / center | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_DRAWABLE_HPP | | #endif // SFML_DRAWABLE_HPP | |
| | | | |
End of changes. 9 change blocks. |
| 18 lines changed or deleted | | 54 lines changed or added | |
|
| Font.hpp | | Font.hpp | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| // 3. This notice may not be removed or altered from any source distributio
n. | | // 3. This notice may not be removed or altered from any source distributio
n. | |
| // | | // | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_FONT_HPP | | #ifndef SFML_FONT_HPP | |
| #define SFML_FONT_HPP | | #define SFML_FONT_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | #include <SFML/System/Resource.hpp> | |
| | | #include <SFML/System/Vector2.hpp> | |
| | | #include <SFML/System/Unicode.hpp> | |
| | | #include <SFML/Graphics/Glyph.hpp> | |
| #include <SFML/Graphics/Image.hpp> | | #include <SFML/Graphics/Image.hpp> | |
| #include <SFML/Graphics/Rect.hpp> | | #include <SFML/Graphics/Rect.hpp> | |
| #include <map> | | #include <map> | |
| #include <string> | | #include <string> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
| class String; | | class String; | |
| | | | |
| namespace priv | | namespace priv | |
| { | | { | |
| class FontLoader; | | class FontLoader; | |
| } | | } | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Font is the low-level class for loading and | | /// Font is the low-level class for loading and | |
| /// manipulating character fonts. This class is meant to | | /// manipulating character fonts. This class is meant to | |
| /// be used by sf::String | | /// be used by sf::String | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API Font | | class SFML_API Font : public Resource<Font> | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Font(); | | Font(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Load the font from a file | | /// Load the font from a file | |
| /// | | /// | |
| /// \param Filename : Font file to load | | /// \param Filename : Font file to load | |
| /// \param CharSize : Size of characters in bitmap - the bigger, the hi
gher quality (30 by default) | | /// \param CharSize : Size of characters in bitmap - the bigger, the hi
gher quality (30 by default) | |
|
| /// \param Charset : Characters set to generate (empty by default - ta
kes the ASCII range [31, 255]) | | /// \param Charset : Characters set to generate (by default, contains
the ISO-8859-1 printable characters) | |
| /// | | /// | |
| /// \return True if loading was successful | | /// \return True if loading was successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool LoadFromFile(const std::string& Filename, unsigned int CharSize =
30, std::wstring Charset = L""); | | bool LoadFromFile(const std::string& Filename, unsigned int CharSize =
30, const Unicode::Text& Charset = ourDefaultCharset); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Load the font from a file in memory | | /// Load the font from a file in memory | |
| /// | | /// | |
| /// \param Data : Pointer to the data to load | | /// \param Data : Pointer to the data to load | |
| /// \param SizeInBytes : Size of the data, in bytes | | /// \param SizeInBytes : Size of the data, in bytes | |
| /// \param CharSize : Size of characters in bitmap - the bigger, the
higher quality (30 by default) | | /// \param CharSize : Size of characters in bitmap - the bigger, the
higher quality (30 by default) | |
|
| /// \param Charset : Characters set to generate (empty by default -
takes the ASCII range [31, 255]) | | /// \param Charset : Characters set to generate (by default, contai
ns the ISO-8859-1 printable characters) | |
| /// | | /// | |
| /// \return True if loading was successful | | /// \return True if loading was successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool LoadFromMemory(const char* Data, std::size_t SizeInBytes, unsigned | | bool LoadFromMemory(const char* Data, std::size_t SizeInBytes, unsigned | |
| int CharSize = 30, std::wstring Charset = L""); | | int CharSize = 30, const Unicode::Text& Charset = ourDefaultCharset); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Get the base size of characters in the font; | |
| | | /// All glyphs dimensions are based on this value | |
| | | /// | |
| | | /// \return Base size of characters | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | unsigned int GetCharacterSize() const; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Get the description of a glyph (character) | |
| | | /// given by its unicode value | |
| | | /// | |
| | | /// \param CodePoint : Unicode value of the character to get | |
| | | /// | |
| | | /// \return Glyph's visual settings, or an invalid glyph if character n | |
| | | ot found | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | const Glyph& GetGlyph(Uint32 CodePoint) const; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Get the image containing the rendered characters (glyphs) | |
| | | /// | |
| | | /// \return Image containing glyphs | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | const Image& GetImage() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the SFML default built-in font (Arial) | | /// Get the SFML default built-in font (Arial) | |
| /// | | /// | |
| /// \return Instance of the default font | | /// \return Instance of the default font | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| static const Font& GetDefaultFont(); | | static const Font& GetDefaultFont(); | |
| | | | |
| private : | | private : | |
| | | | |
|
| friend class String; | | | |
| friend class priv::FontLoader; | | friend class priv::FontLoader; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Defines the drawing attributes of a character | | // Static member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| struct Character | | static Uint32 ourDefaultCharset[]; ///< The default charset (all printa | |
| { | | ble ISO-8859-1 characters) | |
| IntRect Rect; ///< Bouding rectangle in relative coordinates | | | |
| FloatRect Coord; ///< Texture coordinates inside the bitmap font | | | |
| int Advance; ///< Offset to move to the next character | | | |
| }; | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| Image myTexture; ///< Texture holding the bit | | Image myTexture; ///< Texture holding the bitmap fon | |
| map font | | t | |
| unsigned int myCharSize; ///< Size of characters in t | | unsigned int myCharSize; ///< Size of characters in the bitm | |
| he bitmap font | | ap font | |
| std::map<wchar_t, Character> myCharacters; ///< Rendering settings of e | | std::map<Uint32, Glyph> myGlyphs; ///< Rendering settings of each cha | |
| ach character | | racter (glyph) | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_FONT_HPP | | #endif // SFML_FONT_HPP | |
| | | | |
End of changes. 10 change blocks. |
| 20 lines changed or deleted | | 48 lines changed or added | |
|
| IPAddress.hpp | | IPAddress.hpp | |
| | | | |
| skipping to change at line 80 | | skipping to change at line 80 | |
| /// | | /// | |
| /// \param Byte0 : First byte of the address | | /// \param Byte0 : First byte of the address | |
| /// \param Byte1 : Second byte of the address | | /// \param Byte1 : Second byte of the address | |
| /// \param Byte2 : Third byte of the address | | /// \param Byte2 : Third byte of the address | |
| /// \param Byte3 : Fourth byte of the address | | /// \param Byte3 : Fourth byte of the address | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3); | | IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Construct the address from a 32-bits integer | |
| | | /// | |
| | | /// \param Address : 4 bytes of the address packed into a 32-bits integ | |
| | | er | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | IPAddress(Uint32 Address); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// Tell if the address is a valid one | | /// Tell if the address is a valid one | |
| /// | | /// | |
| /// \return True if address has a valid syntax | | /// \return True if address has a valid syntax | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool IsValid() const; | | bool IsValid() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get a string representation of the address | | /// Get a string representation of the address | |
| /// | | /// | |
| /// \return String representation of the IP address ("xxx.xxx.xxx.xxx") | | /// \return String representation of the IP address ("xxx.xxx.xxx.xxx") | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| std::string ToString() const; | | std::string ToString() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Get an integer representation of the address | |
| | | /// | |
| | | /// \return 32-bits integer containing the 4 bytes of the address, in s | |
| | | ystem endianness | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | Uint32 ToInteger() const; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// Get the computer's local IP address (from the LAN point of view) | | /// Get the computer's local IP address (from the LAN point of view) | |
| /// | | /// | |
| /// \return Local IP address | | /// \return Local IP address | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| static IPAddress GetLocalAddress(); | | static IPAddress GetLocalAddress(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the computer's public IP address (from the web point of view). | | /// Get the computer's public IP address (from the web point of view). | |
| /// The only way to get a public address is to ask it to a | | /// The only way to get a public address is to ask it to a | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 18 lines changed or added | |
|
| Image.hpp | | Image.hpp | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| // 3. This notice may not be removed or altered from any source distributio
n. | | // 3. This notice may not be removed or altered from any source distributio
n. | |
| // | | // | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_IMAGE_HPP | | #ifndef SFML_IMAGE_HPP | |
| #define SFML_IMAGE_HPP | | #define SFML_IMAGE_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | #include <SFML/System/Resource.hpp> | |
| #include <SFML/Graphics/Color.hpp> | | #include <SFML/Graphics/Color.hpp> | |
|
| #include <SFML/Graphics/VideoResource.hpp> | | | |
| #include <SFML/Graphics/Rect.hpp> | | #include <SFML/Graphics/Rect.hpp> | |
| #include <string> | | #include <string> | |
| #include <vector> | | #include <vector> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
|
| | | class RenderImage; | |
| | | class RenderWindow; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Image is the low-level class for loading and | | /// Image is the low-level class for loading and | |
| /// manipulating images | | /// manipulating images | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API Image : public VideoResource | | class SFML_API Image : public Resource<Image> | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Image(); | | Image(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 152 | | skipping to change at line 155 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Create transparency mask from a specified colorkey | | /// Create transparency mask from a specified colorkey | |
| /// | | /// | |
| /// \param ColorKey : Color to become transparent | | /// \param ColorKey : Color to become transparent | |
| /// \param Alpha : Alpha value to use for transparent pixels (0 by d
efault) | | /// \param Alpha : Alpha value to use for transparent pixels (0 by d
efault) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void CreateMaskFromColor(Color ColorKey, Uint8 Alpha = 0); | | void CreateMaskFromColor(Color ColorKey, Uint8 Alpha = 0); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Resize the image - warning : this function does not scale the image | | /// Copy pixels from another image onto this one. | |
| , | | /// This function does a slow pixel copy and should only | |
| /// it just adjusts its size (add padding or remove pixels) | | /// be used at initialization time | |
| /// | | /// | |
|
| /// \param Width : New width | | /// \param Source : Source image to copy | |
| /// \param Height : New height | | /// \param DestX : X coordinate of the destination position | |
| /// \param Col : Color to assign to new pixels (black by default) | | /// \param DestY : Y coordinate of the destination position | |
| | | /// \param SourceRect : Sub-rectangle of the source image to copy (empt | |
| | | y by default - entire image) | |
| /// | | /// | |
|
| /// \return True if resize has been successful | | //////////////////////////////////////////////////////////// | |
| | | void Copy(const Image& Source, unsigned int DestX, unsigned int DestY, | |
| | | const IntRect& SourceRect = IntRect(0, 0, 0, 0)); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Create the image from the current contents of the | |
| | | /// given window | |
| | | /// | |
| | | /// \param Window : Window to capture | |
| | | /// \param SourceRect : Sub-rectangle of the screen to copy (empty by d | |
| | | efault - entire image) | |
| | | /// | |
| | | /// \return True if copy was successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Resize(unsigned int Width, unsigned int Height, Color Col = Color(
0, 0, 0, 255)); | | bool CopyScreen(RenderWindow& Window, const IntRect& SourceRect = IntRe
ct(0, 0, 0, 0)); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Change the color of a pixel | | /// Change the color of a pixel | |
| /// | | /// | |
| /// \param X : X coordinate of pixel in the image | | /// \param X : X coordinate of pixel in the image | |
| /// \param Y : Y coordinate of pixel in the image | | /// \param Y : Y coordinate of pixel in the image | |
| /// \param Col : New color for pixel (X, Y) | | /// \param Col : New color for pixel (X, Y) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetPixel(unsigned int X, unsigned int Y, const Color& Col); | | void SetPixel(unsigned int X, unsigned int Y, const Color& Col); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get a pixel from the image | | /// Get a pixel from the image | |
| /// | | /// | |
|
| /// \param X : X coordinate of pixel in the image | | /// \param X : X coordinate of pixel in the image | |
| /// \param Y : Y coordinate of pixel in the image | | /// \param Y : Y coordinate of pixel in the image | |
| /// | | /// | |
|
| /// \return Color of pixel (x, y) | | /// \return Color of pixel (X, Y) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| const Color& GetPixel(unsigned int X, unsigned int Y) const; | | const Color& GetPixel(unsigned int X, unsigned int Y) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get a read-only pointer to the array of pixels (RGBA 8 bits integer
s components) | | /// Get a read-only pointer to the array of pixels (RGBA 8 bits integer
s components) | |
| /// Array size is GetWidth() x GetHeight() x 4 | | /// Array size is GetWidth() x GetHeight() x 4 | |
| /// This pointer becomes invalid if you reload or resize the image | | /// This pointer becomes invalid if you reload or resize the image | |
| /// | | /// | |
| /// \return Const pointer to the array of pixels | | /// \return Const pointer to the array of pixels | |
| | | | |
| skipping to change at line 268 | | skipping to change at line 283 | |
| /// | | /// | |
| /// \param Other : instance to assign | | /// \param Other : instance to assign | |
| /// | | /// | |
| /// \return Reference to the image | | /// \return Reference to the image | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Image& operator =(const Image& Other); | | Image& operator =(const Image& Other); | |
| | | | |
| private : | | private : | |
| | | | |
|
| | | friend class RenderImage; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Create the OpenGL texture | | /// Create the OpenGL texture | |
| /// | | /// | |
| /// \return True if texture has been successfully created | | /// \return True if texture has been successfully created | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool CreateTexture(); | | bool CreateTexture(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Update the internal texture in video memory | | /// Make sure the texture in video memory is updated with the | |
| /// | | /// array of pixels | |
| | | //////////////////////////////////////////////////////////// | |
| | | void EnsureTextureUpdate() const; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Make sure the array of pixels is updated with the | |
| | | /// texture in video memory | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Update(); | | void EnsureArrayUpdate() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Reset the image attributes | | /// Reset the image attributes | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Reset(); | | void Reset(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// /see VideoResource::DestroyVideoResources | | /// Destroy the OpenGL texture | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void DestroyVideoResources(); | | void DestroyTexture(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| unsigned int myWidth; ///< Image width | | unsigned int myWidth; ///< Image width | |
| unsigned int myHeight; ///< Image Height | | unsigned int myHeight; ///< Image Height | |
| unsigned int myTextureWidth; ///< Actual texture width (can be g | | unsigned int myTextureWidth; ///< Actual texture wid | |
| reater than image width because of padding) | | th (can be greater than image width because of padding) | |
| unsigned int myTextureHeight; ///< Actual texture height (can be | | unsigned int myTextureHeight; ///< Actual texture hei | |
| greater than image height because of padding) | | ght (can be greater than image height because of padding) | |
| std::vector<Color> myPixels; ///< Pixels of the image | | unsigned int myTexture; ///< Internal texture i | |
| unsigned int myTexture; ///< Internal texture identifier | | dentifier | |
| bool myIsSmooth; ///< Status if the smooth filter | | bool myIsSmooth; ///< Status of the smoo | |
| mutable bool myUpdated; ///< Tells if the internal texture | | th filter | |
| needs to be updated | | mutable std::vector<Color> myPixels; ///< Pixels of the imag | |
| | | e | |
| | | mutable bool myNeedTextureUpdate; ///< Status of synchron | |
| | | ization between pixels in central memory and the internal texture un video | |
| | | memory | |
| | | mutable bool myNeedArrayUpdate; ///< Status of synchron | |
| | | ization between pixels in central memory and the internal texture un video | |
| | | memory | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_IMAGE_HPP | | #endif // SFML_IMAGE_HPP | |
| | | | |
End of changes. 16 change blocks. |
| 29 lines changed or deleted | | 61 lines changed or added | |
|
| Input.hpp | | Input.hpp | |
| | | | |
| skipping to change at line 90 | | skipping to change at line 90 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool IsJoystickButtonDown(unsigned int JoyId, unsigned int Button) cons
t; | | bool IsJoystickButtonDown(unsigned int JoyId, unsigned int Button) cons
t; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the mouse X position | | /// Get the mouse X position | |
| /// | | /// | |
| /// \return Current mouse left position, relative to owner window | | /// \return Current mouse left position, relative to owner window | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| unsigned int GetMouseX() const; | | int GetMouseX() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the mouse Y position | | /// Get the mouse Y position | |
| /// | | /// | |
| /// \return Current mouse top position, relative to owner window | | /// \return Current mouse top position, relative to owner window | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| unsigned int GetMouseY() const; | | int GetMouseY() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get a joystick axis position | | /// Get a joystick axis position | |
| /// | | /// | |
| /// \param JoyId : Identifier of the joystick to check (0 or 1) | | /// \param JoyId : Identifier of the joystick to check (0 or 1) | |
| /// \param Axis : Axis to get | | /// \param Axis : Axis to get | |
| /// | | /// | |
| /// \return Current axis position, in the range [-100, 100] (except for
POV, which is [0, 360]) | | /// \return Current axis position, in the range [-100, 100] (except for
POV, which is [0, 360]) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| float GetJoystickAxis(unsigned int JoyId, Joy::Axis Axis) const; | | float GetJoystickAxis(unsigned int JoyId, Joy::Axis Axis) const; | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// /see sfWindowListener::OnEvent | | /// /see WindowListener::OnEvent | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual void OnEvent(const Event& EventReceived); | | virtual void OnEvent(const Event& EventReceived); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool myKeys[Key::Count]; ///< Array containing the | | bool myKeys[Key::Count]; ///< Array containing the state of | |
| state of all keayboard keys | | all keyboard keys | |
| bool myMouseButtons[Mouse::Count]; ///< Array containing the | | bool myMouseButtons[Mouse::Count]; ///< Array containing the state of | |
| state of all mouse buttons | | all mouse buttons | |
| bool myJoystickButtons[2][16]; ///< Array containing the | | bool myJoystickButtons[2][16]; ///< Array containing the state of | |
| state of all joysticks buttons | | all joysticks buttons | |
| unsigned int myMouseX; ///< Mouse position on X | | int myMouseX; ///< Mouse position on X | |
| unsigned int myMouseY; ///< Mouse position on Y | | int myMouseY; ///< Mouse position on Y | |
| float myJoystickAxis[2][Joy::Count]; ///< Joysticks position on | | float myJoystickAxis[2][Joy::Count]; ///< Joysticks position on each ax | |
| each axis | | is | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_INPUT_HPP | | #endif // SFML_INPUT_HPP | |
| | | | |
End of changes. 4 change blocks. |
| 13 lines changed or deleted | | 13 lines changed or added | |
|
| Matrix3.inl | | Matrix3.inl | |
| | | | |
| skipping to change at line 45 | | skipping to change at line 45 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct a matrix from its 9 elements | | /// Construct a matrix from its 9 elements | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| inline Matrix3::Matrix3(float a00, float a01, float a02, | | inline Matrix3::Matrix3(float a00, float a01, float a02, | |
| float a10, float a11, float a12, | | float a10, float a11, float a12, | |
| float a20, float a21, float a22) | | float a20, float a21, float a22) | |
| { | | { | |
| myData[0] = a00; myData[4] = a01; myData[8] = 0.f; myData[12] = a02; | | myData[0] = a00; myData[4] = a01; myData[8] = 0.f; myData[12] = a02; | |
| myData[1] = a10; myData[5] = a11; myData[9] = 0.f; myData[13] = a12; | | myData[1] = a10; myData[5] = a11; myData[9] = 0.f; myData[13] = a12; | |
|
| myData[2] = a20; myData[6] = a21; myData[10] = 1.f; myData[14] = a22; | | myData[2] = 0.f; myData[6] = 0.f; myData[10] = 1.f; myData[14] = 0.f; | |
| myData[3] = 0.f; myData[7] = 0.f; myData[11] = 0.f; myData[15] = 1.f; | | myData[3] = a20; myData[7] = a21; myData[11] = 0.f; myData[15] = a22; | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Build a matrix from a set of transformations | | /// Build a matrix from a set of transformations | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| inline void Matrix3::SetFromTransformations(const Vector2f& Center, const V
ector2f& Translation, float Rotation, const Vector2f& Scale) | | inline void Matrix3::SetFromTransformations(const Vector2f& Center, const V
ector2f& Translation, float Rotation, const Vector2f& Scale) | |
| { | | { | |
| float Angle = Rotation * 3.141592654f / 180.f; | | float Angle = Rotation * 3.141592654f / 180.f; | |
| float Cos = static_cast<float>(cos(Angle)); | | float Cos = static_cast<float>(cos(Angle)); | |
| float Sin = static_cast<float>(sin(Angle)); | | float Sin = static_cast<float>(sin(Angle)); | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 85 | |
| return Vector2f(myData[0] * Point.x + myData[4] * Point.y + myData[12], | | return Vector2f(myData[0] * Point.x + myData[4] * Point.y + myData[12], | |
| myData[1] * Point.x + myData[5] * Point.y + myData[13])
; | | myData[1] * Point.x + myData[5] * Point.y + myData[13])
; | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Return the inverse of the matrix | | /// Return the inverse of the matrix | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| inline Matrix3 Matrix3::GetInverse() const | | inline Matrix3 Matrix3::GetInverse() const | |
| { | | { | |
| // Compute the determinant | | // Compute the determinant | |
|
| float Det = myData[0] * (myData[14] * myData[5] - myData[6] * myData[13 | | float Det = myData[0] * (myData[15] * myData[5] - myData[7] * myData[13 | |
| ]) - | | ]) - | |
| myData[1] * (myData[14] * myData[4] - myData[6] * myData[12 | | myData[1] * (myData[15] * myData[4] - myData[7] * myData[12 | |
| ]) + | | ]) + | |
| myData[2] * (myData[13] * myData[4] - myData[5] * myData[12 | | myData[3] * (myData[13] * myData[4] - myData[5] * myData[12 | |
| ]); | | ]); | |
| | | | |
| // Compute the inverse if determinant is not zero | | // Compute the inverse if determinant is not zero | |
| if ((Det < -1E-7f) || (Det > 1E-7f)) | | if ((Det < -1E-7f) || (Det > 1E-7f)) | |
| { | | { | |
|
| return Matrix3( (myData[14] * myData[5] - myData[6] * myData[13]) / | | return Matrix3( (myData[15] * myData[5] - myData[7] * myData[13]) / | |
| Det, | | Det, | |
| -(myData[14] * myData[4] - myData[6] * myData[12]) / | | -(myData[15] * myData[4] - myData[7] * myData[12]) / | |
| Det, | | Det, | |
| (myData[13] * myData[4] - myData[5] * myData[12]) /
Det, | | (myData[13] * myData[4] - myData[5] * myData[12]) /
Det, | |
|
| -(myData[14] * myData[1] - myData[2] * myData[13]) / | | -(myData[15] * myData[1] - myData[3] * myData[13]) / | |
| Det, | | Det, | |
| (myData[14] * myData[0] - myData[2] * myData[12]) / | | (myData[15] * myData[0] - myData[3] * myData[12]) / | |
| Det, | | Det, | |
| -(myData[13] * myData[0] - myData[1] * myData[12]) /
Det, | | -(myData[13] * myData[0] - myData[1] * myData[12]) /
Det, | |
|
| (myData[6] * myData[1] - myData[2] * myData[5]) / | | (myData[7] * myData[1] - myData[3] * myData[5]) / | |
| Det, | | Det, | |
| -(myData[6] * myData[0] - myData[2] * myData[4]) / | | -(myData[7] * myData[0] - myData[3] * myData[4]) / | |
| Det, | | Det, | |
| (myData[5] * myData[0] - myData[1] * myData[4]) /
Det); | | (myData[5] * myData[0] - myData[1] * myData[4]) /
Det); | |
| } | | } | |
| else | | else | |
| { | | { | |
| return Identity; | | return Identity; | |
| } | | } | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Return the elements of the matrix as a 4x4, | | /// Return the elements of the matrix as a 4x4, | |
| | | | |
| skipping to change at line 122 | | skipping to change at line 122 | |
| inline const float* Matrix3::Get4x4Elements() const | | inline const float* Matrix3::Get4x4Elements() const | |
| { | | { | |
| return myData; | | return myData; | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Operator () overloads to access the matrix elements | | /// Operator () overloads to access the matrix elements | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| inline float Matrix3::operator ()(unsigned int Row, unsigned int Col) const | | inline float Matrix3::operator ()(unsigned int Row, unsigned int Col) const | |
| { | | { | |
|
| return myData[Row + (Col + Col / 2) * 4]; | | switch (Row + Col * 3) | |
| | | { | |
| | | case 0 : return myData[0]; | |
| | | case 1 : return myData[1]; | |
| | | case 2 : return myData[3]; | |
| | | case 3 : return myData[4]; | |
| | | case 4 : return myData[5]; | |
| | | case 5 : return myData[7]; | |
| | | case 6 : return myData[12]; | |
| | | case 7 : return myData[13]; | |
| | | case 8 : return myData[15]; | |
| | | | |
| | | default : return myData[0]; | |
| | | } | |
| } | | } | |
| inline float& Matrix3::operator ()(unsigned int Row, unsigned int Col) | | inline float& Matrix3::operator ()(unsigned int Row, unsigned int Col) | |
| { | | { | |
|
| return myData[Row + (Col + Col / 2) * 4]; | | switch (Row + Col * 3) | |
| | | { | |
| | | case 0 : return myData[0]; | |
| | | case 1 : return myData[1]; | |
| | | case 2 : return myData[3]; | |
| | | case 3 : return myData[4]; | |
| | | case 4 : return myData[5]; | |
| | | case 5 : return myData[7]; | |
| | | case 6 : return myData[12]; | |
| | | case 7 : return myData[13]; | |
| | | case 8 : return myData[15]; | |
| | | | |
| | | default : return myData[0]; | |
| | | } | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Operator * overload to multiply two matrices | | /// Operator * overload to multiply two matrices | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| inline Matrix3 Matrix3::operator *(const Matrix3& Mat) const | | inline Matrix3 Matrix3::operator *(const Matrix3& Mat) const | |
| { | | { | |
|
| return Matrix3(myData[0] * Mat.myData[0] + myData[4] * Mat.myData[1] | | return Matrix3(myData[0] * Mat.myData[0] + myData[4] * Mat.myData[1] | |
| + myData[12] * Mat.myData[2], | | + myData[12] * Mat.myData[3], | |
| myData[0] * Mat.myData[4] + myData[4] * Mat.myData[5] | | myData[0] * Mat.myData[4] + myData[4] * Mat.myData[5] | |
| + myData[12] * Mat.myData[3], | | + myData[12] * Mat.myData[7], | |
| myData[0] * Mat.myData[12] + myData[4] * Mat.myData[13] | | myData[0] * Mat.myData[12] + myData[4] * Mat.myData[13] | |
| + myData[12] * Mat.myData[14], | | + myData[12] * Mat.myData[15], | |
| myData[1] * Mat.myData[0] + myData[5] * Mat.myData[1] | | myData[1] * Mat.myData[0] + myData[5] * Mat.myData[1] | |
| + myData[13] * Mat.myData[2], | | + myData[13] * Mat.myData[3], | |
| myData[1] * Mat.myData[4] + myData[5] * Mat.myData[5] | | myData[1] * Mat.myData[4] + myData[5] * Mat.myData[5] | |
| + myData[13] * Mat.myData[3], | | + myData[13] * Mat.myData[7], | |
| myData[1] * Mat.myData[12] + myData[5] * Mat.myData[13] | | myData[1] * Mat.myData[12] + myData[5] * Mat.myData[13] | |
| + myData[13] * Mat.myData[14], | | + myData[13] * Mat.myData[15], | |
| myData[2] * Mat.myData[0] + myData[6] * Mat.myData[1] | | myData[3] * Mat.myData[0] + myData[7] * Mat.myData[1] | |
| + myData[14] * Mat.myData[2], | | + myData[15] * Mat.myData[3], | |
| myData[2] * Mat.myData[4] + myData[6] * Mat.myData[5] | | myData[3] * Mat.myData[4] + myData[7] * Mat.myData[5] | |
| + myData[14] * Mat.myData[3], | | + myData[15] * Mat.myData[7], | |
| myData[2] * Mat.myData[12] + myData[6] * Mat.myData[13] | | myData[3] * Mat.myData[12] + myData[7] * Mat.myData[13] | |
| + myData[14] * Mat.myData[14]); | | + myData[15] * Mat.myData[15]); | |
| } | | } | |
|
| | | <span class="insert">myData[15]</span> * <span class="insert">Mat.myData[1
5]);</span> | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Operator *= overload to multiply-assign two matrices | | /// Operator *= overload to multiply-assign two matrices | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| inline Matrix3& Matrix3::operator *=(const Matrix3& Mat) | | inline Matrix3& Matrix3::operator *=(const Matrix3& Mat) | |
| { | | { | |
| return *this = *this * Mat; | | return *this = *this * Mat; | |
| } | | } | |
| | | | |
End of changes. 9 change blocks. |
| 40 lines changed or deleted | | 67 lines changed or added | |
|
| Music.hpp | | Music.hpp | |
| | | | |
| skipping to change at line 87 | | skipping to change at line 87 | |
| /// | | /// | |
| /// \param Data : Pointer to the file data in memory | | /// \param Data : Pointer to the file data in memory | |
| /// \param SizeInBytes : Size of the data to load, in bytes | | /// \param SizeInBytes : Size of the data to load, in bytes | |
| /// | | /// | |
| /// \return True if loading has been successful | | /// \return True if loading has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool OpenFromMemory(const char* Data, std::size_t SizeInBytes); | | bool OpenFromMemory(const char* Data, std::size_t SizeInBytes); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Set the music loop state. | | | |
| /// This parameter is disabled by default | | | |
| /// | | | |
| /// \param Loop : True to play in loop, false to play once | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| void SetLoop(bool Loop); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Tell whether or not the music is looping | | | |
| /// | | | |
| /// \return True if the music is looping, false otherwise | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| bool GetLoop() const; | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Get the music duration | | /// Get the music duration | |
| /// | | /// | |
| /// \return Music duration, in seconds | | /// \return Music duration, in seconds | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| float GetDuration() const; | | float GetDuration() const; | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 129 | | skipping to change at line 112 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// /see SoundStream::OnGetData | | /// /see SoundStream::OnGetData | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual bool OnGetData(Chunk& Data); | | virtual bool OnGetData(Chunk& Data); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| priv::SoundFile* myFile; ///< Sound file | | priv::SoundFile* myFile; ///< Sound file | |
|
| bool myLoop; ///< Loop flag (true to loop, false to p
lay once) | | | |
| float myDuration; ///< Music duration, in seconds | | float myDuration; ///< Music duration, in seconds | |
| std::vector<Int16> mySamples; ///< Temporary buffer of samples | | std::vector<Int16> mySamples; ///< Temporary buffer of samples | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_MUSIC_HPP | | #endif // SFML_MUSIC_HPP | |
| | | | |
End of changes. 2 change blocks. |
| 18 lines changed or deleted | | 0 lines changed or added | |
|
| Packet.hpp | | Packet.hpp | |
| | | | |
| skipping to change at line 87 | | skipping to change at line 87 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| const char* GetData() const; | | const char* GetData() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the size of the data contained in the packet | | /// Get the size of the data contained in the packet | |
| /// | | /// | |
| /// \return Data size, in bytes | | /// \return Data size, in bytes | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| Uint32 GetDataSize() const; | | std::size_t GetDataSize() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Tell if the packet is valid for reading | | /// Tell if the reading position has reached the end of the packet | |
| /// | | /// | |
|
| /// \return True if data can be extracted from the packet | | /// \return True if all data have been read into the packet | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | bool EndOfPacket() const; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Return the validity of packet | |
| | | /// | |
| | | /// \return True if last data extraction from packet was successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| operator bool() const; | | operator bool() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Operator >> overloads to extract data from the packet | | /// Operator >> overloads to extract data from the packet | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | Packet& operator >>(bool& Data); | |
| Packet& operator >>(Int8& Data); | | Packet& operator >>(Int8& Data); | |
| Packet& operator >>(Uint8& Data); | | Packet& operator >>(Uint8& Data); | |
| Packet& operator >>(Int16& Data); | | Packet& operator >>(Int16& Data); | |
| Packet& operator >>(Uint16& Data); | | Packet& operator >>(Uint16& Data); | |
| Packet& operator >>(Int32& Data); | | Packet& operator >>(Int32& Data); | |
| Packet& operator >>(Uint32& Data); | | Packet& operator >>(Uint32& Data); | |
| Packet& operator >>(float& Data); | | Packet& operator >>(float& Data); | |
| Packet& operator >>(double& Data); | | Packet& operator >>(double& Data); | |
| Packet& operator >>(char* Data); | | Packet& operator >>(char* Data); | |
| Packet& operator >>(std::string& Data); | | Packet& operator >>(std::string& Data); | |
| Packet& operator >>(wchar_t* Data); | | Packet& operator >>(wchar_t* Data); | |
| Packet& operator >>(std::wstring& Data); | | Packet& operator >>(std::wstring& Data); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Operator << overloads to put data into the packet | | /// Operator << overloads to put data into the packet | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | Packet& operator <<(bool Data); | |
| Packet& operator <<(Int8 Data); | | Packet& operator <<(Int8 Data); | |
| Packet& operator <<(Uint8 Data); | | Packet& operator <<(Uint8 Data); | |
| Packet& operator <<(Int16 Data); | | Packet& operator <<(Int16 Data); | |
| Packet& operator <<(Uint16 Data); | | Packet& operator <<(Uint16 Data); | |
| Packet& operator <<(Int32 Data); | | Packet& operator <<(Int32 Data); | |
| Packet& operator <<(Uint32 Data); | | Packet& operator <<(Uint32 Data); | |
| Packet& operator <<(float Data); | | Packet& operator <<(float Data); | |
| Packet& operator <<(double Data); | | Packet& operator <<(double Data); | |
| Packet& operator <<(const char* Data); | | Packet& operator <<(const char* Data); | |
| Packet& operator <<(const std::string& Data); | | Packet& operator <<(const std::string& Data); | |
| | | | |
| skipping to change at line 149 | | skipping to change at line 159 | |
| /// \param Size : Size to check | | /// \param Size : Size to check | |
| /// | | /// | |
| /// \return True if Size bytes can be read from the packet's data | | /// \return True if Size bytes can be read from the packet's data | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool CheckSize(std::size_t Size); | | bool CheckSize(std::size_t Size); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Called before the packet is sent to the network | | /// Called before the packet is sent to the network | |
| /// | | /// | |
|
| | | /// \param DataSize : Variable to fill with the size of data to send | |
| | | /// | |
| | | /// \return Pointer to the array of bytes to send | |
| | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void OnSend(); | | virtual const char* OnSend(std::size_t& DataSize); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Called after the packet has been received from the network | | /// Called after the packet has been received from the network | |
| /// | | /// | |
|
| | | /// \param Data : Pointer to the array of received bytes | |
| | | /// \param DataSize : Size of the array of bytes | |
| | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void OnReceive(); | | virtual void OnReceive(const char* Data, std::size_t DataSize); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| std::vector<char> myData; ///< Data stored in the packet | | std::vector<char> myData; ///< Data stored in the packet | |
| std::size_t myReadPos; ///< Current reading position in the packe
t | | std::size_t myReadPos; ///< Current reading position in the packe
t | |
| bool myIsValid; ///< Reading state of the packet | | bool myIsValid; ///< Reading state of the packet | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
End of changes. 9 change blocks. |
| 5 lines changed or deleted | | 22 lines changed or added | |
|
| PostFX.hpp | | PostFX.hpp | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 33 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_POSTFX_HPP | | #ifndef SFML_POSTFX_HPP | |
| #define SFML_POSTFX_HPP | | #define SFML_POSTFX_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Graphics/Drawable.hpp> | | #include <SFML/Graphics/Drawable.hpp> | |
| #include <SFML/Graphics/Image.hpp> | | #include <SFML/Graphics/Image.hpp> | |
|
| #include <SFML/Graphics/VideoResource.hpp> | | | |
| #include <istream> | | #include <istream> | |
| #include <map> | | #include <map> | |
| #include <string> | | #include <string> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// PostFX is used to apply a post effect to a window | | /// PostFX is used to apply a post effect to a window | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API PostFX : public Drawable, public VideoResource | | class SFML_API PostFX : public Drawable | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| PostFX(); | | PostFX(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 153 | | skipping to change at line 152 | |
| /// Tell whether or not the system supports post-effects | | /// Tell whether or not the system supports post-effects | |
| /// | | /// | |
| /// \return True if the system can use post-effects | | /// \return True if the system can use post-effects | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| static bool CanUsePostFX(); | | static bool CanUsePostFX(); | |
| | | | |
| protected : | | protected : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// /see sfDrawable::Render | | /// /see Drawable::Render | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void Render(const RenderWindow& Window) const; | | virtual void Render(RenderTarget& Target) const; | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Preprocess a SFML effect file | | /// Preprocess a SFML effect file | |
| /// to convert it to a valid GLSL fragment shader | | /// to convert it to a valid GLSL fragment shader | |
| /// | | /// | |
| /// \param File : Stream containing the code to process | | /// \param File : Stream containing the code to process | |
| /// | | /// | |
| /// \return Valid fragment shader source code | | /// \return Valid fragment shader source code | |
| | | | |
| skipping to change at line 178 | | skipping to change at line 177 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| static std::string PreprocessEffect(std::istream& File); | | static std::string PreprocessEffect(std::istream& File); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Create the program and attach the shaders | | /// Create the program and attach the shaders | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void CreateProgram(); | | void CreateProgram(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// /see sfVideoResource::DestroyVideoResources | | // Types | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void DestroyVideoResources(); | | typedef std::map<std::string, const Image*> TextureTable; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| unsigned int myShaderProgram; ///< OpenGL identifier | | unsigned int myShaderProgram; ///< OpenGL identifier for the program | |
| for the program | | TextureTable myTextures; ///< Texture variables in the effect | |
| std::map<std::string, Image*> mySamplers; ///< Sampler names and | | std::string myFragmentShader; ///< Fragment shader source code | |
| textures in the effect | | mutable Image myFrameBuffer; ///< Texture containing the current fra | |
| std::string myFragmentShader; ///< Fragment shader so | | me buffer | |
| urce code | | | |
| mutable Image myFrameBuffer; ///< Texture containing | | | |
| the current frame buffer | | | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_POSTFX_HPP | | #endif // SFML_POSTFX_HPP | |
| | | | |
End of changes. 7 change blocks. |
| 15 lines changed or deleted | | 10 lines changed or added | |
|
| RenderWindow.hpp | | RenderWindow.hpp | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| // 3. This notice may not be removed or altered from any source distributio
n. | | // 3. This notice may not be removed or altered from any source distributio
n. | |
| // | | // | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_RENDERWINDOW_HPP | | #ifndef SFML_RENDERWINDOW_HPP | |
| #define SFML_RENDERWINDOW_HPP | | #define SFML_RENDERWINDOW_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| #include <SFML/Graphics/Color.hpp> | | | |
| #include <SFML/Graphics/Image.hpp> | | #include <SFML/Graphics/Image.hpp> | |
|
| #include <SFML/Graphics/View.hpp> | | #include <SFML/Graphics/RenderTarget.hpp> | |
| #include <SFML/Graphics/Rect.hpp> | | | |
| #include <SFML/Window/Window.hpp> | | #include <SFML/Window/Window.hpp> | |
| #include <string> | | #include <string> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
| class Drawable; | | class Drawable; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Simple wrapper for sf::Window that allows easy | | /// Simple wrapper for sf::Window that allows easy | |
| /// 2D rendering | | /// 2D rendering | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API RenderWindow : public Window | | class SFML_API RenderWindow : public Window, public RenderTarget | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| RenderWindow(); | | RenderWindow(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 83 | | skipping to change at line 81 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| RenderWindow(WindowHandle Handle, const WindowSettings& Params = Window
Settings()); | | RenderWindow(WindowHandle Handle, const WindowSettings& Params = Window
Settings()); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Destructor | | /// Destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual ~RenderWindow(); | | virtual ~RenderWindow(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Draw something on the window | | /// Get the width of the rendering region of the window | |
| /// | | /// | |
|
| /// \param Object : Object to draw | | /// \return Width in pixels | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Draw(const Drawable& Object) const; | | virtual unsigned int GetWidth() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Save the content of the window to an image | | /// Get the height of the rendering region of the window | |
| /// | | /// | |
|
| /// \return Image instance containing the contents of the screen | | /// \return Height in pixels | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| Image Capture() const; | | virtual unsigned int GetHeight() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Change the background color of the window. | | /// Save the content of the window to an image | |
| /// The default color is black | | | |
| /// | | | |
| /// \param Col : New background color | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| void SetBackgroundColor(const Color& Col); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Change the current active view. | | | |
| /// | | | |
| /// \param NewView : New view to use (pass GetDefaultView() to set the | | | |
| default view) | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| void SetView(const View& NewView); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Get the current view | | | |
| /// | | | |
| /// \return Current view active in the window | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| const View& GetView() const; | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Get the default view of the window for read / write | | | |
| /// | | /// | |
|
| /// \return Default view | | /// \return Image instance containing the contents of the screen | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| View& GetDefaultView(); | | Image Capture() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Convert a point in window coordinates into view coordinates | | /// Convert a point in window coordinates into view coordinates | |
| /// | | /// | |
| /// \param WindowX : X coordinate of the point to convert, relative
to the window | | /// \param WindowX : X coordinate of the point to convert, relative
to the window | |
| /// \param WindowY : Y coordinate of the point to convert, relative
to the window | | /// \param WindowY : Y coordinate of the point to convert, relative
to the window | |
| /// \param TargetView : Target view to convert the point to (NULL by de
fault -- uses the current view) | | /// \param TargetView : Target view to convert the point to (NULL by de
fault -- uses the current view) | |
| /// | | /// | |
| /// \return Converted point | | /// \return Converted point | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| sf::Vector2f ConvertCoords(unsigned int WindowX, unsigned int WindowY,
const View* TargetView = NULL) const; | | sf::Vector2f ConvertCoords(unsigned int WindowX, unsigned int WindowY,
const View* TargetView = NULL) const; | |
| | | | |
|
| //////////////////////////////////////////////////////////// | | | |
| /// Tell SFML to preserve external OpenGL states, at the expense of | | | |
| /// more CPU charge. Use this function if you don't want SFML | | | |
| /// to mess up your own OpenGL states (if any). | | | |
| /// Don't enable state preservation if not needed, as it will allow | | | |
| /// SFML to do internal optimizations and improve performances. | | | |
| /// This parameter is false by default | | | |
| /// | | | |
| /// \param Preserve : True to preserve OpenGL states, false to let SFML | | | |
| optimize | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| void PreserveOpenGLStates(bool Preserve); | | | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// /see Window::OnCreate | | /// /see Window::OnCreate | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual void OnCreate(); | | virtual void OnCreate(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// /see Window::OnDisplay | | /// /see RenderTarget::Activate | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| virtual void OnDisplay(); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Set the OpenGL render states needed for the SFML rendering | | | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void SetRenderStates() const; | | virtual bool Activate(bool Active); | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| // Member data | | | |
| //////////////////////////////////////////////////////////// | | | |
| Color myBackgroundColor; ///< Background color | | | |
| View myDefaultView; ///< Default view | | | |
| const View* myCurrentView; ///< Current active view | | | |
| bool myPreserveStates; ///< Should we preserve external OpenGL | | | |
| states ? | | | |
| mutable bool myIsDrawing; ///< True when Draw is called from insi | | | |
| de, to allow some renderstates optimizations | | | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_RENDERWINDOW_HPP | | #endif // SFML_RENDERWINDOW_HPP | |
| | | | |
End of changes. 15 change blocks. |
| 72 lines changed or deleted | | 13 lines changed or added | |
|
| Shape.hpp | | Shape.hpp | |
| | | | |
| skipping to change at line 73 | | skipping to change at line 73 | |
| /// Add a point to the shape | | /// Add a point to the shape | |
| /// | | /// | |
| /// \param Position : Position of the point | | /// \param Position : Position of the point | |
| /// \param Col : Color of the point (white by default) | | /// \param Col : Color of the point (white by default) | |
| /// \param OutlineCol : Outline color of the point (black by default) | | /// \param OutlineCol : Outline color of the point (black by default) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void AddPoint(const Vector2f& Position, const Color& Col = Color(255, 2
55, 255), const Color& OutlineCol = Color(0, 0, 0)); | | void AddPoint(const Vector2f& Position, const Color& Col = Color(255, 2
55, 255), const Color& OutlineCol = Color(0, 0, 0)); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Get the number of points composing the shape | |
| | | /// | |
| | | /// \param Total number of points | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | unsigned int GetNbPoints() const; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// Enable or disable filling the shape. | | /// Enable or disable filling the shape. | |
| /// Fill is enabled by default | | /// Fill is enabled by default | |
| /// | | /// | |
| /// \param Enable : True to enable, false to disable | | /// \param Enable : True to enable, false to disable | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void EnableFill(bool Enable); | | void EnableFill(bool Enable); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Enable or disable drawing the shape outline. | | /// Enable or disable drawing the shape outline. | |
| /// Outline is enabled by default | | /// Outline is enabled by default | |
| /// | | /// | |
| /// \param Enable : True to enable, false to disable | | /// \param Enable : True to enable, false to disable | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void EnableOutline(bool Enable); | | void EnableOutline(bool Enable); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Set the position of a point | |
| | | /// | |
| | | /// \param Index : Index of the point, in range [0, GetNbPoints() - | |
| | | 1] | |
| | | /// \param Position : New position of the Index-th point | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void SetPointPosition(unsigned int Index, const Vector2f& Position); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Set the position of a point | |
| | | /// | |
| | | /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] | |
| | | /// \param X : New X coordinate of the Index-th point | |
| | | /// \param Y : New Y coordinate of the Index-th point | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void SetPointPosition(unsigned int Index, float X, float Y); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Set the color of a point | |
| | | /// | |
| | | /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] | |
| | | /// \param Col : New color of the Index-th point | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void SetPointColor(unsigned int Index, const Color& Col); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Set the outline color of a point | |
| | | /// | |
| | | /// \param Index : Index of the point, in range [0, GetNbPoints() | |
| | | - 1] | |
| | | /// \param OutlineCol : New outline color of the Index-th point | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void SetPointOutlineColor(unsigned int Index, const Color& OutlineCol); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// Change the width of the shape outline | | /// Change the width of the shape outline | |
| /// | | /// | |
| /// \param Width : New width | | /// \param Width : New width | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetOutlineWidth(float Width); | | void SetOutlineWidth(float Width); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Get the number of points composing the shape | | /// Get the position of a point | |
| /// | | /// | |
|
| /// \param Total number of points | | /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] | |
| | | /// | |
| | | /// \return Position of the Index-th point | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| unsigned int GetNbPoints() const; | | const Vector2f& GetPointPosition(unsigned int Index) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Get a point of the shape | | /// Get the color of a point | |
| /// | | /// | |
|
| /// \param Index-th point | | /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] | |
| | | /// | |
| | | /// \return Color of the Index-th point | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| const Vector2f& GetPoint(unsigned int Index) const; | | const Color& GetPointColor(unsigned int Index) const; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Get the outline color of a point | |
| | | /// | |
| | | /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] | |
| | | /// | |
| | | /// \return Outline color of the Index-th point | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | const Color& GetPointOutlineColor(unsigned int Index) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the width of the shape outline | | /// Get the width of the shape outline | |
| /// | | /// | |
|
| /// \param return Current outline width | | /// \return Current outline width | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| float GetOutlineWidth() const; | | float GetOutlineWidth() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Create a shape made of a single line | | /// Create a shape made of a single line (use floats) | |
| /// | | /// | |
| /// \param P1X, P1Y : Position of the first point | | /// \param P1X, P1Y : Position of the first point | |
| /// \param P2X, P2Y : Position second point | | /// \param P2X, P2Y : Position second point | |
| /// \param Thickness : Line thickness | | /// \param Thickness : Line thickness | |
| /// \param Col : Color used to draw the line | | /// \param Col : Color used to draw the line | |
| /// \param Outline : Outline width (0 by default) | | /// \param Outline : Outline width (0 by default) | |
| /// \param OutlineCol : Color used to draw the outline (black by defaul
t) | | /// \param OutlineCol : Color used to draw the outline (black by defaul
t) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| static Shape Line(float P1X, float P1Y, float P2X, float P2Y, float Thi
ckness, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf
::Color(0, 0, 0)); | | static Shape Line(float P1X, float P1Y, float P2X, float P2Y, float Thi
ckness, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf
::Color(0, 0, 0)); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Create a shape made of a single rectangle | | /// Create a shape made of a single line (use vectors) | |
| | | /// | |
| | | /// \param P1X, P1Y : Position of the first point | |
| | | /// \param P2X, P2Y : Position second point | |
| | | /// \param Thickness : Line thickness | |
| | | /// \param Col : Color used to draw the line | |
| | | /// \param Outline : Outline width (0 by default) | |
| | | /// \param OutlineCol : Color used to draw the outline (black by defaul | |
| | | t) | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | static Shape Line(const Vector2f& P1, const Vector2f& P2, float Thickne | |
| | | ss, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Co | |
| | | lor(0, 0, 0)); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Create a shape made of a single rectangle (use floats) | |
| /// | | /// | |
| /// \param P1X, P1Y : Position of the first point | | /// \param P1X, P1Y : Position of the first point | |
| /// \param P2X, P2Y : Position second point | | /// \param P2X, P2Y : Position second point | |
| /// \param Col : Color used to fill the rectangle | | /// \param Col : Color used to fill the rectangle | |
| /// \param Outline : Outline width (0 by default) | | /// \param Outline : Outline width (0 by default) | |
| /// \param OutlineCol : Color used to draw the outline (black by defaul
t) | | /// \param OutlineCol : Color used to draw the outline (black by defaul
t) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| static Shape Rectangle(float P1X, float P1Y, float P2X, float P2Y, cons
t Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0
, 0)); | | static Shape Rectangle(float P1X, float P1Y, float P2X, float P2Y, cons
t Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0
, 0)); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Create a shape made of a single circle | | /// Create a shape made of a single rectangle (use vectors) | |
| | | /// | |
| | | /// \param P1 : Position of the first point | |
| | | /// \param P2 : Position second point | |
| | | /// \param Col : Color used to fill the rectangle | |
| | | /// \param Outline : Outline width (0 by default) | |
| | | /// \param OutlineCol : Color used to draw the outline (black by defaul | |
| | | t) | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | static Shape Rectangle(const Vector2f& P1, const Vector2f& P2, const Co | |
| | | lor& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0) | |
| | | ); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Create a shape made of a single circle (use floats) | |
| /// | | /// | |
| /// \param X, Y : Position of the center | | /// \param X, Y : Position of the center | |
| /// \param Radius : Radius | | /// \param Radius : Radius | |
| /// \param Col : Color used to fill the circle | | /// \param Col : Color used to fill the circle | |
| /// \param Outline : Outline width (0 by default) | | /// \param Outline : Outline width (0 by default) | |
| /// \param OutlineCol : Color used to draw the outline (black by defaul
t) | | /// \param OutlineCol : Color used to draw the outline (black by defaul
t) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| static Shape Circle(float X, float Y, float Radius, const Color& Col, f
loat Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); | | static Shape Circle(float X, float Y, float Radius, const Color& Col, f
loat Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); | |
| | | | |
|
| | | //////////////////////////////////////////////////////////// | |
| | | /// Create a shape made of a single circle (use vectors) | |
| | | /// | |
| | | /// \param Center : Position of the center | |
| | | /// \param Radius : Radius | |
| | | /// \param Col : Color used to fill the circle | |
| | | /// \param Outline : Outline width (0 by default) | |
| | | /// \param OutlineCol : Color used to draw the outline (black by defaul | |
| | | t) | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | static Shape Circle(const Vector2f& Center, float Radius, const Color& | |
| | | Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); | |
| | | | |
| protected : | | protected : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// /see Drawable::Render | | /// /see Drawable::Render | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void Render(const RenderWindow& Window) const; | | virtual void Render(RenderTarget& Target) const; | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Compile the shape : compute its center and its outline | | /// Compile the shape : compute its center and its outline | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Compile(); | | void Compile(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
End of changes. 14 change blocks. |
| 11 lines changed or deleted | | 117 lines changed or added | |
|
| SocketTCP.hpp | | SocketTCP.hpp | |
| | | | |
| skipping to change at line 32 | | skipping to change at line 32 | |
| // | | // | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_SOCKETTCP_HPP | | #ifndef SFML_SOCKETTCP_HPP | |
| #define SFML_SOCKETTCP_HPP | | #define SFML_SOCKETTCP_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Network/SocketHelper.hpp> | | #include <SFML/Network/SocketHelper.hpp> | |
|
| #include <SFML/Network/Packet.hpp> | | #include <vector> | |
| #include <cstddef> | | | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
|
| | | class Packet; | |
| class IPAddress; | | class IPAddress; | |
| template <typename> class Selector; | | template <typename> class Selector; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// SocketTCP wraps a socket using TCP protocol to | | /// SocketTCP wraps a socket using TCP protocol to | |
| /// send data safely (but a bit slower) | | /// send data safely (but a bit slower) | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| class SFML_API SocketTCP | | class SFML_API SocketTCP | |
| { | | { | |
| public : | | public : | |
| | | | |
| skipping to change at line 68 | | skipping to change at line 68 | |
| /// \param Blocking : Pass true to set the socket as blocking, or false
for non-blocking | | /// \param Blocking : Pass true to set the socket as blocking, or false
for non-blocking | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetBlocking(bool Blocking); | | void SetBlocking(bool Blocking); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Connect to another computer on a specified port | | /// Connect to another computer on a specified port | |
| /// | | /// | |
| /// \param Port : Port to use for transfers (warning : ports < 1
024 are reserved) | | /// \param Port : Port to use for transfers (warning : ports < 1
024 are reserved) | |
| /// \param HostAddress : IP Address of the host to connect to | | /// \param HostAddress : IP Address of the host to connect to | |
|
| | | /// \param Timeout : Maximum time to wait, in seconds (0 by default
: no timeout) (this parameter is ignored for non-blocking sockets) | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Connect(unsigned short Port, const IPAddress& HostAddress); | | Socket::Status Connect(unsigned short Port, const IPAddress& HostAddres
s, float Timeout = 0.f); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Listen to a specified port for incoming data or connections | | /// Listen to a specified port for incoming data or connections | |
| /// | | /// | |
| /// \param Port : Port to listen to | | /// \param Port : Port to listen to | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool Listen(unsigned short Port); | | bool Listen(unsigned short Port); | |
| | | | |
| skipping to change at line 206 | | skipping to change at line 207 | |
| /// (for internal use only) | | /// (for internal use only) | |
| /// | | /// | |
| /// \param Descriptor : Socket descriptor | | /// \param Descriptor : Socket descriptor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| SocketTCP(SocketHelper::SocketType Descriptor); | | SocketTCP(SocketHelper::SocketType Descriptor); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Create the socket | | /// Create the socket | |
| /// | | /// | |
|
| | | /// \param Descriptor : System socket descriptor to use (0 by default - | |
| | | - create a new socket) | |
| | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Create(); | | void Create(SocketHelper::SocketType Descriptor = 0); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| SocketHelper::SocketType mySocket; ///< Socket descriptor | | SocketHelper::SocketType mySocket; ///< Socket descriptor | |
|
| sf::Packet myPendingPacket; ///< Current pending pack
et, if any (in non-blocking mode) | | std::vector<char> myPendingPacket; ///< Data of the current
pending packet, if any (in non-blocking mode) | |
| Int32 myPendingPacketSize; ///< Size of the current
pending packet, if any (in non-blocking mode) | | Int32 myPendingPacketSize; ///< Size of the current
pending packet, if any (in non-blocking mode) | |
|
| | | bool myIsBlocking; ///< Is the socket blocki
ng or non-blocking ? | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_SOCKETTCP_HPP | | #endif // SFML_SOCKETTCP_HPP | |
| | | | |
End of changes. 8 change blocks. |
| 5 lines changed or deleted | | 10 lines changed or added | |
|
| SocketUDP.hpp | | SocketUDP.hpp | |
| | | | |
| skipping to change at line 32 | | skipping to change at line 32 | |
| // | | // | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_SOCKETUDP_HPP | | #ifndef SFML_SOCKETUDP_HPP | |
| #define SFML_SOCKETUDP_HPP | | #define SFML_SOCKETUDP_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Network/SocketHelper.hpp> | | #include <SFML/Network/SocketHelper.hpp> | |
|
| #include <SFML/Network/Packet.hpp> | | #include <vector> | |
| #include <cstddef> | | | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
|
| | | class Packet; | |
| class IPAddress; | | class IPAddress; | |
| template <typename> class Selector; | | template <typename> class Selector; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// SocketUDP wraps a socket using UDP protocol to | | /// SocketUDP wraps a socket using UDP protocol to | |
| /// send data fastly (but with less safety) | | /// send data fastly (but with less safety) | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| class SFML_API SocketUDP | | class SFML_API SocketUDP | |
| { | | { | |
| public : | | public : | |
| | | | |
| skipping to change at line 205 | | skipping to change at line 205 | |
| /// (for internal use only) | | /// (for internal use only) | |
| /// | | /// | |
| /// \param Descriptor : Socket descriptor | | /// \param Descriptor : Socket descriptor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| SocketUDP(SocketHelper::SocketType Descriptor); | | SocketUDP(SocketHelper::SocketType Descriptor); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Create the socket | | /// Create the socket | |
| /// | | /// | |
|
| | | /// \param Descriptor : System socket descriptor to use (0 by default - | |
| | | - create a new socket) | |
| | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Create(); | | void Create(SocketHelper::SocketType Descriptor = 0); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| SocketHelper::SocketType mySocket; ///< Socket identifier | | SocketHelper::SocketType mySocket; ///< Socket identifier | |
| unsigned short myPort; ///< Port to which the so
cket is bound | | unsigned short myPort; ///< Port to which the so
cket is bound | |
|
| sf::Packet myPendingPacket; ///< Current pending pack
et, if any (in non-blocking mode) | | std::vector<char> myPendingPacket; ///< Data of the current
pending packet, if any (in non-blocking mode) | |
| Int32 myPendingPacketSize; ///< Size of the current
pending packet, if any (in non-blocking mode) | | Int32 myPendingPacketSize; ///< Size of the current
pending packet, if any (in non-blocking mode) | |
|
| | | bool myIsBlocking; ///< Is the socket blocki
ng or non-blocking ? | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_SOCKETUDP_HPP | | #endif // SFML_SOCKETUDP_HPP | |
| | | | |
End of changes. 6 change blocks. |
| 4 lines changed or deleted | | 8 lines changed or added | |
|
| Sound.hpp | | Sound.hpp | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| // 3. This notice may not be removed or altered from any source distributio
n. | | // 3. This notice may not be removed or altered from any source distributio
n. | |
| // | | // | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_SOUND_HPP | | #ifndef SFML_SOUND_HPP | |
| #define SFML_SOUND_HPP | | #define SFML_SOUND_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| #include <cstdlib> | | #include <SFML/System/Resource.hpp> | |
| #include <SFML/Audio/AudioResource.hpp> | | | |
| #include <SFML/System/Vector3.hpp> | | #include <SFML/System/Vector3.hpp> | |
|
| | | #include <SFML/Audio/AudioResource.hpp> | |
| | | #include <cstdlib> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
| class SoundBuffer; | | class SoundBuffer; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Sound defines the properties of the sound such as position, | | /// Sound defines the properties of a sound such as position, | |
| /// volume, pitch, etc. | | /// volume, pitch, etc. | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| class SFML_API Sound : public AudioResource | | class SFML_API Sound : public AudioResource | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Enumeration of the sound states | | /// Enumeration of the sound states | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| enum Status | | enum Status | |
| | | | |
| skipping to change at line 181 | | skipping to change at line 182 | |
| /// Set the attenuation factor - the higher the attenuation, the | | /// Set the attenuation factor - the higher the attenuation, the | |
| /// more the sound will be attenuated with distance from listener. | | /// more the sound will be attenuated with distance from listener. | |
| /// The default attenuation factor 1.0 | | /// The default attenuation factor 1.0 | |
| /// | | /// | |
| /// \param Attenuation : New attenuation factor for the sound | | /// \param Attenuation : New attenuation factor for the sound | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetAttenuation(float Attenuation); | | void SetAttenuation(float Attenuation); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Set the current playing position of the sound | |
| | | /// | |
| | | /// \param TimeOffset : New playing position, expressed in seconds | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void SetPlayingOffset(float TimeOffset); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// Get the source buffer | | /// Get the source buffer | |
| /// | | /// | |
| /// \return Sound buffer bound to the sound (can be NULL) | | /// \return Sound buffer bound to the sound (can be NULL) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| const SoundBuffer* GetBuffer() const; | | const SoundBuffer* GetBuffer() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Tell whether or not the sound is looping | | /// Tell whether or not the sound is looping | |
| /// | | /// | |
| | | | |
| skipping to change at line 269 | | skipping to change at line 278 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Sound& operator =(const Sound& Other); | | Sound& operator =(const Sound& Other); | |
| | | | |
| private : | | private : | |
| | | | |
| friend class SoundStream; | | friend class SoundStream; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| unsigned int mySource; ///< OpenAL source identifier | | unsigned int mySource; ///< OpenAL source identifier | |
| const SoundBuffer* myBuffer; ///< Sound buffer bound to the source | | ResourcePtr<SoundBuffer> myBuffer; ///< Sound buffer bound to the sourc | |
| | | e | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_SOUND_HPP | | #endif // SFML_SOUND_HPP | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 15 lines changed or added | |
|
| SoundRecorder.hpp | | SoundRecorder.hpp | |
| | | | |
| skipping to change at line 44 | | skipping to change at line 44 | |
| namespace sf | | namespace sf | |
| { | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// SoundRecorder is an interface for capturing sound data, | | /// SoundRecorder is an interface for capturing sound data, | |
| /// it is meant to be used as a base class | | /// it is meant to be used as a base class | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| class SFML_API SoundRecorder : private Thread | | class SFML_API SoundRecorder : private Thread | |
| { | | { | |
| public : | | public : | |
| | | | |
|
| typedef bool (*FuncType)(const Int16*, std::size_t, void*); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Construct the sound recorder with a callback function | | | |
| /// for processing captured samples | | | |
| /// | | | |
| /// \param Callback : Callback for processing captured samples | | | |
| /// \param UserData : Data to pass to the callback function (NULL by de | | | |
| fault) | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| SoundRecorder(FuncType Callback, void* UserData = NULL); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Virtual destructor | | /// Virtual destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual ~SoundRecorder(); | | virtual ~SoundRecorder(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Start the capture. | | /// Start the capture. | |
| /// Warning : only one capture can happen at the same time | | /// Warning : only one capture can happen at the same time | |
| /// | | /// | |
| | | | |
| skipping to change at line 106 | | skipping to change at line 94 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| SoundRecorder(); | | SoundRecorder(); | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Start recording audio data | |
| | | /// | |
| | | /// \return False to abort recording audio data, true to start | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | virtual bool OnStart(); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// Process a new chunk of recorded samples | | /// 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 Samples | | /// \param SamplesCount : Number of samples pointed by Samples | |
| /// | | /// | |
| /// \return False to stop recording audio data, true to continue | | /// \return False to stop recording audio data, true to continue | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual bool ProcessSamples(const Int16* Samples, std::size_t SamplesCo | | virtual bool OnProcessSamples(const Int16* Samples, std::size_t Samples | |
| unt); | | Count) = 0; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Stop recording audio data | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | virtual void OnStop(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// /see sfThread::Run | | /// /see Thread::Run | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual void Run(); | | virtual void Run(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the available captured samples and process them | | /// Get the available captured samples and process them | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void ProcessCapturedSamples(); | | void ProcessCapturedSamples(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Clean up the recorder internal resources | | /// Clean up the recorder internal resources | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void CleanUp(); | | void CleanUp(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| FuncType myCallback; ///< Callback for processing captured | | | |
| samples | | | |
| void* myUserData; ///< User data to pass to the process | | | |
| ing callback | | | |
| std::vector<Int16> mySamples; ///< Buffer to store captured samples | | std::vector<Int16> mySamples; ///< Buffer to store captured samples | |
| unsigned int mySampleRate; ///< Sample rate | | unsigned int mySampleRate; ///< Sample rate | |
| bool myIsCapturing; ///< Capturing state | | bool myIsCapturing; ///< Capturing state | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_SOUNDRECORDER_HPP | | #endif // SFML_SOUNDRECORDER_HPP | |
| | | | |
End of changes. 5 change blocks. |
| 20 lines changed or deleted | | 17 lines changed or added | |
|
| SoundStream.hpp | | SoundStream.hpp | |
| | | | |
| skipping to change at line 40 | | skipping to change at line 40 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Audio/Sound.hpp> | | #include <SFML/Audio/Sound.hpp> | |
| #include <SFML/System/Thread.hpp> | | #include <SFML/System/Thread.hpp> | |
| #include <cstdlib> | | #include <cstdlib> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// SoundStream is a streamed sound, ie samples are acquired | | /// SoundStream is a streamed sound, ie samples are acquired | |
| /// while the sound is playing. Use it for big sounds that would | | /// while the sound is playing. Use it for big sounds that would | |
|
| /// require hundreds of MB in memory (see sfMusic), | | /// require hundreds of MB in memory (see Music), | |
| /// or for streaming sound from the network | | /// or for streaming sound from the network | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| class SFML_API SoundStream : private Thread, private Sound | | class SFML_API SoundStream : private Thread, private Sound | |
| { | | { | |
| public : | | public : | |
| | | | |
| using Sound::Status; | | using Sound::Status; | |
| using Sound::Stopped; | | using Sound::Stopped; | |
| using Sound::Paused; | | using Sound::Paused; | |
| using Sound::Playing; | | using Sound::Playing; | |
| | | | |
| skipping to change at line 114 | | skipping to change at line 114 | |
| unsigned int GetSampleRate() const; | | unsigned int GetSampleRate() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the status of the stream (stopped, paused, playing) | | /// Get the status of the stream (stopped, paused, playing) | |
| /// | | /// | |
| /// \return Current status of the sound | | /// \return Current status of the sound | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Status GetStatus() const; | | Status GetStatus() const; | |
| | | | |
|
| | | //////////////////////////////////////////////////////////// | |
| | | /// Get the current playing position of the stream | |
| | | /// | |
| | | /// \return Current playing position, expressed in seconds | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | float GetPlayingOffset() const; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Set the stream loop state. | |
| | | /// This parameter is disabled by default | |
| | | /// | |
| | | /// \param Loop : True to play in loop, false to play once | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void SetLoop(bool Loop); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Tell whether or not the stream is looping | |
| | | /// | |
| | | /// \return True if the music is looping, false otherwise | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | bool GetLoop() const; | |
| | | | |
| protected : | | protected : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| SoundStream(); | | SoundStream(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Set the audio stream parameters, you must call it before Play() | | /// Set the audio stream parameters, you must call it before Play() | |
| | | | |
| skipping to change at line 158 | | skipping to change at line 183 | |
| /// Called each time new audio data is needed to feed the stream | | /// Called each time new audio data is needed to feed the stream | |
| /// | | /// | |
| /// \param Data : New chunk of data to stream | | /// \param Data : New chunk of data to stream | |
| /// | | /// | |
| /// \return True to continue playback, false to stop | | /// \return True to continue playback, false to stop | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual bool OnGetData(Chunk& Data) = 0; | | virtual bool OnGetData(Chunk& Data) = 0; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Clean up stream internal resources | | /// Fill a new buffer with audio data, and push it to the | |
| | | /// playing queue | |
| | | /// | |
| | | /// \param Buffer : Buffer to fill | |
| | | /// | |
| | | /// \return True if the derived class has requested to stop | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | bool FillAndPushBuffer(unsigned int Buffer); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Fill the buffers queue with all available buffers | |
| | | /// | |
| | | /// \return True if the derived class has requested to stop | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | bool FillQueue(); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Clear the queue of any remaining buffers | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void CleanUp(); | | void ClearQueue(); | |
| | | | |
| enum {BuffersCount = 3}; | | enum {BuffersCount = 3}; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool myIsStreaming; ///< Streaming state (true = pla
ying, false = stopped) | | bool myIsStreaming; ///< Streaming state (true = pla
ying, false = stopped) | |
| unsigned int myBuffers[BuffersCount]; ///< Sound buffers used to store
temporary audio data | | unsigned int myBuffers[BuffersCount]; ///< Sound buffers used to store
temporary audio data | |
| unsigned int myChannelsCount; ///< Number of channels (1 = mon
o, 2 = stereo, ...) | | unsigned int myChannelsCount; ///< Number of channels (1 = mon
o, 2 = stereo, ...) | |
| unsigned int mySampleRate; ///< Frequency (samples / second
) | | unsigned int mySampleRate; ///< Frequency (samples / second
) | |
| unsigned long myFormat; ///< Format of the internal soun
d buffers | | unsigned long myFormat; ///< Format of the internal soun
d buffers | |
|
| | | bool myLoop; ///< Loop flag (true to loop, fa | |
| | | lse to play once) | |
| | | unsigned int mySamplesProcessed; ///< Number of buffers processed | |
| | | since beginning of the stream | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_SOUNDSTREAM_HPP | | #endif // SFML_SOUNDSTREAM_HPP | |
| | | | |
End of changes. 5 change blocks. |
| 3 lines changed or deleted | | 51 lines changed or added | |
|
| Sprite.hpp | | Sprite.hpp | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| // 3. This notice may not be removed or altered from any source distributio
n. | | // 3. This notice may not be removed or altered from any source distributio
n. | |
| // | | // | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_SPRITE_HPP | | #ifndef SFML_SPRITE_HPP | |
| #define SFML_SPRITE_HPP | | #define SFML_SPRITE_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | #include <SFML/System/Resource.hpp> | |
| #include <SFML/Graphics/Drawable.hpp> | | #include <SFML/Graphics/Drawable.hpp> | |
| #include <SFML/Graphics/Rect.hpp> | | #include <SFML/Graphics/Rect.hpp> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
| class Image; | | class Image; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Sprite defines a sprite : texture, transformations, | | /// Sprite defines a sprite : texture, transformations, | |
| /// color, and draw on screen | | /// color, and draw on screen | |
| | | | |
| skipping to change at line 142 | | skipping to change at line 143 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the sprite size | | /// Get the sprite size | |
| /// | | /// | |
| /// \return Size of the sprite | | /// \return Size of the sprite | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Vector2f GetSize() const; | | Vector2f GetSize() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the color of a given pixel in the sprite | | /// Get the color of a given pixel in the sprite | |
|
| | | /// (point is in local coordinates) | |
| /// | | /// | |
| /// \param X : X coordinate of the pixel to get | | /// \param X : X coordinate of the pixel to get | |
| /// \param Y : Y coordinate of the pixel to get | | /// \param Y : Y coordinate of the pixel to get | |
| /// | | /// | |
| /// \return Color of pixel (X, Y) | | /// \return Color of pixel (X, Y) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Color GetPixel(unsigned int X, unsigned int Y) const; | | Color GetPixel(unsigned int X, unsigned int Y) const; | |
| | | | |
| protected : | | protected : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// /see Drawable::Render | | /// /see Drawable::Render | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void Render(const RenderWindow& Window) const; | | virtual void Render(RenderTarget& Target) const; | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| const Image* myImage; ///< Image used to draw the sprite | | ResourcePtr<Image> myImage; ///< Image used to draw the sprite | |
| IntRect mySubRect; ///< Sub-rectangle of source image to assign | | IntRect mySubRect; ///< Sub-rectangle of source image to | |
| to the sprite | | assign to the sprite | |
| bool myIsFlippedX; ///< Is the sprite flipped on the X axis ? | | bool myIsFlippedX; ///< Is the sprite flipped on the X ax | |
| bool myIsFlippedY; ///< Is the sprite flipped on the Y axis ? | | is ? | |
| | | bool myIsFlippedY; ///< Is the sprite flipped on the Y ax | |
| | | is ? | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_SPRITE_HPP | | #endif // SFML_SPRITE_HPP | |
| | | | |
End of changes. 4 change blocks. |
| 6 lines changed or deleted | | 10 lines changed or added | |
|
| String.hpp | | String.hpp | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| // 3. This notice may not be removed or altered from any source distributio
n. | | // 3. This notice may not be removed or altered from any source distributio
n. | |
| // | | // | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_STRING_HPP | | #ifndef SFML_STRING_HPP | |
| #define SFML_STRING_HPP | | #define SFML_STRING_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | #include <SFML/System/Resource.hpp> | |
| | | #include <SFML/System/Unicode.hpp> | |
| #include <SFML/Graphics/Drawable.hpp> | | #include <SFML/Graphics/Drawable.hpp> | |
| #include <SFML/Graphics/Font.hpp> | | #include <SFML/Graphics/Font.hpp> | |
| #include <SFML/Graphics/Rect.hpp> | | #include <SFML/Graphics/Rect.hpp> | |
| #include <string> | | #include <string> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// String defines a graphical 2D text, that can be drawn on screen | | /// String defines a graphical 2D text, that can be drawn on screen | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 57 | | skipping to change at line 59 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| enum Style | | enum Style | |
| { | | { | |
| Regular = 0, ///< Regular characters, no style | | Regular = 0, ///< Regular characters, no style | |
| Bold = 1 << 0, ///< Characters are bold | | Bold = 1 << 0, ///< Characters are bold | |
| Italic = 1 << 1, ///< Characters are in italic | | Italic = 1 << 1, ///< Characters are in italic | |
| Underlined = 1 << 2 ///< Characters are underlined | | Underlined = 1 << 2 ///< Characters are underlined | |
| }; | | }; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Construct the string from a multibyte text | | /// Default constructor | |
| /// | | | |
| /// \param Text : Text assigned to the string | | | |
| /// \param Font : Font used to draw the string (SFML built-in font by d | | | |
| efault) | | | |
| /// \param Size : Characters size (30 by default) | | | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| String(const std::string& Text, const Font& CharFont = Font::GetDefault
Font(), float Size = 30.f); | | String(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Construct the string from a unicode text | | /// Construct the string from any kind of text | |
| /// | | /// | |
|
| /// \param Text : Text assigned to the string ("" by default) | | /// \param Text : Text assigned to the string | |
| /// \param Font : Font used to draw the string (SFML built-in font by d
efault) | | /// \param Font : Font used to draw the string (SFML built-in font by d
efault) | |
| /// \param Size : Characters size (30 by default) | | /// \param Size : Characters size (30 by default) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| String(const std::wstring& Text = L"", const Font& CharFont = Font::Get | | explicit String(const Unicode::Text& Text, const Font& CharFont = Font: | |
| DefaultFont(), float Size = 30.f); | | :GetDefaultFont(), float Size = 30.f); | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Set the text (from a multibyte string) | | | |
| /// | | | |
| /// \param Text : New text | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| void SetText(const std::string& Text); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Set the text (from a unicode string) | | /// Set the text (from any kind of string) | |
| /// | | /// | |
| /// \param Text : New text | | /// \param Text : New text | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void SetText(const std::wstring& Text); | | void SetText(const Unicode::Text& Text); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Set the font of the string | | /// Set the font of the string | |
| /// | | /// | |
| /// \param Font : Font to use | | /// \param Font : Font to use | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetFont(const Font& CharFont); | | void SetFont(const Font& CharFont); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 119 | | skipping to change at line 109 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Set the style of the text | | /// Set the style of the text | |
| /// The default style is Regular | | /// The default style is Regular | |
| /// | | /// | |
| /// \param TextStyle : New text style, (combination of Style enum value
s) | | /// \param TextStyle : New text style, (combination of Style enum value
s) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetStyle(unsigned long TextStyle); | | void SetStyle(unsigned long TextStyle); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Get the text (returns a unicode string) | | /// Get the text (the returned text can be converted implicitely to any
kind of string) | |
| /// | | /// | |
|
| /// \return Text | | /// \return String's text | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| const std::wstring& GetUnicodeText() const; | | const Unicode::Text& GetText() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Get the text (returns a multibyte string) | | | |
| /// | | | |
| /// \return Text | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| std::string GetText() const; | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the font used by the string | | /// Get the font used by the string | |
| /// | | /// | |
| /// \return Font used | | /// \return Font used | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| const Font& GetFont() const; | | const Font& GetFont() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 159 | | skipping to change at line 141 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the style of the text | | /// Get the style of the text | |
| /// | | /// | |
| /// \return Current string style (combination of Style enum values) | | /// \return Current string style (combination of Style enum values) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| unsigned long GetStyle() const; | | unsigned long GetStyle() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Return the visual position of the Index-th character of the string, | |
| | | /// in coordinates relative to the string | |
| | | /// (note : translation, center, rotation and scale are not applied) | |
| | | /// | |
| | | /// \param Index : Index of the character | |
| | | /// | |
| | | /// \return Position of the Index-th character (end of string if Index | |
| | | is out of range) | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | sf::Vector2f GetCharacterPos(std::size_t Index) const; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// Get the string rectangle on screen | | /// Get the string rectangle on screen | |
| /// | | /// | |
| /// \return Rectangle contaning the string in screen coordinates | | /// \return Rectangle contaning the string in screen coordinates | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| FloatRect GetRect() const; | | FloatRect GetRect() const; | |
| | | | |
| protected : | | protected : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// /see Drawable::Render | | /// /see Drawable::Render | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void Render(const RenderWindow& Window) const; | | virtual void Render(RenderTarget& Target) const; | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Recompute the bounding rectangle of the text | | /// Recompute the bounding rectangle of the text | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void RecomputeRect(); | | void RecomputeRect(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| std::wstring myText; ///< Text to display | | Unicode::Text myText; ///< Text to display | |
| const Font* myFont; ///< Font used to display the string | | ResourcePtr<Font> myFont; ///< Font used to display the strin | |
| float mySize; ///< Size of the characters | | g | |
| unsigned long myStyle; ///< Text style (see Style enum) | | float mySize; ///< Size of the characters | |
| FloatRect myBaseRect; ///< Bounding rectangle of the text in | | unsigned long myStyle; ///< Text style (see Style enum) | |
| object coordinates | | FloatRect myBaseRect; ///< Bounding rectangle of the text | |
| bool myNeedRectUpdate; ///< Does the bounding rect need an upd | | in object coordinates | |
| ate ? | | bool myNeedRectUpdate; ///< Does the bounding rect need an | |
| | | update ? | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_STRING_HPP | | #endif // SFML_STRING_HPP | |
| | | | |
End of changes. 14 change blocks. |
| 41 lines changed or deleted | | 36 lines changed or added | |
|