- removed glib dependencies from win32 code

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@14 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
andi75 2001-07-30 14:41:11 +00:00
parent 4eaa5467cf
commit 132c7af3d0
4 changed files with 25 additions and 13 deletions

View 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; unsigned int displayModes = 0, mode = 0xffffffff;
gboolean success = FALSE; GLboolean success = FALSE;
HDC desktopDC; HDC desktopDC;
DEVMODE devMode; DEVMODE devMode;

View 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;
/* /*

View File

@ -313,6 +313,7 @@ static void fghCheckTimers( void )
*/ */
long fgElapsedTime( void ) long fgElapsedTime( void )
{ {
#ifndef WIN32
struct timeval now; struct timeval now;
long elapsed; long elapsed;
@ -322,6 +323,9 @@ long fgElapsedTime( void )
elapsed += (now.tv_sec - fgState.Time.Value.tv_sec) * 1000; elapsed += (now.tv_sec - fgState.Time.Value.tv_sec) * 1000;
return( elapsed ); 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_MBUTTONUP:
case WM_RBUTTONUP: case WM_RBUTTONUP:
{ {
gboolean pressed = TRUE; GLboolean pressed = TRUE;
gint button; 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_SYSKEYDOWN:
case WM_KEYDOWN: 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

View File

@ -214,10 +214,10 @@ XVisualInfo* fgChooseVisual( void )
* Setup the pixel format for a Win32 window * Setup the pixel format for a Win32 window
*/ */
#if TARGET_HOST_WIN32 #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 #elif TARGET_HOST_WIN32
WNDCLASS wc; WNDCLASS wc;
gint flags; int flags;
ATOM atom; ATOM atom;
HWND hWnd; 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(): * Grab the window class we have registered on glutInit():
*/ */
atom = GetClassInfo( fgDisplay.Instance, "FREEGLUT", &wc ); 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.