| Drawable.hpp | | Drawable.hpp | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 38 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Graphics/Color.hpp> | | #include <SFML/Graphics/Color.hpp> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
| class RenderWindow; | | class RenderWindow; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Enumerate the blending modes for drawable objects | |
| | | //////////////////////////////////////////////////////////// | |
| | | namespace Blend | |
| | | { | |
| | | enum Mode | |
| | | { | |
| | | Alpha, ///< Pixel = Src * a + Dest * (1 - a) | |
| | | Add, ///< Pixel = Src + Dest | |
| | | Multiply, ///< Pixel = Src * Dest | |
| | | None ///< No blending | |
| | | }; | |
| | | } | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// 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 Drawable | | class SFML_API Drawable | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| | | | |
| skipping to change at line 67 | | skipping to change at line 81 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Virtual destructor | | /// Virtual destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual ~Drawable(); | | 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 coordinate | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| 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 coordinate | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetTop(float Top); | | void SetTop(float Top); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Set the position of the object | |
| | | /// | |
| | | /// \param Left : New left coordinate | |
| | | /// \param Top : New top coordinate | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void SetPosition(float Left, float Top); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Set the horizontal scale of the object | |
| | | /// | |
| | | /// \param Scale : New scale (must be strictly positive) | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void SetScaleX(float Scale); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Set the vertical scale of the object | |
| | | /// | |
| | | /// \param Scale : New scale (must be strictly positive) | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void SetScaleY(float Scale); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// Set the scale of the object | | /// Set the scale of the object | |
| /// | | /// | |
| /// \param ScaleX : New horizontal scale (must be strictly positive) | | /// \param ScaleX : New horizontal scale (must be strictly positive) | |
| /// \param ScaleY : New vertical scale (must be strictly positive) | | /// \param ScaleY : New vertical scale (must be strictly positive) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetScale(float ScaleX, float ScaleY); | | 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); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Set the center of rotation, in coordinates relative to the | | /// Set the center of rotation, in coordinates relative to the | |
|
| /// object | | /// object. | |
| | | /// The default rotation center is (0, 0) | |
| /// | | /// | |
| /// \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. | |
| | | /// The default color is white | |
| /// | | /// | |
| /// \param Col : New color | | /// \param Col : New color | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetColor(const Color& Col); | | void SetColor(const Color& Col); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Set the blending mode for the object. | |
| | | /// The default blend mode is Blend::Alpha | |
| | | /// | |
| | | /// \param Mode : New blending mode | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void SetBlendMode(Blend::Mode Mode); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// 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 | |
| /// | | /// | |
| | | | |
| skipping to change at line 164 | | skipping to change at line 214 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the color of the object | | /// Get the color of the object | |
| /// | | /// | |
| /// \return Current color | | /// \return Current color | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| const Color& GetColor() const; | | const Color& GetColor() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Get the current blending mode | |
| | | /// | |
| | | /// \return Current blending mode | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | Blend::Mode GetBlendMode() 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 | |
| | | | |
| skipping to change at line 199 | | skipping to change at line 257 | |
| private : | | private : | |
| | | | |
| friend class RenderWindow; | | 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(RenderWindow& Window); | | void Draw(const RenderWindow& Window) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// 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(RenderWindow& Window) = 0; | | virtual void Render(const RenderWindow& Window) const = 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 myScaleX; ///< Horizontal scale of the object | | float myScaleX; ///< Horizontal scale of the object | |
| float myScaleY; ///< Vertical scale of the object | | float myScaleY; ///< Vertical scale of the object | |
| float myRotation; ///< Orientation of the object, in degrees | | float myRotation; ///< Orientation of the object, in degrees | |
| float myCenterX; ///< X coordinate of the center of rotation, relative | | float myCenterX; ///< X coordinate of the center of rotation, r | |
| to the object | | elative to the object | |
| float myCenterY; ///< Y coordinate of the center of rotation, relative | | float myCenterY; ///< Y coordinate of the center of rotation, r | |
| to the object | | elative to the object | |
| Color myColor; ///< Overlay color of the object | | Color myColor; ///< Overlay color of the object | |
| | | Blend::Mode myBlendMode; ///< Blending mode | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_DRAWABLE_HPP | | #endif // SFML_DRAWABLE_HPP | |
| | | | |
End of changes. 11 change blocks. |
| 16 lines changed or deleted | | 75 lines changed or added | |
|
| Event.hpp | | Event.hpp | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 38 | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Config.hpp> | | #include <SFML/Config.hpp> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Definition of key codes for keyboard events | | /// Definition of key codes for keyboard events | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| struct Key | | namespace 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, | |
|
| | | Control, Shift, Alt, | |
| 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, | | Pause, | |
| | | | |
| Count // For internal use | | Count // For internal use | |
| }; | | }; | |
|
| }; | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Definition of button codes for mouse events | | /// Definition of button codes for mouse events | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| struct Mouse | | namespace Mouse | |
| { | | { | |
| enum Button | | enum Button | |
| { | | { | |
|
| Left = 1 << 1, | | Left, | |
| Right = 1 << 2, | | Right, | |
| Middle = 1 << 3 | | Middle, | |
| | | XButton1, | |
| | | XButton2, | |
| | | | |
| | | Count // For internal use | |
| }; | | }; | |
|
| }; | | } | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Definition of joystick axis for joystick events | |
| | | //////////////////////////////////////////////////////////// | |
| | | namespace Joy | |
| | | { | |
| | | enum Axis | |
| | | { | |
| | | AxisX, | |
| | | AxisY, | |
| | | AxisZ, | |
| | | AxisR, | |
| | | AxisU, | |
| | | AxisV, | |
| | | AxisPOV, | |
| | | | |
| | | Count // For internal use | |
| | | }; | |
| | | } | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Event defines a system event and its parameters | | /// Event defines a system event and its parameters | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| class Event | | class Event | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Enumeration of the different types of events | | /// Enumeration of the different types of events | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| enum EventType | | enum EventType | |
| { | | { | |
|
| Close, | | Closed, | |
| Resize, | | Resized, | |
| LostFocus, | | LostFocus, | |
| GainedFocus, | | GainedFocus, | |
| TextEntered, | | TextEntered, | |
| KeyPressed, | | KeyPressed, | |
| KeyReleased, | | KeyReleased, | |
| MouseWheelMoved, | | MouseWheelMoved, | |
| MouseButtonPressed, | | MouseButtonPressed, | |
| MouseButtonReleased, | | MouseButtonReleased, | |
|
| MouseMove, | | MouseMoved, | |
| JoystickButtonPressed, | | JoyButtonPressed, | |
| JoystickButtonReleased, | | JoyButtonReleased, | |
| JoystickMove | | JoyMoved | |
| }; | | }; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| EventType Type; ///< Type of the event | | EventType Type; ///< Type of the event | |
| | | | |
| union | | union | |
| { | | { | |
|
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Text event parameters | | /// Text event parameters | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| struct | | struct | |
| { | | { | |
| Uint16 Unicode; | | Uint16 Unicode; | |
| } Text; | | } Text; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Keyboard events parameters | | /// Keyboard events parameters | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| struct | | struct | |
| { | | { | |
| Key::Code Code; | | Key::Code Code; | |
| bool Alt; | | bool Alt; | |
| bool Control; | | bool Control; | |
| bool Shift; | | bool Shift; | |
| } Key; | | } Key; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Mouse events parameters | | /// Mouse move event parameters | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| struct | | struct | |
| { | | { | |
|
| unsigned int Buttons; | | | |
| unsigned int X; | | unsigned int X; | |
| unsigned int Y; | | unsigned int Y; | |
|
| } Mouse; | | } MouseMove; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Mouse buttons events parameters | |
| | | //////////////////////////////////////////////////////////// | |
| | | struct | |
| | | { | |
| | | Mouse::Button Button; | |
| | | } MouseButton; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Mouse wheel events parameters | | /// Mouse wheel events parameters | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| struct | | struct | |
| { | | { | |
| int Delta; | | int Delta; | |
| } MouseWheel; | | } MouseWheel; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Joystick events parameters | | /// Joystick axis move event parameters | |
| | | //////////////////////////////////////////////////////////// | |
| | | struct | |
| | | { | |
| | | unsigned int JoystickId; | |
| | | Joy::Axis Axis; | |
| | | float Position; | |
| | | } JoyMove; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Joystick buttons events parameters | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| struct | | struct | |
| { | | { | |
| unsigned int JoystickId; | | unsigned int JoystickId; | |
| unsigned int Button; | | unsigned int Button; | |
|
| int X; | | } JoyButton; | |
| int Y; | | | |
| int Z; | | | |
| } Joystick; | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Size events parameters | | /// Size events parameters | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| struct | | struct | |
| { | | { | |
| unsigned int Width; | | unsigned int Width; | |
| unsigned int Height; | | unsigned int Height; | |
| } Size; | | } Size; | |
| }; | | }; | |
| | | | |
End of changes. 14 change blocks. |
| 22 lines changed or deleted | | 59 lines changed or added | |
|
| Image.hpp | | Image.hpp | |
| | | | |
| skipping to change at line 76 | | skipping to change at line 76 | |
| /// \param Col : Image color (black by default) | | /// \param Col : Image color (black by default) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Image(unsigned int Width, unsigned int Height, const Color& Col = Color
(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) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| Image(unsigned int Width, unsigned int Height, const void* Data); | | Image(unsigned int Width, unsigned int Height, const Uint8* Data); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Destructor | | /// Destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| ~Image(); | | ~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); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Save the content of the image to a file | | /// Load the surface from a file in memory | |
| /// | | /// | |
|
| /// \param Filename : Path of the file to save (overwritten if already | | /// \param Data : Pointer to the file data in memory | |
| exist) | | /// \param SizeInBytes : Size of the data to load, in bytes | |
| /// | | /// | |
|
| /// \return True if saving was successful | | /// \return True if loading was successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool SaveToFile(const std::string& Filename) const; | | bool LoadFromMemory(const char* Data, std::size_t SizeInBytes); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Create an empty image | | /// Load the image directly from an array of pixels | |
| /// | | /// | |
| /// \param Width : Image width | | /// \param Width : Image width | |
| /// \param Height : Image height | | /// \param Height : Image height | |
|
| /// \param Col : Image color (black by default) | | /// \param Data : Pointer to the pixels in memory (assumed format is | |
| | | RGBA) | |
| | | /// | |
| | | /// \return True if loading was successful | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | bool LoadFromPixels(unsigned int Width, unsigned int Height, const Uint | |
| | | 8* Data); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Save the content of the image to a file | |
| | | /// | |
| | | /// \param Filename : Path of the file to save (overwritten if already | |
| | | exist) | |
| | | /// | |
| | | /// \return True if saving was successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Create(unsigned int Width, unsigned int Height, const Color& Col =
Color(0, 0, 0, 255)); | | bool SaveToFile(const std::string& Filename) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Load the image from pixels in memory | | /// Create an empty image | |
| /// | | /// | |
| /// \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 | | /// \param Col : Image color (black by default) | |
| RGBA 32 bits) | | /// | |
| | | /// \return True if creation was successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void LoadFromMemory(unsigned int Width, unsigned int Height, const void
* Data); | | bool Create(unsigned int Width, unsigned int Height, const Color& Col =
Color(0, 0, 0, 255)); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Create transparency mask from a specified colorkey | | /// Create transparency mask from a specified colorkey | |
| /// | | /// | |
| /// \param ColorKey : Color to become transparent | | /// \param ColorKey : Color to become transparent | |
| /// \param Alpha : Alpha value to use for transparent pixels (0 by d
efault) | | /// \param Alpha : Alpha value to use for transparent pixels (0 by d
efault) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void CreateMaskFromColor(const Color& ColorKey, Uint8 Alpha = 0); | | 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 Col : Color to assign to new pixels (black by default) | | /// \param Col : Color to assign to new pixels (black by default) | |
| /// | | /// | |
|
| | | /// \return True if resize has been successful | |
| | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Resize(unsigned int Width, unsigned int Height, const Color& Col =
Color(0, 0, 0, 255)); | | bool 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 Col : New color for pixel (X, Y) | | /// \param Col : New color for pixel (X, Y) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 167 | | skipping to change at line 184 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get a pixel from the image | | /// Get a pixel from the image | |
| /// | | /// | |
| /// \param X : X coordinate of pixel in the image | | /// \param X : X coordinate of pixel in the image | |
| /// \param Y : Y coordinate of pixel in the image | | /// \param Y : Y coordinate of pixel in the image | |
| /// | | /// | |
| /// \return Color of pixel (x, y) | | /// \return Color of pixel (x, y) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| Color GetPixel(unsigned int X, unsigned int Y) const; | | const Color& GetPixel(unsigned int X, unsigned int Y) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Get a read-only pointer to the array of pixels (32 bits integer RGB | | /// Get a read-only pointer to the array of pixels (8 bits integers RGB | |
| A) | | A) | |
| /// Array size is GetWidth() x GetHeight() | | /// Array size is GetWidth() x GetHeight() x 4 | |
| /// This pointer becomes invalid if you reload or resize the image | | /// This pointer becomes invalid if you reload or resize the image | |
| /// | | /// | |
| /// \return Const pointer to the array of pixels | | /// \return Const pointer to the array of pixels | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| const Uint32* GetPixelsPtr() const; | | const Uint8* GetPixelsPtr() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Update image in video memory | | | |
| /// (use when you have modified pixels manually) | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| void Update(); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Bind the image for rendering | | /// Bind the image for rendering | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Bind() const; | | void Bind() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Enable or disable image smooth filter | | /// Enable or disable image smooth filter. | |
| | | /// This parameter is enabled by default | |
| /// | | /// | |
| /// \param Smooth : True to enable smoothing filter, false to disable i
t | | /// \param Smooth : True to enable smoothing filter, false to disable i
t | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetSmooth(bool Smooth) const; | | void SetSmooth(bool Smooth) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Enable or disable image repeat mode | | /// Enable or disable image repeat mode | |
|
| /// (ie. how to define pixels outside the texture range) | | /// (ie. how to define pixels outside the texture range). | |
| | | /// This parameter is enabled by default | |
| /// | | /// | |
| /// \param Repeat : True to enable repeat, false to disable | | /// \param Repeat : True to enable repeat, false to disable | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetRepeat(bool Repeat) const; | | void SetRepeat(bool Repeat) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Return the width of the image | | /// Return the width of the image | |
| /// | | /// | |
| /// \return Width in pixels | | /// \return Width in pixels | |
| | | | |
| skipping to change at line 229 | | skipping to change at line 241 | |
| /// | | /// | |
| /// \return Height in pixels | | /// \return Height in pixels | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| unsigned int GetHeight() const; | | unsigned int GetHeight() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// 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 | |
| | | /// \param Adjust : Pass true to apply the half-texel adjustment | |
| /// | | /// | |
| /// \return Texture coordinates corresponding to the sub-rectangle | | /// \return Texture coordinates corresponding to the sub-rectangle | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| FloatRect GetTexCoords(const IntRect& Rect) const; | | FloatRect GetTexCoords(const IntRect& Rect, bool Adjust = true) 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); | |
| | | | |
| skipping to change at line 261 | | skipping to change at line 274 | |
| /// \return Reference to the image | | /// \return Reference to the image | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Image& operator =(const Image& Other); | | Image& operator =(const Image& Other); | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Create the OpenGL texture | | /// Create the OpenGL texture | |
| /// | | /// | |
|
| | | /// \return True if texture has been successfully created | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | bool CreateTexture(); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Update the internal texture in video memory | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void Update() const; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Reset the image attributes | |
| | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void CreateTexture(); | | void Reset(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// /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 be | | unsigned int myTextureWidth; ///< Actual texture width (can be g | |
| greater than image width because of padding) | | reater than image width because of padding) | |
| unsigned int myTextureHeight; ///< Actual texture height (can be | | unsigned int myTextureHeight; ///< Actual texture height (can be | |
| greater than image height because of padding) | | greater than image height because of padding) | |
| std::vector<Uint32> myPixels; ///< Pixels of the image (32 bits | | std::vector<Color> myPixels; ///< Pixels of the image | |
| BGRA) | | unsigned int myGLTexture; ///< OpenGL texture identifier | |
| unsigned int myGLTexture; ///< OpenGL texture identifier | | mutable bool myUpdated; ///< Tells if the internal texture | |
| | | needs to be updated | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_IMAGE_HPP | | #endif // SFML_IMAGE_HPP | |
| | | | |
End of changes. 24 change blocks. |
| 41 lines changed or deleted | | 70 lines changed or added | |
|
| Input.hpp | | Input.hpp | |
| | | | |
| skipping to change at line 101 | | skipping to change at line 101 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the mouse Y position | | /// Get the mouse Y position | |
| /// | | /// | |
| /// \return Current mouse top position, relative to owner window | | /// \return Current mouse top position, relative to owner window | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| unsigned int GetMouseY() const; | | unsigned int GetMouseY() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Get the joystick X position | | /// Get a joystick axis position | |
| /// | | /// | |
| /// \param JoyId : Identifier of the joystick to check (0 or 1) | | /// \param JoyId : Identifier of the joystick to check (0 or 1) | |
|
| | | /// \param Axis : Axis to get | |
| /// | | /// | |
|
| /// \return Current joystick X position, in the range [-100, 100] | | /// \return Current axis position, in the range [-100, 100] (except for
POV, which is [0, 360]) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| int GetJoystickX(unsigned int JoyId) const; | | float GetJoystickAxis(unsigned int JoyId, Joy::Axis Axis) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Get the joystick Y position | | | |
| /// | | | |
| /// \param JoyId : Identifier of the joystick to check (0 or 1) | | | |
| /// | | | |
| /// \return Current joystick Y position, in the range [-100, 100] | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| int GetJoystickY(unsigned int JoyId) const; | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Get the joystick Z position | | | |
| /// | | | |
| /// \param JoyId : Identifier of the joystick to check (0 or 1) | | | |
| /// | | | |
| /// \return Current joystick Z position, in the range [-100, 100] | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| int GetJoystickZ(unsigned int JoyId) const; | | | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// /see sfWindowListener::OnEvent | | /// /see sfWindowListener::OnEvent | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual void OnEvent(const Event& EventReceived); | | virtual void OnEvent(const Event& EventReceived); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool myKeys[Key::Count]; ///< Array containing the state | | bool myKeys[Key::Count]; ///< Array containing the | |
| of all keayboard keys | | state of all keayboard keys | |
| bool myMouseButtons[3]; ///< Array containing the state | | bool myMouseButtons[Mouse::Count]; ///< Array containing the | |
| of all mouse buttons | | state of all mouse buttons | |
| bool myJoystickButtons[2][8]; ///< Array containing the state | | bool myJoystickButtons[2][16]; ///< Array containing the | |
| of all joysticks buttons | | 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 | | float myJoystickAxis[2][Joy::Count]; ///< Joysticks position on | |
| int myJoystickY[2]; ///< Joysticks position on Y | | each axis | |
| int myJoystickZ[2]; ///< Joysticks position on Z | | | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_INPUT_HPP | | #endif // SFML_INPUT_HPP | |
| | | | |
End of changes. 5 change blocks. |
| 34 lines changed or deleted | | 14 lines changed or added | |
|
| Packet.hpp | | Packet.hpp | |
| | | | |
| skipping to change at line 90 | | skipping to change at line 90 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the size of the data contained in the packet | | /// Get the size of the data contained in the packet | |
| /// | | /// | |
| /// \return Data size, in bytes | | /// \return Data size, in bytes | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Uint32 GetDataSize() const; | | Uint32 GetDataSize() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Tell if the packet is valid for reading | |
| | | /// | |
| | | /// \return True if data can be extracted from the packet | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | operator bool() const; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// Operator >> overloads to extract data from the packet | | /// Operator >> overloads to extract data from the packet | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Packet& operator >>(Int8& Data); | | Packet& operator >>(Int8& Data); | |
| Packet& operator >>(Uint8& Data); | | Packet& operator >>(Uint8& Data); | |
| Packet& operator >>(Int16& Data); | | Packet& operator >>(Int16& Data); | |
| Packet& operator >>(Uint16& Data); | | Packet& operator >>(Uint16& Data); | |
| Packet& operator >>(Int32& Data); | | Packet& operator >>(Int32& Data); | |
| Packet& operator >>(Uint32& Data); | | Packet& operator >>(Uint32& Data); | |
| Packet& operator >>(float& Data); | | Packet& operator >>(float& Data); | |
| | | | |
| skipping to change at line 125 | | skipping to change at line 133 | |
| Packet& operator <<(double Data); | | Packet& operator <<(double Data); | |
| Packet& operator <<(const char* Data); | | Packet& operator <<(const char* Data); | |
| Packet& operator <<(const std::string& Data); | | Packet& operator <<(const std::string& Data); | |
| | | | |
| private : | | private : | |
| | | | |
| friend class SocketTCP; | | friend class SocketTCP; | |
| friend class SocketUDP; | | friend class SocketUDP; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Check if the packet can extract a given size of bytes | |
| | | /// | |
| | | /// \param Size : Size to check | |
| | | /// | |
| | | /// \return True if Size bytes can be read from the packet's data | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | bool CheckSize(std::size_t Size); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// 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 | |
|
| | | bool myIsValid; ///< Reading state of the packet | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_PACKET_HPP | | #endif // SFML_PACKET_HPP | |
| | | | |
End of changes. 3 change blocks. |
| 0 lines changed or deleted | | 19 lines changed or added | |
|
| PostFX.hpp | | PostFX.hpp | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| | | | |
| #ifndef SFML_POSTFX_HPP | | #ifndef SFML_POSTFX_HPP | |
| #define SFML_POSTFX_HPP | | #define SFML_POSTFX_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| #include <SFML/Graphics/Drawable.hpp> | | #include <SFML/Graphics/Drawable.hpp> | |
| #include <SFML/Graphics/Image.hpp> | | #include <SFML/Graphics/Image.hpp> | |
| #include <SFML/Graphics/VideoResource.hpp> | | #include <SFML/Graphics/VideoResource.hpp> | |
|
| | | #include <istream> | |
| #include <map> | | #include <map> | |
| #include <string> | | #include <string> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// PostFX is used to apply a post effect to a window | | /// PostFX is used to apply a post effect to a window | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| class SFML_API PostFX : public Drawable, public VideoResource | | class SFML_API PostFX : public Drawable, public VideoResource | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| PostFX(); | | PostFX(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Construct the post-fx from an effect file | | | |
| /// | | | |
| /// \param Filename : Path of the effect file to load | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| PostFX(const std::string& Filename); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Copy constructor | | /// Copy constructor | |
| /// | | /// | |
| /// \param Copy : Instance to copy | | /// \param Copy : Instance to copy | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| PostFX(const PostFX& Copy); | | PostFX(const PostFX& Copy); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Destructor | | /// Destructor | |
| /// | | /// | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 78 | |
| /// 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); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Load the effect from a text in memory | |
| | | /// | |
| | | /// \param Effect : String containing the effect code | |
| | | /// | |
| | | /// \return True on success | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | bool LoadFromMemory(const std::string& Effect); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// Change a parameter of the effect (1 float) | | /// Change a parameter of the effect (1 float) | |
| /// | | /// | |
| /// \param Name : Parameter name in the effect | | /// \param Name : Parameter name in the effect | |
| /// \param X : Value to assign | | /// \param X : Value to assign | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetParameter(const std::string& Name, float X); | | void SetParameter(const std::string& Name, float X); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Change a parameter of the effect (2 floats) | | /// Change a parameter of the effect (2 floats) | |
| | | | |
| skipping to change at line 153 | | skipping to change at line 156 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| static bool CanUsePostFX(); | | static bool CanUsePostFX(); | |
| | | | |
| protected : | | protected : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// /see sfDrawable::Render | | /// /see sfDrawable::Render | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void Render(RenderWindow& Window); | | virtual void Render(const RenderWindow& Window) const; | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Preprocess a SFML effect file | | /// Preprocess a SFML effect file | |
| /// to convert it to a valid GLSL fragment shader | | /// to convert it to a valid GLSL fragment shader | |
| /// | | /// | |
|
| /// \param Filename : Path of effect file to process | | /// \param File : Stream containing the code to process | |
| /// | | /// | |
| /// \return Valid fragment shader source code | | /// \return Valid fragment shader source code | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| static std::string PreprocessEffect(const std::string& Filename); | | static std::string PreprocessEffect(std::istream& File); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Create a shader object from a file, and attach it to the program | | /// Create a shader object from a file, and attach it to the program | |
| /// | | /// | |
| /// \param Filename : Source code of shader to create | | /// \param Filename : Source code of shader to create | |
| /// \param ShaderType : OpenGL shader type (vertex / fragment) | | /// \param ShaderType : OpenGL shader type (vertex / fragment) | |
| /// | | /// | |
| /// \return True on success, false if an error occured | | /// \return True on success, false if an error occured | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 197 | | skipping to change at line 200 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual void DestroyVideoResources(); | | virtual void DestroyVideoResources(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| unsigned int myShaderProgram; ///< OpenGL identifier
for the program | | unsigned int myShaderProgram; ///< OpenGL identifier
for the program | |
| std::map<std::string, Image*> mySamplers; ///< Sampler names and
textures in the effect | | std::map<std::string, Image*> mySamplers; ///< Sampler names and
textures in the effect | |
| std::string myFragmentShader; ///< Fragment shader so
urce code | | std::string myFragmentShader; ///< Fragment shader so
urce code | |
|
| Image myFrameBuffer; ///< Texture containing
the current frame buffer | | mutable Image myFrameBuffer; ///< Texture containing
the current frame buffer | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_POSTFX_HPP | | #endif // SFML_POSTFX_HPP | |
| | | | |
End of changes. 7 change blocks. |
| 12 lines changed or deleted | | 15 lines changed or added | |
|
| RenderWindow.hpp | | RenderWindow.hpp | |
| | | | |
| skipping to change at line 43 | | skipping to change at line 43 | |
| #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> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
| class Drawable; | | class Drawable; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Simple wrapper for sfWindow that allows easy | | /// Simple wrapper for sf::Window that allows easy | |
| /// 2D rendering | | /// 2D rendering | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| class SFML_API RenderWindow : private Window | | class SFML_API RenderWindow : public Window | |
| { | | { | |
| public : | | public : | |
| | | | |
|
| using Window::Style; | | | |
| using Window::Resizable; | | | |
| using Window::Fixed; | | | |
| using Window::Fullscreen; | | | |
| | | | |
| 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 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| RenderWindow(); | | 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 WindowStyle : Window style (resizable by default) | | /// \param WindowStyle : Window style (Resize | Close by default) | |
| /// \param AntialiasingLevel : Level of antialiasing (0 by default, dis
abled) | | /// \param AntialiasingLevel : Level of antialiasing (0 by default, dis
abled) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| RenderWindow(VideoMode Mode, const std::string& Title, Style WindowStyl
e = Resizable, int AntialiasingLevel = 0); | | RenderWindow(VideoMode Mode, const std::string& Title, unsigned long Wi
ndowStyle = Style::Resize | Style::Close, 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) | | /// \param AntialiasingLevel : Level of antialiasing (0 by default, dis
abled) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| RenderWindow(WindowHandle Handle, int AntialiasingLevel = 0); | | RenderWindow(WindowHandle Handle, int AntialiasingLevel = 0); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Destructor | | /// Destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual ~RenderWindow(); | | virtual ~RenderWindow(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Create the window | | | |
| /// | | | |
| /// \param Mode : Video mode to use | | | |
| /// \param Title : Title of the window | | | |
| /// \param WindowStyle : Window style (resizable by default) | | | |
| /// \param AntialiasingLevel : Level of antialiasing (0 by default, dis | | | |
| abled) | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| void Create(VideoMode Mode, const std::string& Title, Style WindowStyle | | | |
| = Resizable, int AntialiasingLevel = 0); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Create the window from an existing control | | | |
| /// | | | |
| /// \param Handle : Platform-specific handle of the control | | | |
| /// \param AntialiasingLevel : Level of antialiasing (0 by default, dis | | | |
| abled) | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| void Create(WindowHandle Handle, int AntialiasingLevel = 0); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Display window content on screen | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| void Display(); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Draw something on the window | | /// Draw something on the window | |
| /// | | /// | |
| /// \param Object : Object to draw | | /// \param Object : Object to draw | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Draw(Drawable& Object); | | void Draw(const Drawable& Object) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Save the content of the window to an image | | /// Save the content of the window to an image | |
| /// | | /// | |
| /// \return Image instance containing the contents of the screen | | /// \return Image instance containing the contents of the screen | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Image Capture() const; | | Image Capture() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Change the background color of the window | | /// Change the background color of the window. | |
| | | /// The default color is black | |
| /// | | /// | |
| /// \param Col : New background color | | /// \param Col : New background color | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetBackgroundColor(const Color& Col); | | void SetBackgroundColor(const Color& Col); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Get the event on top of events stack, if any | | /// Change the current active view. | |
| /// | | /// The current view is defined with the initial size of the window | |
| /// \param EventReceived : Event to fill, if any | | | |
| /// | | | |
| /// \return True if an event was returned, false if events stack was em | | | |
| pty | | | |
| /// | | | |
| //////////////////////////////////////////////////////////// | | | |
| bool GetEvent(Event& EventReceived); | | | |
| | | | |
| //////////////////////////////////////////////////////////// | | | |
| /// Change the current active view | | | |
| /// | | /// | |
| /// \param NewView : Pointer to the new view (pass NULL to set the defa
ult view) | | /// \param NewView : Pointer to the new view (pass NULL to set the defa
ult view) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetView(const View* NewView); | | 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 FloatRect& GetViewRect() const; | | const FloatRect& GetViewRect() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Start custom OpenGL rendering | | /// Tell SFML to optimize its calls to the graphics driver, | |
| | | /// in case the user is not doing custom OpenGL calls. | |
| | | /// This parameter is false by default | |
| | | /// | |
| | | /// \param Optimize : True to enable internal states optimizations, fal | |
| | | se to go back to safe mode | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void OptimizeForNonOpenGL(bool Optimize); | |
| | | | |
| | | private : | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// /see Window::OnCreate | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void BeginOpenGL(); | | virtual void OnCreate(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// End custom OpenGL rendering | | /// /see Window::OnDisplay | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void EndOpenGL(); | | virtual void OnDisplay(); | |
| | | | |
|
| private : | | //////////////////////////////////////////////////////////// | |
| | | /// /see Window::OnEvent | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | virtual void OnEventReceived(const Event& EventReceived); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Initialize internal window | | /// Set the OpenGL render states needed for the SFML rendering | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void Initialize(); | | void SetRenderStates() const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| Color myBackgroundColor; ///< Background color | | Color myBackgroundColor; ///< Background color | |
| View myDefaultView; ///< Default view | | View myDefaultView; ///< Default view | |
| FloatRect myCurrentRect; ///< Rectangle corresponding to the curren | | FloatRect myCurrentRect; ///< Rectangle corresponding to the | |
| t view | | current view | |
| bool myOpenGLMode; ///< True when we are between BeginOpenGL( | | float myCurrentProjection[16]; ///< Projection matrix currently use | |
| ) and EndOpenGL() | | d by the window | |
| | | bool myOptimizeStates; ///< This flag is a hint, to save ma | |
| | | ny calls to the graphics driver when not mixing with OpenGL | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_RENDERWINDOW_HPP | | #endif // SFML_RENDERWINDOW_HPP | |
| | | | |
End of changes. 17 change blocks. |
| 76 lines changed or deleted | | 41 lines changed or added | |
|
| SocketTCP.hpp | | SocketTCP.hpp | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| // 3. This notice may not be removed or altered from any source distributio
n. | | // 3. This notice may not be removed or altered from any source distributio
n. | |
| // | | // | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_SOCKETTCP_HPP | | #ifndef SFML_SOCKETTCP_HPP | |
| #define SFML_SOCKETTCP_HPP | | #define SFML_SOCKETTCP_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| #include <SFML/Network/Sockets.hpp> | | #include <SFML/Network/SocketHelper.hpp> | |
| #include <cstddef> | | #include <cstddef> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
| class Packet; | | class Packet; | |
| class IPAddress; | | class IPAddress; | |
| template <typename> class Selector; | | template <typename> class Selector; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// SocketTCP wraps a socket using TCP protocol to | | /// SocketTCP wraps a socket using TCP protocol to | |
| | | | |
| skipping to change at line 55 | | skipping to change at line 55 | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| SocketTCP(); | | SocketTCP(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Change the blocking state of the socket. | |
| | | /// The default behaviour of a socket is blocking | |
| | | /// | |
| | | /// \param Blocking : Pass true to set the socket as blocking, or false | |
| | | for non-blocking | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void SetBlocking(bool Blocking); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// Connect to another computer on a specified port | | /// Connect to another computer on a specified port | |
| /// | | /// | |
| /// \param Port : Port to use for transfers (warning : ports < 1
024 are reserved) | | /// \param Port : Port to use for transfers (warning : ports < 1
024 are reserved) | |
| /// \param HostAddress : IP Address of the host to connect to | | /// \param HostAddress : IP Address of the host to connect to | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool Connect(unsigned short Port, const IPAddress& HostAddress); | | bool Connect(unsigned short Port, const IPAddress& HostAddress); | |
| | | | |
| | | | |
| skipping to change at line 77 | | skipping to change at line 86 | |
| /// | | /// | |
| /// \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); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// 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 will block if the socket is blocking | |
| /// a connection has been accepted | | | |
| /// | | /// | |
|
| /// \param Address : Pointer to an address to fill with client infos (N | | /// \param Connected : Socket containing the connection with the connec | |
| ULL by default) | | ted client | |
| | | /// \param Address : Pointer to an address to fill with client infos | |
| | | (NULL by default) | |
| /// | | /// | |
|
| /// \return New socket for communicating with connected client | | /// \return Status code | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| SocketTCP Accept(IPAddress* Address = NULL); | | Socket::Status Accept(SocketTCP& Connected, 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 Status code | |
| /// (false would mean the connection is broken) | | | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Send(const char* Data, std::size_t Size); | | Socket::Status Send(const char* Data, std::size_t Size); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Receive an array of bytes from the host (must be connected first). | | /// Receive an array of bytes from the host (must be connected first). | |
|
| /// This function is blocking, ie. it won't return before some | | /// This function will block if the socket is blocking | |
| /// 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 | |
| /// | | /// | |
|
| /// \return True if operation has been successful | | /// \return Status code | |
| /// (false would mean the connection is broken) | | | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived
); | | Socket::Status Receive(char* Data, std::size_t MaxSize, std::size_t& Si
zeReceived); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// 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 PacketToSend : Packet to send | | /// \param PacketToSend : Packet to send | |
| /// | | /// | |
|
| /// \return True if operation has been successful | | /// \return Status code | |
| /// (false would mean the connection is broken) | | | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Send(Packet& PacketToSend); | | Socket::Status 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 will block if the socket is blocking | |
| /// packet is received | | | |
| /// | | /// | |
| /// \param PacketToReceive : Packet to fill with received data | | /// \param PacketToReceive : Packet to fill with received data | |
| /// | | /// | |
|
| /// \return True if operation has been successful | | /// \return Status code | |
| /// (false would mean the connection is broken) | | | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Receive(Packet& PacketToReceive); | | Socket::Status 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(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Check if the socket is in a valid state ; this function | |
| | | /// can be called any time to check if the socket is OK | |
| | | /// | |
| | | /// \return True if the socket is valid | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | bool IsValid() 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 SocketTCP& Other) const; | | bool operator ==(const SocketTCP& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 189 | | skipping to change at line 201 | |
| | | | |
| friend class Selector<SocketTCP>; | | 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 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| SocketTCP(priv::SocketType Descriptor); | | SocketTCP(SocketHelper::SocketType Descriptor); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Create the socket | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void Create(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| priv::SocketType mySocket; ///< Socket descriptor | | SocketHelper::SocketType mySocket; ///< Socket descriptor | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_SOCKETTCP_HPP | | #endif // SFML_SOCKETTCP_HPP | |
| | | | |
End of changes. 19 change blocks. |
| 25 lines changed or deleted | | 45 lines changed or added | |
|
| SocketUDP.hpp | | SocketUDP.hpp | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| // 3. This notice may not be removed or altered from any source distributio
n. | | // 3. This notice may not be removed or altered from any source distributio
n. | |
| // | | // | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| #ifndef SFML_SOCKETUDP_HPP | | #ifndef SFML_SOCKETUDP_HPP | |
| #define SFML_SOCKETUDP_HPP | | #define SFML_SOCKETUDP_HPP | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Headers | | // Headers | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| #include <SFML/Network/Sockets.hpp> | | #include <SFML/Network/SocketHelper.hpp> | |
| #include <cstddef> | | #include <cstddef> | |
| | | | |
| namespace sf | | namespace sf | |
| { | | { | |
| class Packet; | | class Packet; | |
| class IPAddress; | | class IPAddress; | |
| template <typename> class Selector; | | template <typename> class Selector; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// SocketUDP wraps a socket using UDP protocol to | | /// SocketUDP wraps a socket using UDP protocol to | |
| | | | |
| skipping to change at line 55 | | skipping to change at line 55 | |
| { | | { | |
| public : | | public : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Default constructor | | /// Default constructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| SocketUDP(); | | SocketUDP(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Change the blocking state of the socket. | |
| | | /// The default behaviour of a socket is blocking | |
| | | /// | |
| | | /// \param Blocking : Pass true to set the socket as blocking, or false | |
| | | for non-blocking | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void SetBlocking(bool Blocking); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Bind the socket to a specific port | |
| | | /// | |
| | | /// \param Port : Port to bind the socket to | |
| | | /// | |
| | | /// \return True if operation has been successful | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | bool Bind(unsigned short Port); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Unbind the socket from its previous port, if any | |
| | | /// | |
| | | /// \return True if operation has been successful | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | bool Unbind(); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// 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 send the data to | |
| /// | | /// | |
|
| /// \return True if operation has been successful | | /// \return Status code | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Send(const char* Data, std::size_t Size, const IPAddress& Address,
unsigned short Port); | | Socket::Status 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 will block if the socket is blocking | |
| /// 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 which sent the data | |
| /// \param Port : Port to use for communication | | | |
| /// | | /// | |
|
| /// \return True if operation has been successful | | /// \return Status code | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived
, IPAddress& Address, unsigned short Port); | | Socket::Status Receive(char* Data, std::size_t MaxSize, std::size_t& Si
zeReceived, IPAddress& Address); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Send a packet of data | | /// Send a packet of data | |
| /// | | /// | |
| /// \param PacketToSend : 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 send the data to | |
| /// | | /// | |
|
| /// \return True if operation has been successful | | /// \return Status code | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Send(Packet& PacketToSend, const IPAddress& Address, unsigned shor
t Port); | | Socket::Status Send(Packet& PacketToSend, const IPAddress& Address, uns
igned short Port); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Receive a packet. | | /// Receive a packet. | |
|
| /// This function is blocking, ie. it won't return before a | | /// This function will block if the socket is blocking | |
| /// packet is received | | | |
| /// | | /// | |
| /// \param PacketToReceive : Packet to fill with received data | | /// \param PacketToReceive : Packet to fill with received data | |
|
| /// \param Address : Address of the computer that sent the pack | | /// \param Address : Address of the computer which sent the pac | |
| et | | ket | |
| /// \param Port : Port to use for communication | | | |
| /// | | /// | |
|
| /// \return True if operation has been successful | | /// \return Status code | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| bool Receive(Packet& PacketToReceive, IPAddress& Address, unsigned shor
t Port); | | Socket::Status Receive(Packet& PacketToReceive, IPAddress& Address); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Close the socket | | /// Close the socket | |
| /// | | /// | |
| /// \return True if operation has been successful | | /// \return True if operation has been successful | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| bool Close(); | | bool Close(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Check if the socket is in a valid state ; this function | |
| | | /// can be called any time to check if the socket is OK | |
| | | /// | |
| | | /// \return True if the socket is valid | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | bool IsValid() const; | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Get the port the socket is currently bound to | |
| | | /// | |
| | | /// \return Current port (0 means the socket is not bound) | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | unsigned short GetPort() 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 SocketUDP& Other) const; | | bool operator ==(const SocketUDP& Other) const; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 160 | | skipping to change at line 200 | |
| | | | |
| friend class Selector<SocketUDP>; | | 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 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| SocketUDP(priv::SocketType Descriptor); | | SocketUDP(SocketHelper::SocketType Descriptor); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Create the socket | | /// Create the socket | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Create(); | | void Create(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| priv::SocketType mySocket; ///< Socket identifier | | SocketHelper::SocketType mySocket; ///< Socket identifier | |
| unsigned short myPort; ///< Port to which the socket is bound | | unsigned short myPort; ///< Port to which the socket is bou | |
| | | nd | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_SOCKETUDP_HPP | | #endif // SFML_SOCKETUDP_HPP | |
| | | | |
End of changes. 19 change blocks. |
| 23 lines changed or deleted | | 65 lines changed or added | |
|
| Sound.hpp | | Sound.hpp | |
| | | | |
| skipping to change at line 57 | | skipping to change at line 57 | |
| /// 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 | |
| Playing ///< Sound is playing | | Playing ///< Sound is playing | |
| }; | | }; | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Default constructor | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | Sound(); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// Construct the sound from its parameters | | /// Construct the sound from its parameters | |
| /// | | /// | |
| /// \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) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| 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); | | Sound(const SoundBuffer& Buffer, 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 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Sound(const Sound& Copy); | | Sound(const Sound& Copy); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| | | | |
| skipping to change at line 105 | | skipping to change at line 111 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Stop the sound | | /// Stop the sound | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| 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 : New sound buffer to bind to the sound | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| void SetBuffer(const SoundBuffer* Buffer); | | void SetBuffer(const SoundBuffer& Buffer); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Set the sound loop state | | /// Set the sound loop state. | |
| | | /// This parameter is disabled by default | |
| /// | | /// | |
| /// \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); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Set the sound pitch | | /// Set the sound pitch. | |
| | | /// The default pitch is 1 | |
| /// | | /// | |
| /// \param Pitch : New pitch | | /// \param Pitch : New pitch | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetPitch(float Pitch); | | void SetPitch(float Pitch); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Set the sound volume | | /// Set the sound volume. | |
| | | /// The default volume is 100 | |
| /// | | /// | |
| /// \param Volume : Volume (in range [0, 100]) | | /// \param Volume : Volume (in range [0, 100]) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetVolume(float Volume); | | void SetVolume(float Volume); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Set the sound position | | /// Set the sound position. | |
| | | /// The default position is (0, 0, 0) | |
| /// | | /// | |
| /// \param X : X position of the sound in the world | | /// \param X : X position of the sound in the world | |
| /// \param Y : Y position of the sound in the world | | /// \param Y : Y position of the sound in the world | |
| /// \param Z : Z position of the sound in the world | | /// \param Z : Z position of the sound in the world | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetPosition(float X, float Y, float Z); | | void SetPosition(float X, float Y, float Z); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Get the source buffer | | /// Get the source buffer | |
| | | | |
End of changes. 8 change blocks. |
| 7 lines changed or deleted | | 17 lines changed or added | |
|
| SoundRecorder.hpp | | SoundRecorder.hpp | |
| | | | |
| skipping to change at line 44 | | skipping to change at line 44 | |
| namespace sf | | namespace sf | |
| { | | { | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// SoundRecorder is an interface for capturing sound data, | | /// SoundRecorder is an interface for capturing sound data, | |
| /// it is meant to be used as a base class | | /// it is meant to be used as a base class | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| class SFML_API SoundRecorder : private Thread | | class SFML_API SoundRecorder : private Thread | |
| { | | { | |
| public : | | public : | |
| | | | |
|
| | | typedef bool (*FuncType)(const Int16*, std::size_t, void*); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Default constructor | | /// Construct the sound recorder with a callback function | |
| | | /// for processing captured samples | |
| | | /// | |
| | | /// \param Callback : Callback for processing captured samples | |
| | | /// \param UserData : Data to pass to the callback function (NULL by de | |
| | | fault) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| SoundRecorder(); | | SoundRecorder(FuncType Callback, void* UserData = NULL); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Virtual destructor | | /// Virtual destructor | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| virtual ~SoundRecorder(); | | virtual ~SoundRecorder(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Start the capture. | | /// Start the capture. | |
| /// Warning : only one capture can happen at the same time | | /// Warning : only one capture can happen at the same time | |
| | | | |
| skipping to change at line 89 | | skipping to change at line 95 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Tell if the system supports sound capture. | | /// Tell if the system supports sound capture. | |
| /// If not, this class won't be usable | | /// If not, this class won't be usable | |
| /// | | /// | |
| /// \return True if audio capture is supported | | /// \return True if audio capture is supported | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| static bool CanCapture(); | | static bool CanCapture(); | |
| | | | |
|
| | | protected : | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Default constructor | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | SoundRecorder(); | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Process a new chunk of recorded samples | | /// Process a new chunk of recorded samples | |
| /// | | /// | |
| /// \param Samples : Pointer to the new chunk of recorded samples | | /// \param Samples : Pointer to the new chunk of recorded samples | |
| /// \param SamplesCount : Number of samples pointed by Samples | | /// \param SamplesCount : Number of samples pointed by Samples | |
| /// | | /// | |
| /// \return False to stop recording audio data, true to continue | | /// \return False to stop recording audio data, true to continue | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual bool ProcessSamples(const Int16* Samples, std::size_t SamplesCo
unt) = 0; | | virtual bool ProcessSamples(const Int16* Samples, std::size_t SamplesCo
unt); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// /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 123 | | skipping to change at line 137 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Clean up the recorder internal resources | | /// Clean up the recorder internal resources | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void CleanUp(); | | void CleanUp(); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | FuncType myCallback; ///< Callback for processing captured | |
| | | samples | |
| | | void* myUserData; ///< User data to pass to the process | |
| | | ing callback | |
| std::vector<Int16> mySamples; ///< Buffer to store captured samples | | std::vector<Int16> mySamples; ///< Buffer to store captured samples | |
| unsigned int mySampleRate; ///< Sample rate | | unsigned int mySampleRate; ///< Sample rate | |
| bool myIsCapturing; ///< Capturing state | | bool myIsCapturing; ///< Capturing state | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_SOUNDRECORDER_HPP | | #endif // SFML_SOUNDRECORDER_HPP | |
| | | | |
End of changes. 6 change blocks. |
| 3 lines changed or deleted | | 22 lines changed or added | |
|
| Sprite.hpp | | Sprite.hpp | |
| | | | |
| skipping to change at line 75 | | skipping to change at line 75 | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// Change the image of the sprite | | /// Change the image of the sprite | |
| /// | | /// | |
| /// \param Img : New image | | /// \param Img : New image | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetImage(const Image& Img); | | 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. | |
| | | /// By default, the subrect covers the entire source image | |
| /// | | /// | |
| /// \param SubRect : New sub-rectangle | | /// \param SubRect : New sub-rectangle | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void SetSubRect(const IntRect& SubRect); | | void SetSubRect(const IntRect& SubRect); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| /// Resize the sprite (by changing its scale factors) | | /// Resize the sprite (by changing its scale factors). | |
| | | /// The default size is defined by the subrect | |
| /// | | /// | |
| /// \param Width : New width (must be strictly positive) | | /// \param Width : New width (must be strictly positive) | |
| /// \param Height : New height (must be strictly positive) | | /// \param Height : New height (must be strictly positive) | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| void Resize(float Width, float Height); | | void Resize(float Width, float Height); | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| | | /// Flip the sprite horizontally | |
| | | /// | |
| | | /// \param Flipped : True to flip the sprite | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void FlipX(bool Flipped); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| | | /// Flip the sprite vertically | |
| | | /// | |
| | | /// \param Flipped : True to flip the sprite | |
| | | /// | |
| | | //////////////////////////////////////////////////////////// | |
| | | void FlipY(bool Flipped); | |
| | | | |
| | | //////////////////////////////////////////////////////////// | |
| /// 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 Image* 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 | |
| /// | | /// | |
| | | | |
| skipping to change at line 140 | | skipping to change at line 158 | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| Color GetPixel(unsigned int X, unsigned int Y) const; | | Color GetPixel(unsigned int X, unsigned int Y) const; | |
| | | | |
| protected : | | protected : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| /// /see Drawable::Render | | /// /see Drawable::Render | |
| /// | | /// | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| virtual void Render(RenderWindow& Window); | | virtual void Render(const RenderWindow& Window) const; | |
| | | | |
| private : | | private : | |
| | | | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
| // Member data | | // Member data | |
| //////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////// | |
|
| const Image* myImage; ///< Image used to draw the sprite | | const Image* myImage; ///< Image used to draw the sprite | |
| IntRect mySubRect; ///< Sub-rectangle of source image to assign t | | IntRect mySubRect; ///< Sub-rectangle of source image to assign | |
| o the sprite | | to the sprite | |
| | | bool myIsFlippedX; ///< Is the sprite flipped on the X axis ? | |
| | | bool myIsFlippedY; ///< Is the sprite flipped on the Y axis ? | |
| }; | | }; | |
| | | | |
| } // namespace sf | | } // namespace sf | |
| | | | |
| #endif // SFML_SPRITE_HPP | | #endif // SFML_SPRITE_HPP | |
| | | | |
End of changes. 5 change blocks. |
| 6 lines changed or deleted | | 26 lines changed or added | |
|