| Color.hpp | | Color.hpp | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 33 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_COLOR_HPP | | #ifndef SFML_COLOR_HPP | |
| #define SFML_COLOR_HPP | | #define SFML_COLOR_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Config.hpp> | | #include <SFML/Config.hpp> | |
| | | | |
|
| | | namespace sf | |
| | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfColor is an utility class for manipulating colors | | /// Color is an utility class for manipulating colors | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfColor | | class SFML_API Color | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfColor(); | | Color(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the color from a RGBA 32 bits integer | | /// Construct the color from a RGBA 32 bits integer | |
| /// | | /// | |
| /// \param ColorRGBA : RGBA color | | /// \param ColorRGBA : RGBA color | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| explicit sfColor(sfUint32 ColorRGBA); | | explicit Color(Uint32 ColorRGBA); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the color from its 4 RGBA components | | /// Construct the color from its 4 RGBA components | |
| /// | | /// | |
| /// \param R : Red component (0 .. 255) | | /// \param R : Red component (0 .. 255) | |
| /// \param G : Green component (0 .. 255) | | /// \param G : Green component (0 .. 255) | |
| /// \param B : Blue component (0 .. 255) | | /// \param B : Blue component (0 .. 255) | |
| /// \param A : Alpha component (0 .. 255) (255 by default) | | /// \param A : Alpha component (0 .. 255) (255 by default) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfColor(sfUint8 R, sfUint8 G, sfUint8 B, sfUint8 A = 255); | | Color(Uint8 R, Uint8 G, Uint8 B, Uint8 A = 255); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the RGBA representation of the color | | /// Get the RGBA representation of the color | |
| /// | | /// | |
| /// \return 32 bits integer representing the color in RGBA | | /// \return 32 bits integer representing the color in RGBA | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfUint32 ToRGBA() const; | | Uint32 ToRGBA() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Compare two colors (for equality) | | /// Compare two colors (for equality) | |
| /// | | /// | |
| /// \param Other : Color to compare | | /// \param Other : Color to compare | |
| /// | | /// | |
| /// \return True if colors are equal | | /// \return True if colors are equal | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator ==(const sfColor& Other) const; | | bool operator ==(const Color& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Compare two colors (for difference) | | /// Compare two colors (for difference) | |
| /// | | /// | |
| /// \param Other : Color to compare | | /// \param Other : Color to compare | |
| /// | | /// | |
| /// \return True if colors are different | | /// \return True if colors are different | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator !=(const sfColor& Other) const; | | bool operator !=(const Color& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Static member data | | // Static member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| static const sfColor Black; ///< Black predefined color | | static const Color Black; ///< Black predefined color | |
| static const sfColor White; ///< White predefined color | | static const Color White; ///< White predefined color | |
| static const sfColor Red; ///< Red predefined color | | static const Color Red; ///< Red predefined color | |
| static const sfColor Green; ///< Green predefined color | | static const Color Green; ///< Green predefined color | |
| static const sfColor Blue; ///< Blue predefined color | | static const Color Blue; ///< Blue predefined color | |
| static const sfColor Yellow; ///< Yellow predefined color | | static const Color Yellow; ///< Yellow predefined color | |
| static const sfColor Magenta; ///< Magenta predefined color | | static const Color Magenta; ///< Magenta predefined color | |
| static const sfColor Cyan; ///< Cyan predefined color | | static const Color Cyan; ///< Cyan predefined color | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfUint8 r; ///< Red component | | Uint8 r; ///< Red component | |
| sfUint8 g; ///< Green component | | Uint8 g; ///< Green component | |
| sfUint8 b; ///< Blue component | | Uint8 b; ///< Blue component | |
| sfUint8 a; ///< Alpha (transparency) component | | Uint8 a; ///< Alpha (transparency) component | |
| }; | | }; | |
| | | | |
|
| | | //////////////////////////////////////////////////////////// | |
| | | /// Operator + overload to add two colors | |
| | | /// | |
| | | /// \param Color1 : First color | |
| | | /// \param Color2 : Second color | |
| | | /// | |
| | | /// \return Component-wise saturated addition of the two colors | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | SFML_API Color operator +(const Color& Color1, const Color& Color2); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Operator * overload to modulate two colors | |
| | | /// | |
| | | /// \param Color1 : First color | |
| | | /// \param Color2 : Second color | |
| | | /// | |
| | | /// \return Component-wise multiplication of the two colors | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | SFML_API Color operator *(const Color& Color1, const Color& Color2); | |
| | | | |
| | | } // namespace sf | |
| | | | |
| #endif // SFML_COLOR_HPP | | #endif // SFML_COLOR_HPP | |
| | | | |
End of changes. 12 change blocks. |
| 20 lines changed or deleted | | 46 lines changed or added | |
|
| Config.hpp | | Config.hpp | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| #define NOMINMAX | | #define NOMINMAX | |
| #endif | | #endif | |
| #include <windows.h> | | #include <windows.h> | |
| #undef DELETE | | #undef DELETE | |
| | | | |
| #elif defined(linux) || defined(__linux) | | #elif defined(linux) || defined(__linux) | |
| | | | |
| // Linux | | // Linux | |
| #define SFML_SYSTEM_LINUX | | #define SFML_SYSTEM_LINUX | |
| | | | |
|
| #elif defined(__MACOSX__) || defined(__APPLE__) || defined(macintosh) || de
fined(Macintosh) | | #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || define
d(Macintosh) | |
| | | | |
| // MacOS | | // MacOS | |
| #define SFML_SYSTEM_MACOS | | #define SFML_SYSTEM_MACOS | |
|
| | | #include <Carbon/Carbon.h> | |
| | | | |
| #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 | | // Identify the platform | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #if defined(__i386__) || defined(_M_IX86) || defined(_X86_) || defined(__IN
TEL__) || defined(__i386) | | #if defined(__i386__) || defined(_M_IX86) || defined(_X86_) || defined(__IN
TEL__) || defined(__i386) | |
| | | | |
| // Intel x86 | | // Intel x86 | |
| #define SFML_PLATFORM_X86 | | #define SFML_PLATFORM_X86 | |
| | | | |
|
| #elif defined(__amd64__) | | #elif defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || def
ined(_M_AMD64) | |
| | | | |
| // AMD64 | | // AMD64 | |
| #define SFML_PLATFORM_AMD64 | | #define SFML_PLATFORM_AMD64 | |
| | | | |
| #elif defined(__IA64__) || defined(_M_IA64) | | #elif defined(__IA64__) || defined(_M_IA64) | |
| | | | |
| // Intel IA64 | | // Intel IA64 | |
| #define SFML_PLATFORM_IA64 | | #define SFML_PLATFORM_IA64 | |
| | | | |
| #elif defined(__powerpc__) || defined(_M_PPC) || defined(_ARCH_PPC) | | #elif defined(__powerpc__) || defined(_M_PPC) || defined(_ARCH_PPC) | |
| | | | |
| skipping to change at line 101 | | skipping to change at line 102 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // 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 a portable include path for the OpenGL / GLU headers | |
| | | //////////////////////////////////////////////////////////// | |
| | | #if defined(SFML_SYSTEM_MACOS) | |
| | | | |
| | | #define SFML_OPENGL_HEADER <OpenGL/gl.h> | |
| | | #define SFML_GLU_HEADER <OpenGL/glu.h> | |
| | | | |
| | | #else | |
| | | | |
| | | #define SFML_OPENGL_HEADER <GL/gl.h> | |
| | | #define SFML_GLU_HEADER <GL/glu.h> | |
| | | | |
| | | #endif | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| // Define portable import / export macros | | // Define portable import / export macros | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #if defined(SFML_SYSTEM_WINDOWS) | | #if defined(SFML_SYSTEM_WINDOWS) | |
| | | | |
| #ifdef SFML_DYNAMIC | | #ifdef SFML_DYNAMIC | |
| | | | |
| // Windows platforms | | // Windows platforms | |
| #ifdef SFML_EXPORTS | | #ifdef SFML_EXPORTS | |
| | | | |
| // From DLL side, we must export | | // From DLL side, we must export | |
| | | | |
| skipping to change at line 163 | | skipping to change at line 179 | |
| // The other supported processors (x86, IA64, AMD64) are little endian | | // The other supported processors (x86, IA64, AMD64) are little endian | |
| #define SFML_LITTLE_ENDIAN | | #define SFML_LITTLE_ENDIAN | |
| | | | |
| #endif | | #endif | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Define portable types | | // Define portable types | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <climits> | | #include <climits> | |
| | | | |
|
| // 8 bits integer types | | namespace sf | |
| #if UCHAR_MAX == 0xFF | | { | |
| typedef char sfInt8; | | // 8 bits integer types | |
| typedef unsigned char sfUint8; | | #if UCHAR_MAX == 0xFF | |
| #else | | typedef char Int8; | |
| #error No 8 bits integer type for this platform | | typedef unsigned char Uint8; | |
| #endif | | #else | |
| | | #error No 8 bits integer type for this platform | |
| | | #endif | |
| | | | |
|
| // 16 bits integer types | | // 16 bits integer types | |
| #if UCHAR_MAX == 0xFFFF | | #if USHRT_MAX == 0xFFFF | |
| typedef char sfInt16; | | typedef short Int16; | |
| typedef unsigned char sfUint16; | | typedef unsigned short Uint16; | |
| #elif USHRT_MAX == 0xFFFF | | #elif UINT_MAX == 0xFFFF | |
| typedef short sfInt16; | | typedef int Int16; | |
| typedef unsigned short sfUint16; | | typedef unsigned int Uint16; | |
| #elif UINT_MAX == 0xFFFF | | #elif ULONG_MAX == 0xFFFF | |
| typedef int sfInt16; | | typedef long Int16; | |
| typedef unsigned int sfUint16; | | typedef unsigned long Uint16; | |
| #elif ULONG_MAX == 0xFFFF | | #else | |
| typedef long sfInt16; | | #error No 16 bits integer type for this platform | |
| typedef unsigned long sfUint16; | | #endif | |
| #else | | | |
| #error No 16 bits integer type for this platform | | | |
| #endif | | | |
| | | | |
|
| // 32 bits integer types | | // 32 bits integer types | |
| #if UCHAR_MAX == 0xFFFFFFFF | | #if USHRT_MAX == 0xFFFFFFFF | |
| typedef char sfInt32; | | typedef short Int32; | |
| typedef unsigned char sfUint32; | | typedef unsigned short Uint32; | |
| #elif USHRT_MAX == 0xFFFFFFFF | | #elif UINT_MAX == 0xFFFFFFFF | |
| typedef short sfInt32; | | typedef int Int32; | |
| typedef unsigned short sfUint32; | | typedef unsigned int Uint32; | |
| #elif UINT_MAX == 0xFFFFFFFF | | #elif ULONG_MAX == 0xFFFFFFFF | |
| typedef int sfInt32; | | typedef long Int32; | |
| typedef unsigned int sfUint32; | | typedef unsigned long Uint32; | |
| #elif ULONG_MAX == 0xFFFFFFFF | | #else | |
| typedef long sfInt32; | | #error No 32 bits integer type for this platform | |
| typedef unsigned long sfUint32; | | #endif | |
| #else | | | |
| #error No 32 bits integer type for this platform | | } // namespace sf | |
| #endif | | | |
| | | | |
| #endif // SFML_CONFIG_HPP | | #endif // SFML_CONFIG_HPP | |
| | | | |
End of changes. 7 change blocks. |
| 41 lines changed or deleted | | 55 lines changed or added | |
|
| Drawable.hpp | | Drawable.hpp | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 33 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_DRAWABLE_HPP | | #ifndef SFML_DRAWABLE_HPP | |
| #define SFML_DRAWABLE_HPP | | #define SFML_DRAWABLE_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Graphics/Color.hpp> | | #include <SFML/Graphics/Color.hpp> | |
| | | | |
|
| class sfRenderWindow; | | namespace sf | |
| | | { | |
| | | class RenderWindow; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Abstract base class for every object that can be drawn | | /// Abstract base class for every object that can be drawn | |
| /// into a render window | | /// into a render window | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfDrawable | | class SFML_API Drawable | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| /// \param Left : Left coordinate of the object (0 by default) | | /// \param Left : Left coordinate of the object (0 by default) | |
| /// \param Top : Top coordinate of the object (0 by default) | | /// \param Top : Top coordinate of the object (0 by default) | |
|
| /// \param Scale : Scale (1 by default) | | /// \param ScaleX : Horizontal scale (1 by default) | |
| | | /// \param ScaleY : Vertical scale (1 by default) | |
| /// \param Rotation : Orientation, in degrees (0 by default) | | /// \param Rotation : Orientation, in degrees (0 by default) | |
|
| /// \param Color : Color of the object (white by default) | | /// \param Col : Color of the object (white by default) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfDrawable(float Left = 0.f, float Top = 0.f, float Scale = 1.f, float
Rotation = 0.f, const sfColor& Color = sfColor(255, 255, 255, 255)); | | Drawable(float Left = 0.f, float Top = 0.f, float ScaleX = 1.f, float S
caleY = 1.f, float Rotation = 0.f, const Color& Col = Color(255, 255, 255,
255)); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Virtual destructor | | /// Virtual destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual ~sfDrawable(); | | virtual ~Drawable(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Set the left position of the object | | /// Set the left position of the object | |
| /// | | /// | |
| /// \param Left : New left position | | /// \param Left : New left position | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetLeft(float Left); | | void SetLeft(float Left); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Set the top position of the object | | /// Set the top position of the object | |
| /// | | /// | |
| /// \param Top : New top position | | /// \param Top : New top position | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetTop(float Top); | | void SetTop(float Top); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Set the uniform scale of the object | | /// Set the scale of the object | |
| /// | | /// | |
|
| /// \param Scale : New scale (must be strictly positive) | | /// \param ScaleX : New horizontal scale (must be strictly positive) | |
| | | /// \param ScaleY : New vertical scale (must be strictly positive) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void SetScale(float Scale); | | void SetScale(float ScaleX, float ScaleY); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Set the orientation of the object | | /// Set the orientation of the object | |
| /// | | /// | |
| /// \param Rotation : Angle of rotation, in degrees | | /// \param Rotation : Angle of rotation, in degrees | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetRotation(float Rotation); | | void SetRotation(float Rotation); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 106 | | skipping to change at line 110 | |
| /// | | /// | |
| /// \param X : X coordinate of the center of rotation | | /// \param X : X coordinate of the center of rotation | |
| /// \param Y : Y coordinate of the center of rotation | | /// \param Y : Y coordinate of the center of rotation | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetRotationCenter(float X, float Y); | | void SetRotationCenter(float X, float Y); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Set the color of the object | | /// Set the color of the object | |
| /// | | /// | |
|
| /// \param Color : New color | | /// \param Col : New color | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void SetColor(const sfColor& Color); | | void SetColor(const Color& Col); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the left position of the object | | /// Get the left position of the object | |
| /// | | /// | |
| /// \return Current left position | | /// \return Current left position | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| float GetLeft() const; | | float GetLeft() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the top position of the object | | /// Get the top position of the object | |
| /// | | /// | |
| /// \return Current top position | | /// \return Current top position | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| float GetTop() const; | | float GetTop() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Get the uniform scale of the object | | /// Get the horizontal scale of the object | |
| /// | | /// | |
|
| /// \return Current scale position (always positive) | | /// \return Current X scale factor (always positive) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| float GetScale() const; | | float GetScaleX() const; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Get the vertical scale of the object | |
| | | /// | |
| | | /// \return Current Y scale factor (always positive) | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | float GetScaleY() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the orientation of the object | | /// Get the orientation of the object | |
| /// | | /// | |
| /// \return Current rotation, in degrees | | /// \return Current rotation, in degrees | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| float GetRotation() const; | | float GetRotation() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the color of the object | | /// Get the color of the object | |
| /// | | /// | |
| /// \return Current color | | /// \return Current color | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| const sfColor& GetColor() const; | | const Color& GetColor() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Move the object | | /// Move the object | |
| /// | | /// | |
| /// \param OffsetX : Offset on the X axis | | /// \param OffsetX : Offset on the X axis | |
| /// \param OffsetY : Offset on the Y axis | | /// \param OffsetY : Offset on the Y axis | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Move(float OffsetX, float OffsetY); | | void Move(float OffsetX, float OffsetY); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Scale the object | | /// Scale the object | |
| /// | | /// | |
|
| /// \param Factor : Scaling factor (must be strictly positive) | | /// \param FactorX : Horizontal scaling factor (must be strictly positi | |
| | | ve) | |
| | | /// \param FactorY : Vertical scaling factor (must be strictly positive | |
| | | ) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Scale(float Factor); | | void Scale(float FactorX, float FactorY); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// 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); | |
| | | | |
| private : | | private : | |
| | | | |
|
| friend class sfRenderWindow; | | friend class RenderWindow; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Draw the object into the specified window | | /// Draw the object into the specified window | |
| /// | | /// | |
| /// \param Window : Window into which draw the object | | /// \param Window : Window into which draw the object | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Draw(sfRenderWindow& Window); | | void Draw(RenderWindow& Window); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Render the specific geometry of the object | | /// Render the specific geometry of the object | |
| /// | | /// | |
| /// \param Window : Window into which render the object | | /// \param Window : Window into which render the object | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void Render(sfRenderWindow& Window) = 0; | | virtual void Render(RenderWindow& Window) = 0; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| float myLeft; ///< Left position of the object on screen | | float myLeft; ///< Left position of the object on screen | |
| float myTop; ///< Top position of the object on screen | | float myTop; ///< Top position of the object on screen | |
| float myScale; ///< Scale of the object | | float myScaleX; ///< Horizontal scale of the object | |
| float myRotation; ///< Orientation of the object, in degrees | | float myScaleY; ///< Vertical scale of the object | |
| float myCenterX; ///< X coordinate of the center of rotation, relati | | float myRotation; ///< Orientation of the object, in degrees | |
| ve to the object | | float myCenterX; ///< X coordinate of the center of rotation, relative | |
| float myCenterY; ///< Y coordinate of the center of rotation, relati | | to the object | |
| ve to the object | | float myCenterY; ///< Y coordinate of the center of rotation, relative | |
| sfColor myColor; ///< Overlay color of the object | | to the object | |
| | | Color myColor; ///< Overlay color of the object | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_DRAWABLE_HPP | | #endif // SFML_DRAWABLE_HPP | |
| | | | |
End of changes. 22 change blocks. |
| 29 lines changed or deleted | | 47 lines changed or added | |
|
| Event.hpp | | Event.hpp | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 33 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_EVENT_HPP | | #ifndef SFML_EVENT_HPP | |
| #define SFML_EVENT_HPP | | #define SFML_EVENT_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Config.hpp> | | #include <SFML/Config.hpp> | |
| | | | |
|
| | | namespace sf | |
| | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Definition of key codes for keyboard events | | /// Definition of key codes for keyboard events | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| struct sfKey | | struct Key | |
| { | | { | |
| enum Code | | enum Code | |
| { | | { | |
| A = 'a', Z = 'z', E = 'e', R = 'r', T = 't', Y = 'y', U = 'u', I =
'i', O = 'o', P = 'p', | | A = 'a', Z = 'z', E = 'e', R = 'r', T = 't', Y = 'y', U = 'u', I =
'i', O = 'o', P = 'p', | |
| Q = 'q', S = 's', D = 'd', F = 'f', G = 'g', H = 'h', J = 'j', K =
'k', L = 'l', M = 'm', | | Q = 'q', S = 's', D = 'd', F = 'f', G = 'g', H = 'h', J = 'j', K =
'k', L = 'l', M = 'm', | |
| W = 'w', X = 'x', C = 'c', V = 'v', B = 'b', N = 'n', | | W = 'w', X = 'x', C = 'c', V = 'v', B = 'b', N = 'n', | |
| Num0 = '0', Num1 = '1', Num2 = '2', Num3 = '3', Num4 = '4', | | Num0 = '0', Num1 = '1', Num2 = '2', Num3 = '3', Num4 = '4', | |
| Num5 = '5', Num6 = '6', Num7 = '7', Num8 = '8', Num9 = '9', | | Num5 = '5', Num6 = '6', Num7 = '7', Num8 = '8', Num9 = '9', | |
| Escape = 256, | | Escape = 256, | |
| Space, Return, Back, Tab, PageUp, PageDown, End, Home, Insert, Dele
te, Add, Subtract, Multiply, Divide, | | Space, Return, Back, Tab, PageUp, PageDown, End, Home, Insert, Dele
te, Add, Subtract, Multiply, Divide, | |
| Left, Right, Up, Down, | | Left, Right, Up, Down, | |
| Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Nump
ad7, Numpad8, Numpad9, | | Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Nump
ad7, Numpad8, Numpad9, | |
| F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, | | F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, | |
|
| | | Pause, | |
| | | | |
| Count // For internal use | | Count // For internal use | |
| }; | | }; | |
| }; | | }; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Definition of button codes for mouse events | | /// Definition of button codes for mouse events | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| struct sfMouse | | struct Mouse | |
| { | | { | |
| enum Button | | enum Button | |
| { | | { | |
| Left = 1 << 1, | | Left = 1 << 1, | |
| Right = 1 << 2, | | Right = 1 << 2, | |
| Middle = 1 << 3 | | Middle = 1 << 3 | |
| }; | | }; | |
| }; | | }; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfEvent defines a system event and its parameters | | /// Event defines a system event and its parameters | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class sfEvent | | class Event | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Enumeration of the different types of events | | /// Enumeration of the different types of events | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| enum EventType | | enum EventType | |
| { | | { | |
| Close, | | Close, | |
| Resize, | | Resize, | |
| LostFocus, | | LostFocus, | |
| GainedFocus, | | GainedFocus, | |
| TextEntered, | | TextEntered, | |
| KeyPressed, | | KeyPressed, | |
| KeyReleased, | | KeyReleased, | |
|
| | | MouseWheelMoved, | |
| MouseButtonPressed, | | MouseButtonPressed, | |
| MouseButtonReleased, | | MouseButtonReleased, | |
| MouseMove, | | MouseMove, | |
| JoystickButtonPressed, | | JoystickButtonPressed, | |
| JoystickButtonReleased, | | JoystickButtonReleased, | |
| JoystickMove | | JoystickMove | |
| }; | | }; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| | | | |
| skipping to change at line 108 | | skipping to change at line 112 | |
| EventType Type; ///< Type of the event | | EventType Type; ///< Type of the event | |
| | | | |
| union | | union | |
| { | | { | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Text event parameters | | /// Text event parameters | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| struct | | struct | |
| { | | { | |
|
| sfUint16 Unicode; | | Uint16 Unicode; | |
| } Text; | | } Text; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Keyboard events parameters | | /// Keyboard events parameters | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| struct | | struct | |
| { | | { | |
|
| sfKey::Code Code; | | Key::Code Code; | |
| bool Alt; | | bool Alt; | |
| bool Control; | | bool Control; | |
| bool Shift; | | bool Shift; | |
| } Key; | | } Key; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Mouse events parameters | | /// Mouse events parameters | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| struct | | struct | |
| { | | { | |
| unsigned int Buttons; | | unsigned int Buttons; | |
| unsigned int X; | | unsigned int X; | |
| unsigned int Y; | | unsigned int Y; | |
| } Mouse; | | } Mouse; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Mouse wheel events parameters | |
| | | //////////////////////////////////////////////////////////// | |
| | | struct | |
| | | { | |
| | | int Delta; | |
| | | } MouseWheel; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// Joystick events parameters | | /// Joystick events parameters | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| struct | | struct | |
| { | | { | |
| unsigned int JoystickId; | | unsigned int JoystickId; | |
| unsigned int Button; | | unsigned int Button; | |
| int X; | | int X; | |
| int Y; | | int Y; | |
| int Z; | | int Z; | |
| } Joystick; | | } Joystick; | |
| | | | |
| skipping to change at line 155 | | skipping to change at line 167 | |
| /// Size events parameters | | /// Size events parameters | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| struct | | struct | |
| { | | { | |
| unsigned int Width; | | unsigned int Width; | |
| unsigned int Height; | | unsigned int Height; | |
| } Size; | | } Size; | |
| }; | | }; | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_EVENT_HPP | | #endif // SFML_EVENT_HPP | |
| | | | |
End of changes. 11 change blocks. |
| 9 lines changed or deleted | | 23 lines changed or added | |
|
| IPAddress.hpp | | IPAddress.hpp | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| #define SFML_IPADDRESS_HPP | | #define SFML_IPADDRESS_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Config.hpp> | | #include <SFML/Config.hpp> | |
| #include <istream> | | #include <istream> | |
| #include <ostream> | | #include <ostream> | |
| #include <string> | | #include <string> | |
| | | | |
|
| | | namespace sf | |
| | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfIPAddress provides easy manipulation of IP v4 addresses | | /// IPAddress provides easy manipulation of IP v4 addresses | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfIPAddress | | class SFML_API IPAddress | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfIPAddress(); | | IPAddress(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the address from a string | | /// Construct the address from a string | |
| /// | | /// | |
| /// \param Address : IP address ("xxx.xxx.xxx.xxx") or network name | | /// \param Address : IP address ("xxx.xxx.xxx.xxx") or network name | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfIPAddress(const std::string& Address); | | IPAddress(const std::string& Address); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the address from 4 bytes | | /// Construct the address from 4 bytes | |
| /// | | /// | |
| /// \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 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfIPAddress(sfUint8 Byte0, sfUint8 Byte1, sfUint8 Byte2, sfUint8 Byte3)
; | | IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// 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; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 90 | | skipping to change at line 92 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| std::string ToString() const; | | std::string ToString() 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 sfIPAddress 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 | |
| /// distant website ; as a consequence, this function may be | | /// distant website ; as a consequence, this function may be | |
| /// very slow -- use it as few as possible ! | | /// very slow -- use it as few as possible ! | |
| /// | | /// | |
| /// \return Public IP address | | /// \return Public IP address | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| static sfIPAddress GetPublicAddress(); | | static IPAddress GetPublicAddress(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Comparison operator == | | /// Comparison operator == | |
| /// | | /// | |
| /// \param Other : Address to compare | | /// \param Other : Address to compare | |
| /// | | /// | |
| /// \return True if *this == Other | | /// \return True if *this == Other | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator ==(const sfIPAddress& Other) const; | | bool operator ==(const IPAddress& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Comparison operator != | | /// Comparison operator != | |
| /// | | /// | |
| /// \param Other : Address to compare | | /// \param Other : Address to compare | |
| /// | | /// | |
| /// \return True if *this != Other | | /// \return True if *this != Other | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator !=(const sfIPAddress& Other) const; | | bool operator !=(const IPAddress& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Comparison operator < | | /// Comparison operator < | |
| /// | | /// | |
| /// \param Other : Address to compare | | /// \param Other : Address to compare | |
| /// | | /// | |
| /// \return True if *this < Other | | /// \return True if *this < Other | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator <(const sfIPAddress& Other) const; | | bool operator <(const IPAddress& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Comparison operator > | | /// Comparison operator > | |
| /// | | /// | |
| /// \param Other : Address to compare | | /// \param Other : Address to compare | |
| /// | | /// | |
| /// \return True if *this > Other | | /// \return True if *this > Other | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator >(const sfIPAddress& Other) const; | | bool operator >(const IPAddress& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Comparison operator <= | | /// Comparison operator <= | |
| /// | | /// | |
| /// \param Other : Address to compare | | /// \param Other : Address to compare | |
| /// | | /// | |
| /// \return True if *this <= Other | | /// \return True if *this <= Other | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator <=(const sfIPAddress& Other) const; | | bool operator <=(const IPAddress& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Comparison operator >= | | /// Comparison operator >= | |
| /// | | /// | |
| /// \param Other : Address to compare | | /// \param Other : Address to compare | |
| /// | | /// | |
| /// \return True if *this >= Other | | /// \return True if *this >= Other | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator >=(const sfIPAddress& Other) const; | | bool operator >=(const IPAddress& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Static member data | | // Static member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| static const sfIPAddress LocalHost; ///< Local host address (to connect
to the same computer) | | static const IPAddress LocalHost; ///< Local host address (to connect t
o the same computer) | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfUint32 myAddress; ///< Address stored as an unsigned 32 bits integer | | Uint32 myAddress; ///< Address stored as an unsigned 32 bits integer | |
| }; | | }; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Operator >> overload to extract an address from an input stream | | /// Operator >> overload to extract an address from an input stream | |
| /// | | /// | |
| /// \param Stream : Input stream | | /// \param Stream : Input stream | |
| /// \param Address : Address to extract | | /// \param Address : Address to extract | |
| /// | | /// | |
| /// \return Reference to the input stream | | /// \return Reference to the input stream | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| SFML_API std::istream& operator >>(std::istream& Stream, sfIPAddress& Addre
ss); | | SFML_API std::istream& operator >>(std::istream& Stream, IPAddress& Address
); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Operator << overload to print an address to an output stream | | /// Operator << overload to print an address to an output stream | |
| /// | | /// | |
| /// \param Stream : Output stream | | /// \param Stream : Output stream | |
| /// \param Address : Address to print | | /// \param Address : Address to print | |
| /// | | /// | |
| /// \return Reference to the output stream | | /// \return Reference to the output stream | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| SFML_API std::ostream& operator <<(std::ostream& Stream, const sfIPAddress& | | SFML_API std::ostream& operator <<(std::ostream& Stream, const IPAddress& A | |
| Address); | | ddress); | |
| | | | |
| | | } // namespace sf | |
| | | | |
| #endif // SFML_IPADDRESS_HPP | | #endif // SFML_IPADDRESS_HPP | |
| | | | |
End of changes. 18 change blocks. |
| 18 lines changed or deleted | | 22 lines changed or added | |
|
| Image.hpp | | Image.hpp | |
| | | | |
| skipping to change at line 37 | | skipping to change at line 37 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Graphics/Color.hpp> | | #include <SFML/Graphics/Color.hpp> | |
| #include <SFML/Graphics/VideoResource.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 | |
| | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfImage is the low-level class for loading and | | /// Image is the low-level class for loading and | |
| /// manipulating images | | /// manipulating images | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfImage : public sf_private::sfVideoResource | | class SFML_API Image : public VideoResource | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfImage(); | | Image(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Copy constructor | | /// Copy constructor | |
| /// | | /// | |
| /// \param Copy : instance to copy | | /// \param Copy : instance to copy | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfImage(const sfImage& Copy); | | Image(const Image& Copy); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct an empty image | | /// Construct an empty image | |
| /// | | /// | |
| /// \param Width : Image width | | /// \param Width : Image width | |
| /// \param Height : Image height | | /// \param Height : Image height | |
|
| /// \param Color : Image color (black by default) | | /// \param Col : Image color (black by default) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfImage(unsigned int Width, unsigned int Height, const sfColor& Color =
sfColor(0, 0, 0, 255)); | | Image(unsigned int Width, unsigned int Height, const Color& Col = Color
(0, 0, 0, 255)); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the image from pixels in memory | | /// Construct the image from pixels in memory | |
| /// | | /// | |
| /// \param Width : Image width | | /// \param Width : Image width | |
| /// \param Height : Image height | | /// \param Height : Image height | |
| /// \param Data : Pointer to the pixels in memory (assumed format is
RGBA 32 bits) | | /// \param Data : Pointer to the pixels in memory (assumed format is
RGBA 32 bits) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfImage(unsigned int Width, unsigned int Height, const void* Data); | | Image(unsigned int Width, unsigned int Height, const void* Data); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Destructor | | /// Destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| ~sfImage(); | | ~Image(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Load the surface from a file | | /// Load the surface from a file | |
| /// | | /// | |
| /// \param Filename : Path of the image file to load | | /// \param Filename : Path of the image file to load | |
| /// | | /// | |
| /// \return True if loading was successful | | /// \return True if loading was successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool LoadFromFile(const std::string& Filename); | | bool LoadFromFile(const std::string& Filename); | |
| | | | |
| skipping to change at line 110 | | skipping to change at line 112 | |
| /// \return True if saving was successful | | /// \return True if saving was successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool SaveToFile(const std::string& Filename) const; | | bool SaveToFile(const std::string& Filename) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Create an empty image | | /// Create an empty image | |
| /// | | /// | |
| /// \param Width : Image width | | /// \param Width : Image width | |
| /// \param Height : Image height | | /// \param Height : Image height | |
|
| /// \param Color : Image color (black by default) | | /// \param Col : Image color (black by default) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Create(unsigned int Width, unsigned int Height, const sfColor& Col
or = sfColor(0, 0, 0, 255)); | | void Create(unsigned int Width, unsigned int Height, const Color& Col =
Color(0, 0, 0, 255)); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Load the image from pixels in memory | | /// Load the image from pixels in memory | |
| /// | | /// | |
| /// \param Width : Image width | | /// \param Width : Image width | |
| /// \param Height : Image height | | /// \param Height : Image height | |
| /// \param Data : Pointer to the pixels in memory (assumed format is
RGBA 32 bits) | | /// \param Data : Pointer to the pixels in memory (assumed format is
RGBA 32 bits) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void LoadFromMemory(unsigned int Width, unsigned int Height, const void
* Data); | | void LoadFromMemory(unsigned int Width, unsigned int Height, const void
* Data); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// 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) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void CreateMaskFromColor(const sfColor& ColorKey); | | void CreateMaskFromColor(const Color& ColorKey, Uint8 Alpha = 0); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Resize the image - warning : this function does not scale the image
, | | /// Resize the image - warning : this function does not scale the image
, | |
| /// it just ajdusts size (add padding or remove pixels) | | /// it just ajdusts size (add padding or remove pixels) | |
| /// | | /// | |
| /// \param Width : New width | | /// \param Width : New width | |
| /// \param Height : New height | | /// \param Height : New height | |
|
| /// \param Color : Color to assign to new pixels (black by default) | | /// \param Col : Color to assign to new pixels (black by default) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Resize(unsigned int Width, unsigned int Height, const sfColor& Col
or = sfColor(0, 0, 0, 255)); | | void Resize(unsigned int Width, unsigned int Height, const Color& Col =
Color(0, 0, 0, 255)); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Change the color of a pixel | | /// Change the color of a pixel | |
| /// Don't forget to call Update when you end modifying pixels | | /// Don't forget to call Update when you end modifying pixels | |
| /// | | /// | |
|
| /// \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 Color : New color for pixel (X, Y) | | /// \param Col : New color for pixel (X, Y) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void SetPixel(unsigned int X, unsigned int Y, const sfColor& Color); | | 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 : Path of the image file to load | | /// \param X : X coordinate of pixel in the image | |
| /// \param Y : Path of the image file to load | | /// \param Y : Y coordinate of pixel in the image | |
| /// | | /// | |
| /// \return Color of pixel (x, y) | | /// \return Color of pixel (x, y) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfColor GetPixel(unsigned int X, unsigned int Y) const; | | Color GetPixel(unsigned int X, unsigned int Y) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get a read-only pointer to the array of pixels (32 bits integer RGB
A) | | /// Get a read-only pointer to the array of pixels (32 bits integer RGB
A) | |
| /// Array size is GetWidth() x GetHeight() | | /// Array size is GetWidth() x GetHeight() | |
| /// 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 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| const sfUint32* GetPixelsPtr() const; | | const Uint32* GetPixelsPtr() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Update image in video memory | | /// Update image in video memory | |
| /// (use when you have modified pixels manually) | | /// (use when you have modified pixels manually) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Update(); | | void Update(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Bind the image for rendering | | /// Bind the image for rendering | |
| | | | |
| skipping to change at line 231 | | skipping to change at line 234 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Convert a subrect expressed in pixels, into float | | /// Convert a subrect expressed in pixels, into float | |
| /// texture coordinates | | /// texture coordinates | |
| /// | | /// | |
| /// \param Rect : Sub-rectangle of image to convert | | /// \param Rect : Sub-rectangle of image to convert | |
| /// | | /// | |
| /// \return Texture coordinates corresponding to the sub-rectangle | | /// \return Texture coordinates corresponding to the sub-rectangle | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfFloatRect GetTexCoords(const sfIntRect& Rect) const; | | FloatRect GetTexCoords(const IntRect& Rect) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get a valid texture size according to hardware support | | /// Get a valid texture size according to hardware support | |
| /// | | /// | |
| /// \param Size : Size to convert | | /// \param Size : Size to convert | |
| /// | | /// | |
| /// \return Valid nearest size (greater than or equal to specified size
) | | /// \return Valid nearest size (greater than or equal to specified size
) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| static unsigned int GetValidTextureSize(unsigned int Size); | | static unsigned int GetValidTextureSize(unsigned int Size); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Assignment operator | | /// Assignment operator | |
| /// | | /// | |
| /// \param Other : instance to assign | | /// \param Other : instance to assign | |
| /// | | /// | |
| /// \return Reference to the image | | /// \return Reference to the image | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfImage& operator =(const sfImage& Other); | | Image& operator =(const Image& Other); | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Create the OpenGL texture | | /// Create the OpenGL texture | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void CreateTexture(); | | void CreateTexture(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// /see sfVideoResource::DestroyVideoResources | | /// /see sfVideoResource::DestroyVideoResources | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual void DestroyVideoResources(); | | virtual void DestroyVideoResources(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // 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 b | | unsigned int myTextureWidth; ///< Actual texture width (can be | |
| e greater than image width because of padding) | | greater than image width because of padding) | |
| unsigned int myTextureHeight; ///< Actual texture height (can | | unsigned int myTextureHeight; ///< Actual texture height (can be | |
| be greater than image height because of padding) | | greater than image height because of padding) | |
| std::vector<sfUint32> myPixels; ///< Pixels of the image (32 bit | | std::vector<Uint32> myPixels; ///< Pixels of the image (32 bits | |
| s BGRA) | | BGRA) | |
| unsigned int myGLTexture; ///< OpenGL texture identifier | | unsigned int myGLTexture; ///< OpenGL texture identifier | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_IMAGE_HPP | | #endif // SFML_IMAGE_HPP | |
| | | | |
End of changes. 24 change blocks. |
| 32 lines changed or deleted | | 37 lines changed or added | |
|
| Input.hpp | | Input.hpp | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| #define SFML_INPUT_HPP | | #define SFML_INPUT_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Config.hpp> | | #include <SFML/Config.hpp> | |
| #include <SFML/System/NonCopyable.hpp> | | #include <SFML/System/NonCopyable.hpp> | |
| #include <SFML/Window/Event.hpp> | | #include <SFML/Window/Event.hpp> | |
| #include <SFML/Window/WindowListener.hpp> | | #include <SFML/Window/WindowListener.hpp> | |
| | | | |
|
| | | namespace sf | |
| | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfInput handles real-time input from keyboard and mouse. | | /// Input handles real-time input from keyboard and mouse. | |
| /// Use it instead of events to handle continuous moves and more | | /// Use it instead of events to handle continuous moves and more | |
| /// game-friendly inputs | | /// game-friendly inputs | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfInput : public sfWindowListener, sfNonCopyable | | class SFML_API Input : public WindowListener, NonCopyable | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfInput(); | | Input(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the state of a key | | /// Get the state of a key | |
| /// | | /// | |
|
| /// \param Key : Key to check | | /// \param KeyCode : Key to check | |
| /// | | /// | |
| /// \return True if key is down, false if key is up | | /// \return True if key is down, false if key is up | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool IsKeyDown(sfKey::Code Key) const; | | bool IsKeyDown(Key::Code KeyCode) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the state of a mouse button | | /// Get the state of a mouse button | |
| /// | | /// | |
| /// \param Button : Button to check | | /// \param Button : Button to check | |
| /// | | /// | |
| /// \return True if button is down, false if button is up | | /// \return True if button is down, false if button is up | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool IsMouseButtonDown(sfMouse::Button Button) const; | | bool IsMouseButtonDown(Mouse::Button Button) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the state of a joystick button | | /// Get the state of a joystick button | |
| /// | | /// | |
| /// \param JoyId : Identifier of the joystick to check (0 or 1) | | /// \param JoyId : Identifier of the joystick to check (0 or 1) | |
| /// \param Button : Button to check | | /// \param Button : Button to check | |
| /// | | /// | |
| /// \return True if button is down, false if button is up | | /// \return True if button is down, false if button is up | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 134 | | skipping to change at line 136 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| int GetJoystickZ(unsigned int JoyId) const; | | int GetJoystickZ(unsigned int JoyId) const; | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// /see sfWindowListener::OnEvent | | /// /see sfWindowListener::OnEvent | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void OnEvent(const sfEvent& Event); | | virtual void OnEvent(const Event& EventReceived); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool myKeys[sfKey::Count]; ///< Array containing the state
of all keayboard keys | | bool myKeys[Key::Count]; ///< Array containing the state
of all keayboard keys | |
| bool myMouseButtons[3]; ///< Array containing the state
of all mouse buttons | | bool myMouseButtons[3]; ///< Array containing the state
of all mouse buttons | |
| bool myJoystickButtons[2][8]; ///< Array containing the state
of all joysticks buttons | | bool myJoystickButtons[2][8]; ///< Array containing the state
of all joysticks buttons | |
| unsigned int myMouseX; ///< Mouse position on X | | unsigned int myMouseX; ///< Mouse position on X | |
| unsigned int myMouseY; ///< Mouse position on Y | | unsigned int myMouseY; ///< Mouse position on Y | |
| int myJoystickX[2]; ///< Joysticks position on X | | int myJoystickX[2]; ///< Joysticks position on X | |
| int myJoystickY[2]; ///< Joysticks position on Y | | int myJoystickY[2]; ///< Joysticks position on Y | |
| int myJoystickZ[2]; ///< Joysticks position on Z | | int myJoystickZ[2]; ///< Joysticks position on Z | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_INPUT_HPP | | #endif // SFML_INPUT_HPP | |
| | | | |
End of changes. 10 change blocks. |
| 8 lines changed or deleted | | 12 lines changed or added | |
|
| Music.hpp | | Music.hpp | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| #ifndef SFML_MUSIC_HPP | | #ifndef SFML_MUSIC_HPP | |
| #define SFML_MUSIC_HPP | | #define SFML_MUSIC_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Audio/SoundStream.hpp> | | #include <SFML/Audio/SoundStream.hpp> | |
| #include <string> | | #include <string> | |
| #include <vector> | | #include <vector> | |
| | | | |
|
| namespace sf_private | | namespace sf | |
| { | | { | |
|
| class sfSoundFile; | | namespace priv | |
| | | { | |
| | | class SoundFile; | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfMusic defines a big sound played using streaming, | | /// Music defines a big sound played using streaming, | |
| /// so usually what we call a music :) | | /// so usually what we call a music :) | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfMusic : public sfSoundStream | | class SFML_API Music : public SoundStream | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the music with a buffer size | | /// Construct the music with a buffer size | |
| /// | | /// | |
| /// \param BufferSize : Size of the internal buffer, expressed in numbe
r of samples | | /// \param BufferSize : Size of the internal buffer, expressed in numbe
r of samples | |
| /// (ie. size taken by the music in memory) (44100
by default) | | /// (ie. size taken by the music in memory) (44100
by default) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfMusic(std::size_t BufferSize = 44100); | | Music(std::size_t BufferSize = 44100); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Destructor | | /// Destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| ~sfMusic(); | | ~Music(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Open a music file (doesn't play it -- call Play() for that) | | /// Open a music file (doesn't play it -- call Play() for that) | |
| /// | | /// | |
| /// \param Filename : Path of the music file to open | | /// \param Filename : Path of the music file to open | |
| /// | | /// | |
| /// \return True if loading has been successful | | /// \return True if loading has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool Open(const std::string& Filename); | | bool Open(const std::string& Filename); | |
| | | | |
| skipping to change at line 100 | | skipping to change at line 102 | |
| /// 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 : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// /see sfSoundStream::OnStart | | /// /see SoundStream::OnStart | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual bool OnStart(); | | virtual bool OnStart(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// /see sfSoundStream::OnGetData | | /// /see SoundStream::OnGetData | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual bool OnGetData(Chunk& Data); | | virtual bool OnGetData(Chunk& Data); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sf_private::sfSoundFile* myFile; ///< Sound file | | priv::SoundFile* myFile; ///< Sound file | |
| std::string myFilename; ///< Path of the file to play | | std::string myFilename; ///< Path of the file to play | |
| bool myLoop; ///< Loop flag (true to loop, fals | | bool myLoop; ///< Loop flag (true to loop, false to p | |
| e to play once) | | lay once) | |
| float myDuration; ///< Music duration, in seconds | | float myDuration; ///< Music duration, in seconds | |
| std::vector<sfInt16> mySamples; ///< Temporary buffer of samples | | std::vector<Int16> mySamples; ///< Temporary buffer of samples | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_MUSIC_HPP | | #endif // SFML_MUSIC_HPP | |
| | | | |
End of changes. 10 change blocks. |
| 14 lines changed or deleted | | 18 lines changed or added | |
|
| Packet.hpp | | Packet.hpp | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| #ifndef SFML_PACKET_HPP | | #ifndef SFML_PACKET_HPP | |
| #define SFML_PACKET_HPP | | #define SFML_PACKET_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Config.hpp> | | #include <SFML/Config.hpp> | |
| #include <string> | | #include <string> | |
| #include <vector> | | #include <vector> | |
| | | | |
|
| | | namespace sf | |
| | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfPacket wraps data to send / to receive through the network | | /// Packet wraps data to send / to receive through the network | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfPacket | | class SFML_API Packet | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfPacket(); | | Packet(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Virtual destructor | | /// Virtual destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual ~sfPacket(); | | virtual ~Packet(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Append data to the end of the packet | | /// Append data to the end of the packet | |
| /// | | /// | |
| /// \param Data : Pointer to the bytes to append | | /// \param Data : Pointer to the bytes to append | |
| /// \param SizeInBytes : Number of bytes to append | | /// \param SizeInBytes : Number of bytes to append | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Append(const void* Data, std::size_t SizeInBytes); | | void Append(const void* Data, std::size_t SizeInBytes); | |
| | | | |
| | | | |
| skipping to change at line 85 | | 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 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfUint32 GetDataSize() const; | | Uint32 GetDataSize() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Operator >> overloads to extract data from the packet | | /// Operator >> overloads to extract data from the packet | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfPacket& operator >>(sfInt8& Data); | | Packet& operator >>(Int8& Data); | |
| sfPacket& operator >>(sfUint8& Data); | | Packet& operator >>(Uint8& Data); | |
| sfPacket& operator >>(sfInt16& Data); | | Packet& operator >>(Int16& Data); | |
| sfPacket& operator >>(sfUint16& Data); | | Packet& operator >>(Uint16& Data); | |
| sfPacket& operator >>(sfInt32& Data); | | Packet& operator >>(Int32& Data); | |
| sfPacket& operator >>(sfUint32& Data); | | Packet& operator >>(Uint32& Data); | |
| sfPacket& operator >>(float& Data); | | Packet& operator >>(float& Data); | |
| sfPacket& operator >>(double& Data); | | Packet& operator >>(double& Data); | |
| sfPacket& operator >>(char* Data); | | Packet& operator >>(char* Data); | |
| sfPacket& operator >>(std::string& Data); | | Packet& operator >>(std::string& Data); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Operator << overloads to put data into the packet | | /// Operator << overloads to put data into the packet | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfPacket& operator <<(sfInt8 Data); | | Packet& operator <<(Int8 Data); | |
| sfPacket& operator <<(sfUint8 Data); | | Packet& operator <<(Uint8 Data); | |
| sfPacket& operator <<(sfInt16 Data); | | Packet& operator <<(Int16 Data); | |
| sfPacket& operator <<(sfUint16 Data); | | Packet& operator <<(Uint16 Data); | |
| sfPacket& operator <<(sfInt32 Data); | | Packet& operator <<(Int32 Data); | |
| sfPacket& operator <<(sfUint32 Data); | | Packet& operator <<(Uint32 Data); | |
| sfPacket& operator <<(float Data); | | Packet& operator <<(float Data); | |
| sfPacket& operator <<(double Data); | | Packet& operator <<(double Data); | |
| sfPacket& operator <<(const char* Data); | | Packet& operator <<(const char* Data); | |
| sfPacket& operator <<(const std::string& Data); | | Packet& operator <<(const std::string& Data); | |
| | | | |
| private : | | private : | |
| | | | |
|
| friend class sfSocketTCP; | | friend class SocketTCP; | |
| friend class sfSocketUDP; | | friend class SocketUDP; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Called before the packet is sent to the network | | /// Called before the packet is sent to the network | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual void OnSend(); | | virtual void OnSend(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Called after the packet has been received from the network | | /// Called after the packet has been received from the network | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual void OnReceive(); | | virtual void OnReceive(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // 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 | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_PACKET_HPP | | #endif // SFML_PACKET_HPP | |
| | | | |
End of changes. 10 change blocks. |
| 27 lines changed or deleted | | 31 lines changed or added | |
|
| PostFX.hpp | | PostFX.hpp | |
| | | | |
| skipping to change at line 37 | | skipping to change at line 37 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // 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 <SFML/Graphics/VideoResource.hpp> | |
| #include <map> | | #include <map> | |
| #include <string> | | #include <string> | |
| | | | |
|
| | | namespace sf | |
| | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfPostFX is used to apply a post effect to a window | | /// PostFX is used to apply a post effect to a window | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfPostFX : public sfDrawable, public sf_private::sfVideoReso
urce | | class SFML_API PostFX : public Drawable, public VideoResource | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfPostFX(); | | PostFX(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the post-fx from an effect file | | /// Construct the post-fx from an effect file | |
| /// | | /// | |
| /// \param Filename : Path of the effect file to load | | /// \param Filename : Path of the effect file to load | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfPostFX(const std::string& Filename); | | PostFX(const std::string& Filename); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Copy constructor | | /// Copy constructor | |
| /// | | /// | |
| /// \param Copy : Instance to copy | | /// \param Copy : Instance to copy | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfPostFX(const sfPostFX& Copy); | | PostFX(const PostFX& Copy); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Destructor | | /// Destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| ~sfPostFX(); | | ~PostFX(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Load the effect from a file | | /// Load the effect from a file | |
| /// | | /// | |
| /// \param Filename : Path of the effect file to load | | /// \param Filename : Path of the effect file to load | |
| /// | | /// | |
| /// \return True on success | | /// \return True on success | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool LoadFromFile(const std::string& Filename); | | bool LoadFromFile(const std::string& Filename); | |
| | | | |
| skipping to change at line 121 | | skipping to change at line 123 | |
| /// | | /// | |
| /// \param Name : Parameter name in the effect | | /// \param Name : Parameter name in the effect | |
| /// \param X, Y, Z, W : Values to assign | | /// \param X, Y, Z, W : Values to assign | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetParameter(const std::string& Name, float X, float Y, float Z, f
loat W); | | void SetParameter(const std::string& Name, float X, float Y, float Z, f
loat W); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Set a texture parameter | | /// Set a texture parameter | |
| /// | | /// | |
|
| /// \param Name : Texture name in the effect | | /// \param Name : Texture name in the effect | |
| /// \param Image : Image to set (pass NULL to use content of current fr | | /// \param Texture : Image to set (pass NULL to use content of current | |
| amebuffer) | | framebuffer) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void SetTexture(const std::string& Name, sfImage* Image); | | void SetTexture(const std::string& Name, Image* Texture); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Assignment operator | | /// Assignment operator | |
| /// | | /// | |
| /// \param Other : Instance to assign | | /// \param Other : Instance to assign | |
| /// | | /// | |
| /// \return Reference to the post-effect | | /// \return Reference to the post-effect | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfPostFX& operator =(const sfPostFX& Other); | | PostFX& operator =(const PostFX& Other); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// 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 sfDrawable::Render | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void Render(sfRenderWindow& Window); | | virtual void Render(RenderWindow& Window); | |
| | | | |
| 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 Filename : Path of effect file to process | | /// \param Filename : Path of effect file to process | |
| /// | | /// | |
| /// \return Valid fragment shader source code | | /// \return Valid fragment shader source code | |
| | | | |
| skipping to change at line 192 | | skipping to change at line 194 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// /see sfVideoResource::DestroyVideoResources | | /// /see sfVideoResource::DestroyVideoResources | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual void DestroyVideoResources(); | | virtual void DestroyVideoResources(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| unsigned int myShaderProgram; ///< OpenGL identifie | | unsigned int myShaderProgram; ///< OpenGL identifier | |
| r for the program | | for the program | |
| std::map<std::string, sfImage*> mySamplers; ///< Sampler names an | | std::map<std::string, Image*> mySamplers; ///< Sampler names and | |
| d textures in the effect | | textures in the effect | |
| std::string myFragmentShader; ///< Fragment shader | | std::string myFragmentShader; ///< Fragment shader so | |
| source code | | urce code | |
| sfImage myFrameBuffer; ///< Texture containi | | Image myFrameBuffer; ///< Texture containing | |
| ng the current frame buffer | | the current frame buffer | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_POSTFX_HPP | | #endif // SFML_POSTFX_HPP | |
| | | | |
End of changes. 13 change blocks. |
| 20 lines changed or deleted | | 24 lines changed or added | |
|
| Rect.hpp | | Rect.hpp | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 33 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_RECT_HPP | | #ifndef SFML_RECT_HPP | |
| #define SFML_RECT_HPP | | #define SFML_RECT_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <algorithm> | | #include <algorithm> | |
| | | | |
|
| | | namespace sf | |
| | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfRect is an utility class for manipulating rectangles. | | /// Rect is an utility class for manipulating rectangles. | |
| /// Template parameter defines the type of coordinates (integer float, ...) | | /// Template parameter defines the type of coordinates (integer float, ...) | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| template <typename T> | | template <typename T> | |
|
| class sfRect | | class Rect | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfRect(); | | Rect(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the rectangle from its coordinates | | /// Construct the rectangle from its coordinates | |
| /// | | /// | |
| /// \param LeftCoord : Left coordinate of the rectangle | | /// \param LeftCoord : Left coordinate of the rectangle | |
| /// \param TopCoord : Top coordinate of the rectangle | | /// \param TopCoord : Top coordinate of the rectangle | |
| /// \param RightCoord : Right coordinate of the rectangle | | /// \param RightCoord : Right coordinate of the rectangle | |
| /// \param BottomCoord : Bottom coordinate of the rectangle | | /// \param BottomCoord : Bottom coordinate of the rectangle | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfRect(T LeftCoord, T TopCoord, T RightCoord, T BottomCoord); | | Rect(T LeftCoord, T TopCoord, T RightCoord, T BottomCoord); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the width of the rectangle | | /// Get the width of the rectangle | |
| /// | | /// | |
| /// \return Width of rectangle | | /// \return Width of rectangle | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| T GetWidth() const; | | T GetWidth() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 89 | | skipping to change at line 91 | |
| /// \param Y : Y coordinate of the point to test | | /// \param Y : Y coordinate of the point to test | |
| /// | | /// | |
| /// \return True if the point is inside | | /// \return True if the point is inside | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool Contains(T X, T Y) const; | | bool Contains(T X, T Y) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Check intersection between two rectangles | | /// Check intersection between two rectangles | |
| /// | | /// | |
|
| /// \param Rect : Rectangle to test | | /// \param Rectangle : Rectangle to test | |
| /// \param OverlappingRect : Rectangle to be filled with overlapping re
ct (NULL by default) | | /// \param OverlappingRect : Rectangle to be filled with overlapping re
ct (NULL by default) | |
| /// | | /// | |
| /// \return True if rectangles overlap | | /// \return True if rectangles overlap | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Intersects(const sfRect<T>& Rect, sfRect<T>* OverlappingRect = NUL
L) const; | | bool Intersects(const Rect<T>& Rectangle, Rect<T>* OverlappingRect = NU
LL) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| T Left; ///< Left coordinate of the rectangle | | T Left; ///< Left coordinate of the rectangle | |
| T Top; ///< Top coordinate of the rectangle | | T Top; ///< Top coordinate of the rectangle | |
| T Right; ///< Right coordinate of the rectangle | | T Right; ///< Right coordinate of the rectangle | |
| T Bottom; ///< Bottom coordinate of the rectangle | | T Bottom; ///< Bottom coordinate of the rectangle | |
| }; | | }; | |
| | | | |
| #include <SFML/Graphics/Rect.inl> | | #include <SFML/Graphics/Rect.inl> | |
| | | | |
| // Define the most common types | | // Define the most common types | |
|
| typedef sfRect<int> sfIntRect; | | typedef Rect<int> IntRect; | |
| typedef sfRect<float> sfFloatRect; | | typedef Rect<float> FloatRect; | |
| | | | |
| | | } // namespace sf | |
| | | | |
| #endif // SFML_RECT_HPP | | #endif // SFML_RECT_HPP | |
| | | | |
End of changes. 8 change blocks. |
| 8 lines changed or deleted | | 12 lines changed or added | |
|
| Rect.inl | | Rect.inl | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| // and must not be misrepresented as being the original software. | | // and must not be misrepresented as being the original software. | |
| // | | // | |
| // 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. | |
| // | | // | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| template <typename T> | | template <typename T> | |
|
| sfRect<T>::sfRect() : | | Rect<T>::Rect() : | |
| Left (0), | | Left (0), | |
| Top (0), | | Top (0), | |
| Right (0), | | Right (0), | |
| Bottom(0) | | Bottom(0) | |
| { | | { | |
| | | | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the color from its coordinates | | /// Construct the color from its coordinates | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| template <typename T> | | template <typename T> | |
|
| sfRect<T>::sfRect(T LeftCoord, T TopCoord, T RightCoord, T BottomCoord) : | | Rect<T>::Rect(T LeftCoord, T TopCoord, T RightCoord, T BottomCoord) : | |
| Left (LeftCoord), | | Left (LeftCoord), | |
| Top (TopCoord), | | Top (TopCoord), | |
| Right (RightCoord), | | Right (RightCoord), | |
| Bottom(BottomCoord) | | Bottom(BottomCoord) | |
| { | | { | |
| | | | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the width of the rectangle | | /// Get the width of the rectangle | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| template <typename T> | | template <typename T> | |
|
| T sfRect<T>::GetWidth() const | | T Rect<T>::GetWidth() const | |
| { | | { | |
| return Right - Left; | | return Right - Left; | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the height of the rectangle | | /// Get the height of the rectangle | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| template <typename T> | | template <typename T> | |
|
| T sfRect<T>::GetHeight() const | | T Rect<T>::GetHeight() const | |
| { | | { | |
| return Bottom - Top; | | return Bottom - Top; | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Check if a point is inside the rectangle's area | | /// Check if a point is inside the rectangle's area | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| template <typename T> | | template <typename T> | |
|
| bool sfRect<T>::Contains(T X, T Y) const | | bool Rect<T>::Contains(T X, T Y) const | |
| { | | { | |
| return (X >= Left) && (X <= Right) && (Y >= Top) && (Y <= Bottom); | | return (X >= Left) && (X <= Right) && (Y >= Top) && (Y <= Bottom); | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Check intersection between two rectangles | | /// Check intersection between two rectangles | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| template <typename T> | | template <typename T> | |
|
| bool sfRect<T>::Intersects(const sfRect<T>& Rect, sfRect<T>* OverlappingRec
t) const | | bool Rect<T>::Intersects(const Rect<T>& Rectangle, Rect<T>* OverlappingRect
) const | |
| { | | { | |
| // Compute overlapping rect | | // Compute overlapping rect | |
|
| sfRect Overlapping(std::max(Left, Rect.Left), | | Rect Overlapping(std::max(Left, Rectangle.Left), | |
| std::max(Top, Rect.Top), | | std::max(Top, Rectangle.Top), | |
| std::min(Right, Rect.Right), | | std::min(Right, Rectangle.Right), | |
| std::min(Bottom, Rect.Bottom)); | | std::min(Bottom, Rectangle.Bottom)); | |
| | | | |
| // If overlapping rect is valid, then there is intersection | | // If overlapping rect is valid, then there is intersection | |
| if ((Overlapping.Left < Overlapping.Right) && (Overlapping.Top < Overla
pping.Bottom)) | | if ((Overlapping.Left < Overlapping.Right) && (Overlapping.Top < Overla
pping.Bottom)) | |
| { | | { | |
| if (OverlappingRect) | | if (OverlappingRect) | |
| *OverlappingRect = Overlapping; | | *OverlappingRect = Overlapping; | |
| return true; | | return true; | |
| } | | } | |
| else | | else | |
| { | | { | |
| if (OverlappingRect) | | if (OverlappingRect) | |
|
| *OverlappingRect = sfRect(0, 0, 0, 0); | | *OverlappingRect = Rect(0, 0, 0, 0); | |
| return false; | | return false; | |
| } | | } | |
| } | | } | |
| | | | |
End of changes. 8 change blocks. |
| 11 lines changed or deleted | | 11 lines changed or added | |
|
| RenderWindow.hpp | | RenderWindow.hpp | |
| | | | |
| skipping to change at line 32 | | skipping to change at line 32 | |
| // | | // | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #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/Color.hpp> | |
|
| | | #include <SFML/Graphics/Image.hpp> | |
| #include <SFML/Graphics/View.hpp> | | #include <SFML/Graphics/View.hpp> | |
| #include <SFML/Graphics/Rect.hpp> | | #include <SFML/Graphics/Rect.hpp> | |
| #include <SFML/Window/Window.hpp> | | #include <SFML/Window/Window.hpp> | |
| #include <string> | | #include <string> | |
| | | | |
|
| class sfDrawable; | | namespace sf | |
| | | { | |
| | | class Drawable; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Simple wrapper for sfWindow that allows easy | | /// Simple wrapper for sfWindow that allows easy | |
| /// 2D rendering | | /// 2D rendering | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfRenderWindow : private sfWindow | | class SFML_API RenderWindow : private Window | |
| { | | { | |
| public : | | public : | |
| | | | |
|
| using sfWindow::GetWidth; | | using Window::Style; | |
| using sfWindow::GetHeight; | | using Window::Resizable; | |
| using sfWindow::GetInput; | | using Window::Fixed; | |
| using sfWindow::GetFrameTime; | | using Window::Fullscreen; | |
| using sfWindow::UseVerticalSync; | | | |
| using sfWindow::ShowMouseCursor; | | using Window::GetWidth; | |
| | | using Window::GetHeight; | |
| | | using Window::GetInput; | |
| | | using Window::GetFrameTime; | |
| | | using Window::GetDepthBits; | |
| | | using Window::GetStencilBits; | |
| | | using Window::UseVerticalSync; | |
| | | using Window::ShowMouseCursor; | |
| | | using Window::SetPosition; | |
| | | using Window::SetFramerateLimit; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfRenderWindow(); | | RenderWindow(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the window | | /// Construct the window | |
| /// | | /// | |
|
| /// \param Mode : Video mode to use | | /// \param Mode : Video mode to use | |
| /// \param Title : Title of the window | | /// \param Title : Title of the window | |
| /// \param Fullscreen : True to set fullscreen, false to stay in window | | /// \param WindowStyle : Window style (resizable by default) | |
| ed mode | | /// \param AntialiasingLevel : Level of antialiasing (0 by default, dis | |
| | | abled) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfRenderWindow(sfVideoMode Mode, const std::string& Title, bool Fullscr
een); | | RenderWindow(VideoMode Mode, const std::string& Title, Style WindowStyl
e = Resizable, int AntialiasingLevel = 0); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the window from an existing control | | /// Construct the window from an existing control | |
| /// | | /// | |
|
| /// \param Handle : Platform-specific handle of the control | | /// \param Handle : Platform-specific handle of the control | |
| | | /// \param AntialiasingLevel : Level of antialiasing (0 by default, dis | |
| | | abled) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfRenderWindow(sfWindowHandle Handle); | | RenderWindow(WindowHandle Handle, int AntialiasingLevel = 0); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Destructor | | /// Destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual ~sfRenderWindow(); | | virtual ~RenderWindow(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Create the window | | /// Create the window | |
| /// | | /// | |
|
| /// \param Mode : Video mode to use | | /// \param Mode : Video mode to use | |
| /// \param Title : Title of the window | | /// \param Title : Title of the window | |
| /// \param Fullscreen : True to set fullscreen, false to stay in window | | /// \param WindowStyle : Window style (resizable by default) | |
| ed mode | | /// \param AntialiasingLevel : Level of antialiasing (0 by default, dis | |
| | | abled) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Create(sfVideoMode Mode, const std::string& Title, bool Fullscreen
); | | void Create(VideoMode Mode, const std::string& Title, Style WindowStyle
= Resizable, int AntialiasingLevel = 0); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Create the window from an existing control | | /// Create the window from an existing control | |
| /// | | /// | |
|
| /// \param Handle : Platform-specific handle of the control | | /// \param Handle : Platform-specific handle of the control | |
| | | /// \param AntialiasingLevel : Level of antialiasing (0 by default, dis | |
| | | abled) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Create(sfWindowHandle Handle); | | void Create(WindowHandle Handle, int AntialiasingLevel = 0); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Display window content on screen | | /// Display window content on screen | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Display(); | | void Display(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Draw something on the window | | /// Draw something on the window | |
| /// | | /// | |
| /// \param Object : Object to draw | | /// \param Object : Object to draw | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Draw(sfDrawable& Object); | | void Draw(Drawable& Object); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Save the content of the window to a file | | /// Save the content of the window to an image | |
| /// | | /// | |
|
| /// \param Filename : Path of the file to save (file is overwritten if
it already exists) | | /// \return Image instance containing the contents of the screen | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Capture(const std::string& Filename) const; | | Image Capture() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Change the background color of the window | | /// Change the background color of the window | |
| /// | | /// | |
|
| /// \param Color : New background color | | /// \param Col : New background color | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void SetBackgroundColor(const sfColor& Color); | | void SetBackgroundColor(const Color& Col); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the event on top of events stack, if any | | /// Get the event on top of events stack, if any | |
| /// | | /// | |
|
| /// \param Event : Event to fill, if any | | /// \param EventReceived : Event to fill, if any | |
| /// | | /// | |
| /// \return True if an event was returned, false if events stack was em
pty | | /// \return True if an event was returned, false if events stack was em
pty | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool GetEvent(sfEvent& Event); | | bool GetEvent(Event& EventReceived); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Change the current active view | | /// Change the current active view | |
| /// | | /// | |
|
| /// \param View : Pointer to the new view (pass NULL to set the default
view) | | /// \param NewView : Pointer to the new view (pass NULL to set the defa
ult view) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void SetView(const sfView* View); | | void SetView(const View* NewView); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the current view rectangle | | /// Get the current view rectangle | |
| /// | | /// | |
| /// \return Current view rectangle, in global coordinates | | /// \return Current view rectangle, in global coordinates | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| const sfFloatRect& GetViewRect() const; | | const FloatRect& GetViewRect() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Start custom OpenGL rendering | | /// Start custom OpenGL rendering | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void BeginOpenGL(); | | void BeginOpenGL(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// End custom OpenGL rendering | | /// End custom OpenGL rendering | |
| /// | | /// | |
| | | | |
| skipping to change at line 181 | | skipping to change at line 197 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Initialize internal window | | /// Initialize internal window | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Initialize(); | | void Initialize(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfColor myBackgroundColor; ///< Background color | | Color myBackgroundColor; ///< Background color | |
| sfView myDefaultView; ///< Default view | | View myDefaultView; ///< Default view | |
| sfFloatRect myCurrentRect; ///< Rectangle corresponding to the curr | | FloatRect myCurrentRect; ///< Rectangle corresponding to the curren | |
| ent view | | t view | |
| bool myOpenGLMode; ///< True when we are between BeginOpenG | | bool myOpenGLMode; ///< True when we are between BeginOpenGL( | |
| L() and EndOpenGL() | | ) and EndOpenGL() | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_RENDERWINDOW_HPP | | #endif // SFML_RENDERWINDOW_HPP | |
| | | | |
End of changes. 27 change blocks. |
| 41 lines changed or deleted | | 61 lines changed or added | |
|
| Selector.hpp | | Selector.hpp | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| #ifndef SFML_SELECTOR_HPP | | #ifndef SFML_SELECTOR_HPP | |
| #define SFML_SELECTOR_HPP | | #define SFML_SELECTOR_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Network/SocketUDP.hpp> | | #include <SFML/Network/SocketUDP.hpp> | |
| #include <SFML/Network/SocketTCP.hpp> | | #include <SFML/Network/SocketTCP.hpp> | |
| #include <vector> | | #include <vector> | |
| | | | |
|
| | | namespace sf | |
| | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfSelector allow reading from multiple sockets | | /// Selector allow reading from multiple sockets | |
| /// without blocking. It's a kind of multiplexer | | /// without blocking. It's a kind of multiplexer | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| template <typename SocketType> | | template <typename Type> | |
| class sfSelector | | class Selector | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSelector(); | | Selector(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Add a socket to watch | | /// Add a socket to watch | |
| /// | | /// | |
| /// \param Socket : Socket to add | | /// \param Socket : Socket to add | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Add(SocketType Socket); | | void Add(Type Socket); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Remove a socket | | /// Remove a socket | |
| /// | | /// | |
| /// \param Socket : Socket to remove | | /// \param Socket : Socket to remove | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Remove(SocketType Socket); | | void Remove(Type Socket); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Remove all sockets | | /// Remove all sockets | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Clear(); | | void Clear(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Remove a socket | | /// Remove a socket | |
| /// | | /// | |
| /// \param Sockets : Array to fill with sockets that are ready for read
ing | | /// \param Sockets : Array to fill with sockets that are ready for read
ing | |
| /// \param Timeout : Timeout, in seconds (0 by default : no timeout) | | /// \param Timeout : Timeout, in seconds (0 by default : no timeout) | |
| /// | | /// | |
| /// \return True if a socket is ready, false if time was out | | /// \return True if a socket is ready, false if time was out | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool GetSocketsReady(std::vector<SocketType>& Sockets, float Timeout =
0.f); | | bool GetSocketsReady(std::vector<Type>& Sockets, float Timeout = 0.f); | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| fd_set mySet; ///< Set of socket to watch | | fd_set mySet; ///< Set of socket to watch | |
| int myMaxSocket; ///< Maximum socket index | | int myMaxSocket; ///< Maximum socket index | |
| }; | | }; | |
| | | | |
| #include <SFML/Network/Selector.inl> | | #include <SFML/Network/Selector.inl> | |
| | | | |
|
| // Let's define the two only valid types of sfSelector | | // Let's define the two only valid types of Selector | |
| typedef sfSelector<sfSocketUDP> sfSelectorUDP; | | typedef Selector<SocketUDP> SelectorUDP; | |
| typedef sfSelector<sfSocketTCP> sfSelectorTCP; | | typedef Selector<SocketTCP> SelectorTCP; | |
| | | | |
| | | } // namespace sf | |
| | | | |
| #endif // SFML_SELECTOR_HPP | | #endif // SFML_SELECTOR_HPP | |
| | | | |
End of changes. 8 change blocks. |
| 10 lines changed or deleted | | 14 lines changed or added | |
|
| Selector.inl | | Selector.inl | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| // 2. Altered source versions must be plainly marked as such, | | // 2. Altered source versions must be plainly marked as such, | |
| // and must not be misrepresented as being the original software. | | // and must not be misrepresented as being the original software. | |
| // | | // | |
| // 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. | |
| // | | // | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| template <typename SocketType> | | template <typename Type> | |
| sfSelector<SocketType>::sfSelector() : | | Selector<Type>::Selector() : | |
| myMaxSocket(0) | | myMaxSocket(0) | |
| { | | { | |
| Clear(); | | Clear(); | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Add a socket to watch | | /// Add a socket to watch | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| template <typename SocketType> | | template <typename Type> | |
| void sfSelector<SocketType>::Add(SocketType Socket) | | void Selector<Type>::Add(Type Socket) | |
| { | | { | |
| FD_SET(Socket.mySocket, &mySet); | | FD_SET(Socket.mySocket, &mySet); | |
| | | | |
| if (static_cast<int>(Socket.mySocket) > myMaxSocket) | | if (static_cast<int>(Socket.mySocket) > myMaxSocket) | |
| myMaxSocket = static_cast<int>(Socket.mySocket); | | myMaxSocket = static_cast<int>(Socket.mySocket); | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Remove a socket | | /// Remove a socket | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| template <typename SocketType> | | template <typename Type> | |
| void sfSelector<SocketType>::Remove(SocketType Socket) | | void Selector<Type>::Remove(Type Socket) | |
| { | | { | |
| FD_CLR(Socket.mySocket, &mySet); | | FD_CLR(Socket.mySocket, &mySet); | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Remove all sockets | | /// Remove all sockets | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| template <typename SocketType> | | template <typename Type> | |
| void sfSelector<SocketType>::Clear() | | void Selector<Type>::Clear() | |
| { | | { | |
| FD_ZERO(&mySet); | | FD_ZERO(&mySet); | |
| | | | |
| myMaxSocket = 0; | | myMaxSocket = 0; | |
| } | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Remove a socket | | /// Remove a socket | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| template <typename SocketType> | | template <typename Type> | |
| bool sfSelector<SocketType>::GetSocketsReady(std::vector<SocketType>& Socke | | bool Selector<Type>::GetSocketsReady(std::vector<Type>& Sockets, float Time | |
| ts, float Timeout) | | out) | |
| { | | { | |
| // First of all, clear the array to fill... | | // First of all, clear the array to fill... | |
| Sockets.clear(); | | Sockets.clear(); | |
| | | | |
| // Setup the timeout structure | | // Setup the timeout structure | |
| timeval Time; | | timeval Time; | |
| Time.tv_sec = static_cast<long>(Timeout); | | Time.tv_sec = static_cast<long>(Timeout); | |
| Time.tv_usec = (static_cast<long>(Timeout * 1000) % 1000) * 1000; | | Time.tv_usec = (static_cast<long>(Timeout * 1000) % 1000) * 1000; | |
| | | | |
| // Use a copy of the set, as it will be modified by select() | | // Use a copy of the set, as it will be modified by select() | |
| fd_set Set = mySet; | | fd_set Set = mySet; | |
| | | | |
| // Wait until one of the sockets is ready for reading, or timeout is re
ached | | // Wait until one of the sockets is ready for reading, or timeout is re
ached | |
| if (select(myMaxSocket + 1, &Set, NULL, NULL, Timeout > 0 ? &Time : NUL
L) != 0) | | if (select(myMaxSocket + 1, &Set, NULL, NULL, Timeout > 0 ? &Time : NUL
L) != 0) | |
| { | | { | |
| // One or more sockets are ready : put them into the array | | // One or more sockets are ready : put them into the array | |
| for (int i = 0; i < myMaxSocket + 1; ++i) | | for (int i = 0; i < myMaxSocket + 1; ++i) | |
| { | | { | |
| if (FD_ISSET(i, &Set)) | | if (FD_ISSET(i, &Set)) | |
|
| Sockets.push_back(SocketType(static_cast<sf_private::sfSock
etType>(i))); | | Sockets.push_back(Type(static_cast<priv::SocketType>(i))); | |
| } | | } | |
| | | | |
| return true; | | return true; | |
| } | | } | |
| else | | else | |
| { | | { | |
| // Timeout reached... | | // Timeout reached... | |
| return false; | | return false; | |
| } | | } | |
| } | | } | |
| | | | |
End of changes. 6 change blocks. |
| 12 lines changed or deleted | | 12 lines changed or added | |
|
| SocketTCP.hpp | | SocketTCP.hpp | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| | | | |
| #ifndef SFML_SOCKETTCP_HPP | | #ifndef SFML_SOCKETTCP_HPP | |
| #define SFML_SOCKETTCP_HPP | | #define SFML_SOCKETTCP_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Network/Sockets.hpp> | | #include <SFML/Network/Sockets.hpp> | |
| #include <cstddef> | | #include <cstddef> | |
| | | | |
|
| class sfPacket; | | namespace sf | |
| class sfIPAddress; | | { | |
| template <typename> class sfSelector; | | class Packet; | |
| | | class IPAddress; | |
| | | template <typename> class Selector; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfSocketTCP 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 sfSocketTCP | | class SFML_API SocketTCP | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSocketTCP(); | | SocketTCP(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// 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 | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Connect(unsigned short Port, const sfIPAddress& HostAddress); | | bool Connect(unsigned short Port, const IPAddress& HostAddress); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// 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 83 | | skipping to change at line 85 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Wait for a connection (must be listening to a port). | | /// Wait for a connection (must be listening to a port). | |
| /// This function is blocking, ie. it won't return before | | /// This function is blocking, ie. it won't return before | |
| /// a connection has been accepted | | /// a connection has been accepted | |
| /// | | /// | |
| /// \param Address : Pointer to an address to fill with client infos (N
ULL by default) | | /// \param Address : Pointer to an address to fill with client infos (N
ULL by default) | |
| /// | | /// | |
| /// \return New socket for communicating with connected client | | /// \return New socket for communicating with connected client | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSocketTCP Accept(sfIPAddress* Address = NULL); | | SocketTCP Accept(IPAddress* Address = NULL); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Send an array of bytes to the host (must be connected first) | | /// Send an array of bytes to the host (must be connected first) | |
| /// | | /// | |
| /// \param Data : Pointer to the bytes to send | | /// \param Data : Pointer to the bytes to send | |
| /// \param Size : Number of bytes to send | | /// \param Size : Number of bytes to send | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// (false would mean the connection is broken) | | /// (false would mean the connection is broken) | |
| /// | | /// | |
| | | | |
| skipping to change at line 115 | | skipping to change at line 117 | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// (false would mean the connection is broken) | | /// (false would mean the connection is broken) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived
); | | bool Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived
); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Send a packet of data to the host (must be connected first) | | /// Send a packet of data to the host (must be connected first) | |
| /// | | /// | |
|
| /// \param Packet : Packet to send | | /// \param PacketToSend : Packet to send | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// (false would mean the connection is broken) | | /// (false would mean the connection is broken) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Send(sfPacket& Packet); | | bool Send(Packet& PacketToSend); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Receive a packet from the host (must be connected first). | | /// Receive a packet from the host (must be connected first). | |
| /// This function is blocking, ie. it won't return before a | | /// This function is blocking, ie. it won't return before a | |
| /// packet is received | | /// packet is received | |
| /// | | /// | |
|
| /// \param Packet : Packet to fill with received data | | /// \param PacketToReceive : Packet to fill with received data | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// (false would mean the connection is broken) | | /// (false would mean the connection is broken) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Receive(sfPacket& Packet); | | bool Receive(Packet& PacketToReceive); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Close the socket | | /// Close the socket | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool Close(); | | bool Close(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Comparison operator == | | /// Comparison operator == | |
| /// | | /// | |
| /// \param Other : Socket to compare | | /// \param Other : Socket to compare | |
| /// | | /// | |
| /// \return True if *this == Other | | /// \return True if *this == Other | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator ==(const sfSocketTCP& Other) const; | | bool operator ==(const SocketTCP& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Comparison operator != | | /// Comparison operator != | |
| /// | | /// | |
| /// \param Other : Socket to compare | | /// \param Other : Socket to compare | |
| /// | | /// | |
| /// \return True if *this != Other | | /// \return True if *this != Other | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator !=(const sfSocketTCP& Other) const; | | bool operator !=(const SocketTCP& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Comparison operator <. | | /// Comparison operator <. | |
| /// Provided for compatibility with standard containers, as | | /// Provided for compatibility with standard containers, as | |
| /// comparing two sockets doesn't make much sense... | | /// comparing two sockets doesn't make much sense... | |
| /// | | /// | |
| /// \param Other : Socket to compare | | /// \param Other : Socket to compare | |
| /// | | /// | |
| /// \return True if *this < Other | | /// \return True if *this < Other | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator <(const sfSocketTCP& Other) const; | | bool operator <(const SocketTCP& Other) const; | |
| | | | |
| private : | | private : | |
| | | | |
|
| friend class sfSelector<sfSocketTCP>; | | friend class Selector<SocketTCP>; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the socket from a socket descriptor | | /// Construct the socket from a socket descriptor | |
| /// (for internal use only) | | /// (for internal use only) | |
| /// | | /// | |
| /// \param Descriptor : Socket descriptor | | /// \param Descriptor : Socket descriptor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSocketTCP(sf_private::sfSocketType Descriptor); | | SocketTCP(priv::SocketType Descriptor); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sf_private::sfSocketType mySocket; ///< Socket descriptor | | priv::SocketType mySocket; ///< Socket descriptor | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_SOCKETTCP_HPP | | #endif // SFML_SOCKETTCP_HPP | |
| | | | |
End of changes. 17 change blocks. |
| 18 lines changed or deleted | | 22 lines changed or added | |
|
| SocketUDP.hpp | | SocketUDP.hpp | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| | | | |
| #ifndef SFML_SOCKETUDP_HPP | | #ifndef SFML_SOCKETUDP_HPP | |
| #define SFML_SOCKETUDP_HPP | | #define SFML_SOCKETUDP_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Network/Sockets.hpp> | | #include <SFML/Network/Sockets.hpp> | |
| #include <cstddef> | | #include <cstddef> | |
| | | | |
|
| class sfPacket; | | namespace sf | |
| class sfIPAddress; | | { | |
| template <typename> class sfSelector; | | class Packet; | |
| | | class IPAddress; | |
| | | template <typename> class Selector; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfSocketUDP 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 sfSocketUDP | | class SFML_API SocketUDP | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSocketUDP(); | | SocketUDP(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Send an array of bytes | | /// Send an array of bytes | |
| /// | | /// | |
| /// \param Data : Pointer to the bytes to send | | /// \param Data : Pointer to the bytes to send | |
| /// \param Size : Number of bytes to send | | /// \param Size : Number of bytes to send | |
| /// \param Address : Address of the computer to send the packet to | | /// \param Address : Address of the computer to send the packet to | |
| /// \param Port : Port to use for communication | | /// \param Port : Port to use for communication | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Send(const char* Data, std::size_t Size, const sfIPAddress& Addres
s, unsigned short Port); | | bool Send(const char* Data, std::size_t Size, const IPAddress& Address,
unsigned short Port); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Receive an array of bytes. | | /// Receive an array of bytes. | |
| /// This function is blocking, ie. it won't return before some | | /// This function is blocking, ie. it won't return before some | |
| /// bytes have been received | | /// bytes have been received | |
| /// | | /// | |
| /// \param Data : Pointer to a byte array to fill (make sure it
is big enough) | | /// \param Data : Pointer to a byte array to fill (make sure it
is big enough) | |
| /// \param MaxSize : Maximum number of bytes to read | | /// \param MaxSize : Maximum number of bytes to read | |
| /// \param SizeReceived : Number of bytes received | | /// \param SizeReceived : Number of bytes received | |
| /// \param Address : Address of the computer to send the packet to | | /// \param Address : Address of the computer to send the packet to | |
| /// \param Port : Port to use for communication | | /// \param Port : Port to use for communication | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived
, sfIPAddress& Address, unsigned short Port); | | bool Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived
, IPAddress& Address, unsigned short Port); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Send a packet of data | | /// Send a packet of data | |
| /// | | /// | |
|
| /// \param Packet : Packet to send | | /// \param PacketToSend : Packet to send | |
| /// \param Address : Address of the computer to send the packet to | | /// \param Address : Address of the computer to send the packet to | |
| /// \param Port : Port to use for communication | | /// \param Port : Port to use for communication | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Send(sfPacket& Packet, const sfIPAddress& Address, unsigned short
Port); | | bool Send(Packet& PacketToSend, const IPAddress& Address, unsigned shor
t Port); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Receive a packet. | | /// Receive a packet. | |
| /// This function is blocking, ie. it won't return before a | | /// This function is blocking, ie. it won't return before a | |
| /// packet is received | | /// packet is received | |
| /// | | /// | |
|
| /// \param Packet : Packet to fill with received data | | /// \param PacketToReceive : Packet to fill with received data | |
| /// \param Address : Address of the computer that sent the packet | | /// \param Address : Address of the computer that sent the pack | |
| /// \param Port : Port to use for communication | | et | |
| | | /// \param Port : Port to use for communication | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Receive(sfPacket& Packet, sfIPAddress& Address, unsigned short Por
t); | | bool Receive(Packet& PacketToReceive, IPAddress& Address, unsigned shor
t Port); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Close the socket | | /// Close the socket | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool Close(); | | bool Close(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Comparison operator == | | /// Comparison operator == | |
| /// | | /// | |
| /// \param Other : Socket to compare | | /// \param Other : Socket to compare | |
| /// | | /// | |
| /// \return True if *this == Other | | /// \return True if *this == Other | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator ==(const sfSocketUDP& Other) const; | | bool operator ==(const SocketUDP& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Comparison operator != | | /// Comparison operator != | |
| /// | | /// | |
| /// \param Other : Socket to compare | | /// \param Other : Socket to compare | |
| /// | | /// | |
| /// \return True if *this != Other | | /// \return True if *this != Other | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator !=(const sfSocketUDP& Other) const; | | bool operator !=(const SocketUDP& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Comparison operator <. | | /// Comparison operator <. | |
| /// Provided for compatibility with standard containers, as | | /// Provided for compatibility with standard containers, as | |
| /// comparing two sockets doesn't make much sense... | | /// comparing two sockets doesn't make much sense... | |
| /// | | /// | |
| /// \param Other : Socket to compare | | /// \param Other : Socket to compare | |
| /// | | /// | |
| /// \return True if *this < Other | | /// \return True if *this < Other | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator <(const sfSocketUDP& Other) const; | | bool operator <(const SocketUDP& Other) const; | |
| | | | |
| private : | | private : | |
| | | | |
|
| friend class sfSelector<sfSocketUDP>; | | friend class Selector<SocketUDP>; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the socket from a socket descriptor | | /// Construct the socket from a socket descriptor | |
| /// (for internal use only) | | /// (for internal use only) | |
| /// | | /// | |
| /// \param Descriptor : Socket descriptor | | /// \param Descriptor : Socket descriptor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSocketUDP(sf_private::sfSocketType Descriptor); | | SocketUDP(priv::SocketType Descriptor); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Create the socket | | /// Create the socket | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Create(); | | void Create(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sf_private::sfSocketType mySocket; ///< Socket identifier | | priv::SocketType mySocket; ///< Socket identifier | |
| unsigned short myPort; ///< Port to which the socket is bou | | unsigned short myPort; ///< Port to which the socket is bound | |
| nd | | | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_SOCKETUDP_HPP | | #endif // SFML_SOCKETUDP_HPP | |
| | | | |
End of changes. 17 change blocks. |
| 24 lines changed or deleted | | 28 lines changed or added | |
|
| Sound.hpp | | Sound.hpp | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| | | | |
| #ifndef SFML_SOUND_HPP | | #ifndef SFML_SOUND_HPP | |
| #define SFML_SOUND_HPP | | #define SFML_SOUND_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <cstdlib> | | #include <cstdlib> | |
| #include <SFML/Audio/AudioResource.hpp> | | #include <SFML/Audio/AudioResource.hpp> | |
| | | | |
|
| class sfSoundBuffer; | | namespace sf | |
| | | { | |
| | | class SoundBuffer; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfSound defines the properties of the sound such as position, | | /// Sound defines the properties of the sound such as position, | |
| /// volume, pitch, etc. | | /// volume, pitch, etc. | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfSound : public sf_private::sfAudioResource | | class SFML_API Sound : public AudioResource | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Enumeration of the sound states | | /// Enumeration of the sound states | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| enum Status | | enum Status | |
| { | | { | |
| Stopped, ///< Sound is not playing | | Stopped, ///< Sound is not playing | |
| Paused, ///< Sound is paused | | Paused, ///< Sound is paused | |
| | | | |
| skipping to change at line 66 | | skipping to change at line 68 | |
| /// | | /// | |
| /// \param Buffer : Sound buffer to play (NULL by default) | | /// \param Buffer : Sound buffer to play (NULL by default) | |
| /// \param Loop : Loop flag (false by default) | | /// \param Loop : Loop flag (false by default) | |
| /// \param Pitch : Value of the pitch (1 by default) | | /// \param Pitch : Value of the pitch (1 by default) | |
| /// \param Volume : Volume (100 by default) | | /// \param Volume : Volume (100 by default) | |
| /// \param X : X position (0 by default) | | /// \param X : X position (0 by default) | |
| /// \param Y : Y position (0 by default) | | /// \param Y : Y position (0 by default) | |
| /// \param Z : Z position (0 by default) | | /// \param Z : Z position (0 by default) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSound(const sfSoundBuffer* Buffer = NULL, bool Loop = false, float Pi
tch = 1.f, float Volume = 100.f, float X = 0.f, float Y = 0.f, float Z = 0.
f); | | Sound(const SoundBuffer* Buffer = NULL, bool Loop = false, float Pitch
= 1.f, float Volume = 100.f, float X = 0.f, float Y = 0.f, float Z = 0.f); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Copy constructor | | /// Copy constructor | |
| /// | | /// | |
| /// \param Copy : Instance to copy | | /// \param Copy : Instance to copy | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSound(const sfSound& Copy); | | Sound(const Sound& Copy); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Destructor | | /// Destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| ~sfSound(); | | ~Sound(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Play the sound | | /// Play the sound | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Play(); | | void Play(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Pause the sound | | /// Pause the sound | |
| /// | | /// | |
| | | | |
| skipping to change at line 106 | | skipping to change at line 108 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Stop(); | | void Stop(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Set the source buffer | | /// Set the source buffer | |
| /// | | /// | |
| /// \param Buffer : Pointer to the new sound buffer to bind to the soun
d | | /// \param Buffer : Pointer to the new sound buffer to bind to the soun
d | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void SetBuffer(const sfSoundBuffer* Buffer); | | void SetBuffer(const SoundBuffer* Buffer); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Set the sound loop state | | /// Set the sound loop state | |
| /// | | /// | |
| /// \param Loop : True to play in loop, false to play once | | /// \param Loop : True to play in loop, false to play once | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetLoop(bool Loop); | | void SetLoop(bool Loop); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 148 | | skipping to change at line 150 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetPosition(float X, float Y, float Z); | | void SetPosition(float X, float Y, float Z); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// 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 sfSoundBuffer* GetBuffer() const; | | const SoundBuffer* GetBuffer() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Tell whether or not the sound is looping | | /// Tell whether or not the sound is looping | |
| /// | | /// | |
| /// \return True if the sound is looping, false otherwise | | /// \return True if the sound is looping, false otherwise | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool GetLoop() const; | | bool GetLoop() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 208 | | skipping to change at line 210 | |
| float GetPlayingOffset() const; | | float GetPlayingOffset() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Assignment operator | | /// Assignment operator | |
| /// | | /// | |
| /// \param Other : Instance to assign | | /// \param Other : Instance to assign | |
| /// | | /// | |
| /// \return Reference to the sound | | /// \return Reference to the sound | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSound& operator =(const sfSound& Other); | | Sound& operator =(const Sound& Other); | |
| | | | |
| private : | | private : | |
| | | | |
|
| friend class sfSoundStream; | | friend class SoundStream; | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// /see sfAudioResource::DestroyAudioResources | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| virtual void DestroyAudioResources(); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| unsigned int mySource; ///< OpenAL source identifier | | unsigned int mySource; ///< OpenAL source identifier | |
| const sfSoundBuffer* myBuffer; ///< Sound buffer bound to the source | | const SoundBuffer* myBuffer; ///< Sound buffer bound to the source | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_SOUND_HPP | | #endif // SFML_SOUND_HPP | |
| | | | |
End of changes. 12 change blocks. |
| 18 lines changed or deleted | | 16 lines changed or added | |
|
| SoundBuffer.hpp | | SoundBuffer.hpp | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| #define SFML_SOUNDBUFFER_HPP | | #define SFML_SOUNDBUFFER_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Config.hpp> | | #include <SFML/Config.hpp> | |
| #include <SFML/Audio/AudioResource.hpp> | | #include <SFML/Audio/AudioResource.hpp> | |
| #include <string> | | #include <string> | |
| #include <vector> | | #include <vector> | |
| | | | |
|
| | | namespace sf | |
| | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfSoundBuffer is the low-level for loading and manipulating | | /// SoundBuffer is the low-level for loading and manipulating | |
| /// sound buffers | | /// sound buffers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfSoundBuffer : public sf_private::sfAudioResource | | class SFML_API SoundBuffer : public AudioResource | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSoundBuffer(); | | SoundBuffer(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Copy constructor | | /// Copy constructor | |
| /// | | /// | |
| /// \param Copy : Instance to copy | | /// \param Copy : Instance to copy | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSoundBuffer(const sfSoundBuffer& Copy); | | SoundBuffer(const SoundBuffer& Copy); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Destructor | | /// Destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| ~sfSoundBuffer(); | | ~SoundBuffer(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Load the sound buffer from a file | | /// Load the sound buffer from a file | |
| /// | | /// | |
| /// \param Filename : Path of the sound file to load | | /// \param Filename : Path of the sound file to load | |
| /// | | /// | |
| /// \return True if loading has been successful | | /// \return True if loading has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool LoadFromFile(const std::string& Filename); | | bool LoadFromFile(const std::string& Filename); | |
| | | | |
| skipping to change at line 86 | | skipping to change at line 88 | |
| /// samples is 16 bits signed integer | | /// samples is 16 bits signed integer | |
| /// | | /// | |
| /// \param Samples : Pointer to the samples in memory | | /// \param Samples : Pointer to the samples in memory | |
| /// \param SamplesCount : Number of samples pointed by Samples | | /// \param SamplesCount : Number of samples pointed by Samples | |
| /// \param ChannelsCount : Number of channels (1 = mono, 2 = stereo, ..
.) | | /// \param ChannelsCount : Number of channels (1 = mono, 2 = stereo, ..
.) | |
| /// \param SampleRate : Frequency (number of samples to play per sec
ond) | | /// \param SampleRate : Frequency (number of samples to play per sec
ond) | |
| /// | | /// | |
| /// \return True if loading has been successful | | /// \return True if loading has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool LoadFromMemory(const sfInt16* Samples, std::size_t SamplesCount, u
nsigned int ChannelsCount, unsigned int SampleRate); | | bool LoadFromMemory(const Int16* Samples, std::size_t SamplesCount, uns
igned int ChannelsCount, unsigned int SampleRate); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Save the sound buffer to a file | | /// Save the sound buffer to a file | |
| /// | | /// | |
| /// \param Filename : Path of the sound file to write | | /// \param Filename : Path of the sound file to write | |
| /// | | /// | |
| /// \return True if saving has been successful | | /// \return True if saving has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool SaveToFile(const std::string& Filename) const; | | bool SaveToFile(const std::string& Filename) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Return the sound samples | | /// Return the sound samples | |
| /// | | /// | |
| /// \return Pointer to the array of sound samples, in 16 bits signed in
teger format | | /// \return Pointer to the array of sound samples, in 16 bits signed in
teger format | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| const sfInt16* GetSamples() const; | | const Int16* GetSamples() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Return the samples count | | /// Return the samples count | |
| /// | | /// | |
| /// \return Number of samples | | /// \return Number of samples | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| std::size_t GetSamplesCount() const; | | std::size_t GetSamplesCount() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 146 | | skipping to change at line 148 | |
| float GetDuration() const; | | float GetDuration() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Assignment operator | | /// Assignment operator | |
| /// | | /// | |
| /// \param Other : Instance to assign | | /// \param Other : Instance to assign | |
| /// | | /// | |
| /// \return Reference to the sound buffer | | /// \return Reference to the sound buffer | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSoundBuffer& operator =(const sfSoundBuffer& Other); | | SoundBuffer& operator =(const SoundBuffer& Other); | |
| | | | |
| private : | | private : | |
| | | | |
|
| friend class sfSound; | | friend class Sound; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Update the internal buffer with the audio samples | | /// Update the internal buffer with the audio samples | |
| /// | | /// | |
| /// \param ChannelsCount : Number of channels | | /// \param ChannelsCount : Number of channels | |
| /// \param SampleRate : Sample rate | | /// \param SampleRate : Sample rate | |
| /// | | /// | |
| /// \return True on success | | /// \return True on success | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool Update(unsigned int ChannelsCount, unsigned int SampleRate); | | bool Update(unsigned int ChannelsCount, unsigned int SampleRate); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// /see sfAudioResource::DestroyAudioResources | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| virtual void DestroyAudioResources(); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| unsigned int myBuffer; ///< OpenAL buffer identifier | | unsigned int myBuffer; ///< OpenAL buffer identifier | |
| std::vector<sfInt16> mySamples; ///< Samples buffer | | std::vector<Int16> mySamples; ///< Samples buffer | |
| float myDuration; ///< Sound duration, in seconds | | float myDuration; ///< Sound duration, in seconds | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_SOUNDBUFFER_HPP | | #endif // SFML_SOUNDBUFFER_HPP | |
| | | | |
End of changes. 13 change blocks. |
| 18 lines changed or deleted | | 16 lines changed or added | |
|
| SoundRecorder.hpp | | SoundRecorder.hpp | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| | | | |
| #ifndef SFML_SOUNDRECORDER_HPP | | #ifndef SFML_SOUNDRECORDER_HPP | |
| #define SFML_SOUNDRECORDER_HPP | | #define SFML_SOUNDRECORDER_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/System/Thread.hpp> | | #include <SFML/System/Thread.hpp> | |
| #include <vector> | | #include <vector> | |
| | | | |
|
| | | namespace sf | |
| | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfSoundRecorder 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 sfSoundRecorder : private sfThread | | class SFML_API SoundRecorder : private Thread | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSoundRecorder(); | | SoundRecorder(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Virtual destructor | | /// Virtual destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual ~sfSoundRecorder(); | | 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 | |
| /// | | /// | |
| /// \param SampleRate : Sound frequency (the more samples, the higher t
he quality) | | /// \param SampleRate : Sound frequency (the more samples, the higher t
he quality) | |
| /// (44100 by default = CD quality) | | /// (44100 by default = CD quality) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Start(unsigned int SampleRate = 44100); | | void Start(unsigned int SampleRate = 44100); | |
| | | | |
| skipping to change at line 98 | | skipping to change at line 100 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// 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 sfInt16* Samples, std::size_t Samples
Count) = 0; | | virtual bool ProcessSamples(const Int16* Samples, std::size_t SamplesCo
unt) = 0; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// /see sfThread::Run | | /// /see sfThread::Run | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual void Run(); | | virtual void Run(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the available captured samples and process them | | /// Get the available captured samples and process them | |
| /// | | /// | |
| | | | |
| skipping to change at line 121 | | skipping to change at line 123 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Clean up the recorder internal resources | | /// Clean up the recorder internal resources | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void CleanUp(); | | void CleanUp(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| std::vector<sfInt16> mySamples; ///< Buffer to store captured sampl | | std::vector<Int16> mySamples; ///< Buffer to store captured samples | |
| es | | unsigned int mySampleRate; ///< Sample rate | |
| unsigned int mySampleRate; ///< Sample rate | | bool myIsCapturing; ///< Capturing state | |
| bool myIsCapturing; ///< Capturing state | | | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_SOUNDRECORDER_HPP | | #endif // SFML_SOUNDRECORDER_HPP | |
| | | | |
End of changes. 8 change blocks. |
| 9 lines changed or deleted | | 12 lines changed or added | |
|
| SoundStream.hpp | | SoundStream.hpp | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| #ifndef SFML_SOUNDSTREAM_HPP | | #ifndef SFML_SOUNDSTREAM_HPP | |
| #define SFML_SOUNDSTREAM_HPP | | #define SFML_SOUNDSTREAM_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #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 | |
| | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfSoundStream 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 sfMusic), | |
| /// or for streaming sound from the network | | /// or for streaming sound from the network | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfSoundStream : private sfThread, private sfSound | | class SFML_API SoundStream : private Thread, private Sound | |
| { | | { | |
| public : | | public : | |
| | | | |
|
| using sfSound::Status; | | using Sound::Status; | |
| using sfSound::Stopped; | | using Sound::Stopped; | |
| using sfSound::Paused; | | using Sound::Paused; | |
| using sfSound::Playing; | | using Sound::Playing; | |
| using sfSound::Pause; | | using Sound::Pause; | |
| using sfSound::SetPitch; | | using Sound::SetPitch; | |
| using sfSound::SetVolume; | | using Sound::SetVolume; | |
| using sfSound::SetPosition; | | using Sound::SetPosition; | |
| using sfSound::GetPitch; | | using Sound::GetPitch; | |
| using sfSound::GetVolume; | | using Sound::GetVolume; | |
| using sfSound::GetPosition; | | using Sound::GetPosition; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Structure defining a chunk of audio data to stream | | /// Structure defining a chunk of audio data to stream | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| struct Chunk | | struct Chunk | |
| { | | { | |
|
| const sfInt16* Samples; ///< Pointer to the audio samples | | const Int16* Samples; ///< Pointer to the audio samples | |
| std::size_t NbSamples; ///< Number of samples pointed by Samples | | std::size_t NbSamples; ///< Number of samples pointed by Samples | |
| }; | | }; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Virtual destructor | | /// Virtual destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual ~sfSoundStream(); | | virtual ~SoundStream(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Start playing the audio stream | | /// Start playing the audio stream | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Play(); | | void Play(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Stop playing the audio stream | | /// Stop playing the audio stream | |
| /// | | /// | |
| | | | |
| skipping to change at line 114 | | skipping to change at line 116 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Status GetStatus() const; | | Status GetStatus() const; | |
| | | | |
| protected : | | protected : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSoundStream(); | | SoundStream(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Set the audio stream parameters, you must call it before Play() | | /// Set the audio stream parameters, you must call it before Play() | |
| /// | | /// | |
| /// \param ChannelsCount : Number of channels | | /// \param ChannelsCount : Number of channels | |
| /// \param SampleRate : Sample rate | | /// \param SampleRate : Sample rate | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Initialize(unsigned int ChannelsCount, unsigned int SampleRate); | | void Initialize(unsigned int ChannelsCount, unsigned int SampleRate); | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// /see sfThread::Run | | /// /see Thread::Run | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual void Run(); | | virtual void Run(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Called when the sound restarts | | /// Called when the sound restarts | |
| /// | | /// | |
| /// \return If false is returned, the playback is aborted | | /// \return If false is returned, the playback is aborted | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 169 | | skipping to change at line 171 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // 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 | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_SOUNDSTREAM_HPP | | #endif // SFML_SOUNDSTREAM_HPP | |
| | | | |
End of changes. 9 change blocks. |
| 18 lines changed or deleted | | 22 lines changed or added | |
|
| Sprite.hpp | | Sprite.hpp | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| | | | |
| #ifndef SFML_SPRITE_HPP | | #ifndef SFML_SPRITE_HPP | |
| #define SFML_SPRITE_HPP | | #define SFML_SPRITE_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Graphics/Drawable.hpp> | | #include <SFML/Graphics/Drawable.hpp> | |
| #include <SFML/Graphics/Rect.hpp> | | #include <SFML/Graphics/Rect.hpp> | |
| | | | |
|
| class sfImage; | | namespace sf | |
| | | { | |
| | | class Image; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfSprite defines a sprite : texture, transformations, | | /// Sprite defines a sprite : texture, transformations, | |
| /// color, and draw on screen | | /// color, and draw on screen | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfSprite : public sfDrawable | | class SFML_API Sprite : public Drawable | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSprite(); | | Sprite(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the sprite from a source image | | /// Construct the sprite from a source image | |
| /// | | /// | |
|
| /// \param Image : Image of the sprite | | /// \param Img : Image of the sprite | |
| /// \param Left : Left coordinate of the sprite (0 by default) | | /// \param Left : Left coordinate of the sprite (0 by default) | |
| /// \param Top : Top coordinate of the sprite (0 by default) | | /// \param Top : Top coordinate of the sprite (0 by default) | |
|
| /// \param Scale : Scale (1 by default) | | /// \param ScaleX : Horizontal scale (1 by default) | |
| | | /// \param ScaleY : Vertical scale (1 by default) | |
| /// \param Rotation : Orientation, in degrees (0 by default) | | /// \param Rotation : Orientation, in degrees (0 by default) | |
|
| /// \param Color : Color of the sprite (white by default) | | /// \param Col : Color of the sprite (white by default) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfSprite(const sfImage& Image, float Left = 0.f, float Top = 0.f, float
Scale = 1.f, float Rotation = 0.f, const sfColor& Color = sfColor(255, 255
, 255, 255)); | | Sprite(const Image& Img, float Left = 0.f, float Top = 0.f, float Scale
X = 1.f, float ScaleY = 1.f, float Rotation = 0.f, const Color& Col = Color
(255, 255, 255, 255)); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Change the image of the sprite | | /// Change the image of the sprite | |
| /// | | /// | |
|
| /// \param Image : New image | | /// \param Img : New image | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void SetImage(const sfImage& Image); | | void SetImage(const Image& Img); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Set the sub-rectangle of the sprite inside the source image | | /// Set the sub-rectangle of the sprite inside the source image | |
| /// | | /// | |
| /// \param SubRect : New sub-rectangle | | /// \param SubRect : New sub-rectangle | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void SetSubRect(const sfIntRect& SubRect); | | void SetSubRect(const IntRect& SubRect); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Resize the sprite (by changing its scale factors) | |
| | | /// | |
| | | /// \param Width : New width (must be strictly positive) | |
| | | /// \param Height : New height (must be strictly positive) | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void Resize(float Width, float Height); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the source image of the sprite | | /// Get the source image of the sprite | |
| /// | | /// | |
| /// \return Pointer to the image (can be NULL) | | /// \return Pointer to the image (can be NULL) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| const sfImage* GetImage() const; | | const Image* GetImage() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the sub-rectangle of the sprite inside the source image | | /// Get the sub-rectangle of the sprite inside the source image | |
| /// | | /// | |
| /// \return Sub-rectangle | | /// \return Sub-rectangle | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| const sfIntRect& GetSubRect() const; | | const IntRect& GetSubRect() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the sprite width | | /// Get the sprite width | |
| /// | | /// | |
| /// \return Width of the sprite | | /// \return Width of the sprite | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| float GetWidth() const; | | float GetWidth() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 120 | | skipping to change at line 132 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the color of a given pixel in the sprite | | /// Get the color of a given pixel in the sprite | |
| /// | | /// | |
| /// \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) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfColor GetPixel(unsigned int X, unsigned int Y) const; | | Color GetPixel(unsigned int X, unsigned int Y) const; | |
| | | | |
| protected : | | protected : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// /see sfDrawable::Render | | /// /see Drawable::Render | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void Render(sfRenderWindow& Window); | | virtual void Render(RenderWindow& Window); | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| const sfImage* myImage; ///< Image used to draw the sprite | | const Image* myImage; ///< Image used to draw the sprite | |
| sfIntRect mySubRect; ///< Sub-rectangle of source image to assign | | IntRect mySubRect; ///< Sub-rectangle of source image to assign t | |
| to the sprite | | o the sprite | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_SPRITE_HPP | | #endif // SFML_SPRITE_HPP | |
| | | | |
End of changes. 18 change blocks. |
| 19 lines changed or deleted | | 33 lines changed or added | |
|
| String.hpp | | String.hpp | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| #ifndef SFML_STRING_HPP | | #ifndef SFML_STRING_HPP | |
| #define SFML_STRING_HPP | | #define SFML_STRING_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Graphics/Drawable.hpp> | | #include <SFML/Graphics/Drawable.hpp> | |
| #include <SFML/Graphics/Rect.hpp> | | #include <SFML/Graphics/Rect.hpp> | |
| #include <string> | | #include <string> | |
| | | | |
|
| | | namespace sf | |
| | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfString defines a graphical 2D text, that can be drawn on screen | | /// String defines a graphical 2D text, that can be drawn on screen | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfString : public sfDrawable | | class SFML_API String : public Drawable | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Default constructor | | /// Construct the string from a multibyte text | |
| /// | | /// | |
| /// \param Text : Text assigned to the string ("" by default) | | /// \param Text : Text assigned to the string ("" by default) | |
| /// \param Font : Font used to draw the string ("" by default - use def
ault font) | | /// \param Font : Font used to draw the string ("" by default - use def
ault font) | |
| /// \param Size : Characters size, in pixels (32 by default) | | /// \param Size : Characters size, in pixels (32 by default) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfString(const std::string& Text = "", const std::string& Font = "", fl | | String(const std::string& Text, const std::string& Font = "", float Siz | |
| oat Size = 32.f); | | e = 32.f); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Construct the string from a unicode text | |
| | | /// | |
| | | /// \param Text : Text assigned to the string ("" by default) | |
| | | /// \param Font : Font used to draw the string ("" by default - use def | |
| | | ault font) | |
| | | /// \param Size : Characters size, in pixels (32 by default) | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | String(const std::wstring& Text = L"", const std::string& Font = "", fl | |
| | | oat Size = 32.f); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Preload a bitmap font (otherwise, it is done the first time the fon
t is drawn) | | /// Preload a bitmap font (otherwise, it is done the first time the fon
t is drawn) | |
| /// | | /// | |
|
| /// \param Font : Font to load | | /// \param Font : Font to load | |
| /// \param Size : Requested character size | | /// \param Size : Requested character size | |
| | | /// \param Charset : Characters set to generate (empty by default - tak | |
| | | e the ASCII range [31, 255]) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| static void PreloadFont(const std::string& Font, float Size); | | static void PreloadFont(const std::string& Font, float Size, std::wstri
ng Charset = L""); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Set the text | | /// Set the text (from a multibyte string) | |
| /// | | /// | |
| /// \param Text : New text | | /// \param Text : New text | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetText(const std::string& Text); | | void SetText(const std::string& Text); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Set the text (from a unicode string) | |
| | | /// | |
| | | /// \param Text : New text | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void SetText(const std::wstring& Text); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// Set the font of the string | | /// Set the font of the string | |
| /// | | /// | |
| /// \param Font : Font filename | | /// \param Font : Font filename | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetFont(const std::string& Font); | | void SetFont(const std::string& Font); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Set the size of the string | | /// Set the size of the string | |
| /// | | /// | |
| /// \param Size : New size, in pixels | | /// \param Size : New size, in pixels | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetSize(float Size); | | void SetSize(float Size); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Get the text | | /// Get the text (returns a unicode string) | |
| /// | | /// | |
| /// \return Text | | /// \return Text | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| const std::string& GetText() const; | | const std::wstring& GetUnicodeText() 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 name | | /// \return Font name | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| const std::string& GetFont() const; | | const std::string& GetFont() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 115 | | skipping to change at line 144 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| float GetSize() const; | | float GetSize() 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 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfFloatRect GetRect() const; | | FloatRect GetRect() const; | |
| | | | |
| protected : | | protected : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// /see sfDrawable::Render | | /// /see Drawable::Render | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void Render(sfRenderWindow& Window); | | virtual void Render(RenderWindow& Window); | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| std::string myText; ///< Text to display | | std::wstring myText; ///< Text to display | |
| std::string myFont; ///< Font used to display string | | std::string myFont; ///< Font used to display string | |
| float mySize; ///< Size of characters (in pixels) (must be strict | | float mySize; ///< Size of characters (in pixels) (must be stric | |
| ly positive) | | tly positive) | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_STRING_HPP | | #endif // SFML_STRING_HPP | |
| | | | |
End of changes. 16 change blocks. |
| 18 lines changed or deleted | | 52 lines changed or added | |
|
| VideoMode.hpp | | VideoMode.hpp | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| | | | |
| #ifndef SFML_VIDEOMODE_HPP | | #ifndef SFML_VIDEOMODE_HPP | |
| #define SFML_VIDEOMODE_HPP | | #define SFML_VIDEOMODE_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Config.hpp> | | #include <SFML/Config.hpp> | |
| #include <cstdlib> | | #include <cstdlib> | |
| | | | |
|
| | | namespace sf | |
| | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// sfVideoMode defines a video mode (width, height, bpp, frequency) | | /// VideoMode defines a video mode (width, height, bpp, frequency) | |
| /// and provides static functions for getting modes supported | | /// and provides static functions for getting modes supported | |
| /// by the display device | | /// by the display device | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API sfVideoMode | | class SFML_API VideoMode | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfVideoMode(); | | VideoMode(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Construct the video mode with its attributes | | /// Construct the video mode with its attributes | |
| /// | | /// | |
| /// \param ModeWidth : Width in pixels | | /// \param ModeWidth : Width in pixels | |
| /// \param ModeHeight : Height in pixels | | /// \param ModeHeight : Height in pixels | |
| /// \param ModeBpp : Pixel depths in bits per pixel (32 by default) | | /// \param ModeBpp : Pixel depths in bits per pixel (32 by default) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| sfVideoMode(unsigned int ModeWidth, unsigned int ModeHeight, unsigned i
nt ModeBpp = 32); | | VideoMode(unsigned int ModeWidth, unsigned int ModeHeight, unsigned int
ModeBpp = 32); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the current desktop video mode | | /// Get the current desktop video mode | |
| /// | | /// | |
| /// \return Current desktop video mode | | /// \return Current desktop video mode | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| static sfVideoMode GetDesktopMode(); | | static VideoMode GetDesktopMode(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get a valid video mode | | /// Get a valid video mode | |
| /// Index must be in range [0, GetModesCount()[ | | /// Index must be in range [0, GetModesCount()[ | |
| /// Modes are sorted from best to worst | | /// Modes are sorted from best to worst | |
| /// | | /// | |
| /// \param Index : Index of video mode to get | | /// \param Index : Index of video mode to get | |
| /// | | /// | |
| /// \return Corresponding video mode (invalid mode if index is out of r
ange) | | /// \return Corresponding video mode (invalid mode if index is out of r
ange) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| static sfVideoMode GetMode(std::size_t Index); | | static VideoMode GetMode(std::size_t Index); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get valid video modes count | | /// Get valid video modes count | |
| /// | | /// | |
| /// \return Number of valid video modes available | | /// \return Number of valid video modes available | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| static std::size_t GetModesCount(); | | static std::size_t GetModesCount(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 103 | | skipping to change at line 105 | |
| bool IsValid() const; | | bool IsValid() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Comparison operator overload -- tell if two video modes are equal | | /// Comparison operator overload -- tell if two video modes are equal | |
| /// | | /// | |
| /// \param Other : Video mode to compare | | /// \param Other : Video mode to compare | |
| /// | | /// | |
| /// \return True if modes are equal | | /// \return True if modes are equal | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator ==(const sfVideoMode& Other) const; | | bool operator ==(const VideoMode& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Comparison operator overload -- tell if two video modes are differe
nt | | /// Comparison operator overload -- tell if two video modes are differe
nt | |
| /// | | /// | |
| /// \param Other : Video mode to compare | | /// \param Other : Video mode to compare | |
| /// | | /// | |
| /// \return True if modes are different | | /// \return True if modes are different | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool operator !=(const sfVideoMode& Other) const; | | bool operator !=(const VideoMode& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| unsigned int Width; ///< Video mode width, in pixels | | unsigned int Width; ///< Video mode width, in pixels | |
| unsigned int Height; ///< Video mode height, in pixels | | unsigned int Height; ///< Video mode height, in pixels | |
| unsigned int BitsPerPixel; ///< Video mode pixel depth, in bits per pix
els | | unsigned int BitsPerPixel; ///< Video mode pixel depth, in bits per pix
els | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get and sort valid video modes | | /// Get and sort valid video modes | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| static void InitializeModes(); | | static void InitializeModes(); | |
| }; | | }; | |
| | | | |
|
| | | } // namespace sf | |
| | | | |
| #endif // SFML_VIDEOMODE_HPP | | #endif // SFML_VIDEOMODE_HPP | |
| | | | |
End of changes. 10 change blocks. |
| 8 lines changed or deleted | | 12 lines changed or added | |
|