- removed glib dependencies from win32 code
authorAndreas Umbach <umbach@gmail.com>
Mon, 30 Jul 2001 14:41:11 +0000 (14:41 +0000)
committerAndreas Umbach <umbach@gmail.com>
Mon, 30 Jul 2001 14:41:11 +0000 (14:41 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@14 7f0cb862-5218-0410-a997-914c9d46530a

freeglut-1.3/freeglut_gamemode.c
freeglut-1.3/freeglut_init.c
freeglut-1.3/freeglut_main.c
freeglut-1.3/freeglut_window.c

index 591df38..13f2526 100644 (file)
@@ -80,6 +80,10 @@ void fghRememberState( void )
     /*
      * Grab the current desktop settings...
      */
     /*
      * Grab the current desktop settings...
      */
+
+/* hack to get around my stupid cross-gcc headers */
+#define ENUM_CURRENT_SETTINGS -1
+
     EnumDisplaySettings( NULL, ENUM_CURRENT_SETTINGS, &fgDisplay.DisplayMode );
 
     /*
     EnumDisplaySettings( NULL, ENUM_CURRENT_SETTINGS, &fgDisplay.DisplayMode );
 
     /*
@@ -233,8 +237,8 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest )
 
 #elif TARGET_HOST_WIN32
 
 
 #elif TARGET_HOST_WIN32
 
-    guint    displayModes = 0, mode = 0xffffffff;
-    gboolean success = FALSE;
+    unsigned int    displayModes = 0, mode = 0xffffffff;
+    GLboolean success = FALSE;
     HDC      desktopDC;
     DEVMODE  devMode;
 
     HDC      desktopDC;
     DEVMODE  devMode;
 
index f781b43..7cdd647 100644 (file)
@@ -163,7 +163,7 @@ void fgInitialize( const char* displayName )
      */
     if( atom == 0 )
     {
      */
     if( atom == 0 )
     {
-        gboolean retval;
+        GLboolean retval;
 
         /*
          * Make sure the unitialized fields are reset to zero
 
         /*
          * Make sure the unitialized fields are reset to zero
@@ -349,7 +349,11 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
     /*
      * Remember the function's call time
      */
     /*
      * Remember the function's call time
      */
+#ifndef WIN32
     gettimeofday(&fgState.Time.Value, NULL);
     gettimeofday(&fgState.Time.Value, NULL);
+#else
+    fgState.Time.Value = timeGetTime();
+#endif
     fgState.Time.Set = TRUE;
 
     /*
     fgState.Time.Set = TRUE;
 
     /*
index 1d98edd..942a3b6 100644 (file)
@@ -313,6 +313,7 @@ static void fghCheckTimers( void )
  */
 long fgElapsedTime( void )
 {
  */
 long fgElapsedTime( void )
 {
+#ifndef WIN32
        struct timeval now;
        long elapsed;
 
        struct timeval now;
        long elapsed;
 
@@ -322,6 +323,9 @@ long fgElapsedTime( void )
        elapsed += (now.tv_sec - fgState.Time.Value.tv_sec) * 1000;
 
        return( elapsed );
        elapsed += (now.tv_sec - fgState.Time.Value.tv_sec) * 1000;
 
        return( elapsed );
+#else
+        return (timeGetTime() - fgState.Time.Value);
+#endif
 }
 
 /*
 }
 
 /*
@@ -826,7 +830,7 @@ void FGAPIENTRY glutMainLoop( void )
 
 #elif TARGET_HOST_WIN32
 
 
 #elif TARGET_HOST_WIN32
 
-    gboolean bLoop = TRUE;
+    GLboolean bLoop = TRUE;
     MSG stMsg;
 
     /*
     MSG stMsg;
 
     /*
@@ -1068,8 +1072,8 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
     case WM_MBUTTONUP:
     case WM_RBUTTONUP:
     {
     case WM_MBUTTONUP:
     case WM_RBUTTONUP:
     {
-        gboolean pressed = TRUE;
-        gint button;
+        GLboolean pressed = TRUE;
+        int button;
 
         /*
          * A mouse button has been pressed *or* released. Again, break off
 
         /*
          * A mouse button has been pressed *or* released. Again, break off
@@ -1181,7 +1185,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
     case WM_SYSKEYDOWN:
     case WM_KEYDOWN:
     {
     case WM_SYSKEYDOWN:
     case WM_KEYDOWN:
     {
-        gint keypress = -1;
+        int keypress = -1;
 
         /*
          * First of all, make sure that there is a window to be notified of this
 
         /*
          * First of all, make sure that there is a window to be notified of this
index 7e2bfac..6fdf638 100644 (file)
@@ -214,10 +214,10 @@ XVisualInfo* fgChooseVisual( void )
  * Setup the pixel format for a Win32 window
  */
 #if TARGET_HOST_WIN32
  * Setup the pixel format for a Win32 window
  */
 #if TARGET_HOST_WIN32
-gboolean fgSetupPixelFormat( SFG_Window* window, gboolean checkOnly )
+GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly )
 {
        PIXELFORMATDESCRIPTOR* ppfd, pfd;
 {
        PIXELFORMATDESCRIPTOR* ppfd, pfd;
-       gint flags, pixelformat;
+       int flags, pixelformat;
 
        /*
         * Check if the window seems valid
 
        /*
         * Check if the window seems valid
@@ -469,7 +469,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i
 #elif TARGET_HOST_WIN32
 
        WNDCLASS wc;
 #elif TARGET_HOST_WIN32
 
        WNDCLASS wc;
-       gint flags;
+       int flags;
        ATOM atom;
        HWND hWnd;
 
        ATOM atom;
        HWND hWnd;
 
@@ -479,7 +479,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i
         * Grab the window class we have registered on glutInit():
         */
        atom = GetClassInfo( fgDisplay.Instance, "FREEGLUT", &wc );
         * Grab the window class we have registered on glutInit():
         */
        atom = GetClassInfo( fgDisplay.Instance, "FREEGLUT", &wc );
-       g_assert( atom != 0 );
+       assert( atom != 0 );
 
     if( gameMode == FALSE )
     {
 
     if( gameMode == FALSE )
     {
@@ -512,7 +512,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i
         /*
          * In game mode, the story is a little bit different...
          */
         /*
          * In game mode, the story is a little bit different...
          */
-        g_assert( window->Parent == NULL );
+        assert( window->Parent == NULL );
 
         /*
          * Set the window creation flags appropriately to make the window entirely visible:
 
         /*
          * Set the window creation flags appropriately to make the window entirely visible:
@@ -537,7 +537,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i
        /*
      * Make sure window was created
      */
        /*
      * Make sure window was created
      */
-       g_assert( window->Window.Handle != NULL );
+       assert( window->Window.Handle != NULL );
 
     /*
      * Show and update the main window. Hide the mouse cursor.
 
     /*
      * Show and update the main window. Hide the mouse cursor.