Renamed Window::IsOpened to IsOpen

Made some minor consistency modifications in internal code
This commit is contained in:
Laurent Gomila 2012-01-13 14:53:36 +01:00
parent 9d4c8b26a5
commit c2039e866c
14 changed files with 75 additions and 75 deletions

View File

@ -57,7 +57,7 @@ int main()
sf::Clock clock; sf::Clock clock;
// Start game loop // Start game loop
while (window.IsOpened()) while (window.IsOpen())
{ {
// Process events // Process events
sf::Event event; sf::Event event;

View File

@ -82,7 +82,7 @@ int main()
float ballAngle = 0.f; // to be changed later float ballAngle = 0.f; // to be changed later
bool isPlaying = false; bool isPlaying = false;
while (window.IsOpened()) while (window.IsOpen())
{ {
// Handle events // Handle events
sf::Event event; sf::Event event;

View File

@ -305,7 +305,7 @@ int main()
// Start the game loop // Start the game loop
sf::Clock clock; sf::Clock clock;
while (window.IsOpened()) while (window.IsOpen())
{ {
// Process events // Process events
sf::Event event; sf::Event event;

View File

@ -34,7 +34,7 @@ int main()
gluPerspective(90.f, 1.f, 1.f, 500.f); gluPerspective(90.f, 1.f, 1.f, 500.f);
// Start the game loop // Start the game loop
while (window.IsOpened()) while (window.IsOpen())
{ {
// Process events // Process events
sf::Event event; sf::Event event;

View File

@ -195,8 +195,8 @@ private :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
priv::RenderTextureImpl* myImpl; ///< Platform/hardware specific implementation
Texture myTexture; ///< Target texture to draw on Texture myTexture; ///< Target texture to draw on
priv::RenderTextureImpl* myRenderTexture; ///< Platform/hardware specific implementation
}; };
} // namespace sf } // namespace sf
@ -233,7 +233,7 @@ private :
/// return -1 /// return -1
/// ///
/// // The main loop /// // The main loop
/// while (window.IsOpened()) /// while (window.IsOpen())
/// { /// {
/// // Event processing /// // Event processing
/// // ... /// // ...

View File

@ -205,7 +205,7 @@ private :
/// window.SetFramerateLimit(60); /// window.SetFramerateLimit(60);
/// ///
/// // The main loop - ends as soon as the window is closed /// // The main loop - ends as soon as the window is closed
/// while (window.IsOpened()) /// while (window.IsOpen())
/// { /// {
/// // Event processing /// // Event processing
/// sf::Event event; /// sf::Event event;
@ -247,7 +247,7 @@ private :
/// ... /// ...
/// ///
/// // Start the rendering loop /// // Start the rendering loop
/// while (window.IsOpened()) /// while (window.IsOpen())
/// { /// {
/// // Process events /// // Process events
/// ... /// ...

View File

@ -503,7 +503,7 @@ private :
/// \return True on success, false if any error happened /// \return True on success, false if any error happened
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool CompileProgram(const char* vertexShaderCode, const char* fragmentShaderCode); bool Compile(const char* vertexShaderCode, const char* fragmentShaderCode);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Bind all the textures used by the shader /// \brief Bind all the textures used by the shader

View File

@ -187,7 +187,7 @@ private :
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
priv::ThreadImpl* myImpl; ///< OS-specific implementation of the thread priv::ThreadImpl* myImpl; ///< OS-specific implementation of the thread
priv::ThreadFunc* myFunction; ///< Abstraction of the function to run priv::ThreadFunc* myEntryPoint; ///< Abstraction of the function to run
}; };
#include <SFML/System/Thread.inl> #include <SFML/System/Thread.inl>

View File

@ -67,7 +67,7 @@ struct ThreadMemberFunc : ThreadFunc
template <typename F> template <typename F>
Thread::Thread(F functor) : Thread::Thread(F functor) :
myImpl (NULL), myImpl (NULL),
myFunction(new priv::ThreadFunctor<F>(functor)) myEntryPoint(new priv::ThreadFunctor<F>(functor))
{ {
} }
@ -76,7 +76,7 @@ myFunction(new priv::ThreadFunctor<F>(functor))
template <typename F, typename A> template <typename F, typename A>
Thread::Thread(F function, A argument) : Thread::Thread(F function, A argument) :
myImpl (NULL), myImpl (NULL),
myFunction(new priv::ThreadFunctorWithArg<F, A>(function, argument)) myEntryPoint(new priv::ThreadFunctorWithArg<F, A>(function, argument))
{ {
} }
@ -85,6 +85,6 @@ myFunction(new priv::ThreadFunctorWithArg<F, A>(function, argument))
template <typename C> template <typename C>
Thread::Thread(void(C::*function)(), C* object) : Thread::Thread(void(C::*function)(), C* object) :
myImpl (NULL), myImpl (NULL),
myFunction(new priv::ThreadMemberFunc<C>(function, object)) myEntryPoint(new priv::ThreadMemberFunc<C>(function, object))
{ {
} }

View File

@ -145,7 +145,7 @@ public :
/// After calling this function, the sf::Window instance remains /// After calling this function, the sf::Window instance remains
/// valid and you can call Create() to recreate the window. /// valid and you can call Create() to recreate the window.
/// All other functions such as PollEvent() or Display() will /// All other functions such as PollEvent() or Display() will
/// still work (i.e. you don't have to test IsOpened() every time), /// still work (i.e. you don't have to test IsOpen() every time),
/// and will have no effect on closed windows. /// and will have no effect on closed windows.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -160,7 +160,7 @@ public :
/// \return True if the window is opened, false if it has been closed /// \return True if the window is opened, false if it has been closed
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool IsOpened() const; bool IsOpen() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the width of the rendering region of the window /// \brief Get the width of the rendering region of the window
@ -471,7 +471,7 @@ private :
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
priv::WindowImpl* myWindow; ///< Platform-specific implementation of the window priv::WindowImpl* myImpl; ///< Platform-specific implementation of the window
priv::GlContext* myContext; ///< Platform-specific implementation of the OpenGL context priv::GlContext* myContext; ///< Platform-specific implementation of the OpenGL context
Clock myClock; ///< Clock for measuring the elapsed time between frames Clock myClock; ///< Clock for measuring the elapsed time between frames
Uint32 myLastFrameTime; ///< Time elapsed since last frame Uint32 myLastFrameTime; ///< Time elapsed since last frame
@ -519,7 +519,7 @@ private :
/// window.SetFramerateLimit(60); /// window.SetFramerateLimit(60);
/// ///
/// // The main loop - ends as soon as the window is closed /// // The main loop - ends as soon as the window is closed
/// while (window.IsOpened()) /// while (window.IsOpen())
/// { /// {
/// // Event processing /// // Event processing
/// sf::Event event; /// sf::Event event;

View File

@ -35,7 +35,7 @@ namespace sf
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
RenderTexture::RenderTexture() : RenderTexture::RenderTexture() :
myRenderTexture(NULL) myImpl(NULL)
{ {
} }
@ -44,7 +44,7 @@ myRenderTexture(NULL)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
RenderTexture::~RenderTexture() RenderTexture::~RenderTexture()
{ {
delete myRenderTexture; delete myImpl;
} }
@ -62,20 +62,20 @@ bool RenderTexture::Create(unsigned int width, unsigned int height, bool depthBu
SetSmooth(false); SetSmooth(false);
// Create the implementation // Create the implementation
delete myRenderTexture; delete myImpl;
if (priv::RenderTextureImplFBO::IsAvailable()) if (priv::RenderTextureImplFBO::IsAvailable())
{ {
// Use frame-buffer object (FBO) // Use frame-buffer object (FBO)
myRenderTexture = new priv::RenderTextureImplFBO; myImpl = new priv::RenderTextureImplFBO;
} }
else else
{ {
// Use default implementation // Use default implementation
myRenderTexture = new priv::RenderTextureImplDefault; myImpl = new priv::RenderTextureImplDefault;
} }
// Initialize the render texture // Initialize the render texture
if (!myRenderTexture->Create(width, height, myTexture.myTexture, depthBuffer)) if (!myImpl->Create(width, height, myTexture.myTexture, depthBuffer))
return false; return false;
// We can now initialize the render target part // We can now initialize the render target part
@ -102,7 +102,7 @@ bool RenderTexture::IsSmooth() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool RenderTexture::SetActive(bool active) bool RenderTexture::SetActive(bool active)
{ {
return myRenderTexture && myRenderTexture->Activate(active); return myImpl && myImpl->Activate(active);
} }
@ -112,7 +112,7 @@ void RenderTexture::Display()
// Update the target texture // Update the target texture
if (SetActive(true)) if (SetActive(true))
{ {
myRenderTexture->UpdateTexture(myTexture.myTexture); myImpl->UpdateTexture(myTexture.myTexture);
myTexture.myPixelsFlipped = true; myTexture.myPixelsFlipped = true;
} }
} }

View File

@ -118,9 +118,9 @@ bool Shader::LoadFromFile(const std::string& filename, Type type)
// Compile the shader program // Compile the shader program
if (type == Vertex) if (type == Vertex)
return CompileProgram(&shader[0], NULL); return Compile(&shader[0], NULL);
else else
return CompileProgram(NULL, &shader[0]); return Compile(NULL, &shader[0]);
} }
@ -144,7 +144,7 @@ bool Shader::LoadFromFile(const std::string& vertexShaderFilename, const std::st
} }
// Compile the shader program // Compile the shader program
return CompileProgram(&vertexShader[0], &fragmentShader[0]); return Compile(&vertexShader[0], &fragmentShader[0]);
} }
@ -153,9 +153,9 @@ bool Shader::LoadFromMemory(const std::string& shader, Type type)
{ {
// Compile the shader program // Compile the shader program
if (type == Vertex) if (type == Vertex)
return CompileProgram(shader.c_str(), NULL); return Compile(shader.c_str(), NULL);
else else
return CompileProgram(NULL, shader.c_str()); return Compile(NULL, shader.c_str());
} }
@ -163,7 +163,7 @@ bool Shader::LoadFromMemory(const std::string& shader, Type type)
bool Shader::LoadFromMemory(const std::string& vertexShader, const std::string& fragmentShader) bool Shader::LoadFromMemory(const std::string& vertexShader, const std::string& fragmentShader)
{ {
// Compile the shader program // Compile the shader program
return CompileProgram(vertexShader.c_str(), fragmentShader.c_str()); return Compile(vertexShader.c_str(), fragmentShader.c_str());
} }
@ -180,9 +180,9 @@ bool Shader::LoadFromStream(InputStream& stream, Type type)
// Compile the shader program // Compile the shader program
if (type == Vertex) if (type == Vertex)
return CompileProgram(&shader[0], NULL); return Compile(&shader[0], NULL);
else else
return CompileProgram(NULL, &shader[0]); return Compile(NULL, &shader[0]);
} }
@ -206,7 +206,7 @@ bool Shader::LoadFromStream(InputStream& vertexShaderStream, InputStream& fragme
} }
// Compile the shader program // Compile the shader program
return CompileProgram(&vertexShader[0], &fragmentShader[0]); return Compile(&vertexShader[0], &fragmentShader[0]);
} }
@ -449,7 +449,7 @@ bool Shader::IsAvailable()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Shader::CompileProgram(const char* vertexShaderCode, const char* fragmentShaderCode) bool Shader::Compile(const char* vertexShaderCode, const char* fragmentShaderCode)
{ {
EnsureGlContext(); EnsureGlContext();

View File

@ -41,7 +41,7 @@ namespace sf
Thread::~Thread() Thread::~Thread()
{ {
Wait(); Wait();
delete myFunction; delete myEntryPoint;
} }
@ -80,7 +80,7 @@ void Thread::Terminate()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Thread::Run() void Thread::Run()
{ {
myFunction->Run(); myEntryPoint->Run();
} }
} // namespace sf } // namespace sf

View File

@ -45,7 +45,7 @@ namespace sf
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Window::Window() : Window::Window() :
myWindow (NULL), myImpl (NULL),
myContext (NULL), myContext (NULL),
myLastFrameTime (0), myLastFrameTime (0),
myFramerateLimit(0) myFramerateLimit(0)
@ -56,7 +56,7 @@ myFramerateLimit(0)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Window::Window(VideoMode mode, const std::string& title, Uint32 style, const ContextSettings& settings) : Window::Window(VideoMode mode, const std::string& title, Uint32 style, const ContextSettings& settings) :
myWindow (NULL), myImpl (NULL),
myContext (NULL), myContext (NULL),
myLastFrameTime (0), myLastFrameTime (0),
myFramerateLimit(0) myFramerateLimit(0)
@ -67,7 +67,7 @@ myFramerateLimit(0)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Window::Window(WindowHandle handle, const ContextSettings& settings) : Window::Window(WindowHandle handle, const ContextSettings& settings) :
myWindow (NULL), myImpl (NULL),
myContext (NULL), myContext (NULL),
myLastFrameTime (0), myLastFrameTime (0),
myFramerateLimit(0) myFramerateLimit(0)
@ -117,10 +117,10 @@ void Window::Create(VideoMode mode, const std::string& title, Uint32 style, cons
style |= Style::Titlebar; style |= Style::Titlebar;
// Recreate the window implementation // Recreate the window implementation
myWindow = priv::WindowImpl::New(mode, title, style); myImpl = priv::WindowImpl::New(mode, title, style);
// Recreate the context // Recreate the context
myContext = priv::GlContext::New(settings, myWindow, mode.BitsPerPixel); myContext = priv::GlContext::New(settings, myImpl, mode.BitsPerPixel);
// Perform common initializations // Perform common initializations
Initialize(); Initialize();
@ -134,10 +134,10 @@ void Window::Create(WindowHandle handle, const ContextSettings& settings)
Close(); Close();
// Recreate the window implementation // Recreate the window implementation
myWindow = priv::WindowImpl::New(handle); myImpl = priv::WindowImpl::New(handle);
// Recreate the context // Recreate the context
myContext = priv::GlContext::New(settings, myWindow, VideoMode::GetDesktopMode().BitsPerPixel); myContext = priv::GlContext::New(settings, myImpl, VideoMode::GetDesktopMode().BitsPerPixel);
// Perform common initializations // Perform common initializations
Initialize(); Initialize();
@ -154,11 +154,11 @@ void Window::Close()
myContext = NULL; myContext = NULL;
} }
if (myWindow) if (myImpl)
{ {
// Delete the window implementation // Delete the window implementation
delete myWindow; delete myImpl;
myWindow = NULL; myImpl = NULL;
} }
// Update the fullscreen window // Update the fullscreen window
@ -168,23 +168,23 @@ void Window::Close()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Window::IsOpened() const bool Window::IsOpen() const
{ {
return myWindow != NULL; return myImpl != NULL;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int Window::GetWidth() const unsigned int Window::GetWidth() const
{ {
return myWindow ? myWindow->GetWidth() : 0; return myImpl ? myImpl->GetWidth() : 0;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned int Window::GetHeight() const unsigned int Window::GetHeight() const
{ {
return myWindow ? myWindow->GetHeight() : 0; return myImpl ? myImpl->GetHeight() : 0;
} }
@ -200,7 +200,7 @@ const ContextSettings& Window::GetSettings() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Window::PollEvent(Event& event) bool Window::PollEvent(Event& event)
{ {
if (myWindow && myWindow->PopEvent(event, false)) if (myImpl && myImpl->PopEvent(event, false))
{ {
return FilterEvent(event); return FilterEvent(event);
} }
@ -214,7 +214,7 @@ bool Window::PollEvent(Event& event)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Window::WaitEvent(Event& event) bool Window::WaitEvent(Event& event)
{ {
if (myWindow && myWindow->PopEvent(event, true)) if (myImpl && myImpl->PopEvent(event, true))
{ {
return FilterEvent(event); return FilterEvent(event);
} }
@ -236,56 +236,56 @@ void Window::EnableVerticalSync(bool enabled)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Window::ShowMouseCursor(bool show) void Window::ShowMouseCursor(bool show)
{ {
if (myWindow) if (myImpl)
myWindow->ShowMouseCursor(show); myImpl->ShowMouseCursor(show);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Window::SetPosition(int x, int y) void Window::SetPosition(int x, int y)
{ {
if (myWindow) if (myImpl)
myWindow->SetPosition(x, y); myImpl->SetPosition(x, y);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Window::SetSize(unsigned int width, unsigned int height) void Window::SetSize(unsigned int width, unsigned int height)
{ {
if (myWindow) if (myImpl)
myWindow->SetSize(width, height); myImpl->SetSize(width, height);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Window::SetTitle(const std::string& title) void Window::SetTitle(const std::string& title)
{ {
if (myWindow) if (myImpl)
myWindow->SetTitle(title); myImpl->SetTitle(title);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Window::Show(bool show) void Window::Show(bool show)
{ {
if (myWindow) if (myImpl)
myWindow->Show(show); myImpl->Show(show);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Window::EnableKeyRepeat(bool enabled) void Window::EnableKeyRepeat(bool enabled)
{ {
if (myWindow) if (myImpl)
myWindow->EnableKeyRepeat(enabled); myImpl->EnableKeyRepeat(enabled);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Window::SetIcon(unsigned int width, unsigned int height, const Uint8* pixels) void Window::SetIcon(unsigned int width, unsigned int height, const Uint8* pixels)
{ {
if (myWindow) if (myImpl)
myWindow->SetIcon(width, height, pixels); myImpl->SetIcon(width, height, pixels);
} }
@ -349,15 +349,15 @@ Uint32 Window::GetFrameTime() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Window::SetJoystickThreshold(float threshold) void Window::SetJoystickThreshold(float threshold)
{ {
if (myWindow) if (myImpl)
myWindow->SetJoystickThreshold(threshold); myImpl->SetJoystickThreshold(threshold);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle Window::GetSystemHandle() const WindowHandle Window::GetSystemHandle() const
{ {
return myWindow ? myWindow->GetSystemHandle() : 0; return myImpl ? myImpl->GetSystemHandle() : 0;
} }