diff --git a/CSFML/include/SFML/Graphics/RenderWindow.h b/CSFML/include/SFML/Graphics/RenderWindow.h index 5f09d4e7..922c8ad7 100644 --- a/CSFML/include/SFML/Graphics/RenderWindow.h +++ b/CSFML/include/SFML/Graphics/RenderWindow.h @@ -287,6 +287,16 @@ CSFML_API float sfRenderWindow_GetFrameTime(const sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// CSFML_API void sfRenderWindow_SetJoystickThreshold(sfRenderWindow* renderWindow, float threshold); +//////////////////////////////////////////////////////////// +/// Retrieve the Os-specific handle of a window +/// +/// \param renderWindow : Renderwindow object +/// +/// \return Window handle +/// +//////////////////////////////////////////////////////////// +CSFML_API sfWindowHandle sfRenderWindow_GetSystemHandle(const sfRenderWindow* renderWindow); + //////////////////////////////////////////////////////////// /// Draw something on a renderwindow /// diff --git a/CSFML/include/SFML/Window/Window.h b/CSFML/include/SFML/Window/Window.h index 7e004414..3d7396c2 100644 --- a/CSFML/include/SFML/Window/Window.h +++ b/CSFML/include/SFML/Window/Window.h @@ -296,5 +296,15 @@ CSFML_API float sfWindow_GetFrameTime(const sfWindow* window); //////////////////////////////////////////////////////////// CSFML_API void sfWindow_SetJoystickThreshold(sfWindow* window, float threshold); +//////////////////////////////////////////////////////////// +/// Retrieve the Os-specific handle of a window +/// +/// \param window : Window object +/// +/// \return Window handle +/// +//////////////////////////////////////////////////////////// +CSFML_API sfWindowHandle sfWindow_GetSystemHandle(const sfWindow* window); + #endif // SFML_WINDOW_H diff --git a/CSFML/src/SFML/Graphics/RenderWindow.cpp b/CSFML/src/SFML/Graphics/RenderWindow.cpp index 3348b08a..ca4569c3 100644 --- a/CSFML/src/SFML/Graphics/RenderWindow.cpp +++ b/CSFML/src/SFML/Graphics/RenderWindow.cpp @@ -350,6 +350,15 @@ void sfRenderWindow_SetJoystickThreshold(sfRenderWindow* renderWindow, float thr } +//////////////////////////////////////////////////////////// +/// Retrieve the Os-specific handle of a window +//////////////////////////////////////////////////////////// +sfWindowHandle sfRenderWindow_GetSystemHandle(const sfRenderWindow* renderWindow) +{ + CSFML_CALL_RETURN(renderWindow, GetSystemHandle(), 0); +} + + //////////////////////////////////////////////////////////// /// Draw something on a renderwindow //////////////////////////////////////////////////////////// diff --git a/CSFML/src/SFML/Graphics/csfml-graphics-d.def b/CSFML/src/SFML/Graphics/csfml-graphics-d.def index f9690ad5..4817921a 100644 --- a/CSFML/src/SFML/Graphics/csfml-graphics-d.def +++ b/CSFML/src/SFML/Graphics/csfml-graphics-d.def @@ -223,6 +223,7 @@ EXPORTS sfRenderWindow_SetFramerateLimit sfRenderWindow_GetFrameTime sfRenderWindow_SetJoystickThreshold + sfRenderWindow_GetSystemHandle sfRenderWindow_DrawSprite sfRenderWindow_DrawText sfRenderWindow_DrawShape diff --git a/CSFML/src/SFML/Graphics/csfml-graphics.def b/CSFML/src/SFML/Graphics/csfml-graphics.def index eda23e97..544ee2b4 100644 --- a/CSFML/src/SFML/Graphics/csfml-graphics.def +++ b/CSFML/src/SFML/Graphics/csfml-graphics.def @@ -223,6 +223,7 @@ EXPORTS sfRenderWindow_SetFramerateLimit sfRenderWindow_GetFrameTime sfRenderWindow_SetJoystickThreshold + sfRenderWindow_GetSystemHandle sfRenderWindow_DrawSprite sfRenderWindow_DrawText sfRenderWindow_DrawShape diff --git a/CSFML/src/SFML/Window/Window.cpp b/CSFML/src/SFML/Window/Window.cpp index 7f22871b..ff833ce1 100644 --- a/CSFML/src/SFML/Window/Window.cpp +++ b/CSFML/src/SFML/Window/Window.cpp @@ -313,6 +313,7 @@ float sfWindow_GetFrameTime(const sfWindow* window) CSFML_CALL_RETURN(window, GetFrameTime(), 0.f) } + //////////////////////////////////////////////////////////// /// Change the joystick threshold, ie. the value below which /// no move event will be generated @@ -321,3 +322,12 @@ void sfWindow_SetJoystickThreshold(sfWindow* window, float threshold) { CSFML_CALL(window, SetJoystickThreshold(threshold)) } + + +//////////////////////////////////////////////////////////// +/// Retrieve the Os-specific handle of a window +//////////////////////////////////////////////////////////// +sfWindowHandle sfWindow_GetSystemHandle(const sfWindow* window) +{ + CSFML_CALL_RETURN(window, GetSystemHandle(), 0); +} diff --git a/CSFML/src/SFML/Window/csfml-window-d.def b/CSFML/src/SFML/Window/csfml-window-d.def index 2bb80c88..6a9cb9ef 100644 --- a/CSFML/src/SFML/Window/csfml-window-d.def +++ b/CSFML/src/SFML/Window/csfml-window-d.def @@ -33,6 +33,7 @@ EXPORTS sfWindow_SetFramerateLimit sfWindow_GetFrameTime sfWindow_SetJoystickThreshold + sfWindow_GetSystemHandle sfContext_Create sfContext_Destroy sfContext_SetActive diff --git a/CSFML/src/SFML/Window/csfml-window.def b/CSFML/src/SFML/Window/csfml-window.def index 2f6a2d57..a6e00897 100644 --- a/CSFML/src/SFML/Window/csfml-window.def +++ b/CSFML/src/SFML/Window/csfml-window.def @@ -33,6 +33,7 @@ EXPORTS sfWindow_SetFramerateLimit sfWindow_GetFrameTime sfWindow_SetJoystickThreshold + sfWindow_GetSystemHandle sfContext_Create sfContext_Destroy sfContext_SetActive diff --git a/doc/build/Doxygen.hpp b/doc/build/Doxygen.hpp index 032e0354..dc1ece9c 100644 --- a/doc/build/Doxygen.hpp +++ b/doc/build/Doxygen.hpp @@ -27,11 +27,11 @@ /// return EXIT_FAILURE; /// sf::Sprite sprite(image); /// -/// // Create a graphical string to display +/// // Create a graphical text to display /// sf::Font font; /// if (!font.LoadFromFile("arial.ttf")) /// return EXIT_FAILURE; -/// sf::String text("Hello SFML", font, 50); +/// sf::Text text("Hello SFML", font, 50); /// /// // Load a music to play /// sf::Music music; diff --git a/dotnet/extlibs/csfml-graphics.dll b/dotnet/extlibs/csfml-graphics.dll index ee9bcece..726f0901 100644 Binary files a/dotnet/extlibs/csfml-graphics.dll and b/dotnet/extlibs/csfml-graphics.dll differ diff --git a/dotnet/extlibs/csfml-window.dll b/dotnet/extlibs/csfml-window.dll index 2a041a51..2af195c7 100644 Binary files a/dotnet/extlibs/csfml-window.dll and b/dotnet/extlibs/csfml-window.dll differ diff --git a/dotnet/src/Graphics/RenderWindow.cs b/dotnet/src/Graphics/RenderWindow.cs index 91e95d0b..fb42762f 100644 --- a/dotnet/src/Graphics/RenderWindow.cs +++ b/dotnet/src/Graphics/RenderWindow.cs @@ -294,6 +294,16 @@ namespace SFML sfRenderWindow_SetJoystickThreshold(This, threshold); } + //////////////////////////////////////////////////////////// + /// + /// OS-specific handle of the window + /// + //////////////////////////////////////////////////////////// + public override IntPtr SystemHandle + { + get {return sfRenderWindow_GetSystemHandle(This);} + } + //////////////////////////////////////////////////////////// /// /// Default view of the window @@ -592,6 +602,9 @@ namespace SFML [DllImport("csfml-graphics", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] static extern void sfRenderWindow_ConvertCoords(IntPtr This, uint WindowX, uint WindowY, out float ViewX, out float ViewY, IntPtr TargetView); + [DllImport("csfml-graphics", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfRenderWindow_GetSystemHandle(IntPtr This); + #endregion } } diff --git a/dotnet/src/Window/Window.cs b/dotnet/src/Window/Window.cs index 45fda1f1..5c75d872 100644 --- a/dotnet/src/Window/Window.cs +++ b/dotnet/src/Window/Window.cs @@ -341,6 +341,16 @@ namespace SFML sfWindow_SetJoystickThreshold(This, threshold); } + //////////////////////////////////////////////////////////// + /// + /// OS-specific handle of the window + /// + //////////////////////////////////////////////////////////// + public virtual IntPtr SystemHandle + { + get {return sfWindow_GetSystemHandle(This);} + } + //////////////////////////////////////////////////////////// /// /// Wait for a new event and dispatch it to the corresponding @@ -642,6 +652,9 @@ namespace SFML [DllImport("csfml-window", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] static extern void sfWindow_SetJoystickThreshold(IntPtr This, float Threshold); + + [DllImport("csfml-window", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfWindow_GetSystemHandle(IntPtr This); #endregion } } diff --git a/include/SFML/Graphics/Shader.hpp b/include/SFML/Graphics/Shader.hpp index 67ba0375..b6fde662 100644 --- a/include/SFML/Graphics/Shader.hpp +++ b/include/SFML/Graphics/Shader.hpp @@ -279,7 +279,7 @@ public : void Bind() const; //////////////////////////////////////////////////////////// - /// \brief Bind the shader (deactivate it) + /// \brief Unbind the shader (deactivate it) /// /// This function is normally for internal use only, unless /// you want to use the shader with a custom OpenGL rendering diff --git a/include/SFML/Graphics/Sprite.hpp b/include/SFML/Graphics/Sprite.hpp index de0c6591..7759a191 100644 --- a/include/SFML/Graphics/Sprite.hpp +++ b/include/SFML/Graphics/Sprite.hpp @@ -277,9 +277,9 @@ private : /// /// // Create a sprite /// sf::Sprite sprite; -/// text.SetImage(image); -/// text.SetSubRect(sf::IntRect(10, 10, 50, 30)); -/// text.Resize(100, 60); +/// sprite.SetImage(image); +/// sprite.SetSubRect(sf::IntRect(10, 10, 50, 30)); +/// sprite.Resize(100, 60); /// /// // Display it /// window.Draw(sprite); // window is a sf::RenderWindow diff --git a/include/SFML/Graphics/View.hpp b/include/SFML/Graphics/View.hpp index 89e22b05..62fb09f7 100644 --- a/include/SFML/Graphics/View.hpp +++ b/include/SFML/Graphics/View.hpp @@ -144,13 +144,6 @@ public : /// \brief Reset the view to the given rectangle /// /// Note that this function resets the rotation angle to 0. - /// It is a function provided for convenience, equivalent to the - /// following calls: - /// \code - /// view.SetCenter(rectangle.GetCenter()); - /// view.SetSize(rectangle.GetSize()); - /// view.SetRotation(0); - /// \endcode /// /// \param rectangle Rectangle defining the zone to display /// diff --git a/include/SFML/System/Utf.hpp b/include/SFML/System/Utf.hpp index a28d6a0d..ae3b4351 100644 --- a/include/SFML/System/Utf.hpp +++ b/include/SFML/System/Utf.hpp @@ -409,7 +409,7 @@ public : }; //////////////////////////////////////////////////////////// -/// \brief Specialization of the Utf template for UTF-16 +/// \brief Specialization of the Utf template for UTF-32 /// //////////////////////////////////////////////////////////// template <> diff --git a/include/SFML/Window/Window.hpp b/include/SFML/Window/Window.hpp index b2a6ad0b..963d4046 100644 --- a/include/SFML/Window/Window.hpp +++ b/include/SFML/Window/Window.hpp @@ -433,6 +433,20 @@ public : //////////////////////////////////////////////////////////// void SetJoystickThreshold(float threshold); + //////////////////////////////////////////////////////////// + /// \brief Get the OS-specific handle of the window + /// + /// The type of the returned handle is sf::WindowHandle, + /// which is a typedef to the handle type defined by the OS. + /// You shouldn't need to use this function, unless you have + /// very specific stuff to implement that SFML doesn't support, + /// or implement a temporary workaround until a bug is fixed. + /// + /// \return System handle of the window + /// + //////////////////////////////////////////////////////////// + WindowHandle GetSystemHandle() const; + private : //////////////////////////////////////////////////////////// diff --git a/src/SFML/Window/Linux/GlxContext.cpp b/src/SFML/Window/Linux/GlxContext.cpp index b04bb00b..38f28120 100644 --- a/src/SFML/Window/Linux/GlxContext.cpp +++ b/src/SFML/Window/Linux/GlxContext.cpp @@ -76,7 +76,7 @@ myOwnsWindow(false) myDisplay = static_cast(owner)->GetDisplay(); // Get the owner window and its device context - myWindow = static_cast(owner->GetHandle()); + myWindow = static_cast(owner->GetSystemHandle()); // Create the context if (myWindow) diff --git a/src/SFML/Window/Linux/WindowImplX11.cpp b/src/SFML/Window/Linux/WindowImplX11.cpp index 78584bca..490e6fa9 100644 --- a/src/SFML/Window/Linux/WindowImplX11.cpp +++ b/src/SFML/Window/Linux/WindowImplX11.cpp @@ -277,7 +277,7 @@ WindowImplX11::~WindowImplX11() //////////////////////////////////////////////////////////// -WindowHandle WindowImplX11::GetHandle() const +WindowHandle WindowImplX11::GetSystemHandle() const { return myWindow; } diff --git a/src/SFML/Window/Linux/WindowImplX11.hpp b/src/SFML/Window/Linux/WindowImplX11.hpp index 64ee519a..f46f87cd 100644 --- a/src/SFML/Window/Linux/WindowImplX11.hpp +++ b/src/SFML/Window/Linux/WindowImplX11.hpp @@ -89,7 +89,7 @@ private : /// \return Handle of the window /// //////////////////////////////////////////////////////////// - virtual WindowHandle GetHandle() const; + virtual WindowHandle GetSystemHandle() const; //////////////////////////////////////////////////////////// /// \brief Process incoming events from the operating system diff --git a/src/SFML/Window/Win32/WglContext.cpp b/src/SFML/Window/Win32/WglContext.cpp index 318d784b..6d1d8955 100644 --- a/src/SFML/Window/Win32/WglContext.cpp +++ b/src/SFML/Window/Win32/WglContext.cpp @@ -71,7 +71,7 @@ myContext (NULL), myOwnsWindow (false) { // Get the owner window and its device context - myWindow = static_cast(owner->GetHandle()); + myWindow = static_cast(owner->GetSystemHandle()); myDeviceContext = GetDC(myWindow); // Create the context diff --git a/src/SFML/Window/Win32/WindowImplWin32.cpp b/src/SFML/Window/Win32/WindowImplWin32.cpp index 613f782e..f6598665 100644 --- a/src/SFML/Window/Win32/WindowImplWin32.cpp +++ b/src/SFML/Window/Win32/WindowImplWin32.cpp @@ -200,7 +200,7 @@ WindowImplWin32::~WindowImplWin32() //////////////////////////////////////////////////////////// -WindowHandle WindowImplWin32::GetHandle() const +WindowHandle WindowImplWin32::GetSystemHandle() const { return myHandle; } diff --git a/src/SFML/Window/Win32/WindowImplWin32.hpp b/src/SFML/Window/Win32/WindowImplWin32.hpp index 65ed99ec..f34b5d72 100644 --- a/src/SFML/Window/Win32/WindowImplWin32.hpp +++ b/src/SFML/Window/Win32/WindowImplWin32.hpp @@ -78,7 +78,7 @@ private : /// \return Handle of the window /// //////////////////////////////////////////////////////////// - virtual WindowHandle GetHandle() const; + virtual WindowHandle GetSystemHandle() const; //////////////////////////////////////////////////////////// /// \brief Process incoming events from the operating system diff --git a/src/SFML/Window/Window.cpp b/src/SFML/Window/Window.cpp index 7a775fa8..ba3ea9ad 100644 --- a/src/SFML/Window/Window.cpp +++ b/src/SFML/Window/Window.cpp @@ -384,6 +384,13 @@ void Window::SetJoystickThreshold(float threshold) } +//////////////////////////////////////////////////////////// +WindowHandle Window::GetSystemHandle() const +{ + return myWindow ? myWindow->GetSystemHandle() : 0; +} + + //////////////////////////////////////////////////////////// void Window::OnCreate() { diff --git a/src/SFML/Window/WindowImpl.hpp b/src/SFML/Window/WindowImpl.hpp index 0cf8cd35..104f671f 100644 --- a/src/SFML/Window/WindowImpl.hpp +++ b/src/SFML/Window/WindowImpl.hpp @@ -130,7 +130,7 @@ public : /// \return Handle of the window /// //////////////////////////////////////////////////////////// - virtual WindowHandle GetHandle() const = 0; + virtual WindowHandle GetSystemHandle() const = 0; //////////////////////////////////////////////////////////// /// \brief Show or hide the mouse cursor