Fixed <sys/time.h> / <time.h> handling as suggested by the autoconf
[freeglut] / src / freeglut_gamemode.c
index db70942..f57d935 100644 (file)
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <GL/freeglut.h>
 #include "freeglut_internal.h"
 
@@ -96,7 +92,7 @@ static void fghRememberState( void )
     );
 
     if( !fgDisplay.DisplayModeValid )
-            fgWarning( "Runtime use of XF86VidModeGetModeLine failed.\n" );
+            fgWarning( "Runtime use of XF86VidModeGetModeLine failed." );
 
 #   else
     /*
@@ -360,6 +356,8 @@ void FGAPIENTRY glutGameModeString( const char* string )
 {
     int width = 640, height = 480, depth = 16, refresh = 72;
 
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGameModeString" );
+
     /*
      * This one seems a bit easier than glutInitDisplayString. The bad thing
      * about it that I was unable to find the game mode string definition, so
@@ -391,6 +389,8 @@ void FGAPIENTRY glutGameModeString( const char* string )
  */
 int FGAPIENTRY glutEnterGameMode( void )
 {
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutEnterGameMode" );
+
     if( fgStructure.GameMode )
         fgAddToWindowDestroyList( fgStructure.GameMode );
     else
@@ -509,12 +509,13 @@ int FGAPIENTRY glutEnterGameMode( void )
  */
 void FGAPIENTRY glutLeaveGameMode( void )
 {
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutLeaveGameMode" );
+
     freeglut_return_if_fail( fgStructure.GameMode );
 
     fgStructure.GameMode->State.IsGameMode = GL_FALSE;
 
     fgAddToWindowDestroyList( fgStructure.GameMode );
-
     fgStructure.GameMode = NULL;
 
 #if TARGET_HOST_UNIX_X11
@@ -532,6 +533,8 @@ void FGAPIENTRY glutLeaveGameMode( void )
  */
 int FGAPIENTRY glutGameModeGet( GLenum eWhat )
 {
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutGameModeGet" );
+
     switch( eWhat )
     {
     case GLUT_GAME_MODE_ACTIVE:
@@ -559,6 +562,7 @@ int FGAPIENTRY glutGameModeGet( GLenum eWhat )
         return !!fgStructure.GameMode;
     }
 
+    fgWarning( "Unknown gamemode get: %d", eWhat );
     return -1;
 }