From a512479a42e3250eb5eb803f3cc81ea234a30aaf Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Fri, 9 Apr 2010 06:55:29 +0000 Subject: [PATCH] Renamed internal classes related to OpenGL contexts in the window module git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1501 4e206d99-4929-0410-ac5d-dfc041789085 --- build/codeblocks/sfml-window.cbp | 9 +++--- build/vc2005/sfml-window.vcproj | 32 +++++++++---------- build/vc2008/sfml-window.vcproj | 32 +++++++++---------- include/SFML/Window/Context.hpp | 4 +-- include/SFML/Window/Window.hpp | 6 ++-- src/SFML/Window/Context.cpp | 6 ++-- .../Window/{ContextGL.cpp => GlContext.cpp} | 32 +++++++++---------- .../Window/{ContextGL.hpp => GlContext.hpp} | 16 +++++----- .../Linux/{ContextGLX.cpp => GlxContext.cpp} | 16 +++++----- .../Linux/{ContextGLX.hpp => GlxContext.hpp} | 18 +++++------ .../Win32/{ContextWGL.cpp => WglContext.cpp} | 16 +++++----- .../Win32/{ContextWGL.hpp => WglContext.hpp} | 18 +++++------ src/SFML/Window/Window.cpp | 6 ++-- 13 files changed, 105 insertions(+), 106 deletions(-) rename src/SFML/Window/{ContextGL.cpp => GlContext.cpp} (84%) rename src/SFML/Window/{ContextGL.hpp => GlContext.hpp} (94%) rename src/SFML/Window/Linux/{ContextGLX.cpp => GlxContext.cpp} (94%) rename src/SFML/Window/Linux/{ContextGLX.hpp => GlxContext.hpp} (90%) rename src/SFML/Window/Win32/{ContextWGL.cpp => WglContext.cpp} (94%) rename src/SFML/Window/Win32/{ContextWGL.hpp => WglContext.hpp} (90%) diff --git a/build/codeblocks/sfml-window.cbp b/build/codeblocks/sfml-window.cbp index c7d0358c..636547d7 100644 --- a/build/codeblocks/sfml-window.cbp +++ b/build/codeblocks/sfml-window.cbp @@ -117,19 +117,18 @@ - - - + + - - + + diff --git a/build/vc2005/sfml-window.vcproj b/build/vc2005/sfml-window.vcproj index b07ad2a1..d3c9d555 100644 --- a/build/vc2005/sfml-window.vcproj +++ b/build/vc2005/sfml-window.vcproj @@ -351,14 +351,6 @@ - - - - @@ -403,6 +395,14 @@ RelativePath="..\..\src\SFML\Window\Win32\VideoModeImpl.cpp" > + + + + @@ -452,14 +452,6 @@ RelativePath="..\..\include\SFML\Window\Context.hpp" > - - - - @@ -468,6 +460,14 @@ RelativePath="..\..\include\SFML\Window\Event.hpp" > + + + + diff --git a/build/vc2008/sfml-window.vcproj b/build/vc2008/sfml-window.vcproj index b114297e..84ea34c9 100644 --- a/build/vc2008/sfml-window.vcproj +++ b/build/vc2008/sfml-window.vcproj @@ -346,14 +346,6 @@ - - - - @@ -366,6 +358,14 @@ RelativePath="..\..\src\SFML\Window\Win32\VideoModeImpl.cpp" > + + + + @@ -415,14 +415,6 @@ RelativePath="..\..\include\SFML\Window\Context.hpp" > - - - - @@ -431,6 +423,14 @@ RelativePath="..\..\include\SFML\Window\Event.hpp" > + + + + diff --git a/include/SFML/Window/Context.hpp b/include/SFML/Window/Context.hpp index b191cba4..d88e749c 100644 --- a/include/SFML/Window/Context.hpp +++ b/include/SFML/Window/Context.hpp @@ -36,7 +36,7 @@ namespace sf { namespace priv { - class ContextGL; + class GlContext; } //////////////////////////////////////////////////////////// @@ -88,7 +88,7 @@ private : //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - priv::ContextGL* myContext; ///< Internal OpenGL context + priv::GlContext* myContext; ///< Internal OpenGL context }; } // namespace sf diff --git a/include/SFML/Window/Window.hpp b/include/SFML/Window/Window.hpp index 6c75ca73..06fc6ee7 100644 --- a/include/SFML/Window/Window.hpp +++ b/include/SFML/Window/Window.hpp @@ -28,10 +28,10 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include #include #include -#include #include #include #include @@ -42,8 +42,8 @@ namespace sf { namespace priv { + class GlContext; class WindowImpl; - class ContextGL; } class Event; @@ -470,7 +470,7 @@ private : // Member data //////////////////////////////////////////////////////////// priv::WindowImpl* myWindow; ///< Platform-specific implementation of the window - priv::ContextGL* myContext; ///< Platform-specific implementation of the OpenGL context + priv::GlContext* myContext; ///< Platform-specific implementation of the OpenGL context Input myInput; ///< Input manager connected to window Clock myClock; ///< Clock for measuring the elapsed time between frames float myLastFrameTime; ///< Time elapsed since last frame diff --git a/src/SFML/Window/Context.cpp b/src/SFML/Window/Context.cpp index be53a8d1..feb46a09 100644 --- a/src/SFML/Window/Context.cpp +++ b/src/SFML/Window/Context.cpp @@ -26,7 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include -#include +#include namespace sf @@ -34,7 +34,7 @@ namespace sf //////////////////////////////////////////////////////////// Context::Context() { - myContext = priv::ContextGL::New(); + myContext = priv::GlContext::New(); SetActive(true); } @@ -57,7 +57,7 @@ void Context::SetActive(bool active) //////////////////////////////////////////////////////////// bool Context::SetReferenceActive() { - return priv::ContextGL::SetReferenceActive(); + return priv::GlContext::SetReferenceActive(); } diff --git a/src/SFML/Window/ContextGL.cpp b/src/SFML/Window/GlContext.cpp similarity index 84% rename from src/SFML/Window/ContextGL.cpp rename to src/SFML/Window/GlContext.cpp index 156aa3e1..eaee1aed 100644 --- a/src/SFML/Window/ContextGL.cpp +++ b/src/SFML/Window/GlContext.cpp @@ -25,7 +25,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include #include @@ -34,18 +34,18 @@ #if defined(SFML_SYSTEM_WINDOWS) - #include - typedef sf::priv::ContextWGL ContextType; + #include + typedef sf::priv::WglContext ContextType; #elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) - #include - typedef sf::priv::ContextGLX ContextType; + #include + typedef sf::priv::GlxContext ContextType; #elif defined(SFML_SYSTEM_MACOS) - #include - typedef sf::priv::ContextAGL ContextType; + #include + typedef sf::priv::AglContext ContextType; #endif @@ -56,7 +56,7 @@ namespace { // This thread-local variable will hold the "global" context for each thread - sf::ThreadLocalPtr threadContext(NULL); + sf::ThreadLocalPtr threadContext(NULL); // Now we create two global contexts. // The first one is the reference context: it will be shared with every other @@ -73,14 +73,14 @@ namespace sf namespace priv { //////////////////////////////////////////////////////////// -ContextGL* ContextGL::New() +GlContext* GlContext::New() { return new ContextType(&referenceContext); } //////////////////////////////////////////////////////////// -ContextGL* ContextGL::New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) +GlContext* GlContext::New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) { ContextType* context = new ContextType(&referenceContext, owner, bitsPerPixel, settings); @@ -93,7 +93,7 @@ ContextGL* ContextGL::New(const WindowImpl* owner, unsigned int bitsPerPixel, co //////////////////////////////////////////////////////////// -ContextGL::~ContextGL() +GlContext::~GlContext() { if (threadContext == this) { @@ -108,14 +108,14 @@ ContextGL::~ContextGL() //////////////////////////////////////////////////////////// -const ContextSettings& ContextGL::GetSettings() const +const ContextSettings& GlContext::GetSettings() const { return mySettings; } //////////////////////////////////////////////////////////// -bool ContextGL::SetActive(bool active) +bool GlContext::SetActive(bool active) { if (active) { @@ -148,7 +148,7 @@ bool ContextGL::SetActive(bool active) //////////////////////////////////////////////////////////// -bool ContextGL::SetReferenceActive() +bool GlContext::SetReferenceActive() { if (threadContext) return threadContext->SetActive(true); @@ -158,14 +158,14 @@ bool ContextGL::SetReferenceActive() //////////////////////////////////////////////////////////// -ContextGL::ContextGL() +GlContext::GlContext() { // Nothing to do } //////////////////////////////////////////////////////////// -int ContextGL::EvaluateFormat(unsigned int bitsPerPixel, const ContextSettings& settings, int colorBits, int depthBits, int stencilBits, int antialiasing) +int GlContext::EvaluateFormat(unsigned int bitsPerPixel, const ContextSettings& settings, int colorBits, int depthBits, int stencilBits, int antialiasing) { return abs(static_cast(bitsPerPixel - colorBits)) + abs(static_cast(settings.DepthBits - depthBits)) + diff --git a/src/SFML/Window/ContextGL.hpp b/src/SFML/Window/GlContext.hpp similarity index 94% rename from src/SFML/Window/ContextGL.hpp rename to src/SFML/Window/GlContext.hpp index d0b6461c..c20f484f 100644 --- a/src/SFML/Window/ContextGL.hpp +++ b/src/SFML/Window/GlContext.hpp @@ -22,8 +22,8 @@ // //////////////////////////////////////////////////////////// -#ifndef SFML_CONTEXTGL_HPP -#define SFML_CONTEXTGL_HPP +#ifndef SFML_GLCONTEXT_HPP +#define SFML_GLCONTEXT_HPP //////////////////////////////////////////////////////////// // Headers @@ -43,7 +43,7 @@ class WindowImpl; /// \brief Abstract class representing an OpenGL context /// //////////////////////////////////////////////////////////// -class ContextGL : NonCopyable +class GlContext : NonCopyable { public : @@ -56,7 +56,7 @@ public : /// \return Pointer to the created context (don't forget to delete it) /// //////////////////////////////////////////////////////////// - static ContextGL* New(); + static GlContext* New(); //////////////////////////////////////////////////////////// /// \brief Create a new context attached to a window @@ -71,7 +71,7 @@ public : /// \return Pointer to the created context (don't forget to delete it) /// //////////////////////////////////////////////////////////// - static ContextGL* New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings); + static GlContext* New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings); public : @@ -79,7 +79,7 @@ public : /// \brief Destructor /// //////////////////////////////////////////////////////////// - virtual ~ContextGL(); + virtual ~GlContext(); //////////////////////////////////////////////////////////// /// \brief Get the settings of the context @@ -149,7 +149,7 @@ protected : /// This constructor is meant for derived classes only. /// //////////////////////////////////////////////////////////// - ContextGL(); + GlContext(); //////////////////////////////////////////////////////////// /// \brief Activate the context as the current target @@ -191,4 +191,4 @@ protected : } // namespace sf -#endif // SFML_CONTEXTGL_HPP +#endif // SFML_GLCONTEXT_HPP diff --git a/src/SFML/Window/Linux/ContextGLX.cpp b/src/SFML/Window/Linux/GlxContext.cpp similarity index 94% rename from src/SFML/Window/Linux/ContextGLX.cpp rename to src/SFML/Window/Linux/GlxContext.cpp index 6fce2575..b04bb00b 100644 --- a/src/SFML/Window/Linux/ContextGLX.cpp +++ b/src/SFML/Window/Linux/GlxContext.cpp @@ -26,7 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #define GLX_GLXEXT_LEGACY // so that our local glxext.h is used instead of the system one -#include +#include #include #include #include @@ -38,7 +38,7 @@ namespace sf namespace priv { //////////////////////////////////////////////////////////// -ContextGLX::ContextGLX(ContextGLX* shared) : +GlxContext::GlxContext(GlxContext* shared) : myWindow (0), myContext (NULL), myOwnsWindow(true) @@ -67,7 +67,7 @@ myOwnsWindow(true) //////////////////////////////////////////////////////////// -ContextGLX::ContextGLX(ContextGLX* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) : +GlxContext::GlxContext(GlxContext* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) : myWindow (0), myContext (NULL), myOwnsWindow(false) @@ -88,7 +88,7 @@ myOwnsWindow(false) //////////////////////////////////////////////////////////// -ContextGLX::~ContextGLX() +GlxContext::~GlxContext() { // Destroy the context if (myContext) @@ -114,7 +114,7 @@ ContextGLX::~ContextGLX() //////////////////////////////////////////////////////////// -bool ContextGLX::MakeCurrent() +bool GlxContext::MakeCurrent() { if (myContext) { @@ -131,7 +131,7 @@ bool ContextGLX::MakeCurrent() //////////////////////////////////////////////////////////// -void ContextGLX::Display() +void GlxContext::Display() { if (myWindow) glXSwapBuffers(myDisplay, myWindow); @@ -139,7 +139,7 @@ void ContextGLX::Display() //////////////////////////////////////////////////////////// -void ContextGLX::UseVerticalSync(bool enabled) +void GlxContext::UseVerticalSync(bool enabled) { const GLubyte* name = reinterpret_cast("glXSwapIntervalSGI"); PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = reinterpret_cast(glXGetProcAddress(name)); @@ -149,7 +149,7 @@ void ContextGLX::UseVerticalSync(bool enabled) //////////////////////////////////////////////////////////// -void ContextGLX::CreateContext(ContextGLX* shared, unsigned int bitsPerPixel, const ContextSettings& settings) +void GlxContext::CreateContext(GlxContext* shared, unsigned int bitsPerPixel, const ContextSettings& settings) { // Save the creation settings mySettings = settings; diff --git a/src/SFML/Window/Linux/ContextGLX.hpp b/src/SFML/Window/Linux/GlxContext.hpp similarity index 90% rename from src/SFML/Window/Linux/ContextGLX.hpp rename to src/SFML/Window/Linux/GlxContext.hpp index 63445825..96b9621f 100644 --- a/src/SFML/Window/Linux/ContextGLX.hpp +++ b/src/SFML/Window/Linux/GlxContext.hpp @@ -22,13 +22,13 @@ // //////////////////////////////////////////////////////////// -#ifndef SFML_CONTEXTGLX_HPP -#define SFML_CONTEXTGLX_HPP +#ifndef SFML_GLXCONTEXT_HPP +#define SFML_GLXCONTEXT_HPP //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include @@ -41,7 +41,7 @@ namespace priv /// \brief Linux (GLX) implementation of OpenGL contexts /// //////////////////////////////////////////////////////////// -class ContextGLX : public ContextGL +class GlxContext : public GlContext { public : @@ -51,7 +51,7 @@ public : /// \param shared Context to share the new one with (can be NULL) /// //////////////////////////////////////////////////////////// - ContextGLX(ContextGLX* shared); + GlxContext(GlxContext* shared); //////////////////////////////////////////////////////////// /// \brief Create a new context attached to a window @@ -62,13 +62,13 @@ public : /// \param settings Creation parameters /// //////////////////////////////////////////////////////////// - ContextGLX(ContextGLX* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings); + GlxContext(GlxContext* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings); //////////////////////////////////////////////////////////// /// \brief Destructor /// //////////////////////////////////////////////////////////// - ~ContextGLX(); + ~GlxContext(); //////////////////////////////////////////////////////////// /// \brief Activate the context as the current target @@ -108,7 +108,7 @@ private : /// \param settings Creation parameters /// //////////////////////////////////////////////////////////// - void CreateContext(ContextGLX* shared, unsigned int bitsPerPixel, const ContextSettings& settings); + void CreateContext(GlxContext* shared, unsigned int bitsPerPixel, const ContextSettings& settings); //////////////////////////////////////////////////////////// // Member data @@ -123,4 +123,4 @@ private : } // namespace sf -#endif // SFML_CONTEXTGLX_HPP +#endif // SFML_GLXCONTEXT_HPP diff --git a/src/SFML/Window/Win32/ContextWGL.cpp b/src/SFML/Window/Win32/WglContext.cpp similarity index 94% rename from src/SFML/Window/Win32/ContextWGL.cpp rename to src/SFML/Window/Win32/WglContext.cpp index d1c0422c..318d784b 100644 --- a/src/SFML/Window/Win32/ContextWGL.cpp +++ b/src/SFML/Window/Win32/WglContext.cpp @@ -25,7 +25,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include #include #include @@ -39,7 +39,7 @@ namespace sf namespace priv { //////////////////////////////////////////////////////////// -ContextWGL::ContextWGL(ContextWGL* shared) : +WglContext::WglContext(WglContext* shared) : myWindow (NULL), myDeviceContext(NULL), myContext (NULL), @@ -64,7 +64,7 @@ myOwnsWindow (true) //////////////////////////////////////////////////////////// -ContextWGL::ContextWGL(ContextWGL* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) : +WglContext::WglContext(WglContext* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings) : myWindow (NULL), myDeviceContext(NULL), myContext (NULL), @@ -84,7 +84,7 @@ myOwnsWindow (false) //////////////////////////////////////////////////////////// -ContextWGL::~ContextWGL() +WglContext::~WglContext() { // Destroy the OpenGL context if (myContext) @@ -105,7 +105,7 @@ ContextWGL::~ContextWGL() //////////////////////////////////////////////////////////// -bool ContextWGL::MakeCurrent() +bool WglContext::MakeCurrent() { if (myDeviceContext && myContext) { @@ -122,7 +122,7 @@ bool ContextWGL::MakeCurrent() //////////////////////////////////////////////////////////// -void ContextWGL::Display() +void WglContext::Display() { if (myDeviceContext && myContext) SwapBuffers(myDeviceContext); @@ -130,7 +130,7 @@ void ContextWGL::Display() //////////////////////////////////////////////////////////// -void ContextWGL::UseVerticalSync(bool enabled) +void WglContext::UseVerticalSync(bool enabled) { PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = reinterpret_cast(wglGetProcAddress("wglSwapIntervalEXT")); if (wglSwapIntervalEXT) @@ -139,7 +139,7 @@ void ContextWGL::UseVerticalSync(bool enabled) //////////////////////////////////////////////////////////// -void ContextWGL::CreateContext(ContextWGL* shared, unsigned int bitsPerPixel, const ContextSettings& settings) +void WglContext::CreateContext(WglContext* shared, unsigned int bitsPerPixel, const ContextSettings& settings) { // Save the creation settings mySettings = settings; diff --git a/src/SFML/Window/Win32/ContextWGL.hpp b/src/SFML/Window/Win32/WglContext.hpp similarity index 90% rename from src/SFML/Window/Win32/ContextWGL.hpp rename to src/SFML/Window/Win32/WglContext.hpp index 52405980..d0c2d371 100644 --- a/src/SFML/Window/Win32/ContextWGL.hpp +++ b/src/SFML/Window/Win32/WglContext.hpp @@ -22,13 +22,13 @@ // //////////////////////////////////////////////////////////// -#ifndef SFML_CONTEXTWGL_HPP -#define SFML_CONTEXTWGL_HPP +#ifndef SFML_WGLCONTEXT_HPP +#define SFML_WGLCONTEXT_HPP //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// -#include +#include #include @@ -40,7 +40,7 @@ namespace priv /// \brief Windows (WGL) implementation of OpenGL contexts /// //////////////////////////////////////////////////////////// -class ContextWGL : public ContextGL +class WglContext : public GlContext { public : @@ -50,7 +50,7 @@ public : /// \param shared Context to share the new one with (can be NULL) /// //////////////////////////////////////////////////////////// - ContextWGL(ContextWGL* shared); + WglContext(WglContext* shared); //////////////////////////////////////////////////////////// /// \brief Create a new context attached to a window @@ -61,13 +61,13 @@ public : /// \param settings Creation parameters /// //////////////////////////////////////////////////////////// - ContextWGL(ContextWGL* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings); + WglContext(WglContext* shared, const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings); //////////////////////////////////////////////////////////// /// \brief Destructor /// //////////////////////////////////////////////////////////// - ~ContextWGL(); + ~WglContext(); //////////////////////////////////////////////////////////// /// \brief Activate the context as the current target @@ -107,7 +107,7 @@ private : /// \param settings Creation parameters /// //////////////////////////////////////////////////////////// - void CreateContext(ContextWGL* shared, unsigned int bitsPerPixel, const ContextSettings& settings); + void CreateContext(WglContext* shared, unsigned int bitsPerPixel, const ContextSettings& settings); //////////////////////////////////////////////////////////// // Member data @@ -122,4 +122,4 @@ private : } // namespace sf -#endif // SFML_CONTEXTWGL_HPP +#endif // SFML_WGLCONTEXT_HPP diff --git a/src/SFML/Window/Window.cpp b/src/SFML/Window/Window.cpp index f2c286e8..42d88594 100644 --- a/src/SFML/Window/Window.cpp +++ b/src/SFML/Window/Window.cpp @@ -26,7 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include -#include +#include #include #include #include @@ -129,7 +129,7 @@ void Window::Create(VideoMode mode, const std::string& title, unsigned long styl myWindow = priv::WindowImpl::New(mode, title, style); // Recreate the context - myContext = priv::ContextGL::New(myWindow, mode.BitsPerPixel, settings); + myContext = priv::GlContext::New(myWindow, mode.BitsPerPixel, settings); // Perform common initializations Initialize(); @@ -146,7 +146,7 @@ void Window::Create(WindowHandle handle, const ContextSettings& settings) myWindow = priv::WindowImpl::New(handle); // Recreate the context - myContext = priv::ContextGL::New(myWindow, VideoMode::GetDesktopMode().BitsPerPixel, settings); + myContext = priv::GlContext::New(myWindow, VideoMode::GetDesktopMode().BitsPerPixel, settings); // Perform common initializations Initialize();