From: Andreas Umbach Date: Mon, 30 Jul 2001 14:41:11 +0000 (+0000) Subject: - removed glib dependencies from win32 code X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;ds=sidebyside;h=d0dde87efb130eeb45fe61dd63b582432b972606;p=freeglut - removed glib dependencies from win32 code git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@14 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/freeglut-1.3/freeglut_gamemode.c b/freeglut-1.3/freeglut_gamemode.c index 591df38..13f2526 100644 --- a/freeglut-1.3/freeglut_gamemode.c +++ b/freeglut-1.3/freeglut_gamemode.c @@ -80,6 +80,10 @@ void fghRememberState( void ) /* * 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 ); /* @@ -233,8 +237,8 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest ) #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; diff --git a/freeglut-1.3/freeglut_init.c b/freeglut-1.3/freeglut_init.c index f781b43..7cdd647 100644 --- a/freeglut-1.3/freeglut_init.c +++ b/freeglut-1.3/freeglut_init.c @@ -163,7 +163,7 @@ void fgInitialize( const char* displayName ) */ if( atom == 0 ) { - gboolean retval; + GLboolean retval; /* * 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 */ +#ifndef WIN32 gettimeofday(&fgState.Time.Value, NULL); +#else + fgState.Time.Value = timeGetTime(); +#endif fgState.Time.Set = TRUE; /* diff --git a/freeglut-1.3/freeglut_main.c b/freeglut-1.3/freeglut_main.c index 1d98edd..942a3b6 100644 --- a/freeglut-1.3/freeglut_main.c +++ b/freeglut-1.3/freeglut_main.c @@ -313,6 +313,7 @@ static void fghCheckTimers( void ) */ long fgElapsedTime( void ) { +#ifndef WIN32 struct timeval now; long elapsed; @@ -322,6 +323,9 @@ long fgElapsedTime( void ) 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 - gboolean bLoop = TRUE; + GLboolean bLoop = TRUE; MSG stMsg; /* @@ -1068,8 +1072,8 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara 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 @@ -1181,7 +1185,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara 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 diff --git a/freeglut-1.3/freeglut_window.c b/freeglut-1.3/freeglut_window.c index 7e2bfac..6fdf638 100644 --- a/freeglut-1.3/freeglut_window.c +++ b/freeglut-1.3/freeglut_window.c @@ -214,10 +214,10 @@ XVisualInfo* fgChooseVisual( void ) * 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; - gint flags, pixelformat; + int flags, pixelformat; /* * 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; - gint flags; + int flags; 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 ); - g_assert( atom != 0 ); + assert( atom != 0 ); 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... */ - g_assert( window->Parent == NULL ); + assert( window->Parent == NULL ); /* * 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 */ - g_assert( window->Window.Handle != NULL ); + assert( window->Window.Handle != NULL ); /* * Show and update the main window. Hide the mouse cursor.