diff --git a/lib/enable.c b/lib/enable.c index ffef2cb4..eca7b03e 100644 --- a/lib/enable.c +++ b/lib/enable.c @@ -44,9 +44,7 @@ static void enableMouseCursor( void ) int centerPosX, centerPosY; if( !_glfwWin.opened || !_glfwWin.mouseLock ) - { return; - } // Show mouse cursor _glfwPlatformShowMouseCursor(); @@ -79,9 +77,7 @@ static void enableMouseCursor( void ) static void disableMouseCursor( void ) { if( !_glfwWin.opened || _glfwWin.mouseLock ) - { return; - } // Hide mouse cursor _glfwPlatformHideMouseCursor(); @@ -118,9 +114,7 @@ static void disableStickyKeys( void ) for( i = 0; i <= GLFW_KEY_LAST; i++ ) { if( _glfwInput.Key[ i ] == 2 ) - { _glfwInput.Key[ i ] = 0; - } } } @@ -148,9 +142,7 @@ static void disableStickyMouseButtons( void ) for( i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++ ) { if( _glfwInput.MouseButton[ i ] == 2 ) - { _glfwInput.MouseButton[ i ] = 0; - } } } @@ -162,9 +154,7 @@ static void disableStickyMouseButtons( void ) static void enableSystemKeys( void ) { if( !_glfwWin.sysKeysDisabled ) - { return; - } _glfwPlatformEnableSystemKeys(); @@ -179,9 +169,7 @@ static void enableSystemKeys( void ) static void disableSystemKeys( void ) { if( _glfwWin.sysKeysDisabled ) - { return; - } _glfwPlatformDisableSystemKeys(); @@ -228,7 +216,6 @@ static void disableAutoPollEvents( void ) } - //************************************************************************ //**** GLFW user functions **** //************************************************************************ @@ -239,11 +226,8 @@ static void disableAutoPollEvents( void ) GLFWAPI void glfwEnable( int token ) { - // Is GLFW initialized? if( !_glfwInitialized ) - { return; - } switch( token ) { @@ -277,11 +261,8 @@ GLFWAPI void glfwEnable( int token ) GLFWAPI void glfwDisable( int token ) { - // Is GLFW initialized? if( !_glfwInitialized ) - { return; - } switch( token ) { diff --git a/lib/fullscreen.c b/lib/fullscreen.c index f5693914..574e544f 100644 --- a/lib/fullscreen.c +++ b/lib/fullscreen.c @@ -41,13 +41,11 @@ GLFWAPI int glfwGetVideoModes( GLFWvidmode *list, int maxcount ) { - int count, i, swap, res1, res2, depth1, depth2; + int count, i, swap, res1, res2, depth1, depth2; GLFWvidmode vm; if( !_glfwInitialized || maxcount <= 0 || list == (GLFWvidmode*) 0 ) - { return 0; - } // Get list of video modes count = _glfwPlatformGetVideoModes( list, maxcount ); @@ -63,7 +61,8 @@ GLFWAPI int glfwGetVideoModes( GLFWvidmode *list, int maxcount ) res2 = list[i+1].Width*list[i+1].Height; depth2 = list[i+1].RedBits+list[i+1].GreenBits+ list[i+1].BlueBits; - if( (depth2= '0' && *ptr <= '9'; ptr ++ ) - { _major = 10*_major + (*ptr - '0'); - } + if( *ptr == '.' ) { ptr ++; for( _minor = 0; *ptr >= '0' && *ptr <= '9'; ptr ++ ) - { _minor = 10*_minor + (*ptr - '0'); - } + if( *ptr == '.' ) { ptr ++; for( _rev = 0; *ptr >= '0' && *ptr <= '9'; ptr ++ ) - { _rev = 10*_rev + (*ptr - '0'); - } } } @@ -103,17 +97,15 @@ int _glfwStringInExtensionString( const char *string, { where = (GLubyte *) strstr( (const char *) start, string ); if( !where ) - { return GL_FALSE; - } + terminator = where + strlen( string ); if( where == start || *(where - 1) == ' ' ) { if( *terminator == ' ' || *terminator == '\0' ) - { break; - } } + start = terminator; } @@ -137,18 +129,13 @@ GLFWAPI int glfwExtensionSupported( const char *extension ) GLint count; int i; - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return GL_FALSE; - } // Extension names should not have spaces where = (GLubyte *) strchr( extension, ' ' ); if( where || *extension == '\0' ) - { return GL_FALSE; - } if( _glfwWin.glMajor < 3 ) { @@ -158,9 +145,7 @@ GLFWAPI int glfwExtensionSupported( const char *extension ) if( extensions != NULL ) { if( _glfwStringInExtensionString( extension, extensions ) ) - { return GL_TRUE; - } } } else @@ -181,9 +166,7 @@ GLFWAPI int glfwExtensionSupported( const char *extension ) // Additional platform specific extension checking (e.g. WGL) if( _glfwPlatformExtensionSupported( extension ) ) - { return GL_TRUE; - } return GL_FALSE; } @@ -196,11 +179,8 @@ GLFWAPI int glfwExtensionSupported( const char *extension ) GLFWAPI void * glfwGetProcAddress( const char *procname ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return NULL; - } return _glfwPlatformGetProcAddress( procname ); } @@ -212,23 +192,16 @@ GLFWAPI void * glfwGetProcAddress( const char *procname ) GLFWAPI void glfwGetGLVersion( int *major, int *minor, int *rev ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } if( major != NULL ) - { *major = _glfwWin.glMajor; - } + if( minor != NULL ) - { *minor = _glfwWin.glMinor; - } + if( rev != NULL ) - { *rev = _glfwWin.glRevision; - } } diff --git a/lib/init.c b/lib/init.c index 7460aa07..b522ff45 100644 --- a/lib/init.c +++ b/lib/init.c @@ -37,16 +37,13 @@ //************************************************************************ //======================================================================== -// glfwInit() - Initialize various GLFW state +// Initialize various GLFW state //======================================================================== GLFWAPI int glfwInit( void ) { - // Is GLFW already initialized? if( _glfwInitialized ) - { return GL_TRUE; - } memset( &_glfwLibrary, 0, sizeof( _glfwLibrary ) ); memset( &_glfwWin, 0, sizeof( _glfwWin ) ); @@ -62,9 +59,7 @@ GLFWAPI int glfwInit( void ) // Platform specific initialization if( !_glfwPlatformInit() ) - { return GL_FALSE; - } // Form now on, GLFW state is valid _glfwInitialized = GL_TRUE; @@ -73,24 +68,18 @@ GLFWAPI int glfwInit( void ) } - //======================================================================== // Close window and shut down library //======================================================================== GLFWAPI void glfwTerminate( void ) { - // Is GLFW initialized? if( !_glfwInitialized ) - { return; - } // Platform specific termination if( !_glfwPlatformTerminate() ) - { return; - } // GLFW is no longer initialized _glfwInitialized = GL_FALSE; @@ -98,13 +87,18 @@ GLFWAPI void glfwTerminate( void ) //======================================================================== -// glfwGetVersion() - Get GLFW version +// Get GLFW version //======================================================================== GLFWAPI void glfwGetVersion( int *major, int *minor, int *rev ) { - if( major != NULL ) *major = GLFW_VERSION_MAJOR; - if( minor != NULL ) *minor = GLFW_VERSION_MINOR; - if( rev != NULL ) *rev = GLFW_VERSION_REVISION; + if( major != NULL ) + *major = GLFW_VERSION_MAJOR; + + if( minor != NULL ) + *minor = GLFW_VERSION_MINOR; + + if( rev != NULL ) + *rev = GLFW_VERSION_REVISION; } diff --git a/lib/input.c b/lib/input.c index 323b77da..d866e52c 100644 --- a/lib/input.c +++ b/lib/input.c @@ -37,17 +37,12 @@ GLFWAPI int glfwGetKey( int key ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return GLFW_RELEASE; - } // Is it a valid key? if( key < 0 || key > GLFW_KEY_LAST ) - { return GLFW_RELEASE; - } if( _glfwInput.Key[ key ] == GLFW_STICK ) { @@ -66,17 +61,12 @@ GLFWAPI int glfwGetKey( int key ) GLFWAPI int glfwGetMouseButton( int button ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return GLFW_RELEASE; - } // Is it a valid mouse button? if( button < 0 || button > GLFW_MOUSE_BUTTON_LAST ) - { return GLFW_RELEASE; - } if( _glfwInput.MouseButton[ button ] == GLFW_STICK ) { @@ -95,21 +85,15 @@ GLFWAPI int glfwGetMouseButton( int button ) GLFWAPI void glfwGetMousePos( int *xpos, int *ypos ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Return mouse position if( xpos != NULL ) - { *xpos = _glfwInput.MousePosX; - } + if( ypos != NULL ) - { *ypos = _glfwInput.MousePosY; - } } @@ -119,17 +103,12 @@ GLFWAPI void glfwGetMousePos( int *xpos, int *ypos ) GLFWAPI void glfwSetMousePos( int xpos, int ypos ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Don't do anything if the mouse position did not change if( xpos == _glfwInput.MousePosX && ypos == _glfwInput.MousePosY ) - { return; - } // Set GLFW mouse position _glfwInput.MousePosX = xpos; @@ -137,9 +116,7 @@ GLFWAPI void glfwSetMousePos( int xpos, int ypos ) // If we have a locked mouse, do not change cursor position if( _glfwWin.mouseLock ) - { return; - } // Update physical cursor position _glfwPlatformSetMouseCursorPos( xpos, ypos ); @@ -152,11 +129,8 @@ GLFWAPI void glfwSetMousePos( int xpos, int ypos ) GLFWAPI int glfwGetMouseWheel( void ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return 0; - } // Return mouse wheel position return _glfwInput.WheelPos; @@ -169,11 +143,8 @@ GLFWAPI int glfwGetMouseWheel( void ) GLFWAPI void glfwSetMouseWheel( int pos ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Set mouse wheel position _glfwInput.WheelPos = pos; @@ -186,11 +157,8 @@ GLFWAPI void glfwSetMouseWheel( int pos ) GLFWAPI void glfwSetKeyCallback( GLFWkeyfun cbfun ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Set callback function _glfwWin.keyCallback = cbfun; @@ -203,11 +171,8 @@ GLFWAPI void glfwSetKeyCallback( GLFWkeyfun cbfun ) GLFWAPI void glfwSetCharCallback( GLFWcharfun cbfun ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Set callback function _glfwWin.charCallback = cbfun; @@ -220,11 +185,8 @@ GLFWAPI void glfwSetCharCallback( GLFWcharfun cbfun ) GLFWAPI void glfwSetMouseButtonCallback( GLFWmousebuttonfun cbfun ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Set callback function _glfwWin.mouseButtonCallback = cbfun; @@ -237,11 +199,8 @@ GLFWAPI void glfwSetMouseButtonCallback( GLFWmousebuttonfun cbfun ) GLFWAPI void glfwSetMousePosCallback( GLFWmouseposfun cbfun ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Set callback function _glfwWin.mousePosCallback = cbfun; @@ -249,9 +208,7 @@ GLFWAPI void glfwSetMousePosCallback( GLFWmouseposfun cbfun ) // Call the callback function to let the application know the current // mouse position if( cbfun ) - { cbfun( _glfwInput.MousePosX, _glfwInput.MousePosY ); - } } @@ -261,11 +218,8 @@ GLFWAPI void glfwSetMousePosCallback( GLFWmouseposfun cbfun ) GLFWAPI void glfwSetMouseWheelCallback( GLFWmousewheelfun cbfun ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Set callback function _glfwWin.mouseWheelCallback = cbfun; @@ -273,8 +227,6 @@ GLFWAPI void glfwSetMouseWheelCallback( GLFWmousewheelfun cbfun ) // Call the callback function to let the application know the current // mouse wheel position if( cbfun ) - { cbfun( _glfwInput.WheelPos ); - } } diff --git a/lib/joystick.c b/lib/joystick.c index 4fb44eec..d66e1109 100644 --- a/lib/joystick.c +++ b/lib/joystick.c @@ -41,11 +41,8 @@ GLFWAPI int glfwGetJoystickParam( int joy, int param ) { - // Is GLFW initialized? if( !_glfwInitialized ) - { return 0; - } return _glfwPlatformGetJoystickParam( joy, param ); } @@ -59,17 +56,12 @@ GLFWAPI int glfwGetJoystickPos( int joy, float *pos, int numaxes ) { int i; - // Is GLFW initialized? if( !_glfwInitialized ) - { return 0; - } // Clear positions for( i = 0; i < numaxes; i++ ) - { pos[ i ] = 0.0f; - } return _glfwPlatformGetJoystickPos( joy, pos, numaxes ); } @@ -85,17 +77,12 @@ GLFWAPI int glfwGetJoystickButtons( int joy, { int i; - // Is GLFW initialized? if( !_glfwInitialized ) - { return 0; - } // Clear button states for( i = 0; i < numbuttons; i++ ) - { buttons[ i ] = GLFW_RELEASE; - } return _glfwPlatformGetJoystickButtons( joy, buttons, numbuttons ); } diff --git a/lib/time.c b/lib/time.c index 5228b268..e4d41332 100644 --- a/lib/time.c +++ b/lib/time.c @@ -41,11 +41,8 @@ GLFWAPI double glfwGetTime( void ) { - // Is GLFW initialized? if( !_glfwInitialized ) - { return 0.0; - } return _glfwPlatformGetTime(); } @@ -57,11 +54,8 @@ GLFWAPI double glfwGetTime( void ) GLFWAPI void glfwSetTime( double time ) { - // Is GLFW initialized? if( !_glfwInitialized ) - { return; - } _glfwPlatformSetTime( time ); } diff --git a/lib/window.c b/lib/window.c index 39066cdf..7af9ae19 100644 --- a/lib/window.c +++ b/lib/window.c @@ -33,7 +33,6 @@ #include - //************************************************************************ //**** GLFW internal functions **** //************************************************************************ @@ -66,18 +65,14 @@ void _glfwInputDeactivation( void ) for( i = 0; i <= GLFW_KEY_LAST; i ++ ) { if( _glfwInput.Key[ i ] == GLFW_PRESS ) - { _glfwInputKey( i, GLFW_RELEASE ); - } } // Release all mouse buttons for( i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i ++ ) { if( _glfwInput.MouseButton[ i ] == GLFW_PRESS ) - { _glfwInputMouseClick( i, GLFW_RELEASE ); - } } } @@ -92,18 +87,14 @@ void _glfwClearInput( void ) // Release all keyboard keys for( i = 0; i <= GLFW_KEY_LAST; i ++ ) - { _glfwInput.Key[ i ] = GLFW_RELEASE; - } // Clear last character _glfwInput.LastChar = 0; // Release all mouse buttons for( i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i ++ ) - { _glfwInput.MouseButton[ i ] = GLFW_RELEASE; - } // Set mouse position to (0,0) _glfwInput.MousePosX = 0; @@ -130,21 +121,15 @@ void _glfwInputKey( int key, int action ) int keyrepeat = 0; if( key < 0 || key > GLFW_KEY_LAST ) - { return; - } // Are we trying to release an already released key? if( action == GLFW_RELEASE && _glfwInput.Key[ key ] != GLFW_PRESS ) - { return; - } // Register key action if( action == GLFW_RELEASE && _glfwInput.StickyKeys ) - { _glfwInput.Key[ key ] = GLFW_STICK; - } else { keyrepeat = (_glfwInput.Key[ key ] == GLFW_PRESS) && @@ -154,9 +139,7 @@ void _glfwInputKey( int key, int action ) // Call user callback function if( _glfwWin.keyCallback && (_glfwInput.KeyRepeat || !keyrepeat) ) - { _glfwWin.keyCallback( key, action ); - } } @@ -170,25 +153,17 @@ void _glfwInputChar( int character, int action ) // Valid Unicode (ISO 10646) character? if( !( (character >= 32 && character <= 126) || character >= 160 ) ) - { return; - } // Is this a key repeat? if( action == GLFW_PRESS && _glfwInput.LastChar == character ) - { keyrepeat = 1; - } // Store this character as last character (or clear it, if released) if( action == GLFW_PRESS ) - { _glfwInput.LastChar = character; - } else - { _glfwInput.LastChar = 0; - } if( action != GLFW_PRESS ) { @@ -209,9 +184,7 @@ void _glfwInputChar( int character, int action ) } if( _glfwWin.charCallback && (_glfwInput.KeyRepeat || !keyrepeat) ) - { _glfwWin.charCallback( character, action ); - } } @@ -225,19 +198,13 @@ void _glfwInputMouseClick( int button, int action ) { // Register mouse button action if( action == GLFW_RELEASE && _glfwInput.StickyMouseButtons ) - { _glfwInput.MouseButton[ button ] = GLFW_STICK; - } else - { _glfwInput.MouseButton[ button ] = (char) action; - } // Call user callback function if( _glfwWin.mouseButtonCallback ) - { _glfwWin.mouseButtonCallback( button, action ); - } } } @@ -282,24 +249,16 @@ const _GLFWfbconfig *_glfwChooseFBConfig( const _GLFWfbconfig *desired, missing = 0; if( desired->alphaBits > 0 && current->alphaBits == 0 ) - { missing++; - } if( desired->depthBits > 0 && current->depthBits == 0 ) - { missing++; - } if( desired->stencilBits > 0 && current->stencilBits == 0 ) - { missing++; - } if( desired->auxBuffers > 0 && current->auxBuffers < desired->auxBuffers ) - { missing += desired->auxBuffers - current->auxBuffers; - } if( desired->samples > 0 && current->samples == 0 ) { @@ -392,9 +351,7 @@ const _GLFWfbconfig *_glfwChooseFBConfig( const _GLFWfbconfig *desired, // Figure out if the current one is better than the best one found so far if( missing < leastMissing ) - { closest = current; - } else if( missing == leastMissing ) { if( desiresColor ) @@ -442,11 +399,8 @@ GLFWAPI int glfwOpenWindow( int width, int height, _GLFWfbconfig fbconfig; _GLFWwndconfig wndconfig; - // Is GLFW initialized? if( !_glfwInitialized || _glfwWin.opened ) - { return GL_FALSE; - } // Set up desired framebuffer config fbconfig.redBits = Max( redbits, 0 ); @@ -511,9 +465,7 @@ GLFWAPI int glfwOpenWindow( int width, int height, // Check input arguments if( mode != GLFW_WINDOW && mode != GLFW_FULLSCREEN ) - { return GL_FALSE; - } // Clear GLFW window state _glfwWin.active = GL_TRUE; @@ -557,9 +509,7 @@ GLFWAPI int glfwOpenWindow( int width, int height, // Platform specific window opening routine if( !_glfwPlatformOpenWindow( width, height, &wndconfig, &fbconfig ) ) - { return GL_FALSE; - } // Flag that window is now opened _glfwWin.opened = GL_TRUE; @@ -601,9 +551,7 @@ GLFWAPI int glfwOpenWindow( int width, int height, // If full-screen mode was requested, disable mouse cursor if( mode == GLFW_FULLSCREEN ) - { glfwDisable( GLFW_MOUSE_CURSOR ); - } // Start by clearing the front buffer to black (avoid ugly desktop // remains in our OpenGL window) @@ -622,9 +570,7 @@ GLFWAPI void glfwOpenWindowHint( int target, int hint ) { // Is GLFW initialized? if( !_glfwInitialized ) - { return; - } switch( target ) { @@ -683,9 +629,7 @@ GLFWAPI void glfwOpenWindowHint( int target, int hint ) GLFWAPI void glfwCloseWindow( void ) { if( !_glfwInitialized ) - { return; - } // Show mouse pointer again (if hidden) glfwEnable( GLFW_MOUSE_CURSOR ); @@ -703,11 +647,8 @@ GLFWAPI void glfwCloseWindow( void ) GLFWAPI void glfwSetWindowTitle( const char *title ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Set window title _glfwPlatformSetWindowTitle( title ); @@ -721,13 +662,10 @@ GLFWAPI void glfwSetWindowTitle( const char *title ) GLFWAPI void glfwGetWindowSize( int *width, int *height ) { if( width != NULL ) - { *width = _glfwWin.width; - } + if( height != NULL ) - { *height = _glfwWin.height; - } } @@ -737,17 +675,12 @@ GLFWAPI void glfwGetWindowSize( int *width, int *height ) GLFWAPI void glfwSetWindowSize( int width, int height ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened || _glfwWin.iconified ) - { return; - } // Don't do anything if the window size did not change if( width == _glfwWin.width && height == _glfwWin.height ) - { return; - } // Change window size _glfwPlatformSetWindowSize( width, height ); @@ -764,7 +697,6 @@ GLFWAPI void glfwSetWindowSize( int width, int height ) GLFWAPI void glfwSetWindowPos( int x, int y ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened || _glfwWin.fullscreen || _glfwWin.iconified ) { @@ -782,11 +714,8 @@ GLFWAPI void glfwSetWindowPos( int x, int y ) GLFWAPI void glfwIconifyWindow( void ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened || _glfwWin.iconified ) - { return; - } // Iconify window _glfwPlatformIconifyWindow(); @@ -799,11 +728,8 @@ GLFWAPI void glfwIconifyWindow( void ) GLFWAPI void glfwRestoreWindow( void ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened || !_glfwWin.iconified ) - { return; - } // Restore iconified window _glfwPlatformRestoreWindow(); @@ -819,23 +745,16 @@ GLFWAPI void glfwRestoreWindow( void ) GLFWAPI void glfwSwapBuffers( void ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Update display-buffer if( _glfwWin.opened ) - { _glfwPlatformSwapBuffers(); - } // Check for window messages if( _glfwWin.autoPollEvents ) - { glfwPollEvents(); - } } @@ -845,11 +764,8 @@ GLFWAPI void glfwSwapBuffers( void ) GLFWAPI void glfwSwapInterval( int interval ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Set double buffering swap interval _glfwPlatformSwapInterval( interval ); @@ -862,19 +778,14 @@ GLFWAPI void glfwSwapInterval( int interval ) GLFWAPI int glfwGetWindowParam( int param ) { - // Is GLFW initialized? if( !_glfwInitialized ) - { return 0; - } - // Is the window opened? if( !_glfwWin.opened ) { if( param == GLFW_OPENED ) - { return GL_FALSE; - } + return 0; } @@ -941,11 +852,8 @@ GLFWAPI int glfwGetWindowParam( int param ) GLFWAPI void glfwSetWindowSizeCallback( GLFWwindowsizefun cbfun ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Set callback function _glfwWin.windowSizeCallback = cbfun; @@ -953,9 +861,7 @@ GLFWAPI void glfwSetWindowSizeCallback( GLFWwindowsizefun cbfun ) // Call the callback function to let the application know the current // window size if( cbfun ) - { cbfun( _glfwWin.width, _glfwWin.height ); - } } //======================================================================== @@ -964,11 +870,8 @@ GLFWAPI void glfwSetWindowSizeCallback( GLFWwindowsizefun cbfun ) GLFWAPI void glfwSetWindowCloseCallback( GLFWwindowclosefun cbfun ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Set callback function _glfwWin.windowCloseCallback = cbfun; @@ -981,11 +884,8 @@ GLFWAPI void glfwSetWindowCloseCallback( GLFWwindowclosefun cbfun ) GLFWAPI void glfwSetWindowRefreshCallback( GLFWwindowrefreshfun cbfun ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Set callback function _glfwWin.windowRefreshCallback = cbfun; @@ -998,11 +898,8 @@ GLFWAPI void glfwSetWindowRefreshCallback( GLFWwindowrefreshfun cbfun ) GLFWAPI void glfwPollEvents( void ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Poll for new events _glfwPlatformPollEvents(); @@ -1015,11 +912,8 @@ GLFWAPI void glfwPollEvents( void ) GLFWAPI void glfwWaitEvents( void ) { - // Is GLFW initialized? if( !_glfwInitialized || !_glfwWin.opened ) - { return; - } // Poll for new events _glfwPlatformWaitEvents();