Added glfwIsWindow.

This commit is contained in:
Camilla Berglund 2010-09-09 18:42:41 +02:00
parent 39fd7a5ac1
commit 29a0ca47f9
3 changed files with 16 additions and 2 deletions

View File

@ -606,7 +606,7 @@ int main( void )
glfwPollEvents(); glfwPollEvents();
/* Check if we are still running */ /* Check if we are still running */
running = !glfwGetKey( window, GLFW_KEY_ESC ); running = glfwIsWindow(window) && !glfwGetKey( window, GLFW_KEY_ESC );
} }
while( running ); while( running );

View File

@ -391,6 +391,7 @@ GLFWAPI void glfwGetDesktopMode(GLFWvidmode* mode);
GLFWAPI GLFWwindow glfwOpenWindow(int width, int height, int redbits, int greenbits, int bluebits, int alphabits, int depthbits, int stencilbits, int mode); GLFWAPI GLFWwindow glfwOpenWindow(int width, int height, int redbits, int greenbits, int bluebits, int alphabits, int depthbits, int stencilbits, int mode);
GLFWAPI void glfwOpenWindowHint(int target, int hint); GLFWAPI void glfwOpenWindowHint(int target, int hint);
GLFWAPI void glfwMakeWindowCurrent(GLFWwindow window); GLFWAPI void glfwMakeWindowCurrent(GLFWwindow window);
GLFWAPI int glfwIsWindow(GLFWwindow window);
GLFWAPI void glfwCloseWindow(GLFWwindow window); GLFWAPI void glfwCloseWindow(GLFWwindow window);
GLFWAPI void glfwSetWindowTitle(GLFWwindow, const char* title); GLFWAPI void glfwSetWindowTitle(GLFWwindow, const char* title);
GLFWAPI void glfwGetWindowSize(GLFWwindow, int* width, int* height); GLFWAPI void glfwGetWindowSize(GLFWwindow, int* width, int* height);

View File

@ -565,7 +565,7 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
GLFWAPI void glfwMakeWindowCurrent(GLFWwindow window) GLFWAPI void glfwMakeWindowCurrent(GLFWwindow window)
{ {
if (_glfwLibrary.currentWindow == window) if (!_glfwInitialized || _glfwLibrary.currentWindow == window)
return; return;
_glfwPlatformMakeWindowCurrent(window); _glfwPlatformMakeWindowCurrent(window);
@ -573,6 +573,19 @@ GLFWAPI void glfwMakeWindowCurrent(GLFWwindow window)
} }
//========================================================================
// Returns GL_TRUE if the specified window handle is an actual window
//========================================================================
GLFWAPI int glfwIsWindow(GLFWwindow window)
{
if (!_glfwInitialized)
return;
return window == _glfwLibrary.window;
}
//======================================================================== //========================================================================
// Set hints for opening the window // Set hints for opening the window
//======================================================================== //========================================================================