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;
// Start game loop
while (window.IsOpened())
while (window.IsOpen())
{
// Process events
sf::Event event;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -503,7 +503,7 @@ private :
/// \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

View File

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

View File

@ -66,8 +66,8 @@ struct ThreadMemberFunc : ThreadFunc
////////////////////////////////////////////////////////////
template <typename F>
Thread::Thread(F functor) :
myImpl (NULL),
myFunction(new priv::ThreadFunctor<F>(functor))
myImpl (NULL),
myEntryPoint(new priv::ThreadFunctor<F>(functor))
{
}
@ -75,8 +75,8 @@ myFunction(new priv::ThreadFunctor<F>(functor))
////////////////////////////////////////////////////////////
template <typename F, typename A>
Thread::Thread(F function, A argument) :
myImpl (NULL),
myFunction(new priv::ThreadFunctorWithArg<F, A>(function, argument))
myImpl (NULL),
myEntryPoint(new priv::ThreadFunctorWithArg<F, A>(function, argument))
{
}
@ -84,7 +84,7 @@ myFunction(new priv::ThreadFunctorWithArg<F, A>(function, argument))
////////////////////////////////////////////////////////////
template <typename C>
Thread::Thread(void(C::*function)(), C* object) :
myImpl (NULL),
myFunction(new priv::ThreadMemberFunc<C>(function, object))
myImpl (NULL),
myEntryPoint(new priv::ThreadMemberFunc<C>(function, object))
{
}

View File

@ -145,7 +145,7 @@ public :
/// After calling this function, the sf::Window instance remains
/// valid and you can call Create() to recreate the window.
/// 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.
///
////////////////////////////////////////////////////////////
@ -160,7 +160,7 @@ public :
/// \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
@ -471,7 +471,7 @@ private :
////////////////////////////////////////////////////////////
// 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
Clock myClock; ///< Clock for measuring the elapsed time between frames
Uint32 myLastFrameTime; ///< Time elapsed since last frame
@ -519,7 +519,7 @@ private :
/// window.SetFramerateLimit(60);
///
/// // The main loop - ends as soon as the window is closed
/// while (window.IsOpened())
/// while (window.IsOpen())
/// {
/// // Event processing
/// sf::Event event;

View File

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

View File

@ -118,9 +118,9 @@ bool Shader::LoadFromFile(const std::string& filename, Type type)
// Compile the shader program
if (type == Vertex)
return CompileProgram(&shader[0], NULL);
return Compile(&shader[0], NULL);
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
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
if (type == Vertex)
return CompileProgram(shader.c_str(), NULL);
return Compile(shader.c_str(), NULL);
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)
{
// 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
if (type == Vertex)
return CompileProgram(&shader[0], NULL);
return Compile(&shader[0], NULL);
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
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();

View File

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

View File

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