diff options
Diffstat (limited to 'include/SFML/Window')
23 files changed, 1863 insertions, 30 deletions
diff --git a/include/SFML/Window/.svn/all-wcprops b/include/SFML/Window/.svn/all-wcprops new file mode 100644 index 0000000..3acb4eb --- /dev/null +++ b/include/SFML/Window/.svn/all-wcprops @@ -0,0 +1,65 @@ +K 25 +svn:wc:ra_dav:version-url +V 46 +/svnroot/sfml/!svn/ver/901/include/SFML/Window +END +VideoMode.hpp +K 25 +svn:wc:ra_dav:version-url +V 60 +/svnroot/sfml/!svn/ver/434/include/SFML/Window/VideoMode.hpp +END +WindowListener.hpp +K 25 +svn:wc:ra_dav:version-url +V 65 +/svnroot/sfml/!svn/ver/434/include/SFML/Window/WindowListener.hpp +END +Input.hpp +K 25 +svn:wc:ra_dav:version-url +V 56 +/svnroot/sfml/!svn/ver/824/include/SFML/Window/Input.hpp +END +Event.hpp +K 25 +svn:wc:ra_dav:version-url +V 56 +/svnroot/sfml/!svn/ver/812/include/SFML/Window/Event.hpp +END +WindowHandle.hpp +K 25 +svn:wc:ra_dav:version-url +V 63 +/svnroot/sfml/!svn/ver/520/include/SFML/Window/WindowHandle.hpp +END +Context.hpp +K 25 +svn:wc:ra_dav:version-url +V 58 +/svnroot/sfml/!svn/ver/901/include/SFML/Window/Context.hpp +END +OpenGL.hpp +K 25 +svn:wc:ra_dav:version-url +V 57 +/svnroot/sfml/!svn/ver/652/include/SFML/Window/OpenGL.hpp +END +Window.hpp +K 25 +svn:wc:ra_dav:version-url +V 57 +/svnroot/sfml/!svn/ver/859/include/SFML/Window/Window.hpp +END +WindowSettings.hpp +K 25 +svn:wc:ra_dav:version-url +V 65 +/svnroot/sfml/!svn/ver/679/include/SFML/Window/WindowSettings.hpp +END +WindowStyle.hpp +K 25 +svn:wc:ra_dav:version-url +V 62 +/svnroot/sfml/!svn/ver/496/include/SFML/Window/WindowStyle.hpp +END diff --git a/include/SFML/Window/.svn/entries b/include/SFML/Window/.svn/entries new file mode 100644 index 0000000..b0dc51b --- /dev/null +++ b/include/SFML/Window/.svn/entries @@ -0,0 +1,368 @@ +9 + +dir +915 +https://sfml.svn.sourceforge.net/svnroot/sfml/include/SFML/Window +https://sfml.svn.sourceforge.net/svnroot/sfml + + + +2008-10-09T19:07:22.925297Z +901 +laurentgom + + +svn:special svn:externals svn:needs-lock + + + + + + + + + + + +4e206d99-4929-0410-ac5d-dfc041789085 + +VideoMode.hpp +file + + + + +2008-11-01T16:23:32.000000Z +b0019e248f50535875c76844f886916d +2008-01-23T16:10:18.126022Z +434 +laurentgom + + + + + + + + + + + + + + + + + + + + + +5118 + +WindowListener.hpp +file + + + + +2008-11-01T16:23:32.000000Z +d4ed84c715ce4fe981e3ee12cedac4cc +2008-01-23T16:10:18.126022Z +434 +laurentgom + + + + + + + + + + + + + + + + + + + + + +2269 + +Input.hpp +file + + + + +2008-11-01T16:23:32.000000Z +306eb9e6dc1e3292de913563b74408f1 +2008-08-24T15:29:46.762411Z +824 +laurentgom + + + + + + + + + + + + + + + + + + + + + +5177 + +Event.hpp +file + + + + +2008-11-01T16:23:32.000000Z +9e826ebb4f3a271ac1fc6d651914713a +2008-08-20T15:23:28.983027Z +812 +laurentgom + + + + + + + + + + + + + + + + + + + + + +7762 + +WindowHandle.hpp +file + + + + +2008-11-01T16:23:32.000000Z +a958ed58ba6f9c539ddfbf9f4b69b6dc +2008-03-19T16:02:24.006249Z +520 +ceylo + + + + + + + + + + + + + + + + + + + + + +1965 + +Context.hpp +file + + + + +2008-11-01T16:23:32.000000Z +7d006fa7f23517eca9859e356fb95463 +2008-10-09T19:07:22.925297Z +901 +laurentgom + + + + + + + + + + + + + + + + + + + + + +3470 + +OpenGL.hpp +file + + + + +2008-11-01T16:23:32.000000Z +b77a7ea1e483207bff244543bcac0a08 +2008-05-15T16:49:04.685797Z +652 +laurentgom + + + + + + + + + + + + + + + + + + + + + +1678 + +Window.hpp +file + + + + +2008-11-01T16:23:32.000000Z +498001836062a7b1f066c227c34c31b9 +2008-09-07T16:48:20.213384Z +859 +laurentgom + + + + + + + + + + + + + + + + + + + + + +13158 + +WindowSettings.hpp +file + + + + +2008-11-01T16:23:32.000000Z +6995a70ea0d94e9989bb34727d78f019 +2008-05-19T09:21:14.650459Z +679 +laurentgom + + + + + + + + + + + + + + + + + + + + + +2446 + +WindowStyle.hpp +file + + + + +2008-11-01T16:23:32.000000Z +965012553527b7664de9894d86a12124 +2008-03-14T11:17:36.597700Z +496 +laurentgom + + + + + + + + + + + + + + + + + + + + + +1896 + diff --git a/include/SFML/Window/.svn/format b/include/SFML/Window/.svn/format new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/include/SFML/Window/.svn/format @@ -0,0 +1 @@ +9 diff --git a/include/SFML/Window/.svn/text-base/Context.hpp.svn-base b/include/SFML/Window/.svn/text-base/Context.hpp.svn-base new file mode 100644 index 0000000..2335afb --- /dev/null +++ b/include/SFML/Window/.svn/text-base/Context.hpp.svn-base @@ -0,0 +1,100 @@ +////////////////////////////////////////////////////////////
+//
+// 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_CONTEXT_HPP
+#define SFML_CONTEXT_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+#include <SFML/System/NonCopyable.hpp>
+
+
+namespace sf
+{
+namespace priv
+{
+ class WindowImpl;
+}
+
+////////////////////////////////////////////////////////////
+/// Class wrapping an OpenGL context.
+/// All SFML windows already have their own context, so
+/// this class is more a helper for specific issues involving
+/// OpenGL and multi-threading.
+/// It's meant to be used internally.
+////////////////////////////////////////////////////////////
+class SFML_API Context : NonCopyable
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor, create the context
+ ///
+ ////////////////////////////////////////////////////////////
+ Context();
+
+ ////////////////////////////////////////////////////////////
+ /// Destructor, destroy the context
+ ///
+ ////////////////////////////////////////////////////////////
+ ~Context();
+
+ ////////////////////////////////////////////////////////////
+ /// Activate or deactivate the context
+ ///
+ /// \param Active : True to activate the context, false to deactivate it
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetActive(bool Active);
+
+ ////////////////////////////////////////////////////////////
+ /// Check if there's a context bound to the current thread
+ ///
+ /// \return True if there's a context bound to the current thread
+ ///
+ ////////////////////////////////////////////////////////////
+ static bool IsContextActive();
+
+ ////////////////////////////////////////////////////////////
+ /// Get the global context
+ ///
+ /// \return Reference to the global context
+ ///
+ ////////////////////////////////////////////////////////////
+ static Context& GetGlobal();
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ priv::WindowImpl* myDummyWindow; ///< Dummy window holding the context
+};
+
+} // namespace sf
+
+
+#endif // SFML_CONTEXT_HPP
diff --git a/include/SFML/Window/.svn/text-base/Event.hpp.svn-base b/include/SFML/Window/.svn/text-base/Event.hpp.svn-base new file mode 100644 index 0000000..dd9814e --- /dev/null +++ b/include/SFML/Window/.svn/text-base/Event.hpp.svn-base @@ -0,0 +1,313 @@ +//////////////////////////////////////////////////////////// +// +// 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 + { + Uint32 Unicode; + }; + + //////////////////////////////////////////////////////////// + /// Mouse move event parameters + //////////////////////////////////////////////////////////// + struct MouseMoveEvent + { + int X; + int Y; + }; + + //////////////////////////////////////////////////////////// + /// Mouse buttons events parameters + //////////////////////////////////////////////////////////// + struct MouseButtonEvent + { + Mouse::Button Button; + int X; + int Y; + }; + + //////////////////////////////////////////////////////////// + /// 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, + MouseEntered, + MouseLeft, + 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/.svn/text-base/Input.hpp.svn-base b/include/SFML/Window/.svn/text-base/Input.hpp.svn-base new file mode 100644 index 0000000..4156db2 --- /dev/null +++ b/include/SFML/Window/.svn/text-base/Input.hpp.svn-base @@ -0,0 +1,134 @@ +////////////////////////////////////////////////////////////
+//
+// 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_INPUT_HPP
+#define SFML_INPUT_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+#include <SFML/System/NonCopyable.hpp>
+#include <SFML/Window/Event.hpp>
+#include <SFML/Window/WindowListener.hpp>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// Input handles real-time input from keyboard and mouse.
+/// Use it instead of events to handle continuous moves and more
+/// game-friendly inputs
+////////////////////////////////////////////////////////////
+class SFML_API Input : public WindowListener, NonCopyable
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ Input();
+
+ ////////////////////////////////////////////////////////////
+ /// Get the state of a key
+ ///
+ /// \param KeyCode : Key to check
+ ///
+ /// \return True if key is down, false if key is up
+ ///
+ ////////////////////////////////////////////////////////////
+ bool IsKeyDown(Key::Code KeyCode) const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get the state of a mouse button
+ ///
+ /// \param Button : Button to check
+ ///
+ /// \return True if button is down, false if button is up
+ ///
+ ////////////////////////////////////////////////////////////
+ bool IsMouseButtonDown(Mouse::Button Button) const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get the state of a joystick button
+ ///
+ /// \param JoyId : Identifier of the joystick to check (0 or 1)
+ /// \param Button : Button to check
+ ///
+ /// \return True if button is down, false if button is up
+ ///
+ ////////////////////////////////////////////////////////////
+ bool IsJoystickButtonDown(unsigned int JoyId, unsigned int Button) const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get the mouse X position
+ ///
+ /// \return Current mouse left position, relative to owner window
+ ///
+ ////////////////////////////////////////////////////////////
+ int GetMouseX() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get the mouse Y position
+ ///
+ /// \return Current mouse top position, relative to owner window
+ ///
+ ////////////////////////////////////////////////////////////
+ int GetMouseY() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get a joystick axis position
+ ///
+ /// \param JoyId : Identifier of the joystick to check (0 or 1)
+ /// \param Axis : Axis to get
+ ///
+ /// \return Current axis position, in the range [-100, 100] (except for POV, which is [0, 360])
+ ///
+ ////////////////////////////////////////////////////////////
+ float GetJoystickAxis(unsigned int JoyId, Joy::Axis Axis) const;
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ /// /see WindowListener::OnEvent
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual void OnEvent(const Event& EventReceived);
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ bool myKeys[Key::Count]; ///< Array containing the state of all keyboard keys
+ bool myMouseButtons[Mouse::Count]; ///< Array containing the state of all mouse buttons
+ bool myJoystickButtons[2][16]; ///< Array containing the state of all joysticks buttons
+ int myMouseX; ///< Mouse position on X
+ int myMouseY; ///< Mouse position on Y
+ float myJoystickAxis[2][Joy::Count]; ///< Joysticks position on each axis
+};
+
+} // namespace sf
+
+
+#endif // SFML_INPUT_HPP
diff --git a/include/SFML/Window/.svn/text-base/OpenGL.hpp.svn-base b/include/SFML/Window/.svn/text-base/OpenGL.hpp.svn-base new file mode 100644 index 0000000..56e2623 --- /dev/null +++ b/include/SFML/Window/.svn/text-base/OpenGL.hpp.svn-base @@ -0,0 +1,46 @@ +////////////////////////////////////////////////////////////
+//
+// 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_OPENGL_HPP
+#define SFML_OPENGL_HPP
+
+
+////////////////////////////////////////////////////////////
+/// This file just includes the OpenGL (GL and GLU) headers,
+/// which have actually different paths on each system
+////////////////////////////////////////////////////////////
+#if defined(SFML_SYSTEM_WINDOWS) || defined(SFML_SYSTEM_LINUX)
+
+ #include <GL/gl.h>
+ #include <GL/glu.h>
+
+#elif defined(SFML_SYSTEM_MACOS)
+
+ #include <OpenGL/gl.h>
+ #include <OpenGL/glu.h>
+
+#endif
+
+
+#endif // SFML_OPENGL_HPP
diff --git a/include/SFML/Window/.svn/text-base/VideoMode.hpp.svn-base b/include/SFML/Window/.svn/text-base/VideoMode.hpp.svn-base new file mode 100644 index 0000000..955f016 --- /dev/null +++ b/include/SFML/Window/.svn/text-base/VideoMode.hpp.svn-base @@ -0,0 +1,136 @@ +////////////////////////////////////////////////////////////
+//
+// 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_VIDEOMODE_HPP
+#define SFML_VIDEOMODE_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+#include <cstdlib>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// VideoMode defines a video mode (width, height, bpp, frequency)
+/// and provides static functions for getting modes supported
+/// by the display device
+////////////////////////////////////////////////////////////
+class SFML_API VideoMode
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ VideoMode();
+
+ ////////////////////////////////////////////////////////////
+ /// Construct the video mode with its attributes
+ ///
+ /// \param ModeWidth : Width in pixels
+ /// \param ModeHeight : Height in pixels
+ /// \param ModeBpp : Pixel depths in bits per pixel (32 by default)
+ ///
+ ////////////////////////////////////////////////////////////
+ VideoMode(unsigned int ModeWidth, unsigned int ModeHeight, unsigned int ModeBpp = 32);
+
+ ////////////////////////////////////////////////////////////
+ /// Get the current desktop video mode
+ ///
+ /// \return Current desktop video mode
+ ///
+ ////////////////////////////////////////////////////////////
+ static VideoMode GetDesktopMode();
+
+ ////////////////////////////////////////////////////////////
+ /// Get a valid video mode
+ /// Index must be in range [0, GetModesCount()[
+ /// Modes are sorted from best to worst
+ ///
+ /// \param Index : Index of video mode to get
+ ///
+ /// \return Corresponding video mode (invalid mode if index is out of range)
+ ///
+ ////////////////////////////////////////////////////////////
+ static VideoMode GetMode(std::size_t Index);
+
+ ////////////////////////////////////////////////////////////
+ /// Get valid video modes count
+ ///
+ /// \return Number of valid video modes available
+ ///
+ ////////////////////////////////////////////////////////////
+ static std::size_t GetModesCount();
+
+ ////////////////////////////////////////////////////////////
+ /// Tell whether or not the video mode is supported
+ ///
+ /// \return True if video mode is supported, false otherwise
+ ///
+ ////////////////////////////////////////////////////////////
+ bool IsValid() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Comparison operator overload -- tell if two video modes are equal
+ ///
+ /// \param Other : Video mode to compare
+ ///
+ /// \return True if modes are equal
+ ///
+ ////////////////////////////////////////////////////////////
+ bool operator ==(const VideoMode& Other) const;
+
+ ////////////////////////////////////////////////////////////
+ /// Comparison operator overload -- tell if two video modes are different
+ ///
+ /// \param Other : Video mode to compare
+ ///
+ /// \return True if modes are different
+ ///
+ ////////////////////////////////////////////////////////////
+ bool operator !=(const VideoMode& Other) const;
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ unsigned int Width; ///< Video mode width, in pixels
+ unsigned int Height; ///< Video mode height, in pixels
+ unsigned int BitsPerPixel; ///< Video mode pixel depth, in bits per pixels
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ /// Get and sort valid video modes
+ ////////////////////////////////////////////////////////////
+ static void InitializeModes();
+};
+
+} // namespace sf
+
+
+#endif // SFML_VIDEOMODE_HPP
diff --git a/include/SFML/Window/.svn/text-base/Window.hpp.svn-base b/include/SFML/Window/.svn/text-base/Window.hpp.svn-base new file mode 100644 index 0000000..1506b3f --- /dev/null +++ b/include/SFML/Window/.svn/text-base/Window.hpp.svn-base @@ -0,0 +1,326 @@ +////////////////////////////////////////////////////////////
+//
+// 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_WINDOW_HPP
+#define SFML_WINDOW_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#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>
+
+
+namespace sf
+{
+namespace priv
+{
+ class WindowImpl;
+}
+
+////////////////////////////////////////////////////////////
+/// Window is a rendering window ; it can create a new window
+/// or connect to an existing one
+////////////////////////////////////////////////////////////
+class SFML_API Window : public WindowListener, NonCopyable
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ Window();
+
+ ////////////////////////////////////////////////////////////
+ /// 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 Params : Creation parameters (see default constructor for default values)
+ ///
+ ////////////////////////////////////////////////////////////
+ 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 Params : Creation parameters (see default constructor for default values)
+ ///
+ ////////////////////////////////////////////////////////////
+ Window(WindowHandle Handle, const WindowSettings& Params = WindowSettings());
+
+ ////////////////////////////////////////////////////////////
+ /// Destructor
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual ~Window();
+
+ ////////////////////////////////////////////////////////////
+ /// 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 Params : Creation parameters (see default constructor for default values)
+ ///
+ ////////////////////////////////////////////////////////////
+ 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 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
+ ///
+ ////////////////////////////////////////////////////////////
+ bool IsOpened() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get the width of the rendering region of the window
+ ///
+ /// \return Width in pixels
+ ///
+ ////////////////////////////////////////////////////////////
+ unsigned int GetWidth() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get the height of the rendering region of the window
+ ///
+ /// \return Height in pixels
+ ///
+ ////////////////////////////////////////////////////////////
+ unsigned int GetHeight() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get the creation settings of the window
+ ///
+ /// \return Structure containing the creation settings
+ ///
+ ////////////////////////////////////////////////////////////
+ const WindowSettings& GetSettings() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Get the event on top of events stack, if any, and pop it
+ ///
+ /// \param EventReceived : Event to fill, if any
+ ///
+ /// \return True if an event was returned, false if events stack was empty
+ ///
+ ////////////////////////////////////////////////////////////
+ bool GetEvent(Event& EventReceived);
+
+ ////////////////////////////////////////////////////////////
+ /// Enable / disable vertical synchronization
+ ///
+ /// \param Enabled : True to enable v-sync, false to deactivate
+ ///
+ ////////////////////////////////////////////////////////////
+ void UseVerticalSync(bool Enabled);
+
+ ////////////////////////////////////////////////////////////
+ /// Show or hide the mouse cursor
+ ///
+ /// \param Show : True to show, false to hide
+ ///
+ ////////////////////////////////////////////////////////////
+ void ShowMouseCursor(bool Show);
+
+ ////////////////////////////////////////////////////////////
+ /// Change the position of the mouse cursor
+ ///
+ /// \param Left : Left coordinate of the cursor, relative to the window
+ /// \param Top : Top coordinate of the cursor, relative to the window
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetCursorPosition(unsigned int Left, unsigned int Top);
+
+ ////////////////////////////////////////////////////////////
+ /// Change the position of the window on screen.
+ /// Only works for top-level windows
+ ///
+ /// \param Left : Left position
+ /// \param Top : Top position
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetPosition(int Left, int Top);
+
+ ////////////////////////////////////////////////////////////
+ /// Change the size of the rendering region of the window
+ ///
+ /// \param Width : New width
+ /// \param Height : New height
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetSize(unsigned int Width, unsigned int Height);
+
+ ////////////////////////////////////////////////////////////
+ /// Show or hide the window
+ ///
+ /// \param State : True to show, false to hide
+ ///
+ ////////////////////////////////////////////////////////////
+ void Show(bool State);
+
+ ////////////////////////////////////////////////////////////
+ /// 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);
+
+ ////////////////////////////////////////////////////////////
+ /// Change the window's icon
+ ///
+ /// \param Width : Icon's width, in pixels
+ /// \param Height : Icon's height, in pixels
+ /// \param Pixels : Pointer to the pixels in memory, format must be RGBA 32 bits
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels);
+
+ ////////////////////////////////////////////////////////////
+ /// 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 SetActive(bool Active = true) const;
+
+ ////////////////////////////////////////////////////////////
+ /// Display the window on screen
+ ///
+ ////////////////////////////////////////////////////////////
+ void Display();
+
+ ////////////////////////////////////////////////////////////
+ /// Get the input manager of the window
+ ///
+ /// \return Reference to the input
+ ///
+ ////////////////////////////////////////////////////////////
+ const Input& GetInput() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Limit the framerate to a maximum fixed frequency
+ ///
+ /// \param Limit : Framerate limit, in frames per seconds (use 0 to disable limit)
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetFramerateLimit(unsigned int Limit);
+
+ ////////////////////////////////////////////////////////////
+ /// Get time elapsed since last frame
+ ///
+ /// \return Time elapsed, in seconds
+ ///
+ ////////////////////////////////////////////////////////////
+ float GetFrameTime() const;
+
+ ////////////////////////////////////////////////////////////
+ /// Change the joystick threshold, ie. the value below which
+ /// no move event will be generated
+ ///
+ /// \param Threshold : New threshold, in range [0, 100]
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetJoystickThreshold(float Threshold);
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ /// Called after the window has been created
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual void OnCreate();
+
+ ////////////////////////////////////////////////////////////
+ /// /see WindowListener::OnEvent
+ ///
+ /// \param EventReceived : Event received
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual void OnEvent(const Event& EventReceived);
+
+ ////////////////////////////////////////////////////////////
+ /// Initialize internal window
+ ///
+ /// \param Impl : New internal window implementation
+ ///
+ ////////////////////////////////////////////////////////////
+ void Initialize(priv::WindowImpl* Impl);
+
+ ////////////////////////////////////////////////////////////
+ // 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
+
+
+#endif // SFML_WINDOW_HPP
diff --git a/include/SFML/Window/.svn/text-base/WindowHandle.hpp.svn-base b/include/SFML/Window/.svn/text-base/WindowHandle.hpp.svn-base new file mode 100644 index 0000000..356a798 --- /dev/null +++ b/include/SFML/Window/.svn/text-base/WindowHandle.hpp.svn-base @@ -0,0 +1,60 @@ +//////////////////////////////////////////////////////////// +// +// 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/.svn/text-base/WindowListener.hpp.svn-base b/include/SFML/Window/.svn/text-base/WindowListener.hpp.svn-base new file mode 100644 index 0000000..244f6fe --- /dev/null +++ b/include/SFML/Window/.svn/text-base/WindowListener.hpp.svn-base @@ -0,0 +1,66 @@ +////////////////////////////////////////////////////////////
+//
+// 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_WINDOWLISTENER_HPP
+#define SFML_WINDOWLISTENER_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+
+
+namespace sf
+{
+class Event;
+
+////////////////////////////////////////////////////////////
+/// Base class for classes that want to receive events
+/// from a window (for internal use only)
+////////////////////////////////////////////////////////////
+class SFML_API WindowListener
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Called each time an event is received from attached window
+ ///
+ /// \param EventReceived : Event received
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual void OnEvent(const Event& EventReceived) = 0;
+
+protected :
+
+ ////////////////////////////////////////////////////////////
+ /// Destructor
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual ~WindowListener() {}
+};
+
+} // namespace sf
+
+
+#endif // SFML_WINDOWLISTENER_HPP
diff --git a/include/SFML/Window/.svn/text-base/WindowSettings.hpp.svn-base b/include/SFML/Window/.svn/text-base/WindowSettings.hpp.svn-base new file mode 100644 index 0000000..05e8962 --- /dev/null +++ b/include/SFML/Window/.svn/text-base/WindowSettings.hpp.svn-base @@ -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/.svn/text-base/WindowStyle.hpp.svn-base b/include/SFML/Window/.svn/text-base/WindowStyle.hpp.svn-base new file mode 100644 index 0000000..159b999 --- /dev/null +++ b/include/SFML/Window/.svn/text-base/WindowStyle.hpp.svn-base @@ -0,0 +1,51 @@ +////////////////////////////////////////////////////////////
+//
+// 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_WINDOWSTYLE_HPP
+#define SFML_WINDOWSTYLE_HPP
+
+
+namespace sf
+{
+
+////////////////////////////////////////////////////////////
+/// Enumeration of window creation styles
+////////////////////////////////////////////////////////////
+namespace Style
+{
+ enum
+ {
+ 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)
+ };
+}
+
+
+} // namespace sf
+
+
+#endif // SFML_WINDOWSTYLE_HPP
diff --git a/include/SFML/Window/Context.hpp b/include/SFML/Window/Context.hpp new file mode 100644 index 0000000..2335afb --- /dev/null +++ b/include/SFML/Window/Context.hpp @@ -0,0 +1,100 @@ +////////////////////////////////////////////////////////////
+//
+// 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_CONTEXT_HPP
+#define SFML_CONTEXT_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+#include <SFML/System/NonCopyable.hpp>
+
+
+namespace sf
+{
+namespace priv
+{
+ class WindowImpl;
+}
+
+////////////////////////////////////////////////////////////
+/// Class wrapping an OpenGL context.
+/// All SFML windows already have their own context, so
+/// this class is more a helper for specific issues involving
+/// OpenGL and multi-threading.
+/// It's meant to be used internally.
+////////////////////////////////////////////////////////////
+class SFML_API Context : NonCopyable
+{
+public :
+
+ ////////////////////////////////////////////////////////////
+ /// Default constructor, create the context
+ ///
+ ////////////////////////////////////////////////////////////
+ Context();
+
+ ////////////////////////////////////////////////////////////
+ /// Destructor, destroy the context
+ ///
+ ////////////////////////////////////////////////////////////
+ ~Context();
+
+ ////////////////////////////////////////////////////////////
+ /// Activate or deactivate the context
+ ///
+ /// \param Active : True to activate the context, false to deactivate it
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetActive(bool Active);
+
+ ////////////////////////////////////////////////////////////
+ /// Check if there's a context bound to the current thread
+ ///
+ /// \return True if there's a context bound to the current thread
+ ///
+ ////////////////////////////////////////////////////////////
+ static bool IsContextActive();
+
+ ////////////////////////////////////////////////////////////
+ /// Get the global context
+ ///
+ /// \return Reference to the global context
+ ///
+ ////////////////////////////////////////////////////////////
+ static Context& GetGlobal();
+
+private :
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ priv::WindowImpl* myDummyWindow; ///< Dummy window holding the context
+};
+
+} // namespace sf
+
+
+#endif // SFML_CONTEXT_HPP
diff --git a/include/SFML/Window/Event.hpp b/include/SFML/Window/Event.hpp index 2f03830..dd9814e 100755..100644 --- a/include/SFML/Window/Event.hpp +++ b/include/SFML/Window/Event.hpp @@ -208,7 +208,7 @@ public : //////////////////////////////////////////////////////////// struct TextEvent { - Uint16 Unicode; + Uint32 Unicode; }; //////////////////////////////////////////////////////////// @@ -216,8 +216,8 @@ public : //////////////////////////////////////////////////////////// struct MouseMoveEvent { - unsigned int X; - unsigned int Y; + int X; + int Y; }; //////////////////////////////////////////////////////////// @@ -226,6 +226,8 @@ public : struct MouseButtonEvent { Mouse::Button Button; + int X; + int Y; }; //////////////////////////////////////////////////////////// @@ -280,6 +282,8 @@ public : MouseButtonPressed, MouseButtonReleased, MouseMoved, + MouseEntered, + MouseLeft, JoyButtonPressed, JoyButtonReleased, JoyMoved diff --git a/include/SFML/Window/Input.hpp b/include/SFML/Window/Input.hpp index 3cbdbc4..4156db2 100755..100644 --- a/include/SFML/Window/Input.hpp +++ b/include/SFML/Window/Input.hpp @@ -88,7 +88,7 @@ public : /// \return Current mouse left position, relative to owner window
///
////////////////////////////////////////////////////////////
- unsigned int GetMouseX() const;
+ int GetMouseX() const;
////////////////////////////////////////////////////////////
/// Get the mouse Y position
@@ -96,7 +96,7 @@ public : /// \return Current mouse top position, relative to owner window
///
////////////////////////////////////////////////////////////
- unsigned int GetMouseY() const;
+ int GetMouseY() const;
////////////////////////////////////////////////////////////
/// Get a joystick axis position
@@ -112,7 +112,7 @@ public : private :
////////////////////////////////////////////////////////////
- /// /see sfWindowListener::OnEvent
+ /// /see WindowListener::OnEvent
///
////////////////////////////////////////////////////////////
virtual void OnEvent(const Event& EventReceived);
@@ -120,12 +120,12 @@ private : ////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- bool myKeys[Key::Count]; ///< Array containing the state of all keayboard keys
- bool myMouseButtons[Mouse::Count]; ///< Array containing the state of all mouse buttons
- bool myJoystickButtons[2][16]; ///< Array containing the state of all joysticks buttons
- unsigned int myMouseX; ///< Mouse position on X
- unsigned int myMouseY; ///< Mouse position on Y
- float myJoystickAxis[2][Joy::Count]; ///< Joysticks position on each axis
+ bool myKeys[Key::Count]; ///< Array containing the state of all keyboard keys
+ bool myMouseButtons[Mouse::Count]; ///< Array containing the state of all mouse buttons
+ bool myJoystickButtons[2][16]; ///< Array containing the state of all joysticks buttons
+ int myMouseX; ///< Mouse position on X
+ int myMouseY; ///< Mouse position on Y
+ float myJoystickAxis[2][Joy::Count]; ///< Joysticks position on each axis
};
} // namespace sf
diff --git a/include/SFML/Window/OpenGL.hpp b/include/SFML/Window/OpenGL.hpp index 56e2623..56e2623 100755..100644 --- a/include/SFML/Window/OpenGL.hpp +++ b/include/SFML/Window/OpenGL.hpp diff --git a/include/SFML/Window/VideoMode.hpp b/include/SFML/Window/VideoMode.hpp index 955f016..955f016 100755..100644 --- a/include/SFML/Window/VideoMode.hpp +++ b/include/SFML/Window/VideoMode.hpp diff --git a/include/SFML/Window/Window.hpp b/include/SFML/Window/Window.hpp index 57ca37f..1506b3f 100755..100644 --- a/include/SFML/Window/Window.hpp +++ b/include/SFML/Window/Window.hpp @@ -196,6 +196,15 @@ public : void SetPosition(int Left, int Top);
////////////////////////////////////////////////////////////
+ /// Change the size of the rendering region of the window
+ ///
+ /// \param Width : New width
+ /// \param Height : New height
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetSize(unsigned int Width, unsigned int Height);
+
+ ////////////////////////////////////////////////////////////
/// Show or hide the window
///
/// \param State : True to show, false to hide
@@ -213,6 +222,16 @@ public : void EnableKeyRepeat(bool Enabled);
////////////////////////////////////////////////////////////
+ /// Change the window's icon
+ ///
+ /// \param Width : Icon's width, in pixels
+ /// \param Height : Icon's height, in pixels
+ /// \param Pixels : Pointer to the pixels in memory, format must be RGBA 32 bits
+ ///
+ ////////////////////////////////////////////////////////////
+ void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels);
+
+ ////////////////////////////////////////////////////////////
/// Activate of deactivate the window as the current target
/// for rendering
///
@@ -262,13 +281,6 @@ public : ////////////////////////////////////////////////////////////
void SetJoystickThreshold(float Threshold);
- ////////////////////////////////////////////////////////////
- /// Force a valid OpenGL context to exist even if
- /// no window has been created
- ///
- ////////////////////////////////////////////////////////////
- static void ForceContextInit();
-
private :
////////////////////////////////////////////////////////////
@@ -278,12 +290,6 @@ private : virtual void OnCreate();
////////////////////////////////////////////////////////////
- /// Called when the window displays its content on screen
- ///
- ////////////////////////////////////////////////////////////
- virtual void OnDisplay();
-
- ////////////////////////////////////////////////////////////
/// /see WindowListener::OnEvent
///
/// \param EventReceived : Event received
@@ -300,11 +306,6 @@ 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
diff --git a/include/SFML/Window/WindowHandle.hpp b/include/SFML/Window/WindowHandle.hpp index 356a798..356a798 100755..100644 --- a/include/SFML/Window/WindowHandle.hpp +++ b/include/SFML/Window/WindowHandle.hpp diff --git a/include/SFML/Window/WindowListener.hpp b/include/SFML/Window/WindowListener.hpp index 244f6fe..244f6fe 100755..100644 --- a/include/SFML/Window/WindowListener.hpp +++ b/include/SFML/Window/WindowListener.hpp diff --git a/include/SFML/Window/WindowSettings.hpp b/include/SFML/Window/WindowSettings.hpp index 05e8962..05e8962 100755..100644 --- a/include/SFML/Window/WindowSettings.hpp +++ b/include/SFML/Window/WindowSettings.hpp diff --git a/include/SFML/Window/WindowStyle.hpp b/include/SFML/Window/WindowStyle.hpp index 159b999..159b999 100755..100644 --- a/include/SFML/Window/WindowStyle.hpp +++ b/include/SFML/Window/WindowStyle.hpp |