summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChristoph Egger <Christoph.Egger@gmx.de>2008-06-22 11:08:22 +0200
committerChristoph Egger <Christoph.Egger@gmx.de>2008-06-22 11:08:22 +0200
commit19199f59628f0187703b21abc6e1af7e303f56a2 (patch)
tree7adcc5985de0766f23d2d5ec3fbac3098e2fa9e9 /include
parent4b040a97527868d87cf70814c44340be2a3f7e78 (diff)
Imported Upstream version 1.3
Diffstat (limited to 'include')
-rwxr-xr-xinclude/SFML/Audio/AudioResource.hpp2
-rwxr-xr-xinclude/SFML/Audio/Listener.hpp50
-rwxr-xr-xinclude/SFML/Audio/Music.hpp4
-rwxr-xr-xinclude/SFML/Audio/Sound.hpp74
-rwxr-xr-xinclude/SFML/Audio/SoundBuffer.hpp2
-rwxr-xr-xinclude/SFML/Audio/SoundBufferRecorder.hpp2
-rwxr-xr-xinclude/SFML/Audio/SoundRecorder.hpp2
-rwxr-xr-xinclude/SFML/Audio/SoundStream.hpp8
-rwxr-xr-xinclude/SFML/Graphics.hpp2
-rwxr-xr-xinclude/SFML/Graphics/Color.hpp22
-rwxr-xr-xinclude/SFML/Graphics/Drawable.hpp180
-rwxr-xr-xinclude/SFML/Graphics/Font.hpp119
-rwxr-xr-xinclude/SFML/Graphics/Image.hpp44
-rwxr-xr-xinclude/SFML/Graphics/Matrix3.hpp148
-rwxr-xr-xinclude/SFML/Graphics/Matrix3.inl160
-rwxr-xr-xinclude/SFML/Graphics/PostFX.hpp13
-rwxr-xr-xinclude/SFML/Graphics/Rect.hpp4
-rwxr-xr-xinclude/SFML/Graphics/Rect.inl2
-rwxr-xr-xinclude/SFML/Graphics/RenderWindow.hpp76
-rwxr-xr-xinclude/SFML/Graphics/Shape.hpp214
-rwxr-xr-xinclude/SFML/Graphics/Sprite.hpp35
-rwxr-xr-xinclude/SFML/Graphics/String.hpp79
-rwxr-xr-xinclude/SFML/Graphics/VideoResource.hpp2
-rwxr-xr-xinclude/SFML/Graphics/View.hpp138
-rwxr-xr-xinclude/SFML/Network/IPAddress.hpp2
-rwxr-xr-xinclude/SFML/Network/Packet.hpp46
-rwxr-xr-xinclude/SFML/Network/Selector.hpp44
-rwxr-xr-xinclude/SFML/Network/Selector.inl83
-rwxr-xr-xinclude/SFML/Network/SelectorBase.hpp (renamed from include/SFML/Window/Linux/Joystick.hpp)72
-rwxr-xr-xinclude/SFML/Network/SocketHelper.hpp2
-rwxr-xr-xinclude/SFML/Network/SocketTCP.hpp9
-rwxr-xr-xinclude/SFML/Network/SocketUDP.hpp10
-rwxr-xr-xinclude/SFML/Network/Sockets.hpp2
-rwxr-xr-xinclude/SFML/Network/Unix/SocketHelper.hpp190
-rwxr-xr-xinclude/SFML/Network/Win32/SocketHelper.hpp2
-rwxr-xr-xinclude/SFML/System.hpp3
-rwxr-xr-xinclude/SFML/System/Clock.hpp2
-rwxr-xr-xinclude/SFML/System/Lock.hpp2
-rwxr-xr-xinclude/SFML/System/Mutex.hpp2
-rwxr-xr-xinclude/SFML/System/NonCopyable.hpp4
-rwxr-xr-xinclude/SFML/System/Randomizer.hpp2
-rwxr-xr-xinclude/SFML/System/Sleep.hpp2
-rwxr-xr-xinclude/SFML/System/Thread.hpp2
-rwxr-xr-xinclude/SFML/System/Vector2.hpp215
-rwxr-xr-xinclude/SFML/System/Vector2.inl179
-rwxr-xr-xinclude/SFML/System/Vector3.hpp217
-rwxr-xr-xinclude/SFML/System/Vector3.inl185
-rwxr-xr-xinclude/SFML/System/Win32/Mutex.hpp2
-rwxr-xr-xinclude/SFML/System/Win32/Thread.hpp2
-rwxr-xr-xinclude/SFML/Window.hpp3
-rwxr-xr-xinclude/SFML/Window/Event.hpp520
-rwxr-xr-xinclude/SFML/Window/Input.hpp2
-rwxr-xr-xinclude/SFML/Window/OpenGL.hpp (renamed from include/SFML/Window/Joystick.hpp)44
-rwxr-xr-xinclude/SFML/Window/OpenGLCaps.hpp90
-rwxr-xr-xinclude/SFML/Window/VideoMode.hpp2
-rwxr-xr-xinclude/SFML/Window/Win32/Joystick.hpp91
-rwxr-xr-xinclude/SFML/Window/Window.hpp109
-rwxr-xr-xinclude/SFML/Window/WindowHandle.hpp120
-rwxr-xr-xinclude/SFML/Window/WindowListener.hpp2
-rwxr-xr-xinclude/SFML/Window/WindowSettings.hpp62
-rwxr-xr-xinclude/SFML/Window/WindowStyle.hpp11
61 files changed, 2722 insertions, 997 deletions
diff --git a/include/SFML/Audio/AudioResource.hpp b/include/SFML/Audio/AudioResource.hpp
index d6e1187..c0dbdb2 100755
--- a/include/SFML/Audio/AudioResource.hpp
+++ b/include/SFML/Audio/AudioResource.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/Audio/Listener.hpp b/include/SFML/Audio/Listener.hpp
index 8257cb9..c6679b3 100755
--- a/include/SFML/Audio/Listener.hpp
+++ b/include/SFML/Audio/Listener.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
+#include <SFML/System/Vector3.hpp>
namespace sf
@@ -60,48 +61,59 @@ public :
static float GetGlobalVolume();
////////////////////////////////////////////////////////////
- /// Change the position of the listener.
+ /// Change the position of the listener (take 3 values).
/// The default position is (0, 0, 0)
///
- /// \param PosX : X position of the listener in the world
- /// \param PosY : Y position of the listener in the world
- /// \param PosZ : Z position of the listener in the world
+ /// \param X, Y, Z : Position of the listener in the world
///
////////////////////////////////////////////////////////////
- static void SetPosition(float PosX, float PosY, float PosZ);
+ static void SetPosition(float X, float Y, float Z);
+
+ ////////////////////////////////////////////////////////////
+ /// Change the position of the listener (take a 3D vector).
+ /// The default position is (0, 0, 0)
+ ///
+ /// \param Position : Position of the listener in the world
+ ///
+ ////////////////////////////////////////////////////////////
+ static void SetPosition(const Vector3f& Position);
////////////////////////////////////////////////////////////
/// Get the current position of the listener
///
- /// \param PosX : X position of the listener in the world
- /// \param PosY : Y position of the listener in the world
- /// \param PosZ : Z position of the listener in the world
+ /// \return Position of the listener in the world
+ ///
+ ////////////////////////////////////////////////////////////
+ static Vector3f GetPosition();
+
+ ////////////////////////////////////////////////////////////
+ /// Change the orientation of the listener (the point
+ /// he must look at) (take 3 values).
+ /// The default target is (0, 0, -1)
+ ///
+ /// \param X, Y, Z : Position of the point the listener must look at
///
////////////////////////////////////////////////////////////
- static void GetPosition(float& PosX, float& PosY, float& PosZ);
+ static void SetTarget(float X, float Y, float Z);
////////////////////////////////////////////////////////////
/// Change the orientation of the listener (the point
- /// he must look at).
+ /// he must look at) (take a 3D vector).
/// The default target is (0, 0, -1)
///
- /// \param TargetX : X position of the point the listener must look at
- /// \param TargetY : X position of the point the listener must look at
- /// \param TargetZ : X position of the point the listener must look at
+ /// \param Target : Position of the point the listener must look at
///
////////////////////////////////////////////////////////////
- static void SetTarget(float TargetX, float TargetY, float TargetZ);
+ static void SetTarget(const Vector3f& Target);
////////////////////////////////////////////////////////////
/// Get the current orientation of the listener (the point
/// he's looking at)
///
- /// \param TargetX : X position of the point the listener is looking at
- /// \param TargetY : X position of the point the listener is looking at
- /// \param TargetZ : X position of the point the listener is looking at
+ /// \return : Position of the point the listener is looking at
///
////////////////////////////////////////////////////////////
- static void GetTarget(float& TargetX, float& TargetY, float& TargetZ);
+ static Vector3f GetTarget();
};
} // namespace sf
diff --git a/include/SFML/Audio/Music.hpp b/include/SFML/Audio/Music.hpp
index 94ae235..898f1f3 100755
--- a/include/SFML/Audio/Music.hpp
+++ b/include/SFML/Audio/Music.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -71,7 +71,7 @@ public :
/// \return True if loading has been successful
///
////////////////////////////////////////////////////////////
- bool Open(const std::string& Filename);
+ bool OpenFromFile(const std::string& Filename);
////////////////////////////////////////////////////////////
/// Open a music file from memory (doesn't play it -- call Play() for that)
diff --git a/include/SFML/Audio/Sound.hpp b/include/SFML/Audio/Sound.hpp
index c9f445f..60b1e2a 100755
--- a/include/SFML/Audio/Sound.hpp
+++ b/include/SFML/Audio/Sound.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -30,6 +30,7 @@
////////////////////////////////////////////////////////////
#include <cstdlib>
#include <SFML/Audio/AudioResource.hpp>
+#include <SFML/System/Vector3.hpp>
namespace sf
@@ -63,16 +64,14 @@ public :
////////////////////////////////////////////////////////////
/// Construct the sound from its parameters
///
- /// \param Buffer : Sound buffer to play (NULL by default)
- /// \param Loop : Loop flag (false by default)
- /// \param Pitch : Value of the pitch (1 by default)
- /// \param Volume : Volume (100 by default)
- /// \param X : X position (0 by default)
- /// \param Y : Y position (0 by default)
- /// \param Z : Z position (0 by default)
+ /// \param Buffer : Sound buffer to play (NULL by default)
+ /// \param Loop : Loop flag (false by default)
+ /// \param Pitch : Value of the pitch (1 by default)
+ /// \param Volume : Volume (100 by default)
+ /// \param Position : Position (0, 0, 0 by default)
///
////////////////////////////////////////////////////////////
- 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);
+ Sound(const SoundBuffer& Buffer, bool Loop = false, float Pitch = 1.f, float Volume = 100.f, const Vector3f& Position = Vector3f(0, 0, 0));
////////////////////////////////////////////////////////////
/// Copy constructor
@@ -142,17 +141,44 @@ public :
void SetVolume(float Volume);
////////////////////////////////////////////////////////////
- /// Set the sound position.
+ /// Set the sound position (take 3 values).
/// The default position is (0, 0, 0)
///
- /// \param X : X 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 X, Y, Z : Position of the sound in the world
///
////////////////////////////////////////////////////////////
void SetPosition(float X, float Y, float Z);
////////////////////////////////////////////////////////////
+ /// Set the sound position (take a 3D vector).
+ /// The default position is (0, 0, 0)
+ ///
+ /// \param Position : Position of the sound in the world
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetPosition(const Vector3f& Position);
+
+ ////////////////////////////////////////////////////////////
+ /// Set the minimum distance - closer than this distance,
+ /// the listener will hear the sound at its maximum volume.
+ /// The default minimum distance is 1.0
+ ///
+ /// \param MinDistance : New minimum distance for the sound
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetMinDistance(float MinDistance);
+
+ ////////////////////////////////////////////////////////////
+ /// Set the attenuation factor - the higher the attenuation, the
+ /// more the sound will be attenuated with distance from listener.
+ /// The default attenuation factor 1.0
+ ///
+ /// \param Attenuation : New attenuation factor for the sound
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetAttenuation(float Attenuation);
+
+ ////////////////////////////////////////////////////////////
/// Get the source buffer
///
/// \return Sound buffer bound to the sound (can be NULL)
@@ -187,12 +213,26 @@ public :
////////////////////////////////////////////////////////////
/// Get the sound position
///
- /// \param X : X 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
+ /// \return Position of the sound in the world
+ ///
+ ////////////////////////////////////////////////////////////
+ Vector3f GetPosition() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get the minimum distance
+ ///
+ /// \return Minimum distance for the sound
+ ///
+ ////////////////////////////////////////////////////////////
+ float GetMinDistance() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get the attenuation factor
+ ///
+ /// \return Attenuation factor of the sound
///
////////////////////////////////////////////////////////////
- void GetPosition(float& X, float& Y, float& Z) const;
+ float GetAttenuation() const;
////////////////////////////////////////////////////////////
/// Get the status of the sound (stopped, paused, playing)
diff --git a/include/SFML/Audio/SoundBuffer.hpp b/include/SFML/Audio/SoundBuffer.hpp
index eab6d4b..f28cc89 100755
--- a/include/SFML/Audio/SoundBuffer.hpp
+++ b/include/SFML/Audio/SoundBuffer.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/Audio/SoundBufferRecorder.hpp b/include/SFML/Audio/SoundBufferRecorder.hpp
index 94a10df..b108af4 100755
--- a/include/SFML/Audio/SoundBufferRecorder.hpp
+++ b/include/SFML/Audio/SoundBufferRecorder.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/Audio/SoundRecorder.hpp b/include/SFML/Audio/SoundRecorder.hpp
index cb8a164..7f927cf 100755
--- a/include/SFML/Audio/SoundRecorder.hpp
+++ b/include/SFML/Audio/SoundRecorder.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/Audio/SoundStream.hpp b/include/SFML/Audio/SoundStream.hpp
index dfc473b..a5649e7 100755
--- a/include/SFML/Audio/SoundStream.hpp
+++ b/include/SFML/Audio/SoundStream.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -53,9 +53,13 @@ public :
using Sound::SetPitch;
using Sound::SetVolume;
using Sound::SetPosition;
+ using Sound::SetMinDistance;
+ using Sound::SetAttenuation;
using Sound::GetPitch;
using Sound::GetVolume;
using Sound::GetPosition;
+ using Sound::GetMinDistance;
+ using Sound::GetAttenuation;
////////////////////////////////////////////////////////////
/// Structure defining a chunk of audio data to stream
@@ -157,7 +161,7 @@ private :
////////////////////////////////////////////////////////////
void CleanUp();
- enum {BuffersCount = 2};
+ enum {BuffersCount = 3};
////////////////////////////////////////////////////////////
// Member data
diff --git a/include/SFML/Graphics.hpp b/include/SFML/Graphics.hpp
index cb4527d..fab8851 100755
--- a/include/SFML/Graphics.hpp
+++ b/include/SFML/Graphics.hpp
@@ -31,9 +31,11 @@
#include <SFML/Window.hpp>
#include <SFML/Graphics/Color.hpp>
+#include <SFML/Graphics/Font.hpp>
#include <SFML/Graphics/Image.hpp>
#include <SFML/Graphics/PostFX.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
+#include <SFML/Graphics/Shape.hpp>
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/String.hpp>
#include <SFML/Graphics/View.hpp>
diff --git a/include/SFML/Graphics/Color.hpp b/include/SFML/Graphics/Color.hpp
index cc17917..b4ca5b5 100755
--- a/include/SFML/Graphics/Color.hpp
+++ b/include/SFML/Graphics/Color.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -58,6 +58,26 @@ public :
Color(Uint8 R, Uint8 G, Uint8 B, Uint8 A = 255);
////////////////////////////////////////////////////////////
+ /// Operator += overload to add a color
+ ///
+ /// \param Other : Color to add
+ ///
+ /// \return Component-wise saturated addition of the two colors
+ ///
+ ////////////////////////////////////////////////////////////
+ Color& operator +=(const Color& Other);
+
+ ////////////////////////////////////////////////////////////
+ /// Operator *= overload to modulate a color
+ ///
+ /// \param Other : Color to modulate
+ ///
+ /// \return Component-wise multiplication of the two colors
+ ///
+ ////////////////////////////////////////////////////////////
+ Color& operator *=(const Color& Other);
+
+ ////////////////////////////////////////////////////////////
/// Compare two colors (for equality)
///
/// \param Other : Color to compare
diff --git a/include/SFML/Graphics/Drawable.hpp b/include/SFML/Graphics/Drawable.hpp
index 5965642..210b43d 100755
--- a/include/SFML/Graphics/Drawable.hpp
+++ b/include/SFML/Graphics/Drawable.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -28,7 +28,9 @@
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
+#include <SFML/System/Vector2.hpp>
#include <SFML/Graphics/Color.hpp>
+#include <SFML/Graphics/Matrix3.hpp>
namespace sf
@@ -60,15 +62,13 @@ public :
////////////////////////////////////////////////////////////
/// Default constructor
///
- /// \param Left : Left coordinate of the object (0 by default)
- /// \param Top : Top coordinate of the object (0 by default)
- /// \param ScaleX : Horizontal scale (1 by default)
- /// \param ScaleY : Vertical scale (1 by default)
+ /// \param Position : Position of the object (0, 0 by default)
+ /// \param Scale : Scale factor (1, 1 by default)
/// \param Rotation : Orientation, in degrees (0 by default)
/// \param Col : Color of the object (white by default)
///
////////////////////////////////////////////////////////////
- Drawable(float Left = 0.f, float Top = 0.f, float ScaleX = 1.f, float ScaleY = 1.f, float Rotation = 0.f, const Color& Col = Color(255, 255, 255, 255));
+ Drawable(const Vector2f& Position = Vector2f(0, 0), const Vector2f& Scale = Vector2f(1, 1), float Rotation = 0.f, const Color& Col = Color(255, 255, 255, 255));
////////////////////////////////////////////////////////////
/// Virtual destructor
@@ -77,73 +77,99 @@ public :
virtual ~Drawable();
////////////////////////////////////////////////////////////
- /// Set the left position of the object
+ /// Set the position of the object (take 2 values)
///
- /// \param Left : New left coordinate
+ /// \param X : New X coordinate
+ /// \param Y : New Y coordinate
///
////////////////////////////////////////////////////////////
- void SetLeft(float Left);
+ void SetPosition(float X, float Y);
////////////////////////////////////////////////////////////
- /// Set the top position of the object
+ /// Set the position of the object (take a 2D vector)
///
- /// \param Top : New top coordinate
+ /// \param Position : New position
///
////////////////////////////////////////////////////////////
- void SetTop(float Top);
+ void SetPosition(const Vector2f& Position);
////////////////////////////////////////////////////////////
- /// Set the position of the object
+ /// Set the X position of the object
///
- /// \param Left : New left coordinate
- /// \param Top : New top coordinate
+ /// \param X : New X coordinate
///
////////////////////////////////////////////////////////////
- void SetPosition(float Left, float Top);
+ void SetX(float X);
////////////////////////////////////////////////////////////
- /// Set the horizontal scale of the object
+ /// Set the Y position of the object
///
- /// \param Scale : New scale (must be strictly positive)
+ /// \param Y : New Y coordinate
///
////////////////////////////////////////////////////////////
- void SetScaleX(float Scale);
+ void SetY(float Y);
////////////////////////////////////////////////////////////
- /// Set the vertical scale of the object
+ /// Set the scale of the object (take 2 values)
///
- /// \param Scale : New scale (must be strictly positive)
+ /// \param ScaleX : New horizontal scale (must be strictly positive)
+ /// \param ScaleY : New vertical scale (must be strictly positive)
///
////////////////////////////////////////////////////////////
- void SetScaleY(float Scale);
+ void SetScale(float ScaleX, float ScaleY);
////////////////////////////////////////////////////////////
- /// Set the scale of the object
+ /// Set the scale of the object (take a 2D vector)
///
- /// \param ScaleX : New horizontal scale (must be strictly positive)
- /// \param ScaleY : New vertical scale (must be strictly positive)
+ /// \param Scale : New scale (both values must be strictly positive)
///
////////////////////////////////////////////////////////////
- void SetScale(float ScaleX, float ScaleY);
+ void SetScale(const Vector2f& Scale);
////////////////////////////////////////////////////////////
- /// Set the orientation of the object
+ /// Set the X scale factor of the object
///
- /// \param Rotation : Angle of rotation, in degrees
+ /// \param X : New X scale factor
///
////////////////////////////////////////////////////////////
- void SetRotation(float Rotation);
+ void SetScaleX(float FactorX);
+
+ ////////////////////////////////////////////////////////////
+ /// Set the Y scale factor of the object
+ ///
+ /// \param Y : New Y scale factor
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetScaleY(float FactorY);
+
+ ////////////////////////////////////////////////////////////
+ /// Set the center of the object, in coordinates relative to the
+ /// top-left of the object (take 2 values).
+ /// The default center is (0, 0)
+ ///
+ /// \param CenterX : X coordinate of the center
+ /// \param CenterY : Y coordinate of the center
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetCenter(float CenterX, float CenterY);
+
+ ////////////////////////////////////////////////////////////
+ /// Set the center of the object, in coordinates relative to the
+ /// top-left of the object (take a 2D vector).
+ /// The default center is (0, 0)
+ ///
+ /// \param Center : New center
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetCenter(const Vector2f& Center);
////////////////////////////////////////////////////////////
- /// Set the center of rotation, in coordinates relative to the
- /// object.
- /// The default rotation center is (0, 0)
+ /// Set the orientation of the object
///
- /// \param X : X coordinate of the center of rotation
- /// \param Y : Y coordinate of the center of rotation
+ /// \param Rotation : Angle of rotation, in degrees
///
////////////////////////////////////////////////////////////
- void SetRotationCenter(float X, float Y);
+ void SetRotation(float Rotation);
////////////////////////////////////////////////////////////
/// Set the color of the object.
@@ -164,39 +190,32 @@ public :
void SetBlendMode(Blend::Mode Mode);
////////////////////////////////////////////////////////////
- /// Get the left position of the object
- ///
- /// \return Current left position
- ///
- ////////////////////////////////////////////////////////////
- float GetLeft() const;
-
- ////////////////////////////////////////////////////////////
- /// Get the top position of the object
+ /// Get the position of the object
///
- /// \return Current top position
+ /// \return Current position
///
////////////////////////////////////////////////////////////
- float GetTop() const;
+ const Vector2f& GetPosition() const;
////////////////////////////////////////////////////////////
- /// Get the horizontal scale of the object
+ /// Get the current scale of the object
///
- /// \return Current X scale factor (always positive)
+ /// \return Current scale factor (always positive)
///
////////////////////////////////////////////////////////////
- float GetScaleX() const;
+ const Vector2f& GetScale() const;
////////////////////////////////////////////////////////////
- /// Get the vertical scale of the object
+ /// Get the center of the object
///
- /// \return Current Y scale factor (always positive)
+ /// \return Current position of the center
///
////////////////////////////////////////////////////////////
- float GetScaleY() const;
+ const Vector2f& GetCenter() const;
////////////////////////////////////////////////////////////
- /// Get the orientation of the object
+ /// Get the orientation of the object.
+ /// Rotation is always in the range [0, 360]
///
/// \return Current rotation, in degrees
///
@@ -220,24 +239,40 @@ public :
Blend::Mode GetBlendMode() const;
////////////////////////////////////////////////////////////
- /// Move the object
+ /// Move the object of a given offset (take 2 values)
///
- /// \param OffsetX : Offset on the X axis
- /// \param OffsetY : Offset on the Y axis
+ /// \param OffsetX : X offset
+ /// \param OffsetY : Y offset
///
////////////////////////////////////////////////////////////
void Move(float OffsetX, float OffsetY);
////////////////////////////////////////////////////////////
- /// Scale the object
+ /// Move the object of a given offset (take a 2D vector)
+ ///
+ /// \param Offset : Amount of units to move the object of
+ ///
+ ////////////////////////////////////////////////////////////
+ void Move(const Vector2f& Offset);
+
+ ////////////////////////////////////////////////////////////
+ /// Scale the object (take 2 values)
///
- /// \param FactorX : Horizontal scaling factor (must be strictly positive)
- /// \param FactorY : Vertical scaling factor (must be strictly positive)
+ /// \param FactorX : Scaling factor on X (must be strictly positive)
+ /// \param FactorY : Scaling factor on Y (must be strictly positive)
///
////////////////////////////////////////////////////////////
void Scale(float FactorX, float FactorY);
////////////////////////////////////////////////////////////
+ /// Scale the object (take a 2D vector)
+ ///
+ /// \param Factor : Scaling factors (both values must be strictly positive)
+ ///
+ ////////////////////////////////////////////////////////////
+ void Scale(const Vector2f& Factor);
+
+ ////////////////////////////////////////////////////////////
/// Rotate the object
///
/// \param Angle : Angle of rotation, in degrees
@@ -245,6 +280,16 @@ public :
////////////////////////////////////////////////////////////
void Rotate(float Angle);
+protected :
+
+ ////////////////////////////////////////////////////////////
+ /// Get the transform matrix of the drawable
+ ///
+ /// \return Transform matrix
+ ///
+ ////////////////////////////////////////////////////////////
+ const Matrix3& GetMatrix() const;
+
private :
friend class RenderWindow;
@@ -268,15 +313,14 @@ private :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- float myLeft; ///< Left position of the object on screen
- float myTop; ///< Top position of the object on screen
- float myScaleX; ///< Horizontal scale of the object
- float myScaleY; ///< Vertical scale of the object
- float myRotation; ///< Orientation of the object, in degrees
- float myCenterX; ///< X coordinate of the center of rotation, relative to the object
- float myCenterY; ///< Y coordinate of the center of rotation, relative to the object
- Color myColor; ///< Overlay color of the object
- Blend::Mode myBlendMode; ///< Blending mode
+ Vector2f myPosition; ///< Position of the object on screen
+ Vector2f myScale; ///< Scale of the object
+ Vector2f myCenter; ///< Origin of translation / rotation / scaling of the object
+ float myRotation; ///< Orientation of the object, in degrees
+ Color myColor; ///< Overlay color of the object
+ Blend::Mode myBlendMode; ///< Blending mode
+ mutable bool myNeedUpdate; ///< Do we need to recompute the transform matrix ?
+ mutable Matrix3 myMatrix; ///< Precomputed transform matrix gathering the translation / rotation / scale / center
};
} // namespace sf
diff --git a/include/SFML/Graphics/Font.hpp b/include/SFML/Graphics/Font.hpp
new file mode 100755
index 0000000..8bb3b3a
--- /dev/null
+++ b/include/SFML/Graphics/Font.hpp
@@ -0,0 +1,119 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_FONT_HPP
+#define SFML_FONT_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Graphics/Image.hpp>
+#include <SFML/Graphics/Rect.hpp>
+#include <map>
+#include <string>
+
+
+namespace sf
+{
+class String;
+
+namespace priv
+{
+class FontLoader;
+}
+////////////////////////////////////////////////////////////
+/// Font is the low-level class for loading and
+/// manipulating character fonts. This class is meant to
+/// be used by sf::String
+////////////////////////////////////////////////////////////
+class SFML_API Font
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ Font();
+
+ ////////////////////////////////////////////////////////////
+ /// Load the font from a file
+ ///
+ /// \param Filename : Font file to load
+ /// \param CharSize : Size of characters in bitmap - the bigger, the higher quality (30 by default)
+ /// \param Charset : Characters set to generate (empty by default - takes the ASCII range [31, 255])
+ ///
+ /// \return True if loading was successful
+ ///
+ ////////////////////////////////////////////////////////////
+ bool LoadFromFile(const std::string& Filename, unsigned int CharSize = 30, std::wstring Charset = L"");
+
+ ////////////////////////////////////////////////////////////
+ /// Load the font from a file in memory
+ ///
+ /// \param Data : Pointer to the data to load
+ /// \param SizeInBytes : Size of the data, in bytes
+ /// \param CharSize : Size of characters in bitmap - the bigger, the higher quality (30 by default)
+ /// \param Charset : Characters set to generate (empty by default - takes the ASCII range [31, 255])
+ ///
+ /// \return True if loading was successful
+ ///
+ ////////////////////////////////////////////////////////////
+ bool LoadFromMemory(const char* Data, std::size_t SizeInBytes, unsigned int CharSize = 30, std::wstring Charset = L"");
+
+ ////////////////////////////////////////////////////////////
+ /// Get the SFML default built-in font (Arial)
+ ///
+ /// \return Instance of the default font
+ ///
+ ////////////////////////////////////////////////////////////
+ static const Font& GetDefaultFont();
+
+private :
+
+ friend class String;
+ friend class priv::FontLoader;
+
+ ////////////////////////////////////////////////////////////
+ /// Defines the drawing attributes of a character
+ ////////////////////////////////////////////////////////////
+ struct Character
+ {
+ IntRect Rect; ///< Bouding rectangle in relative coordinates
+ FloatRect Coord; ///< Texture coordinates inside the bitmap font
+ int Advance; ///< Offset to move to the next character
+ };
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ Image myTexture; ///< Texture holding the bitmap font
+ unsigned int myCharSize; ///< Size of characters in the bitmap font
+ std::map<wchar_t, Character> myCharacters; ///< Rendering settings of each character
+};
+
+} // namespace sf
+
+
+#endif // SFML_FONT_HPP
diff --git a/include/SFML/Graphics/Image.hpp b/include/SFML/Graphics/Image.hpp
index 03469eb..200d3a7 100755
--- a/include/SFML/Graphics/Image.hpp
+++ b/include/SFML/Graphics/Image.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -86,7 +86,7 @@ public :
~Image();
////////////////////////////////////////////////////////////
- /// Load the surface from a file
+ /// Load the image from a file
///
/// \param Filename : Path of the image file to load
///
@@ -96,7 +96,7 @@ public :
bool LoadFromFile(const std::string& Filename);
////////////////////////////////////////////////////////////
- /// Load the surface from a file in memory
+ /// Load the image from a file in memory
///
/// \param Data : Pointer to the file data in memory
/// \param SizeInBytes : Size of the data to load, in bytes
@@ -138,7 +138,7 @@ public :
/// \return True if creation was successful
///
////////////////////////////////////////////////////////////
- bool Create(unsigned int Width, unsigned int Height, const Color& Col = Color(0, 0, 0, 255));
+ bool Create(unsigned int Width, unsigned int Height, Color Col = Color(0, 0, 0, 255));
////////////////////////////////////////////////////////////
/// Create transparency mask from a specified colorkey
@@ -147,11 +147,11 @@ public :
/// \param Alpha : Alpha value to use for transparent pixels (0 by default)
///
////////////////////////////////////////////////////////////
- void CreateMaskFromColor(const Color& ColorKey, Uint8 Alpha = 0);
+ void CreateMaskFromColor(Color ColorKey, Uint8 Alpha = 0);
////////////////////////////////////////////////////////////
/// Resize the image - warning : this function does not scale the image,
- /// it just ajdusts size (add padding or remove pixels)
+ /// it just adjusts its size (add padding or remove pixels)
///
/// \param Width : New width
/// \param Height : New height
@@ -160,11 +160,10 @@ public :
/// \return True if resize has been successful
///
////////////////////////////////////////////////////////////
- bool Resize(unsigned int Width, unsigned int Height, const Color& Col = Color(0, 0, 0, 255));
+ bool Resize(unsigned int Width, unsigned int Height, Color Col = Color(0, 0, 0, 255));
////////////////////////////////////////////////////////////
/// Change the color of a pixel
- /// Don't forget to call Update when you end modifying pixels
///
/// \param X : X coordinate of pixel in the image
/// \param Y : Y coordinate of pixel in the image
@@ -185,7 +184,7 @@ public :
const Color& GetPixel(unsigned int X, unsigned int Y) const;
////////////////////////////////////////////////////////////
- /// Get a read-only pointer to the array of pixels (8 bits integers RGBA)
+ /// Get a read-only pointer to the array of pixels (RGBA 8 bits integers components)
/// Array size is GetWidth() x GetHeight() x 4
/// This pointer becomes invalid if you reload or resize the image
///
@@ -207,17 +206,7 @@ public :
/// \param Smooth : True to enable smoothing filter, false to disable it
///
////////////////////////////////////////////////////////////
- void SetSmooth(bool Smooth) const;
-
- ////////////////////////////////////////////////////////////
- /// Enable or disable image repeat mode
- /// (ie. how to define pixels outside the texture range).
- /// This parameter is enabled by default
- ///
- /// \param Repeat : True to enable repeat, false to disable
- ///
- ////////////////////////////////////////////////////////////
- void SetRepeat(bool Repeat) const;
+ void SetSmooth(bool Smooth);
////////////////////////////////////////////////////////////
/// Return the width of the image
@@ -236,6 +225,14 @@ public :
unsigned int GetHeight() const;
////////////////////////////////////////////////////////////
+ /// Tells whether the smooth filtering is enabled or not
+ ///
+ /// \return True if image smoothing is enabled
+ ///
+ ////////////////////////////////////////////////////////////
+ bool IsSmooth() const;
+
+ ////////////////////////////////////////////////////////////
/// Convert a subrect expressed in pixels, into float
/// texture coordinates
///
@@ -281,7 +278,7 @@ private :
/// Update the internal texture in video memory
///
////////////////////////////////////////////////////////////
- void Update() const;
+ void Update();
////////////////////////////////////////////////////////////
/// Reset the image attributes
@@ -290,7 +287,7 @@ private :
void Reset();
////////////////////////////////////////////////////////////
- /// /see sfVideoResource::DestroyVideoResources
+ /// /see VideoResource::DestroyVideoResources
///
////////////////////////////////////////////////////////////
virtual void DestroyVideoResources();
@@ -303,7 +300,8 @@ private :
unsigned int myTextureWidth; ///< Actual texture width (can be greater than image width because of padding)
unsigned int myTextureHeight; ///< Actual texture height (can be greater than image height because of padding)
std::vector<Color> myPixels; ///< Pixels of the image
- unsigned int myGLTexture; ///< OpenGL texture identifier
+ unsigned int myTexture; ///< Internal texture identifier
+ bool myIsSmooth; ///< Status if the smooth filter
mutable bool myUpdated; ///< Tells if the internal texture needs to be updated
};
diff --git a/include/SFML/Graphics/Matrix3.hpp b/include/SFML/Graphics/Matrix3.hpp
new file mode 100755
index 0000000..2d1ea74
--- /dev/null
+++ b/include/SFML/Graphics/Matrix3.hpp
@@ -0,0 +1,148 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_MATRIX3_HPP
+#define SFML_MATRIX3_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+#include <SFML/System/Vector2.hpp>
+#include <math.h>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Utility class to manipulate 3x3 matrices representing
+/// 2D transformations
+////////////////////////////////////////////////////////////
+class SFML_API Matrix3
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor (builds an identity matrix)
+ ///
+ ////////////////////////////////////////////////////////////
+ Matrix3();
+
+ ////////////////////////////////////////////////////////////
+ /// Construct a matrix from its 9 elements
+ ///
+ ////////////////////////////////////////////////////////////
+ Matrix3(float a00, float a01, float a02,
+ float a10, float a11, float a12,
+ float a20, float a21, float a22);
+
+ ////////////////////////////////////////////////////////////
+ /// Build a matrix from a set of transformations
+ ///
+ /// \param Center : Origin for the transformations
+ /// \param Translation : Translation offset
+ /// \param Rotation : Rotation angle in degrees
+ /// \param Scale : Scaling factors
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetFromTransformations(const Vector2f& Center, const Vector2f& Translation, float Rotation, const Vector2f& Scale);
+
+ ////////////////////////////////////////////////////////////
+ /// Transform a point by the matrix
+ ///
+ /// \param Point : Point to transform
+ ///
+ /// \return Transformed point
+ ///
+ ////////////////////////////////////////////////////////////
+ Vector2f Transform(const Vector2f& Point) const;
+
+ ////////////////////////////////////////////////////////////
+ /// Return the inverse of the matrix
+ ///
+ /// \return A new matrix which is the inverse of this
+ ///
+ ////////////////////////////////////////////////////////////
+ Matrix3 GetInverse() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Return the elements of the matrix as a 4x4,
+ /// in an array of 16 floats
+ ///
+ /// \return Pointer to the 4x4 matrix elements
+ ///
+ ////////////////////////////////////////////////////////////
+ const float* Get4x4Elements() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Operator () overloads to access the matrix elements
+ ///
+ /// \param Row : Element row (0 based)
+ /// \param Col : Element column (0 based)
+ ///
+ /// \return Matrix element (Row, Col)
+ ///
+ ////////////////////////////////////////////////////////////
+ float operator ()(unsigned int Row, unsigned int Col) const;
+ float& operator ()(unsigned int Row, unsigned int Col);
+
+ ////////////////////////////////////////////////////////////
+ /// Operator * overload to multiply two matrices
+ ///
+ /// \param Mat : Matrix to multiply
+ ///
+ /// \return this * Mat
+ ///
+ ////////////////////////////////////////////////////////////
+ Matrix3 operator *(const Matrix3& Mat) const;
+
+ ////////////////////////////////////////////////////////////
+ /// Operator *= overload to multiply-assign two matrices
+ ///
+ /// \param Mat : Matrix to multiply
+ ///
+ /// \return this * Mat
+ ///
+ ////////////////////////////////////////////////////////////
+ Matrix3& operator *=(const Matrix3& Mat);
+
+ ////////////////////////////////////////////////////////////
+ // Static member data
+ ////////////////////////////////////////////////////////////
+ static const Matrix3 Identity; ///< Identity matrix
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ float myData[16]; /// Matrix elements (we directly store it as a 4x4 matrix for optimization purpose)
+};
+
+#include <SFML/Graphics/Matrix3.inl>
+
+} // namespace sf
+
+
+#endif // SFML_MATRIX3_HPP
diff --git a/include/SFML/Graphics/Matrix3.inl b/include/SFML/Graphics/Matrix3.inl
new file mode 100755
index 0000000..610c745
--- /dev/null
+++ b/include/SFML/Graphics/Matrix3.inl
@@ -0,0 +1,160 @@
+////////////////////////////////////////////////////////////
+//
+// SFGE - Simple and Fast Game Engine
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////
+/// Default constructor (builds an identity matrix)
+////////////////////////////////////////////////////////////
+inline Matrix3::Matrix3()
+{
+ myData[0] = 1.f; myData[4] = 0.f; myData[8] = 0.f; myData[12] = 0.f;
+ myData[1] = 0.f; myData[5] = 1.f; myData[9] = 0.f; myData[13] = 0.f;
+ myData[2] = 0.f; myData[6] = 0.f; myData[10] = 1.f; myData[14] = 0.f;
+ myData[3] = 0.f; myData[7] = 0.f; myData[11] = 0.f; myData[15] = 1.f;
+}
+
+
+////////////////////////////////////////////////////////////
+/// Construct a matrix from its 9 elements
+////////////////////////////////////////////////////////////
+inline Matrix3::Matrix3(float a00, float a01, float a02,
+ float a10, float a11, float a12,
+ float a20, float a21, float a22)
+{
+ myData[0] = a00; myData[4] = a01; myData[8] = 0.f; myData[12] = a02;
+ myData[1] = a10; myData[5] = a11; myData[9] = 0.f; myData[13] = a12;
+ myData[2] = a20; myData[6] = a21; myData[10] = 1.f; myData[14] = a22;
+ myData[3] = 0.f; myData[7] = 0.f; myData[11] = 0.f; myData[15] = 1.f;
+}
+
+
+////////////////////////////////////////////////////////////
+/// Build a matrix from a set of transformations
+////////////////////////////////////////////////////////////
+inline void Matrix3::SetFromTransformations(const Vector2f& Center, const Vector2f& Translation, float Rotation, const Vector2f& Scale)
+{
+ float Angle = Rotation * 3.141592654f / 180.f;
+ float Cos = static_cast<float>(cos(Angle));
+ float Sin = static_cast<float>(sin(Angle));
+ float SxCos = Scale.x * Cos;
+ float SyCos = Scale.y * Cos;
+ float SxSin = Scale.x * Sin;
+ float SySin = Scale.y * Sin;
+ float Tx = -Center.x * SxCos - Center.y * SySin + Translation.x;
+ float Ty = Center.x * SxSin - Center.y * SyCos + Translation.y;
+
+ myData[0] = SxCos; myData[4] = SySin; myData[8] = 0.f; myData[12] = Tx;
+ myData[1] = -SxSin; myData[5] = SyCos; myData[9] = 0.f; myData[13] = Ty;
+ myData[2] = 0.f; myData[6] = 0.f; myData[10] = 1.f; myData[14] = 0.f;
+ myData[3] = 0.f; myData[7] = 0.f; myData[11] = 0.f; myData[15] = 1.f;
+}
+
+
+////////////////////////////////////////////////////////////
+/// Transform a point by the matrix
+////////////////////////////////////////////////////////////
+inline Vector2f Matrix3::Transform(const Vector2f& Point) const
+{
+ return Vector2f(myData[0] * Point.x + myData[4] * Point.y + myData[12],
+ myData[1] * Point.x + myData[5] * Point.y + myData[13]);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Return the inverse of the matrix
+////////////////////////////////////////////////////////////
+inline Matrix3 Matrix3::GetInverse() const
+{
+ // Compute the determinant
+ float Det = myData[0] * (myData[14] * myData[5] - myData[6] * myData[13]) -
+ myData[1] * (myData[14] * myData[4] - myData[6] * myData[12]) +
+ myData[2] * (myData[13] * myData[4] - myData[5] * myData[12]);
+
+ // Compute the inverse if determinant is not zero
+ if ((Det < -1E-7f) || (Det > 1E-7f))
+ {
+ return Matrix3( (myData[14] * myData[5] - myData[6] * myData[13]) / Det,
+ -(myData[14] * myData[4] - myData[6] * myData[12]) / Det,
+ (myData[13] * myData[4] - myData[5] * myData[12]) / Det,
+ -(myData[14] * myData[1] - myData[2] * myData[13]) / Det,
+ (myData[14] * myData[0] - myData[2] * myData[12]) / Det,
+ -(myData[13] * myData[0] - myData[1] * myData[12]) / Det,
+ (myData[6] * myData[1] - myData[2] * myData[5]) / Det,
+ -(myData[6] * myData[0] - myData[2] * myData[4]) / Det,
+ (myData[5] * myData[0] - myData[1] * myData[4]) / Det);
+ }
+ else
+ {
+ return Identity;
+ }
+}
+
+
+////////////////////////////////////////////////////////////
+/// Return the elements of the matrix as a 4x4,
+/// in an array of 16 floats
+////////////////////////////////////////////////////////////
+inline const float* Matrix3::Get4x4Elements() const
+{
+ return myData;
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator () overloads to access the matrix elements
+////////////////////////////////////////////////////////////
+inline float Matrix3::operator ()(unsigned int Row, unsigned int Col) const
+{
+ return myData[Row + (Col + Col / 2) * 4];
+}
+inline float& Matrix3::operator ()(unsigned int Row, unsigned int Col)
+{
+ return myData[Row + (Col + Col / 2) * 4];
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator * overload to multiply two matrices
+////////////////////////////////////////////////////////////
+inline Matrix3 Matrix3::operator *(const Matrix3& Mat) const
+{
+ return Matrix3(myData[0] * Mat.myData[0] + myData[4] * Mat.myData[1] + myData[12] * Mat.myData[2],
+ myData[0] * Mat.myData[4] + myData[4] * Mat.myData[5] + myData[12] * Mat.myData[3],
+ myData[0] * Mat.myData[12] + myData[4] * Mat.myData[13] + myData[12] * Mat.myData[14],
+ myData[1] * Mat.myData[0] + myData[5] * Mat.myData[1] + myData[13] * Mat.myData[2],
+ myData[1] * Mat.myData[4] + myData[5] * Mat.myData[5] + myData[13] * Mat.myData[3],
+ myData[1] * Mat.myData[12] + myData[5] * Mat.myData[13] + myData[13] * Mat.myData[14],
+ myData[2] * Mat.myData[0] + myData[6] * Mat.myData[1] + myData[14] * Mat.myData[2],
+ myData[2] * Mat.myData[4] + myData[6] * Mat.myData[5] + myData[14] * Mat.myData[3],
+ myData[2] * Mat.myData[12] + myData[6] * Mat.myData[13] + myData[14] * Mat.myData[14]);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator *= overload to multiply-assign two matrices
+////////////////////////////////////////////////////////////
+inline Matrix3& Matrix3::operator *=(const Matrix3& Mat)
+{
+ return *this = *this * Mat;
+}
diff --git a/include/SFML/Graphics/PostFX.hpp b/include/SFML/Graphics/PostFX.hpp
index 52d180d..9bd254b 100755
--- a/include/SFML/Graphics/PostFX.hpp
+++ b/include/SFML/Graphics/PostFX.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -170,17 +170,6 @@ private :
static std::string PreprocessEffect(std::istream& File);
////////////////////////////////////////////////////////////
- /// Create a shader object from a file, and attach it to the program
- ///
- /// \param Filename : Source code of shader to create
- /// \param ShaderType : OpenGL shader type (vertex / fragment)
- ///
- /// \return True on success, false if an error occured
- ///
- ////////////////////////////////////////////////////////////
- bool CreateAndAttachShader(const std::string& Source, unsigned int ShaderType);
-
- ////////////////////////////////////////////////////////////
/// Create the program and attach the shaders
///
////////////////////////////////////////////////////////////
diff --git a/include/SFML/Graphics/Rect.hpp b/include/SFML/Graphics/Rect.hpp
index a2567f4..b8e693d 100755
--- a/include/SFML/Graphics/Rect.hpp
+++ b/include/SFML/Graphics/Rect.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -35,7 +35,7 @@ namespace sf
{
////////////////////////////////////////////////////////////
/// Rect is an utility class for manipulating rectangles.
-/// Template parameter defines the type of coordinates (integer float, ...)
+/// Template parameter defines the type of coordinates (integer, float, ...)
////////////////////////////////////////////////////////////
template <typename T>
class Rect
diff --git a/include/SFML/Graphics/Rect.inl b/include/SFML/Graphics/Rect.inl
index de0c0ec..8391119 100755
--- a/include/SFML/Graphics/Rect.inl
+++ b/include/SFML/Graphics/Rect.inl
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/Graphics/RenderWindow.hpp b/include/SFML/Graphics/RenderWindow.hpp
index be66f56..1e708e5 100755
--- a/include/SFML/Graphics/RenderWindow.hpp
+++ b/include/SFML/Graphics/RenderWindow.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -57,22 +57,22 @@ public :
////////////////////////////////////////////////////////////
/// Construct the window
///
- /// \param Mode : Video mode to use
- /// \param Title : Title of the window
- /// \param WindowStyle : Window style (Resize | Close by default)
- /// \param AntialiasingLevel : Level of antialiasing (0 by default, disabled)
+ /// \param Mode : Video mode to use
+ /// \param Title : Title of the window
+ /// \param WindowStyle : Window style (Resize | Close by default)
+ /// \param Params : Creation parameters (see default constructor for default values)
///
////////////////////////////////////////////////////////////
- RenderWindow(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, int AntialiasingLevel = 0);
+ RenderWindow(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const WindowSettings& Params = WindowSettings());
////////////////////////////////////////////////////////////
/// Construct the window from an existing control
///
- /// \param Handle : Platform-specific handle of the control
- /// \param AntialiasingLevel : Level of antialiasing (0 by default, disabled)
+ /// \param Handle : Platform-specific handle of the control
+ /// \param Params : Creation parameters (see default constructor for default values)
///
////////////////////////////////////////////////////////////
- RenderWindow(WindowHandle Handle, int AntialiasingLevel = 0);
+ RenderWindow(WindowHandle Handle, const WindowSettings& Params = WindowSettings());
////////////////////////////////////////////////////////////
/// Destructor
@@ -107,30 +107,52 @@ public :
////////////////////////////////////////////////////////////
/// Change the current active view.
- /// The current view is defined with the initial size of the window
///
- /// \param NewView : Pointer to the new view (pass NULL to set the default view)
+ /// \param NewView : New view to use (pass GetDefaultView() to set the default view)
///
////////////////////////////////////////////////////////////
- void SetView(const View* NewView);
+ void SetView(const View& NewView);
////////////////////////////////////////////////////////////
- /// Get the current view rectangle
+ /// Get the current view
///
- /// \return Current view rectangle, in global coordinates
+ /// \return Current view active in the window
///
////////////////////////////////////////////////////////////
- const FloatRect& GetViewRect() const;
+ const View& GetView() const;
////////////////////////////////////////////////////////////
- /// Tell SFML to optimize its calls to the graphics driver,
- /// in case the user is not doing custom OpenGL calls.
+ /// Get the default view of the window for read / write
+ ///
+ /// \return Default view
+ ///
+ ////////////////////////////////////////////////////////////
+ View& GetDefaultView();
+
+ ////////////////////////////////////////////////////////////
+ /// Convert a point in window coordinates into view coordinates
+ ///
+ /// \param WindowX : X coordinate of the point to convert, relative to the window
+ /// \param WindowY : Y coordinate of the point to convert, relative to the window
+ /// \param TargetView : Target view to convert the point to (NULL by default -- uses the current view)
+ ///
+ /// \return Converted point
+ ///
+ ////////////////////////////////////////////////////////////
+ sf::Vector2f ConvertCoords(unsigned int WindowX, unsigned int WindowY, const View* TargetView = NULL) const;
+
+ ////////////////////////////////////////////////////////////
+ /// Tell SFML to preserve external OpenGL states, at the expense of
+ /// more CPU charge. Use this function if you don't want SFML
+ /// to mess up your own OpenGL states (if any).
+ /// Don't enable state preservation if not needed, as it will allow
+ /// SFML to do internal optimizations and improve performances.
/// This parameter is false by default
///
- /// \param Optimize : True to enable internal states optimizations, false to go back to safe mode
+ /// \param Preserve : True to preserve OpenGL states, false to let SFML optimize
///
////////////////////////////////////////////////////////////
- void OptimizeForNonOpenGL(bool Optimize);
+ void PreserveOpenGLStates(bool Preserve);
private :
@@ -147,12 +169,6 @@ private :
virtual void OnDisplay();
////////////////////////////////////////////////////////////
- /// /see Window::OnEvent
- ///
- ////////////////////////////////////////////////////////////
- virtual void OnEventReceived(const Event& EventReceived);
-
- ////////////////////////////////////////////////////////////
/// Set the OpenGL render states needed for the SFML rendering
///
////////////////////////////////////////////////////////////
@@ -161,11 +177,11 @@ private :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- Color myBackgroundColor; ///< Background color
- View myDefaultView; ///< Default view
- FloatRect myCurrentRect; ///< Rectangle corresponding to the current view
- float myCurrentProjection[16]; ///< Projection matrix currently used by the window
- bool myOptimizeStates; ///< This flag is a hint, to save many calls to the graphics driver when not mixing with OpenGL
+ Color myBackgroundColor; ///< Background color
+ View myDefaultView; ///< Default view
+ const View* myCurrentView; ///< Current active view
+ bool myPreserveStates; ///< Should we preserve external OpenGL states ?
+ mutable bool myIsDrawing; ///< True when Draw is called from inside, to allow some renderstates optimizations
};
} // namespace sf
diff --git a/include/SFML/Graphics/Shape.hpp b/include/SFML/Graphics/Shape.hpp
new file mode 100755
index 0000000..17197bb
--- /dev/null
+++ b/include/SFML/Graphics/Shape.hpp
@@ -0,0 +1,214 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_SHAPE_HPP
+#define SFML_SHAPE_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Graphics/Drawable.hpp>
+#include <SFML/System/Vector2.hpp>
+#include <vector>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Shape defines a drawable convex shape ; it also defines
+/// helper functions to draw simple shapes like
+/// lines, rectangles, circles, etc.
+////////////////////////////////////////////////////////////
+class SFML_API Shape : public sf::Drawable
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ Shape();
+
+ ////////////////////////////////////////////////////////////
+ /// Add a point to the shape
+ ///
+ /// \param X, Y : Position of the point
+ /// \param Col : Color of the point (white by default)
+ /// \param OutlineCol : Outline color of the point (black by default)
+ ///
+ ////////////////////////////////////////////////////////////
+ void AddPoint(float X, float Y, const Color& Col = Color(255, 255, 255), const Color& OutlineCol = Color(0, 0, 0));
+
+ ////////////////////////////////////////////////////////////
+ /// Add a point to the shape
+ ///
+ /// \param Position : Position of the point
+ /// \param Col : Color of the point (white by default)
+ /// \param OutlineCol : Outline color of the point (black by default)
+ ///
+ ////////////////////////////////////////////////////////////
+ void AddPoint(const Vector2f& Position, const Color& Col = Color(255, 255, 255), const Color& OutlineCol = Color(0, 0, 0));
+
+ ////////////////////////////////////////////////////////////
+ /// Enable or disable filling the shape.
+ /// Fill is enabled by default
+ ///
+ /// \param Enable : True to enable, false to disable
+ ///
+ ////////////////////////////////////////////////////////////
+ void EnableFill(bool Enable);
+
+ ////////////////////////////////////////////////////////////
+ /// Enable or disable drawing the shape outline.
+ /// Outline is enabled by default
+ ///
+ /// \param Enable : True to enable, false to disable
+ ///
+ ////////////////////////////////////////////////////////////
+ void EnableOutline(bool Enable);
+
+ ////////////////////////////////////////////////////////////
+ /// Change the width of the shape outline
+ ///
+ /// \param Width : New width
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetOutlineWidth(float Width);
+
+ ////////////////////////////////////////////////////////////
+ /// Get the number of points composing the shape
+ ///
+ /// \param Total number of points
+ ///
+ ////////////////////////////////////////////////////////////
+ unsigned int GetNbPoints() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get a point of the shape
+ ///
+ /// \param Index-th point
+ ///
+ ////////////////////////////////////////////////////////////
+ const Vector2f& GetPoint(unsigned int Index) const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get the width of the shape outline
+ ///
+ /// \param return Current outline width
+ ///
+ ////////////////////////////////////////////////////////////
+ float GetOutlineWidth() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Create a shape made of a single line
+ ///
+ /// \param P1X, P1Y : Position of the first point
+ /// \param P2X, P2Y : Position second point
+ /// \param Thickness : Line thickness
+ /// \param Col : Color used to draw the line
+ /// \param Outline : Outline width (0 by default)
+ /// \param OutlineCol : Color used to draw the outline (black by default)
+ ///
+ ////////////////////////////////////////////////////////////
+ static Shape Line(float P1X, float P1Y, float P2X, float P2Y, float Thickness, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0));
+
+ ////////////////////////////////////////////////////////////
+ /// Create a shape made of a single rectangle
+ ///
+ /// \param P1X, P1Y : Position of the first point
+ /// \param P2X, P2Y : Position second point
+ /// \param Col : Color used to fill the rectangle
+ /// \param Outline : Outline width (0 by default)
+ /// \param OutlineCol : Color used to draw the outline (black by default)
+ ///
+ ////////////////////////////////////////////////////////////
+ static Shape Rectangle(float P1X, float P1Y, float P2X, float P2Y, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0));
+
+ ////////////////////////////////////////////////////////////
+ /// Create a shape made of a single circle
+ ///
+ /// \param X, Y : Position of the center
+ /// \param Radius : Radius
+ /// \param Col : Color used to fill the circle
+ /// \param Outline : Outline width (0 by default)
+ /// \param OutlineCol : Color used to draw the outline (black by default)
+ ///
+ ////////////////////////////////////////////////////////////
+ static Shape Circle(float X, float Y, float Radius, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0));
+
+protected :
+
+ ////////////////////////////////////////////////////////////
+ /// /see Drawable::Render
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual void Render(const RenderWindow& Window) const;
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ /// Compile the shape : compute its center and its outline
+ ///
+ ////////////////////////////////////////////////////////////
+ void Compile();
+
+ ////////////////////////////////////////////////////////////
+ /// Compute the normal of a given 2D segment
+ ///
+ /// \param P1 : First point of the segment
+ /// \param P2 : Second point of the segment
+ /// \param Normal : Calculated normal
+ ///
+ /// \return False if the normal couldn't be calculated (segment is null)
+ ///
+ ////////////////////////////////////////////////////////////
+ static bool ComputeNormal(const Vector2f& P1, const Vector2f& P2, Vector2f& Normal);
+
+ ////////////////////////////////////////////////////////////
+ /// Defines a simple 2D point
+ ////////////////////////////////////////////////////////////
+ struct Point
+ {
+ Point(const Vector2f& Pos = Vector2f(0, 0), const Color& C = Color(255, 255, 255), const Color& OutlineC = Color(255, 255, 255));
+
+ Vector2f Position; ///< Position
+ Vector2f Normal; ///< Extruded normal
+ Color Col; ///< Color of the point
+ Color OutlineCol; ///< Outline color of the point
+ };
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ std::vector<Point> myPoints; ///< Points composing the shape
+ float myOutline; ///< Outline width
+ bool myIsFillEnabled; ///< Should we draw the inside if the shape ?
+ bool myIsOutlineEnabled; ///< Should we draw the outline if the shape ?
+ bool myIsCompiled; ///< Compiled state of the shape
+};
+
+} // namespace sf
+
+
+#endif // SFML_SHAPE_HPP
diff --git a/include/SFML/Graphics/Sprite.hpp b/include/SFML/Graphics/Sprite.hpp
index 5547093..3b00b72 100755
--- a/include/SFML/Graphics/Sprite.hpp
+++ b/include/SFML/Graphics/Sprite.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -54,15 +54,13 @@ public :
/// Construct the sprite from a source image
///
/// \param Img : Image of the sprite
- /// \param Left : Left coordinate of the sprite (0 by default)
- /// \param Top : Top coordinate of the sprite (0 by default)
- /// \param ScaleX : Horizontal scale (1 by default)
- /// \param ScaleY : Vertical scale (1 by default)
+ /// \param Position : Position of the sprite (0, 0 by default)
+ /// \param Scale : Scale factor (1, 1 by default)
/// \param Rotation : Orientation, in degrees (0 by default)
/// \param Col : Color of the sprite (white by default)
///
////////////////////////////////////////////////////////////
- Sprite(const Image& Img, float Left = 0.f, float Top = 0.f, float ScaleX = 1.f, float ScaleY = 1.f, float Rotation = 0.f, const Color& Col = Color(255, 255, 255, 255));
+ Sprite(const Image& Img, const Vector2f& Position = Vector2f(0, 0), const Vector2f& Scale = Vector2f(1, 1), float Rotation = 0.f, const Color& Col = Color(255, 255, 255, 255));
////////////////////////////////////////////////////////////
/// Change the image of the sprite
@@ -82,7 +80,7 @@ public :
void SetSubRect(const IntRect& SubRect);
////////////////////////////////////////////////////////////
- /// Resize the sprite (by changing its scale factors).
+ /// Resize the sprite (by changing its scale factors) (take 2 values).
/// The default size is defined by the subrect
///
/// \param Width : New width (must be strictly positive)
@@ -92,6 +90,15 @@ public :
void Resize(float Width, float Height);
////////////////////////////////////////////////////////////
+ /// Resize the sprite (by changing its scale factors) (take a 2D vector).
+ /// The default size is defined by the subrect
+ ///
+ /// \param Size : New size (both coordinates must be strictly positive)
+ ///
+ ////////////////////////////////////////////////////////////
+ void Resize(const Vector2f& Size);
+
+ ////////////////////////////////////////////////////////////
/// Flip the sprite horizontally
///
/// \param Flipped : True to flip the sprite
@@ -124,20 +131,12 @@ public :
const IntRect& GetSubRect() const;
////////////////////////////////////////////////////////////
- /// Get the sprite width
- ///
- /// \return Width of the sprite
- ///
- ////////////////////////////////////////////////////////////
- float GetWidth() const;
-
- ////////////////////////////////////////////////////////////
- /// Get the sprite height
+ /// Get the sprite size
///
- /// \return Height of the sprite
+ /// \return Size of the sprite
///
////////////////////////////////////////////////////////////
- float GetHeight() const;
+ Vector2f GetSize() const;
////////////////////////////////////////////////////////////
/// Get the color of a given pixel in the sprite
diff --git a/include/SFML/Graphics/String.hpp b/include/SFML/Graphics/String.hpp
index 762a247..d3a1f73 100755
--- a/include/SFML/Graphics/String.hpp
+++ b/include/SFML/Graphics/String.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics/Drawable.hpp>
+#include <SFML/Graphics/Font.hpp>
#include <SFML/Graphics/Rect.hpp>
#include <string>
@@ -43,34 +44,35 @@ class SFML_API String : public Drawable
public :
////////////////////////////////////////////////////////////
- /// Construct the string from a multibyte text
- ///
- /// \param Text : Text assigned to the string ("" by default)
- /// \param Font : Font used to draw the string ("" by default - use default font)
- /// \param Size : Characters size, in pixels (32 by default)
- ///
+ /// Enumerate the string drawing styles
////////////////////////////////////////////////////////////
- String(const std::string& Text, const std::string& Font = "", float Size = 32.f);
+ enum Style
+ {
+ Regular = 0, ///< Regular characters, no style
+ Bold = 1 << 0, ///< Characters are bold
+ Italic = 1 << 1, ///< Characters are in italic
+ Underlined = 1 << 2 ///< Characters are underlined
+ };
////////////////////////////////////////////////////////////
- /// Construct the string from a unicode text
+ /// Construct the string from a multibyte text
///
- /// \param Text : Text assigned to the string ("" by default)
- /// \param Font : Font used to draw the string ("" by default - use default font)
- /// \param Size : Characters size, in pixels (32 by default)
+ /// \param Text : Text assigned to the string
+ /// \param Font : Font used to draw the string (SFML built-in font by default)
+ /// \param Size : Characters size (30 by default)
///
////////////////////////////////////////////////////////////
- String(const std::wstring& Text = L"", const std::string& Font = "", float Size = 32.f);
+ String(const std::string& Text, const Font& CharFont = Font::GetDefaultFont(), float Size = 30.f);
////////////////////////////////////////////////////////////
- /// Preload a bitmap font (otherwise, it is done the first time the font is drawn)
+ /// Construct the string from a unicode text
///
- /// \param Font : Font to load
- /// \param Size : Requested character size
- /// \param Charset : Characters set to generate (empty by default - take the ASCII range [31, 255])
+ /// \param Text : Text assigned to the string ("" by default)
+ /// \param Font : Font used to draw the string (SFML built-in font by default)
+ /// \param Size : Characters size (30 by default)
///
////////////////////////////////////////////////////////////
- static void PreloadFont(const std::string& Font, float Size, std::wstring Charset = L"");
+ String(const std::wstring& Text = L"", const Font& CharFont = Font::GetDefaultFont(), float Size = 30.f);
////////////////////////////////////////////////////////////
/// Set the text (from a multibyte string)
@@ -91,13 +93,14 @@ public :
////////////////////////////////////////////////////////////
/// Set the font of the string
///
- /// \param Font : Font filename
+ /// \param Font : Font to use
///
////////////////////////////////////////////////////////////
- void SetFont(const std::string& Font);
+ void SetFont(const Font& CharFont);
////////////////////////////////////////////////////////////
/// Set the size of the string
+ /// The default size is 30
///
/// \param Size : New size, in pixels
///
@@ -105,6 +108,15 @@ public :
void SetSize(float Size);
////////////////////////////////////////////////////////////
+ /// Set the style of the text
+ /// The default style is Regular
+ ///
+ /// \param TextStyle : New text style, (combination of Style enum values)
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetStyle(unsigned long TextStyle);
+
+ ////////////////////////////////////////////////////////////
/// Get the text (returns a unicode string)
///
/// \return Text
@@ -123,10 +135,10 @@ public :
////////////////////////////////////////////////////////////
/// Get the font used by the string
///
- /// \return Font name
+ /// \return Font used
///
////////////////////////////////////////////////////////////
- const std::string& GetFont() const;
+ const Font& GetFont() const;
////////////////////////////////////////////////////////////
/// Get the size of the characters
@@ -137,6 +149,14 @@ public :
float GetSize() const;
////////////////////////////////////////////////////////////
+ /// Get the style of the text
+ ///
+ /// \return Current string style (combination of Style enum values)
+ ///
+ ////////////////////////////////////////////////////////////
+ unsigned long GetStyle() const;
+
+ ////////////////////////////////////////////////////////////
/// Get the string rectangle on screen
///
/// \return Rectangle contaning the string in screen coordinates
@@ -155,11 +175,20 @@ protected :
private :
////////////////////////////////////////////////////////////
+ /// Recompute the bounding rectangle of the text
+ ///
+ ////////////////////////////////////////////////////////////
+ void RecomputeRect();
+
+ ////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- std::wstring myText; ///< Text to display
- std::string myFont; ///< Font used to display string
- float mySize; ///< Size of characters (in pixels) (must be strictly positive)
+ std::wstring myText; ///< Text to display
+ const Font* myFont; ///< Font used to display the string
+ float mySize; ///< Size of the characters
+ unsigned long myStyle; ///< Text style (see Style enum)
+ FloatRect myBaseRect; ///< Bounding rectangle of the text in object coordinates
+ bool myNeedRectUpdate; ///< Does the bounding rect need an update ?
};
} // namespace sf
diff --git a/include/SFML/Graphics/VideoResource.hpp b/include/SFML/Graphics/VideoResource.hpp
index 0558e49..9e4c6a3 100755
--- a/include/SFML/Graphics/VideoResource.hpp
+++ b/include/SFML/Graphics/VideoResource.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/Graphics/View.hpp b/include/SFML/Graphics/View.hpp
index 863469f..d3de605 100755
--- a/include/SFML/Graphics/View.hpp
+++ b/include/SFML/Graphics/View.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -30,32 +30,154 @@
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
#include <SFML/Graphics/Rect.hpp>
+#include <SFML/Graphics/Matrix3.hpp>
+#include <SFML/System/Vector2.hpp>
namespace sf
{
////////////////////////////////////////////////////////////
-/// This class defines a view (position, size and zoom) ;
-/// you can consider it as a camera
+/// This class defines a view (position, size, etc.) ;
+/// you can consider it as a 2D camera
////////////////////////////////////////////////////////////
class SFML_API View
{
public :
////////////////////////////////////////////////////////////
- /// Construct the view with position and size
+ /// Construct the view from a rectangle
+ ///
+ /// \param ViewRect : Rectangle defining the position and size of the view (1000x1000 by default)
+ ///
+ ////////////////////////////////////////////////////////////
+ explicit View(const FloatRect& ViewRect = FloatRect(0, 0, 1000, 1000));
+
+ ////////////////////////////////////////////////////////////
+ /// Construct the view from its center and half-size
+ ///
+ /// \param Center : Center of the view
+ /// \param HalfSize : Half-size of the view (from center to corner)
+ ///
+ ////////////////////////////////////////////////////////////
+ View(const sf::Vector2f& Center, const sf::Vector2f& HalfSize);
+
+ ////////////////////////////////////////////////////////////
+ /// Change the center of the view (take 2 values)
+ ///
+ /// \param X : X coordinate of the new center
+ /// \param Y : Y coordinate of the new center
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetCenter(float X, float Y);
+
+ ////////////////////////////////////////////////////////////
+ /// Change the center of the view (take a vector)
+ ///
+ /// \param Center : New center
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetCenter(const sf::Vector2f& Center);
+
+ ////////////////////////////////////////////////////////////
+ /// Change the half-size of the view (take 2 values)
+ ///
+ /// \param HalfWidth : New half-width
+ /// \param HalfHeight : New half-height
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetHalfSize(float HalfWidth, float HalfHeight);
+
+ ////////////////////////////////////////////////////////////
+ /// Change the half-size of the view (take a vector)
+ ///
+ /// \param HalfSize : New half-size
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetHalfSize(const sf::Vector2f& HalfSize);
+
+ ////////////////////////////////////////////////////////////
+ /// Rebuild the view from a rectangle
///
/// \param ViewRect : Rectangle defining the position and size of the view
- /// \param ViewZoom : Zoom factor (1 by default)
///
////////////////////////////////////////////////////////////
- View(const FloatRect& ViewRect = FloatRect(0, 0, 1000, 1000), float ViewZoom = 1.f);
+ void SetFromRect(const FloatRect& ViewRect);
+
+ ////////////////////////////////////////////////////////////
+ /// Get the center of the view
+ ///
+ /// \return Center of the view
+ ///
+ ////////////////////////////////////////////////////////////
+ const sf::Vector2f& GetCenter() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get the half-size of the view
+ ///
+ /// \return Half-size of the view
+ ///
+ ////////////////////////////////////////////////////////////
+ const sf::Vector2f& GetHalfSize() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get the bounding rectangle of the view
+ ///
+ /// \return Bounding rectangle of the view
+ ///
+ ////////////////////////////////////////////////////////////
+ const sf::FloatRect& GetRect() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Move the view (take 2 values)
+ ///
+ /// \param OffsetX : Offset to move the view, on X axis
+ /// \param OffsetY : Offset to move the view, on Y axis
+ ///
+ ////////////////////////////////////////////////////////////
+ void Move(float OffsetX, float OffsetY);
+
+ ////////////////////////////////////////////////////////////
+ /// Move the view (take a vector)
+ ///
+ /// \param Offset : Offset to move the view
+ ///
+ ////////////////////////////////////////////////////////////
+ void Move(const sf::Vector2f& Offset);
+
+ ////////////////////////////////////////////////////////////
+ /// Resize the view rectangle to simulate a zoom / unzoom effect
+ ///
+ /// \param Factor : Zoom factor to apply, relative to the current zoom
+ ///
+ ////////////////////////////////////////////////////////////
+ void Zoom(float Factor);
+
+private :
+
+ friend class RenderWindow;
+
+ ////////////////////////////////////////////////////////////
+ /// Get the projection matrix of the view
+ ///
+ /// \return Projection matrix containing the view settings
+ ///
+ ////////////////////////////////////////////////////////////
+ const Matrix3& GetMatrix() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Recompute the view rectangle and the projection matrix
+ ///
+ ////////////////////////////////////////////////////////////
+ void RecomputeMatrix();
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- FloatRect Rect; ///< Rectangle defining the view's position and size
- float Zoom; ///< Zoom (less than 1 is unzoom, greater than 1 is zoom)
+ sf::Vector2f myCenter; ///< Center of the view
+ sf::Vector2f myHalfSize; ///< Half-size of the view
+ FloatRect myRect; ///< Rectangle defining the bounds of the view
+ Matrix3 myMatrix; ///< Precomputed projection matrix corresponding to the view
+ bool myNeedUpdate; ///< Internal state telling if the matrix needs to be updated
};
} // namespace sf
diff --git a/include/SFML/Network/IPAddress.hpp b/include/SFML/Network/IPAddress.hpp
index c28e600..5721623 100755
--- a/include/SFML/Network/IPAddress.hpp
+++ b/include/SFML/Network/IPAddress.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/Network/Packet.hpp b/include/SFML/Network/Packet.hpp
index 4d9631a..738dfce 100755
--- a/include/SFML/Network/Packet.hpp
+++ b/include/SFML/Network/Packet.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -99,31 +99,35 @@ public :
/// Operator >> overloads to extract data from the packet
///
////////////////////////////////////////////////////////////
- Packet& operator >>(Int8& Data);
- Packet& operator >>(Uint8& Data);
- Packet& operator >>(Int16& Data);
- Packet& operator >>(Uint16& Data);
- Packet& operator >>(Int32& Data);
- Packet& operator >>(Uint32& Data);
- Packet& operator >>(float& Data);
- Packet& operator >>(double& Data);
- Packet& operator >>(char* Data);
- Packet& operator >>(std::string& Data);
+ Packet& operator >>(Int8& Data);
+ Packet& operator >>(Uint8& Data);
+ Packet& operator >>(Int16& Data);
+ Packet& operator >>(Uint16& Data);
+ Packet& operator >>(Int32& Data);
+ Packet& operator >>(Uint32& Data);
+ Packet& operator >>(float& Data);
+ Packet& operator >>(double& Data);
+ Packet& operator >>(char* Data);
+ Packet& operator >>(std::string& Data);
+ Packet& operator >>(wchar_t* Data);
+ Packet& operator >>(std::wstring& Data);
////////////////////////////////////////////////////////////
/// Operator << overloads to put data into the packet
///
////////////////////////////////////////////////////////////
- Packet& operator <<(Int8 Data);
- Packet& operator <<(Uint8 Data);
- Packet& operator <<(Int16 Data);
- Packet& operator <<(Uint16 Data);
- Packet& operator <<(Int32 Data);
- Packet& operator <<(Uint32 Data);
- Packet& operator <<(float Data);
- Packet& operator <<(double Data);
- Packet& operator <<(const char* Data);
- Packet& operator <<(const std::string& Data);
+ Packet& operator <<(Int8 Data);
+ Packet& operator <<(Uint8 Data);
+ Packet& operator <<(Int16 Data);
+ Packet& operator <<(Uint16 Data);
+ Packet& operator <<(Int32 Data);
+ Packet& operator <<(Uint32 Data);
+ Packet& operator <<(float Data);
+ Packet& operator <<(double Data);
+ Packet& operator <<(const char* Data);
+ Packet& operator <<(const std::string& Data);
+ Packet& operator <<(const wchar_t* Data);
+ Packet& operator <<(const std::wstring& Data);
private :
diff --git a/include/SFML/Network/Selector.hpp b/include/SFML/Network/Selector.hpp
index a993937..7d1c320 100755
--- a/include/SFML/Network/Selector.hpp
+++ b/include/SFML/Network/Selector.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -30,7 +30,8 @@
////////////////////////////////////////////////////////////
#include <SFML/Network/SocketUDP.hpp>
#include <SFML/Network/SocketTCP.hpp>
-#include <vector>
+#include <SFML/Network/SelectorBase.hpp>
+#include <map>
namespace sf
@@ -40,17 +41,11 @@ namespace sf
/// without blocking. It's a kind of multiplexer
////////////////////////////////////////////////////////////
template <typename Type>
-class Selector
+class Selector : private SelectorBase
{
public :
////////////////////////////////////////////////////////////
- /// Default constructor
- ///
- ////////////////////////////////////////////////////////////
- Selector();
-
- ////////////////////////////////////////////////////////////
/// Add a socket to watch
///
/// \param Socket : Socket to add
@@ -73,25 +68,40 @@ public :
void Clear();
////////////////////////////////////////////////////////////
- /// Retrieve all the sockets of the selector which are
- /// ready for reading or writing. This functions will return
- /// either when at least one socket is ready, or when given time is out
+ /// Wait and collect sockets which are ready for reading.
+ /// This functions will return either when at least one socket
+ /// is ready, or when the given time is out
///
- /// \param Sockets : Array to fill with sockets that are ready for reading
/// \param Timeout : Timeout, in seconds (0 by default : no timeout)
///
- /// \return True if a socket is ready, false if time was out
+ /// \return Number of sockets ready to be read
///
////////////////////////////////////////////////////////////
- bool GetSocketsReady(std::vector<Type>& Sockets, float Timeout = 0.f);
+ unsigned int Wait(float Timeout = 0.f);
+
+ ////////////////////////////////////////////////////////////
+ /// After a call to Wait(), get the Index-th socket which is
+ /// ready for reading. The total number of sockets ready
+ /// is the integer returned by the previous call to Wait()
+ ///
+ /// \param Index : Index of the socket to get
+ ///
+ /// \return The Index-th socket
+ ///
+ ////////////////////////////////////////////////////////////
+ Type GetSocketReady(unsigned int Index) const;
private :
////////////////////////////////////////////////////////////
+ // Types
+ ////////////////////////////////////////////////////////////
+ typedef std::map<SocketHelper::SocketType, Type> SocketTable;
+
+ ////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- fd_set mySet; ///< Set of socket to watch
- int myMaxSocket; ///< Maximum socket index
+ SocketTable mySockets; ///< Table matching the SFML socket instances with their low-level handles
};
#include <SFML/Network/Selector.inl>
diff --git a/include/SFML/Network/Selector.inl b/include/SFML/Network/Selector.inl
index 10f4b21..9eacb6f 100755
--- a/include/SFML/Network/Selector.inl
+++ b/include/SFML/Network/Selector.inl
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -24,26 +24,16 @@
////////////////////////////////////////////////////////////
-/// Default constructor
-////////////////////////////////////////////////////////////
-template <typename Type>
-Selector<Type>::Selector() :
-myMaxSocket(0)
-{
- Clear();
-}
-
-
-////////////////////////////////////////////////////////////
/// Add a socket to watch
////////////////////////////////////////////////////////////
template <typename Type>
void Selector<Type>::Add(Type Socket)
{
- FD_SET(Socket.mySocket, &mySet);
-
- if (static_cast<int>(Socket.mySocket) > myMaxSocket)
- myMaxSocket = static_cast<int>(Socket.mySocket);
+ if (Socket.IsValid())
+ {
+ SelectorBase::Add(Socket.mySocket);
+ mySockets[Socket.mySocket] = Socket;
+ }
}
@@ -53,7 +43,12 @@ void Selector<Type>::Add(Type Socket)
template <typename Type>
void Selector<Type>::Remove(Type Socket)
{
- FD_CLR(Socket.mySocket, &mySet);
+ typename SocketTable::iterator It = mySockets.find(Socket.mySocket);
+ if (It != mySockets.end())
+ {
+ SelectorBase::Remove(Socket.mySocket);
+ mySockets.erase(It);
+ }
}
@@ -63,46 +58,40 @@ void Selector<Type>::Remove(Type Socket)
template <typename Type>
void Selector<Type>::Clear()
{
- FD_ZERO(&mySet);
-
- myMaxSocket = 0;
+ SelectorBase::Clear();
+ mySockets.clear();
}
////////////////////////////////////////////////////////////
-/// Retrieve all the sockets of the selector which are
-/// ready for reading or writing. This functions will return
-/// either when at least one socket is ready, or when given time is out
+/// Wait and collect sockets which are ready for reading.
+/// This functions will return either when at least one socket
+/// is ready, or when the given time is out
////////////////////////////////////////////////////////////
template <typename Type>
-bool Selector<Type>::GetSocketsReady(std::vector<Type>& Sockets, float Timeout)
+unsigned int Selector<Type>::Wait(float Timeout)
{
- // First of all, clear the array to fill...
- Sockets.clear();
+ // No socket in the selector : return 0
+ if (mySockets.empty())
+ return 0;
- // Setup the timeout structure
- timeval Time;
- Time.tv_sec = static_cast<long>(Timeout);
- Time.tv_usec = (static_cast<long>(Timeout * 1000) % 1000) * 1000;
+ return SelectorBase::Wait(Timeout);
+}
- // Use a copy of the set, as it will be modified by select()
- fd_set Set = mySet;
- // Wait until one of the sockets is ready for reading, or timeout is reached
- if (select(myMaxSocket + 1, &Set, NULL, NULL, Timeout > 0 ? &Time : NULL) != 0)
- {
- // One or more sockets are ready : put them into the array
- for (int i = 0; i < myMaxSocket + 1; ++i)
- {
- if (FD_ISSET(i, &Set))
- Sockets.push_back(Type(static_cast<SocketHelper::SocketType>(i)));
- }
+////////////////////////////////////////////////////////////
+/// After a call to Wait(), get the Index-th socket which is
+/// ready for reading. The total number of sockets ready
+/// is the integer returned by the previous call to Wait()
+////////////////////////////////////////////////////////////
+template <typename Type>
+Type Selector<Type>::GetSocketReady(unsigned int Index) const
+{
+ SocketHelper::SocketType Socket = SelectorBase::GetSocketReady(Index);
- return true;
- }
+ typename SocketTable::const_iterator It = mySockets.find(Socket);
+ if (It != mySockets.end())
+ return It->second;
else
- {
- // Timeout reached...
- return false;
- }
+ return Type(Socket);
}
diff --git a/include/SFML/Window/Linux/Joystick.hpp b/include/SFML/Network/SelectorBase.hpp
index 1c1e4a2..103c103 100755
--- a/include/SFML/Window/Linux/Joystick.hpp
+++ b/include/SFML/Network/SelectorBase.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -22,71 +22,91 @@
//
////////////////////////////////////////////////////////////
-#ifndef SFML_JOYSTICKLINUX_HPP
-#define SFML_JOYSTICKLINUX_HPP
+#ifndef SFML_SELECTORBASE_HPP
+#define SFML_SELECTORBASE_HPP
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+#include <SFML/Network/SocketHelper.hpp>
+#include <map>
namespace sf
{
-namespace priv
-{
////////////////////////////////////////////////////////////
-/// Linux implementation of Joystick
+/// Private base class for selectors.
+/// As Selector is a template class, this base is needed so that
+/// every system call get compiled in SFML (not inlined)
////////////////////////////////////////////////////////////
-class Joystick
+class SFML_API SelectorBase
{
public :
////////////////////////////////////////////////////////////
- /// Initialize the instance and bind it to a physical joystick
+ /// Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ SelectorBase();
+
+ ////////////////////////////////////////////////////////////
+ /// Add a socket to watch
///
- /// \param Index : Index of the physical joystick to bind to
+ /// \param Socket : Socket to add
///
////////////////////////////////////////////////////////////
- void Initialize(unsigned int Index);
+ void Add(SocketHelper::SocketType Socket);
////////////////////////////////////////////////////////////
- /// Update the current joystick and return its new state
+ /// Remove a socket
+ ///
+ /// \param Socket : Socket to remove
///
- /// \return Current state of the joystick
+ ////////////////////////////////////////////////////////////
+ void Remove(SocketHelper::SocketType Socket);
+
+ ////////////////////////////////////////////////////////////
+ /// Remove all sockets
///
////////////////////////////////////////////////////////////
- JoystickState UpdateState();
+ void Clear();
////////////////////////////////////////////////////////////
- /// Get the number of axes supported by the joystick
+ /// Wait and collect sockets which are ready for reading.
+ /// This functions will return either when at least one socket
+ /// is ready, or when the given time is out
///
- /// \return Number of axis
+ /// \param Timeout : Timeout, in seconds (0 by default : no timeout)
+ ///
+ /// \return Number of sockets ready to be read
///
////////////////////////////////////////////////////////////
- unsigned int GetAxesCount() const;
+ unsigned int Wait(float Timeout = 0.f);
////////////////////////////////////////////////////////////
- /// Get the number of buttons supported by the joystick
+ /// After a call to Wait(), get the Index-th socket which is
+ /// ready for reading. The total number of sockets ready
+ /// is the integer returned by the previous call to Wait()
+ ///
+ /// \param Index : Index of the socket to get
///
- /// \return Number of buttons
+ /// \return The Index-th socket
///
////////////////////////////////////////////////////////////
- unsigned int GetButtonsCount() const;
+ SocketHelper::SocketType GetSocketReady(unsigned int Index) const;
private :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- int myDescriptor; ///< Linux descriptor of the joystick
- unsigned int myNbAxes; ///< Number of axis supported by the joystick
- unsigned int myNbButtons; ///< Number of buttons supported by the joystick
- JoystickState myState; ///< Current state of the joystick
+ fd_set mySet; ///< Set of socket to watch
+ fd_set mySetReady; ///< Set of socket which are ready for reading
+ int myMaxSocket; ///< Maximum socket index
};
-} // namespace priv
-
} // namespace sf
-#endif // SFML_JOYSTICKLINUX_HPP
+#endif // SFML_SELECTORBASE_HPP
diff --git a/include/SFML/Network/SocketHelper.hpp b/include/SFML/Network/SocketHelper.hpp
index 4f7a748..36126db 100755
--- a/include/SFML/Network/SocketHelper.hpp
+++ b/include/SFML/Network/SocketHelper.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/Network/SocketTCP.hpp b/include/SFML/Network/SocketTCP.hpp
index bc6254e..06bcf9e 100755
--- a/include/SFML/Network/SocketTCP.hpp
+++ b/include/SFML/Network/SocketTCP.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -29,16 +29,15 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Network/SocketHelper.hpp>
+#include <SFML/Network/Packet.hpp>
#include <cstddef>
namespace sf
{
-class Packet;
class IPAddress;
template <typename> class Selector;
-
////////////////////////////////////////////////////////////
/// SocketTCP wraps a socket using TCP protocol to
/// send data safely (but a bit slower)
@@ -211,7 +210,9 @@ private :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- SocketHelper::SocketType mySocket; ///< Socket descriptor
+ SocketHelper::SocketType mySocket; ///< Socket descriptor
+ sf::Packet myPendingPacket; ///< Current pending packet, if any (in non-blocking mode)
+ Int32 myPendingPacketSize; ///< Size of the current pending packet, if any (in non-blocking mode)
};
} // namespace sf
diff --git a/include/SFML/Network/SocketUDP.hpp b/include/SFML/Network/SocketUDP.hpp
index cca2522..62229b4 100755
--- a/include/SFML/Network/SocketUDP.hpp
+++ b/include/SFML/Network/SocketUDP.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -29,12 +29,12 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Network/SocketHelper.hpp>
+#include <SFML/Network/Packet.hpp>
#include <cstddef>
namespace sf
{
-class Packet;
class IPAddress;
template <typename> class Selector;
@@ -209,8 +209,10 @@ private :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- SocketHelper::SocketType mySocket; ///< Socket identifier
- unsigned short myPort; ///< Port to which the socket is bound
+ SocketHelper::SocketType mySocket; ///< Socket identifier
+ unsigned short myPort; ///< Port to which the socket is bound
+ sf::Packet myPendingPacket; ///< Current pending packet, if any (in non-blocking mode)
+ Int32 myPendingPacketSize; ///< Size of the current pending packet, if any (in non-blocking mode)
};
} // namespace sf
diff --git a/include/SFML/Network/Sockets.hpp b/include/SFML/Network/Sockets.hpp
index b0fb8ea..b611e85 100755
--- a/include/SFML/Network/Sockets.hpp
+++ b/include/SFML/Network/Sockets.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/Network/Unix/SocketHelper.hpp b/include/SFML/Network/Unix/SocketHelper.hpp
index caa58bb..8a3b391 100755
--- a/include/SFML/Network/Unix/SocketHelper.hpp
+++ b/include/SFML/Network/Unix/SocketHelper.hpp
@@ -1,95 +1,95 @@
-////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-#ifndef SFML_SOCKETHELPERUNIX_HPP
-#define SFML_SOCKETHELPERUNIX_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <unistd.h>
-
-
-namespace sf
-{
-////////////////////////////////////////////////////////////
-/// This class defines helper functions to do all the
-/// non-portable socket stuff. This class is meant for internal
-/// use only
-////////////////////////////////////////////////////////////
-class SFML_API SocketHelper
-{
-public :
-
- ////////////////////////////////////////////////////////////
- // Define some socket types
- ////////////////////////////////////////////////////////////
- typedef int SocketType;
- typedef socklen_t LengthType;
-
- ////////////////////////////////////////////////////////////
- /// Return the value of the invalid socket
- ///
- /// \return Unique value of the invalid socket
- ///
- ////////////////////////////////////////////////////////////
- static SocketType InvalidSocket();
-
- ////////////////////////////////////////////////////////////
- /// Close / destroy a socket
- ///
- /// \param Socket : Socket to close
- ///
- /// \return True on success
- ///
- ////////////////////////////////////////////////////////////
- static bool Close(SocketType Socket);
-
- ////////////////////////////////////////////////////////////
- /// Set a socket as blocking or non-blocking
- ///
- /// \param Socket : Socket to modify
- /// \param Block : New blocking state of the socket
- ///
- ////////////////////////////////////////////////////////////
- static void SetBlocking(SocketType Socket, bool Block);
-
- ////////////////////////////////////////////////////////////
- /// Get the last socket error status
- ///
- /// \return Status corresponding to the last socket error
- ///
- ////////////////////////////////////////////////////////////
- static Socket::Status GetErrorStatus();
-};
-
-} // namespace sf
-
-
-#endif // SFML_SOCKETHELPERUNIX_HPP
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_SOCKETHELPERUNIX_HPP
+#define SFML_SOCKETHELPERUNIX_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <unistd.h>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// This class defines helper functions to do all the
+/// non-portable socket stuff. This class is meant for internal
+/// use only
+////////////////////////////////////////////////////////////
+class SFML_API SocketHelper
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ // Define some socket types
+ ////////////////////////////////////////////////////////////
+ typedef int SocketType;
+ typedef socklen_t LengthType;
+
+ ////////////////////////////////////////////////////////////
+ /// Return the value of the invalid socket
+ ///
+ /// \return Unique value of the invalid socket
+ ///
+ ////////////////////////////////////////////////////////////
+ static SocketType InvalidSocket();
+
+ ////////////////////////////////////////////////////////////
+ /// Close / destroy a socket
+ ///
+ /// \param Socket : Socket to close
+ ///
+ /// \return True on success
+ ///
+ ////////////////////////////////////////////////////////////
+ static bool Close(SocketType Socket);
+
+ ////////////////////////////////////////////////////////////
+ /// Set a socket as blocking or non-blocking
+ ///
+ /// \param Socket : Socket to modify
+ /// \param Block : New blocking state of the socket
+ ///
+ ////////////////////////////////////////////////////////////
+ static void SetBlocking(SocketType Socket, bool Block);
+
+ ////////////////////////////////////////////////////////////
+ /// Get the last socket error status
+ ///
+ /// \return Status corresponding to the last socket error
+ ///
+ ////////////////////////////////////////////////////////////
+ static Socket::Status GetErrorStatus();
+};
+
+} // namespace sf
+
+
+#endif // SFML_SOCKETHELPERUNIX_HPP
diff --git a/include/SFML/Network/Win32/SocketHelper.hpp b/include/SFML/Network/Win32/SocketHelper.hpp
index ec30f08..d7851b4 100755
--- a/include/SFML/Network/Win32/SocketHelper.hpp
+++ b/include/SFML/Network/Win32/SocketHelper.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/System.hpp b/include/SFML/System.hpp
index ea80e1b..01aff60 100755
--- a/include/SFML/System.hpp
+++ b/include/SFML/System.hpp
@@ -36,6 +36,7 @@
#include <SFML/System/Randomizer.hpp>
#include <SFML/System/Sleep.hpp>
#include <SFML/System/Thread.hpp>
-
+#include <SFML/System/Vector2.hpp>
+#include <SFML/System/Vector3.hpp>
#endif // SFML_SYSTEM_HPP
diff --git a/include/SFML/System/Clock.hpp b/include/SFML/System/Clock.hpp
index 62c9963..4b3cf9a 100755
--- a/include/SFML/System/Clock.hpp
+++ b/include/SFML/System/Clock.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/System/Lock.hpp b/include/SFML/System/Lock.hpp
index 69074ce..f1176fa 100755
--- a/include/SFML/System/Lock.hpp
+++ b/include/SFML/System/Lock.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/System/Mutex.hpp b/include/SFML/System/Mutex.hpp
index be392a5..7e096ae 100755
--- a/include/SFML/System/Mutex.hpp
+++ b/include/SFML/System/Mutex.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/System/NonCopyable.hpp b/include/SFML/System/NonCopyable.hpp
index 984f716..7910444 100755
--- a/include/SFML/System/NonCopyable.hpp
+++ b/include/SFML/System/NonCopyable.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -38,7 +38,7 @@ namespace sf
/// Utility base class to easily declare non-copyable classes.
/// Just inherit from NonCopyable to get a non-copyable class
////////////////////////////////////////////////////////////
-class SFML_API NonCopyable
+struct SFML_API NonCopyable
{
protected :
diff --git a/include/SFML/System/Randomizer.hpp b/include/SFML/System/Randomizer.hpp
index 0f8f6c9..dd453c1 100755
--- a/include/SFML/System/Randomizer.hpp
+++ b/include/SFML/System/Randomizer.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/System/Sleep.hpp b/include/SFML/System/Sleep.hpp
index c2c0890..8cc23f5 100755
--- a/include/SFML/System/Sleep.hpp
+++ b/include/SFML/System/Sleep.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/System/Thread.hpp b/include/SFML/System/Thread.hpp
index f0822b3..016dab7 100755
--- a/include/SFML/System/Thread.hpp
+++ b/include/SFML/System/Thread.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/System/Vector2.hpp b/include/SFML/System/Vector2.hpp
new file mode 100755
index 0000000..f6a18ab
--- /dev/null
+++ b/include/SFML/System/Vector2.hpp
@@ -0,0 +1,215 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_VECTOR2_HPP
+#define SFML_VECTOR2_HPP
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Vector2 is an utility class for manipulating 2 dimensional
+/// vectors. Template parameter defines the type of coordinates
+/// (integer, float, ...)
+////////////////////////////////////////////////////////////
+template <typename T>
+class Vector2
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ Vector2();
+
+ ////////////////////////////////////////////////////////////
+ /// Construct the vector from its coordinates
+ ///
+ /// \param X : X coordinate
+ /// \param Y : Y coordinate
+ ///
+ ////////////////////////////////////////////////////////////
+ Vector2(T X, T Y);
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ T x; ///< X coordinate of the vector
+ T y; ///< Y coordinate of the vector
+};
+
+////////////////////////////////////////////////////////////
+/// Operator - overload ; returns the opposite of a vector
+///
+/// \param V : Vector to negate
+///
+/// \return -V
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T> operator -(const Vector2<T>& V);
+
+////////////////////////////////////////////////////////////
+/// Operator += overload ; add two vectors and assign to the first op
+///
+/// \param V1 : First vector
+/// \param V2 : Second vector
+///
+/// \return V1 + V2
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T>& operator +=(Vector2<T>& V1, const Vector2<T>& V2);
+
+////////////////////////////////////////////////////////////
+/// Operator -= overload ; subtract two vectors and assign to the first op
+///
+/// \param V1 : First vector
+/// \param V2 : Second vector
+///
+/// \return V1 - V2
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T>& operator -=(Vector2<T>& V1, const Vector2<T>& V2);
+
+////////////////////////////////////////////////////////////
+/// Operator + overload ; adds two vectors
+///
+/// \param V1 : First vector
+/// \param V2 : Second vector
+///
+/// \return V1 + V2
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T> operator +(const Vector2<T>& V1, const Vector2<T>& V2);
+
+////////////////////////////////////////////////////////////
+/// Operator - overload ; subtracts two vectors
+///
+/// \param V1 : First vector
+/// \param V2 : Second vector
+///
+/// \return V1 - V2
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T> operator -(const Vector2<T>& V1, const Vector2<T>& V2);
+
+////////////////////////////////////////////////////////////
+/// Operator * overload ; multiply a vector by a scalar value
+///
+/// \param V : Vector
+/// \param X : Scalar value
+///
+/// \return V * X
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T> operator *(const Vector2<T>& V, T X);
+
+////////////////////////////////////////////////////////////
+/// Operator * overload ; multiply a scalar value by a vector
+///
+/// \param X : Scalar value
+/// \param V : Vector
+///
+/// \return X * V
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T> operator *(T X, const Vector2<T>& V);
+
+////////////////////////////////////////////////////////////
+/// Operator *= overload ; multiply-assign a vector by a scalar value
+///
+/// \param V : Vector
+/// \param X : Scalar value
+///
+/// \return V * X
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T>& operator *=(Vector2<T>& V, T X);
+
+////////////////////////////////////////////////////////////
+/// Operator / overload ; divide a vector by a scalar value
+///
+/// \param V : Vector
+/// \param X : Scalar value
+///
+/// \return V / X
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T> operator /(const Vector2<T>& V, T X);
+
+////////////////////////////////////////////////////////////
+/// Operator /= overload ; divide-assign a vector by a scalar value
+///
+/// \param V : Vector
+/// \param X : Scalar value
+///
+/// \return V / X
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T>& operator /=(Vector2<T>& V, T X);
+
+////////////////////////////////////////////////////////////
+/// Operator == overload ; compares the equality of two vectors
+///
+/// \param V1 : First vector
+/// \param V2 : Second vector
+///
+/// \return True if V1 is equal to V2
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+bool operator ==(const Vector2<T>& V1, const Vector2<T>& V2);
+
+////////////////////////////////////////////////////////////
+/// Operator != overload ; compares the difference of two vectors
+///
+/// \param V1 : First vector
+/// \param V2 : Second vector
+///
+/// \return True if V1 is different than V2
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+bool operator !=(const Vector2<T>& V1, const Vector2<T>& V2);
+
+#include <SFML/System/Vector2.inl>
+
+// Define the most common types
+typedef Vector2<int> Vector2i;
+typedef Vector2<float> Vector2f;
+
+} // namespace sf
+
+
+#endif // SFML_VECTOR2_HPP
diff --git a/include/SFML/System/Vector2.inl b/include/SFML/System/Vector2.inl
new file mode 100755
index 0000000..05f686c
--- /dev/null
+++ b/include/SFML/System/Vector2.inl
@@ -0,0 +1,179 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////
+/// Default constructor
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T>::Vector2() :
+x(0),
+y(0)
+{
+
+}
+
+
+////////////////////////////////////////////////////////////
+/// Construct the color from its coordinates
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T>::Vector2(T X, T Y) :
+x(X),
+y(Y)
+{
+
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator - overload ; returns the opposite of a vector
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T> operator -(const Vector2<T>& V)
+{
+ return Vector2<T>(-V.x, -V.y);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator += overload ; add two vectors and assign to the first op
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T>& operator +=(Vector2<T>& V1, const Vector2<T>& V2)
+{
+ V1.x += V2.x;
+ V1.y += V2.y;
+
+ return V1;
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator -= overload ; subtract two vectors and assign to the first op
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T>& operator -=(Vector2<T>& V1, const Vector2<T>& V2)
+{
+ V1.x -= V2.x;
+ V1.y -= V2.y;
+
+ return V1;
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator + overload ; adds two vectors
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T> operator +(const Vector2<T>& V1, const Vector2<T>& V2)
+{
+ return Vector2<T>(V1.x + V2.x, V1.y + V2.y);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator - overload ; subtracts two vectors
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T> operator -(const Vector2<T>& V1, const Vector2<T>& V2)
+{
+ return Vector2<T>(V1.x - V2.x, V1.y - V2.y);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator * overload ; multiply a vector by a scalar value
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T> operator *(const Vector2<T>& V, T X)
+{
+ return Vector2<T>(V.x * X, V.y * X);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator * overload ; multiply a scalar value by a vector
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T> operator *(T X, const Vector2<T>& V)
+{
+ return Vector2<T>(V.x * X, V.y * X);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator *= overload ; multiply-assign a vector by a scalar value
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T>& operator *=(Vector2<T>& V, T X)
+{
+ V.x *= X;
+ V.y *= X;
+
+ return V;
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator / overload ; divide a vector by a scalar value
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T> operator /(const Vector2<T>& V, T X)
+{
+ return Vector2<T>(V.x / X, V.y / X);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator /= overload ; divide-assign a vector by a scalar value
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector2<T>& operator /=(Vector2<T>& V, T X)
+{
+ V.x /= X;
+ V.y /= X;
+
+ return V;
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator == overload ; compares the equality of two vectors
+////////////////////////////////////////////////////////////
+template <typename T>
+bool operator ==(const Vector2<T>& V1, const Vector2<T>& V2)
+{
+ return (V1.x == V2.x) && (V1.y == V2.y);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator != overload ; compares the difference of two vectors
+////////////////////////////////////////////////////////////
+template <typename T>
+bool operator !=(const Vector2<T>& V1, const Vector2<T>& V2)
+{
+ return (V1.x != V2.x) || (V1.y != V2.y);
+}
diff --git a/include/SFML/System/Vector3.hpp b/include/SFML/System/Vector3.hpp
new file mode 100755
index 0000000..0174c3f
--- /dev/null
+++ b/include/SFML/System/Vector3.hpp
@@ -0,0 +1,217 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_VECTOR3_HPP
+#define SFML_VECTOR3_HPP
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Vector3 is an utility class for manipulating 3 dimensional
+/// vectors. Template parameter defines the type of coordinates
+/// (integer, float, ...)
+////////////////////////////////////////////////////////////
+template <typename T>
+class Vector3
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ Vector3();
+
+ ////////////////////////////////////////////////////////////
+ /// Construct the vector from its coordinates
+ ///
+ /// \param X : X coordinate
+ /// \param Y : Y coordinate
+ /// \param Z : Z coordinate
+ ///
+ ////////////////////////////////////////////////////////////
+ Vector3(T X, T Y, T Z);
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ T x; ///< X coordinate of the vector
+ T y; ///< Y coordinate of the vector
+ T z; ///< Z coordinate of the vector
+};
+
+////////////////////////////////////////////////////////////
+/// Operator - overload ; returns the opposite of a vector
+///
+/// \param V : Vector to negate
+///
+/// \return -V
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T> operator -(const Vector3<T>& V);
+
+////////////////////////////////////////////////////////////
+/// Operator += overload ; add two vectors and assign to the first op
+///
+/// \param V1 : First vector
+/// \param V2 : Second vector
+///
+/// \return V1 + V2
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T>& operator +=(Vector3<T>& V1, const Vector3<T>& V2);
+
+////////////////////////////////////////////////////////////
+/// Operator -= overload ; subtract two vectors and assign to the first op
+///
+/// \param V1 : First vector
+/// \param V2 : Second vector
+///
+/// \return V1 - V2
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T>& operator -=(Vector3<T>& V1, const Vector3<T>& V2);
+
+////////////////////////////////////////////////////////////
+/// Operator + overload ; adds two vectors
+///
+/// \param V1 : First vector
+/// \param V2 : Second vector
+///
+/// \return V1 + V2
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T> operator +(const Vector3<T>& V1, const Vector3<T>& V2);
+
+////////////////////////////////////////////////////////////
+/// Operator - overload ; subtracts two vectors
+///
+/// \param V1 : First vector
+/// \param V2 : Second vector
+///
+/// \return V1 - V2
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T> operator -(const Vector3<T>& V1, const Vector3<T>& V2);
+
+////////////////////////////////////////////////////////////
+/// Operator * overload ; multiply a vector by a scalar value
+///
+/// \param V : Vector
+/// \param X : Scalar value
+///
+/// \return V * X
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T> operator *(const Vector3<T>& V, T X);
+
+////////////////////////////////////////////////////////////
+/// Operator * overload ; multiply a scalar value by a vector
+///
+/// \param X : Scalar value
+/// \param V : Vector
+///
+/// \return X * V
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T> operator *(T X, const Vector3<T>& V);
+
+////////////////////////////////////////////////////////////
+/// Operator *= overload ; multiply-assign a vector by a scalar value
+///
+/// \param V : Vector
+/// \param X : Scalar value
+///
+/// \return V * X
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T>& operator *=(Vector3<T>& V, T X);
+
+////////////////////////////////////////////////////////////
+/// Operator / overload ; divide a vector by a scalar value
+///
+/// \param V : Vector
+/// \param X : Scalar value
+///
+/// \return V / X
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T> operator /(const Vector3<T>& V, T X);
+
+////////////////////////////////////////////////////////////
+/// Operator /= overload ; divide-assign a vector by a scalar value
+///
+/// \param V : Vector
+/// \param X : Scalar value
+///
+/// \return V / X
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T>& operator /=(Vector3<T>& V, T X);
+
+////////////////////////////////////////////////////////////
+/// Operator == overload ; compares the equality of two vectors
+///
+/// \param V1 : First vector
+/// \param V2 : Second vector
+///
+/// \return True if V1 is equal to V2
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+bool operator ==(const Vector3<T>& V1, const Vector3<T>& V2);
+
+////////////////////////////////////////////////////////////
+/// Operator != overload ; compares the difference of two vectors
+///
+/// \param V1 : First vector
+/// \param V2 : Second vector
+///
+/// \return True if V1 is different than V2
+///
+////////////////////////////////////////////////////////////
+template <typename T>
+bool operator !=(const Vector3<T>& V1, const Vector3<T>& V2);
+
+#include <SFML/System/Vector3.inl>
+
+// Define the most common types
+typedef Vector3<int> Vector3i;
+typedef Vector3<float> Vector3f;
+
+} // namespace sf
+
+
+#endif // SFML_VECTOR3_HPP
diff --git a/include/SFML/System/Vector3.inl b/include/SFML/System/Vector3.inl
new file mode 100755
index 0000000..234a01c
--- /dev/null
+++ b/include/SFML/System/Vector3.inl
@@ -0,0 +1,185 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////
+/// Default constructor
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T>::Vector3() :
+x(0),
+y(0),
+z(0)
+{
+
+}
+
+
+////////////////////////////////////////////////////////////
+/// Construct the color from its coordinates
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T>::Vector3(T X, T Y, T Z) :
+x(X),
+y(Y),
+z(Z)
+{
+
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator - overload ; returns the opposite of a vector
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T> operator -(const Vector3<T>& V)
+{
+ return Vector3<T>(-V.x, -V.y, -V.z);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator += overload ; add two vectors and assign to the first op
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T>& operator +=(Vector3<T>& V1, const Vector3<T>& V2)
+{
+ V1.x += V2.x;
+ V1.y += V2.y;
+ V1.z += V2.z;
+
+ return V1;
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator -= overload ; subtract two vectors and assign to the first op
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T>& operator -=(Vector3<T>& V1, const Vector3<T>& V2)
+{
+ V1.x -= V2.x;
+ V1.y -= V2.y;
+ V1.z -= V2.z;
+
+ return V1;
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator + overload ; adds two vectors
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T> operator +(const Vector3<T>& V1, const Vector3<T>& V2)
+{
+ return Vector3<T>(V1.x + V2.x, V1.y + V2.y, V1.z + V2.z);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator - overload ; subtracts two vectors
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T> operator -(const Vector3<T>& V1, const Vector3<T>& V2)
+{
+ return Vector3<T>(V1.x - V2.x, V1.y - V2.y, V1.z - V2.z);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator * overload ; multiply a vector by a scalar value
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T> operator *(const Vector3<T>& V, T X)
+{
+ return Vector3<T>(V.x * X, V.y * X, V.z * X);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator * overload ; multiply a scalar value by a vector
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T> operator *(T X, const Vector3<T>& V)
+{
+ return Vector3<T>(V.x * X, V.y * X, V.z * X);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator *= overload ; multiply-assign a vector by a scalar value
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T>& operator *=(Vector3<T>& V, T X)
+{
+ V.x *= X;
+ V.y *= X;
+ V.z *= X;
+
+ return V;
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator / overload ; divide a vector by a scalar value
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T> operator /(const Vector3<T>& V, T X)
+{
+ return Vector3<T>(V.x / X, V.y / X, V.z / X);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator /= overload ; divide-assign a vector by a scalar value
+////////////////////////////////////////////////////////////
+template <typename T>
+Vector3<T>& operator /=(Vector3<T>& V, T X)
+{
+ V.x /= X;
+ V.y /= X;
+ V.z /= X;
+
+ return V;
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator == overload ; compares the equality of two vectors
+////////////////////////////////////////////////////////////
+template <typename T>
+bool operator ==(const Vector3<T>& V1, const Vector3<T>& V2)
+{
+ return (V1.x == V2.x) && (V1.y == V2.y) && (V1.z == V2.z);
+}
+
+
+////////////////////////////////////////////////////////////
+/// Operator != overload ; compares the difference of two vectors
+////////////////////////////////////////////////////////////
+template <typename T>
+bool operator !=(const Vector3<T>& V1, const Vector3<T>& V2)
+{
+ return (V1.x != V2.x) || (V1.y != V2.y) || (V1.z != V2.z);
+}
diff --git a/include/SFML/System/Win32/Mutex.hpp b/include/SFML/System/Win32/Mutex.hpp
index 005a8c7..6d84cc5 100755
--- a/include/SFML/System/Win32/Mutex.hpp
+++ b/include/SFML/System/Win32/Mutex.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/System/Win32/Thread.hpp b/include/SFML/System/Win32/Thread.hpp
index 6a3ca4b..c1a0ac9 100755
--- a/include/SFML/System/Win32/Thread.hpp
+++ b/include/SFML/System/Win32/Thread.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/Window.hpp b/include/SFML/Window.hpp
index 3f65f73..2b5ed49 100755
--- a/include/SFML/Window.hpp
+++ b/include/SFML/Window.hpp
@@ -32,12 +32,11 @@
#include <SFML/System.hpp>
#include <SFML/Window/Event.hpp>
#include <SFML/Window/Input.hpp>
-#include <SFML/Window/OpenGLCaps.hpp>
#include <SFML/Window/VideoMode.hpp>
#include <SFML/Window/Window.hpp>
#include <SFML/Window/WindowListener.hpp>
#include <SFML/Window/WindowStyle.hpp>
-#include <SFML/Window/glew/glew.h>
+#include <SFML/Window/OpenGL.hpp>
#endif // SFML_SFML_WINDOW_HPP
diff --git a/include/SFML/Window/Event.hpp b/include/SFML/Window/Event.hpp
index c75c745..2f03830 100755
--- a/include/SFML/Window/Event.hpp
+++ b/include/SFML/Window/Event.hpp
@@ -1,211 +1,309 @@
-////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-#ifndef SFML_EVENT_HPP
-#define SFML_EVENT_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <SFML/Config.hpp>
-
-
-namespace sf
-{
-////////////////////////////////////////////////////////////
-/// Definition of key codes for keyboard events
-////////////////////////////////////////////////////////////
-namespace Key
-{
- enum Code
- {
- 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',
- W = 'w', X = 'x', C = 'c', V = 'v', B = 'b', N = 'n',
- Num0 = '0', Num1 = '1', Num2 = '2', Num3 = '3', Num4 = '4',
- Num5 = '5', Num6 = '6', Num7 = '7', Num8 = '8', Num9 = '9',
- Escape = 256,
- Control, Shift, Alt,
- Space, Return, Back, Tab, PageUp, PageDown, End, Home, Insert, Delete, Add, Subtract, Multiply, Divide,
- Left, Right, Up, Down,
- Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Numpad7, Numpad8, Numpad9,
- F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15,
- Pause,
-
- Count // For internal use
- };
-}
-
-
-////////////////////////////////////////////////////////////
-/// Definition of button codes for mouse events
-////////////////////////////////////////////////////////////
-namespace Mouse
-{
- enum Button
- {
- Left,
- Right,
- 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
-////////////////////////////////////////////////////////////
-class Event
-{
-public :
-
- ////////////////////////////////////////////////////////////
- /// Enumeration of the different types of events
- ////////////////////////////////////////////////////////////
- enum EventType
- {
- Closed,
- Resized,
- LostFocus,
- GainedFocus,
- TextEntered,
- KeyPressed,
- KeyReleased,
- MouseWheelMoved,
- MouseButtonPressed,
- MouseButtonReleased,
- MouseMoved,
- JoyButtonPressed,
- JoyButtonReleased,
- JoyMoved
- };
-
- ////////////////////////////////////////////////////////////
- // Member data
- ////////////////////////////////////////////////////////////
- EventType Type; ///< Type of the event
-
- union
- {
- ////////////////////////////////////////////////////////////
- /// Text event parameters
- ////////////////////////////////////////////////////////////
- struct
- {
- Uint16 Unicode;
- } Text;
-
- ////////////////////////////////////////////////////////////
- /// Keyboard events parameters
- ////////////////////////////////////////////////////////////
- struct
- {
- Key::Code Code;
- bool Alt;
- bool Control;
- bool Shift;
- } Key;
-
- ////////////////////////////////////////////////////////////
- /// Mouse move event parameters
- ////////////////////////////////////////////////////////////
- struct
- {
- unsigned int X;
- unsigned int Y;
- } MouseMove;
-
- ////////////////////////////////////////////////////////////
- /// Mouse buttons events parameters
- ////////////////////////////////////////////////////////////
- struct
- {
- Mouse::Button Button;
- } MouseButton;
-
- ////////////////////////////////////////////////////////////
- /// Mouse wheel events parameters
- ////////////////////////////////////////////////////////////
- struct
- {
- int Delta;
- } MouseWheel;
-
- ////////////////////////////////////////////////////////////
- /// Joystick axis move event parameters
- ////////////////////////////////////////////////////////////
- struct
- {
- unsigned int JoystickId;
- Joy::Axis Axis;
- float Position;
- } JoyMove;
-
- ////////////////////////////////////////////////////////////
- /// Joystick buttons events parameters
- ////////////////////////////////////////////////////////////
- struct
- {
- unsigned int JoystickId;
- unsigned int Button;
- } JoyButton;
-
- ////////////////////////////////////////////////////////////
- /// Size events parameters
- ////////////////////////////////////////////////////////////
- struct
- {
- unsigned int Width;
- unsigned int Height;
- } Size;
- };
-};
-
-} // namespace sf
-
-
-#endif // SFML_EVENT_HPP
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_EVENT_HPP
+#define SFML_EVENT_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Definition of key codes for keyboard events
+////////////////////////////////////////////////////////////
+namespace Key
+{
+ enum Code
+ {
+ A = 'a',
+ B = 'b',
+ C = 'c',
+ D = 'd',
+ E = 'e',
+ F = 'f',
+ G = 'g',
+ H = 'h',
+ I = 'i',
+ J = 'j',
+ K = 'k',
+ L = 'l',
+ M = 'm',
+ N = 'n',
+ O = 'o',
+ P = 'p',
+ Q = 'q',
+ R = 'r',
+ S = 's',
+ T = 't',
+ U = 'u',
+ V = 'v',
+ W = 'w',
+ X = 'x',
+ Y = 'y',
+ Z = 'z',
+ Num0 = '0',
+ Num1 = '1',
+ Num2 = '2',
+ Num3 = '3',
+ Num4 = '4',
+ Num5 = '5',
+ Num6 = '6',
+ Num7 = '7',
+ Num8 = '8',
+ Num9 = '9',
+ Escape = 256,
+ LControl,
+ LShift,
+ LAlt,
+ LSystem, ///< OS specific key (left side) : windows (Win and Linux), apple (MacOS), ...
+ RControl,
+ RShift,
+ RAlt,
+ RSystem, ///< OS specific key (right side) : windows (Win and Linux), apple (MacOS), ...
+ Menu,
+ LBracket, ///< [
+ RBracket, ///< ]
+ SemiColon, ///< ;
+ Comma, ///< ,
+ Period, ///< .
+ Quote, ///< '
+ Slash, ///< /
+ BackSlash,
+ Tilde, ///< ~
+ Equal, ///< =
+ Dash, ///< -
+ Space,
+ Return,
+ Back,
+ Tab,
+ PageUp,
+ PageDown,
+ End,
+ Home,
+ Insert,
+ Delete,
+ Add, ///< +
+ Subtract, ///< -
+ Multiply, ///< *
+ Divide, ///< /
+ Left, ///< Left arrow
+ Right, ///< Right arrow
+ Up, ///< Up arrow
+ Down, ///< Down arrow
+ Numpad0,
+ Numpad1,
+ Numpad2,
+ Numpad3,
+ Numpad4,
+ Numpad5,
+ Numpad6,
+ Numpad7,
+ Numpad8,
+ Numpad9,
+ F1,
+ F2,
+ F3,
+ F4,
+ F5,
+ F6,
+ F7,
+ F8,
+ F9,
+ F10,
+ F11,
+ F12,
+ F13,
+ F14,
+ F15,
+ Pause,
+
+ Count // For internal use
+ };
+}
+
+
+////////////////////////////////////////////////////////////
+/// Definition of button codes for mouse events
+////////////////////////////////////////////////////////////
+namespace Mouse
+{
+ enum Button
+ {
+ Left,
+ Right,
+ 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
+////////////////////////////////////////////////////////////
+class Event
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Keyboard event parameters
+ ////////////////////////////////////////////////////////////
+ struct KeyEvent
+ {
+ Key::Code Code;
+ bool Alt;
+ bool Control;
+ bool Shift;
+ };
+
+ ////////////////////////////////////////////////////////////
+ /// Text event parameters
+ ////////////////////////////////////////////////////////////
+ struct TextEvent
+ {
+ Uint16 Unicode;
+ };
+
+ ////////////////////////////////////////////////////////////
+ /// Mouse move event parameters
+ ////////////////////////////////////////////////////////////
+ struct MouseMoveEvent
+ {
+ unsigned int X;
+ unsigned int Y;
+ };
+
+ ////////////////////////////////////////////////////////////
+ /// Mouse buttons events parameters
+ ////////////////////////////////////////////////////////////
+ struct MouseButtonEvent
+ {
+ Mouse::Button Button;
+ };
+
+ ////////////////////////////////////////////////////////////
+ /// Mouse wheel events parameters
+ ////////////////////////////////////////////////////////////
+ struct MouseWheelEvent
+ {
+ int Delta;
+ };
+
+ ////////////////////////////////////////////////////////////
+ /// Joystick axis move event parameters
+ ////////////////////////////////////////////////////////////
+ struct JoyMoveEvent
+ {
+ unsigned int JoystickId;
+ Joy::Axis Axis;
+ float Position;
+ };
+
+ ////////////////////////////////////////////////////////////
+ /// Joystick buttons events parameters
+ ////////////////////////////////////////////////////////////
+ struct JoyButtonEvent
+ {
+ unsigned int JoystickId;
+ unsigned int Button;
+ };
+
+ ////////////////////////////////////////////////////////////
+ /// Size events parameters
+ ////////////////////////////////////////////////////////////
+ struct SizeEvent
+ {
+ unsigned int Width;
+ unsigned int Height;
+ };
+
+ ////////////////////////////////////////////////////////////
+ /// Enumeration of the different types of events
+ ////////////////////////////////////////////////////////////
+ enum EventType
+ {
+ Closed,
+ Resized,
+ LostFocus,
+ GainedFocus,
+ TextEntered,
+ KeyPressed,
+ KeyReleased,
+ MouseWheelMoved,
+ MouseButtonPressed,
+ MouseButtonReleased,
+ MouseMoved,
+ JoyButtonPressed,
+ JoyButtonReleased,
+ JoyMoved
+ };
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ EventType Type; ///< Type of the event
+
+ union
+ {
+ KeyEvent Key;
+ TextEvent Text;
+ MouseMoveEvent MouseMove;
+ MouseButtonEvent MouseButton;
+ MouseWheelEvent MouseWheel;
+ JoyMoveEvent JoyMove;
+ JoyButtonEvent JoyButton;
+ SizeEvent Size;
+ };
+};
+
+} // namespace sf
+
+
+#endif // SFML_EVENT_HPP
diff --git a/include/SFML/Window/Input.hpp b/include/SFML/Window/Input.hpp
index 24b7f77..3cbdbc4 100755
--- a/include/SFML/Window/Input.hpp
+++ b/include/SFML/Window/Input.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/Window/Joystick.hpp b/include/SFML/Window/OpenGL.hpp
index a072011..56e2623 100755
--- a/include/SFML/Window/Joystick.hpp
+++ b/include/SFML/Window/OpenGL.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -22,47 +22,25 @@
//
////////////////////////////////////////////////////////////
-#ifndef SFML_JOYSTICK_HPP
-#define SFML_JOYSTICK_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <SFML/Config.hpp>
-#include <SFML/Window/Event.hpp>
+#ifndef SFML_OPENGL_HPP
+#define SFML_OPENGL_HPP
-namespace sf
-{
-namespace priv
-{
////////////////////////////////////////////////////////////
-/// Structure holding the joystick state's parameters
+/// This file just includes the OpenGL (GL and GLU) headers,
+/// which have actually different paths on each system
////////////////////////////////////////////////////////////
-struct JoystickState
-{
- float Axis[Joy::Count]; ///< Position on each axis in range [-100, 100] (except POV which is [0, 360])
- bool Buttons[16]; ///< Status of each button (true = pressed)
-};
-
-} // namespace priv
-
-} // namespace sf
-
-
-#if defined(SFML_SYSTEM_WINDOWS)
-
- #include <SFML/Window/Win32/Joystick.hpp>
-
-#elif defined(SFML_SYSTEM_LINUX)
+#if defined(SFML_SYSTEM_WINDOWS) || defined(SFML_SYSTEM_LINUX)
- #include <SFML/Window/Linux/Joystick.hpp>
+ #include <GL/gl.h>
+ #include <GL/glu.h>
#elif defined(SFML_SYSTEM_MACOS)
- #include <SFML/Window/OSX/Joystick.hpp>
+ #include <OpenGL/gl.h>
+ #include <OpenGL/glu.h>
#endif
-#endif // SFML_JOYSTICK_HPP
+#endif // SFML_OPENGL_HPP
diff --git a/include/SFML/Window/OpenGLCaps.hpp b/include/SFML/Window/OpenGLCaps.hpp
deleted file mode 100755
index d91bade..0000000
--- a/include/SFML/Window/OpenGLCaps.hpp
+++ /dev/null
@@ -1,90 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-#ifndef SFML_OPENGLCAPS_HPP
-#define SFML_OPENGLCAPS_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <SFML/Config.hpp>
-#include <string>
-
-
-namespace sf
-{
-namespace priv
-{
- class WindowImpl;
-}
-
-////////////////////////////////////////////////////////////
-/// Interface for requesting OpenGL extensions
-/// and capabilities
-////////////////////////////////////////////////////////////
-class SFML_API OpenGLCaps
-{
-public :
-
- ////////////////////////////////////////////////////////////
- /// Check whether or not an OpenGL extension is supported
- ///
- /// \param Name : String identifier of the extension to check
- ///
- /// \return True if the extension is supported
- ///
- ////////////////////////////////////////////////////////////
- static bool CheckExtension(const std::string& Name);
-
- ////////////////////////////////////////////////////////////
- /// Return the maximum texture size
- ///
- /// \return Maximum texture size, in pixels
- ///
- ////////////////////////////////////////////////////////////
- static int GetMaxTextureSize();
-
- ////////////////////////////////////////////////////////////
- /// Return the maximum number of texture units available
- ///
- /// \return Maximum number of texture units
- ///
- ////////////////////////////////////////////////////////////
- static int GetMaxTextureUnits();
-
-private :
-
- friend class priv::WindowImpl;
-
- ////////////////////////////////////////////////////////////
- /// Initialize the capabilities
- ///
- ////////////////////////////////////////////////////////////
- static void Initialize();
-};
-
-} // namespace sf
-
-
-#endif // SFML_OPENGLCAPS_HPP
diff --git a/include/SFML/Window/VideoMode.hpp b/include/SFML/Window/VideoMode.hpp
index af3c2aa..955f016 100755
--- a/include/SFML/Window/VideoMode.hpp
+++ b/include/SFML/Window/VideoMode.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/Window/Win32/Joystick.hpp b/include/SFML/Window/Win32/Joystick.hpp
deleted file mode 100755
index 962cc42..0000000
--- a/include/SFML/Window/Win32/Joystick.hpp
+++ /dev/null
@@ -1,91 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-#ifndef SFML_JOYSTICKWIN32_HPP
-#define SFML_JOYSTICKWIN32_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-
-
-namespace sf
-{
-namespace priv
-{
-////////////////////////////////////////////////////////////
-/// Win32 implementation of Joystick
-////////////////////////////////////////////////////////////
-class Joystick
-{
-public :
-
- ////////////////////////////////////////////////////////////
- /// Initialize the instance and bind it to a physical joystick
- ///
- /// \param Index : Index of the physical joystick to bind to
- ///
- ////////////////////////////////////////////////////////////
- void Initialize(unsigned int Index);
-
- ////////////////////////////////////////////////////////////
- /// Update the current joystick and return its new state
- ///
- /// \return Current state of the joystick
- ///
- ////////////////////////////////////////////////////////////
- JoystickState UpdateState();
-
- ////////////////////////////////////////////////////////////
- /// Get the number of axes supported by the joystick
- ///
- /// \return Number of axis
- ///
- ////////////////////////////////////////////////////////////
- unsigned int GetAxesCount() const;
-
- ////////////////////////////////////////////////////////////
- /// Get the number of buttons supported by the joystick
- ///
- /// \return Number of buttons
- ///
- ////////////////////////////////////////////////////////////
- unsigned int GetButtonsCount() const;
-
-private :
-
- ////////////////////////////////////////////////////////////
- // Member data
- ////////////////////////////////////////////////////////////
- unsigned int myIndex; ///< Windows ID of the joystick
- unsigned int myNbAxes; ///< Number of axis supported by the joystick
- unsigned int myNbButtons; ///< Number of buttons supported by the joystick
-};
-
-} // namespace priv
-
-} // namespace sf
-
-
-#endif // SFML_JOYSTICKWIN32_HPP
diff --git a/include/SFML/Window/Window.hpp b/include/SFML/Window/Window.hpp
index 5062044..57ca37f 100755
--- a/include/SFML/Window/Window.hpp
+++ b/include/SFML/Window/Window.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -28,15 +28,15 @@
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
-#include <SFML/Config.hpp>
-#include <SFML/System/NonCopyable.hpp>
#include <SFML/Window/Event.hpp>
#include <SFML/Window/Input.hpp>
#include <SFML/Window/VideoMode.hpp>
#include <SFML/Window/WindowHandle.hpp>
#include <SFML/Window/WindowListener.hpp>
+#include <SFML/Window/WindowSettings.hpp>
#include <SFML/Window/WindowStyle.hpp>
#include <SFML/System/Clock.hpp>
+#include <SFML/System/NonCopyable.hpp>
#include <queue>
#include <string>
@@ -65,22 +65,22 @@ public :
////////////////////////////////////////////////////////////
/// Construct a new window
///
- /// \param Mode : Video mode to use
- /// \param Title : Title of the window
- /// \param WindowStyle : Window style (Resize | Close by default)
- /// \param AntialiasingLevel : Level of antialiasing (0 by default, disabled)
+ /// \param Mode : Video mode to use
+ /// \param Title : Title of the window
+ /// \param WindowStyle : Window style (Resize | Close by default)
+ /// \param Params : Creation parameters (see default constructor for default values)
///
////////////////////////////////////////////////////////////
- Window(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, int AntialiasingLevel = 0);
+ Window(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const WindowSettings& Params = WindowSettings());
////////////////////////////////////////////////////////////
/// Construct the window from an existing control
///
- /// \param Handle : Platform-specific handle of the control
- /// \param AntialiasingLevel : Level of antialiasing (0 by default, disabled)
+ /// \param Handle : Platform-specific handle of the control
+ /// \param Params : Creation parameters (see default constructor for default values)
///
////////////////////////////////////////////////////////////
- Window(WindowHandle Handle, int AntialiasingLevel = 0);
+ Window(WindowHandle Handle, const WindowSettings& Params = WindowSettings());
////////////////////////////////////////////////////////////
/// Destructor
@@ -91,22 +91,40 @@ public :
////////////////////////////////////////////////////////////
/// Create (or recreate) the window
///
- /// \param Mode : Video mode to use
- /// \param Title : Title of the window
- /// \param WindowStyle : Window style (Resize | Close by default)
- /// \param AntialiasingLevel : Level of antialiasing (0 by default, disabled)
+ /// \param Mode : Video mode to use
+ /// \param Title : Title of the window
+ /// \param WindowStyle : Window style (Resize | Close by default)
+ /// \param Params : Creation parameters (see default constructor for default values)
///
////////////////////////////////////////////////////////////
- void Create(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, int AntialiasingLevel = 0);
+ void Create(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const WindowSettings& Params = WindowSettings());
////////////////////////////////////////////////////////////
/// Create (or recreate) the window from an existing control
///
- /// \param Handle : Platform-specific handle of the control
- /// \param AntialiasingLevel : Level of antialiasing (0 by default, disabled)
+ /// \param Handle : Platform-specific handle of the control
+ /// \param Params : Creation parameters (see default constructor for default values)
+ ///
+ ////////////////////////////////////////////////////////////
+ void Create(WindowHandle Handle, const WindowSettings& Params = WindowSettings());
+
+ ////////////////////////////////////////////////////////////
+ /// Close (destroy) the window.
+ /// The sf::Window instance remains valid and you can call
+ /// Create to recreate the window
+ ///
+ ////////////////////////////////////////////////////////////
+ void Close();
+
+ ////////////////////////////////////////////////////////////
+ /// Tell whether or not the window is opened (ie. has been created).
+ /// Note that a hidden window (Show(false))
+ /// will still return true
+ ///
+ /// \return True if the window is opened
///
////////////////////////////////////////////////////////////
- void Create(WindowHandle Handle, int AntialiasingLevel = 0);
+ bool IsOpened() const;
////////////////////////////////////////////////////////////
/// Get the width of the rendering region of the window
@@ -125,20 +143,12 @@ public :
unsigned int GetHeight() const;
////////////////////////////////////////////////////////////
- /// Get the depth buffer bits
+ /// Get the creation settings of the window
///
- /// \return Depth bits (can be 0 if there is no depth buffer)
+ /// \return Structure containing the creation settings
///
////////////////////////////////////////////////////////////
- unsigned int GetDepthBits() const;
-
- ////////////////////////////////////////////////////////////
- /// Get the stencil buffer bits
- ///
- /// \return Stencil bits (can be 0 if there is no stencil buffer)
- ///
- ////////////////////////////////////////////////////////////
- unsigned int GetStencilBits() const;
+ const WindowSettings& GetSettings() const;
////////////////////////////////////////////////////////////
/// Get the event on top of events stack, if any, and pop it
@@ -194,12 +204,24 @@ public :
void Show(bool State);
////////////////////////////////////////////////////////////
- /// Set the window as the current target for rendering
+ /// Enable or disable automatic key-repeat.
+ /// Automatic key-repeat is enabled by default
+ ///
+ /// \param Enabled : True to enable, false to disable
+ ///
+ ////////////////////////////////////////////////////////////
+ void EnableKeyRepeat(bool Enabled);
+
+ ////////////////////////////////////////////////////////////
+ /// Activate of deactivate the window as the current target
+ /// for rendering
+ ///
+ /// \param Active : True to activate, false to deactivate (true by default)
///
/// \return True if operation was successful, false otherwise
///
////////////////////////////////////////////////////////////
- bool SetCurrent() const;
+ bool SetActive(bool Active = true) const;
////////////////////////////////////////////////////////////
/// Display the window on screen
@@ -240,6 +262,13 @@ public :
////////////////////////////////////////////////////////////
void SetJoystickThreshold(float Threshold);
+ ////////////////////////////////////////////////////////////
+ /// Force a valid OpenGL context to exist even if
+ /// no window has been created
+ ///
+ ////////////////////////////////////////////////////////////
+ static void ForceContextInit();
+
private :
////////////////////////////////////////////////////////////
@@ -255,14 +284,6 @@ private :
virtual void OnDisplay();
////////////////////////////////////////////////////////////
- /// Called after an event has been received
- ///
- /// \param EventReceived : Event received
- ///
- ////////////////////////////////////////////////////////////
- virtual void OnEventReceived(const Event& EventReceived);
-
- ////////////////////////////////////////////////////////////
/// /see WindowListener::OnEvent
///
/// \param EventReceived : Event received
@@ -279,15 +300,23 @@ private :
void Initialize(priv::WindowImpl* Impl);
////////////////////////////////////////////////////////////
+ // Static member data
+ ////////////////////////////////////////////////////////////
+ static priv::WindowImpl* ourDummyWindow; ///< Dummy window used to ensure a valid OpenGL context is created
+
+ ////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
priv::WindowImpl* myWindow; ///< Platform-specific implementation of window
std::queue<Event> myEvents; ///< Queue of received events
Input myInput; ///< Input manager connected to window
Clock myClock; ///< Clock for measuring the elapsed time between frames
+ WindowSettings mySettings; ///< Creation settings of the window
float myLastFrameTime; ///< Time elapsed since last frame
bool myIsExternal; ///< Tell whether the window is internal or external (created by SFML or not)
unsigned int myFramerateLimit; ///< Current framerate limit
+ int mySetCursorPosX; ///< X coordinate passed to the last call to SetCursorPosition
+ int mySetCursorPosY; ///< Y coordinate passed to the last call to SetCursorPosition
};
} // namespace sf
diff --git a/include/SFML/Window/WindowHandle.hpp b/include/SFML/Window/WindowHandle.hpp
index 98e2f9d..356a798 100755
--- a/include/SFML/Window/WindowHandle.hpp
+++ b/include/SFML/Window/WindowHandle.hpp
@@ -1,60 +1,60 @@
-////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
-//
-// This software is provided 'as-is', without any express or implied warranty.
-// In no event will the authors be held liable for any damages arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it freely,
-// subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented;
-// you must not claim that you wrote the original software.
-// If you use this software in a product, an acknowledgment
-// in the product documentation would be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such,
-// and must not be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source distribution.
-//
-////////////////////////////////////////////////////////////
-
-#ifndef SFML_WINDOWHANDLE_HPP
-#define SFML_WINDOWHANDLE_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <SFML/Config.hpp>
-
-
-namespace sf
-{
-////////////////////////////////////////////////////////////
-/// Define a low-level window handle type, specific to
-/// each platform
-////////////////////////////////////////////////////////////
-#if defined(SFML_SYSTEM_WINDOWS)
-
- // Windows defines a void* handle (HWND)
- typedef void* WindowHandle;
-
-#elif defined(SFML_SYSTEM_LINUX)
-
- // Unix - X11 defines an unsigned integer handle (Window)
- typedef unsigned long WindowHandle;
-
-#elif defined(SFML_SYSTEM_MACOS)
-
- // OSX - A GrafPort struct defined as WindowRef
- typedef WindowRef WindowHandle;
-
-#endif
-
-} // namespace sf
-
-
-#endif // SFML_WINDOWHANDLE_HPP
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_WINDOWHANDLE_HPP
+#define SFML_WINDOWHANDLE_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Define a low-level window handle type, specific to
+/// each platform
+////////////////////////////////////////////////////////////
+#if defined(SFML_SYSTEM_WINDOWS)
+
+ // Windows defines a void* handle (HWND)
+ typedef void* WindowHandle;
+
+#elif defined(SFML_SYSTEM_LINUX)
+
+ // Unix - X11 defines an unsigned integer handle (Window)
+ typedef unsigned long WindowHandle;
+
+#elif defined(SFML_SYSTEM_MACOS)
+
+ // OSX - A GrafPort struct defined as WindowRef
+ typedef void* WindowHandle;
+
+#endif
+
+} // namespace sf
+
+
+#endif // SFML_WINDOWHANDLE_HPP
diff --git a/include/SFML/Window/WindowListener.hpp b/include/SFML/Window/WindowListener.hpp
index 8672145..244f6fe 100755
--- a/include/SFML/Window/WindowListener.hpp
+++ b/include/SFML/Window/WindowListener.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
diff --git a/include/SFML/Window/WindowSettings.hpp b/include/SFML/Window/WindowSettings.hpp
new file mode 100755
index 0000000..05e8962
--- /dev/null
+++ b/include/SFML/Window/WindowSettings.hpp
@@ -0,0 +1,62 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
+//
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors be held liable for any damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it freely,
+// subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented;
+// you must not claim that you wrote the original software.
+// If you use this software in a product, an acknowledgment
+// in the product documentation would be appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such,
+// and must not be misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+////////////////////////////////////////////////////////////
+
+#ifndef SFML_WINDOWSETTINGS_HPP
+#define SFML_WINDOWSETTINGS_HPP
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Structure defining the creation settings of windows
+////////////////////////////////////////////////////////////
+struct WindowSettings
+{
+ ////////////////////////////////////////////////////////////
+ /// Default constructor
+ ///
+ /// \param Depth : Depth buffer bits (24 by default)
+ /// \param Stencil : Stencil buffer bits (8 by default)
+ /// \param Antialiasing : Antialiasing level (0 by default)
+ ///
+ ////////////////////////////////////////////////////////////
+ explicit WindowSettings(unsigned int Depth = 24, unsigned int Stencil = 8, unsigned int Antialiasing = 0) :
+ DepthBits (Depth),
+ StencilBits (Stencil),
+ AntialiasingLevel(Antialiasing)
+ {
+ }
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ unsigned int DepthBits; ///< Bits of the depth buffer
+ unsigned int StencilBits; ///< Bits of the stencil buffer
+ unsigned int AntialiasingLevel; ///< Level of antialiasing
+};
+
+} // namespace sf
+
+
+#endif // SFML_WINDOWSETTINGS_HPP
diff --git a/include/SFML/Window/WindowStyle.hpp b/include/SFML/Window/WindowStyle.hpp
index bbfd4d8..159b999 100755
--- a/include/SFML/Window/WindowStyle.hpp
+++ b/include/SFML/Window/WindowStyle.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -36,10 +36,11 @@ namespace Style
{
enum
{
- NoStyle = 0, ///< No style (this flag and all others are mutually exclusive)
- Resize = 1 << 0, ///< Window can be resized
- Close = 1 << 1, ///< Window can be closed
- Fullscreen = 1 << 2 ///< Fullscreen mode (this flag and all others are mutually exclusive)
+ None = 0, ///< No border / title bar (this flag and all others are mutually exclusive)
+ Titlebar = 1 << 0, ///< Title bar + fixed border
+ Resize = 1 << 1, ///< Titlebar + resizable border + maximize button
+ Close = 1 << 2, ///< Titlebar + close button
+ Fullscreen = 1 << 3 ///< Fullscreen mode (this flag and all others are mutually exclusive)
};
}