X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmswin%2Ffreeglut_init_mswin.c;h=568170e115864d629baacaa4c326ca69f6610058;hb=7662d246c2686f027ab71cbe4eb9d7310a236583;hp=d75765f4ccd4904a4009645c8caa733f23fc2018;hpb=b7ffd3e60d961de87355b3027e589eb150337e60;p=freeglut diff --git a/src/mswin/freeglut_init_mswin.c b/src/mswin/freeglut_init_mswin.c index d75765f..568170e 100644 --- a/src/mswin/freeglut_init_mswin.c +++ b/src/mswin/freeglut_init_mswin.c @@ -26,7 +26,7 @@ */ #include -#include "freeglut_internal_mswin.h" +#include "../Common/freeglut_internal.h" @@ -43,9 +43,9 @@ void fgPlatformInitialize( const char* displayName ) ATOM atom; /* What we need to do is to initialize the fgDisplay global structure here. */ - fgDisplay.Instance = GetModuleHandle( NULL ); - fgDisplay.DisplayName= displayName ? strdup(displayName) : 0 ; - atom = GetClassInfo( fgDisplay.Instance, _T("FREEGLUT"), &wc ); + fgDisplay.pDisplay.Instance = GetModuleHandle( NULL ); + fgDisplay.pDisplay.DisplayName= displayName ? strdup(displayName) : 0 ; + atom = GetClassInfo( fgDisplay.pDisplay.Instance, _T("FREEGLUT"), &wc ); if( atom == 0 ) { @@ -62,8 +62,8 @@ void fgPlatformInitialize( const char* displayName ) wc.lpfnWndProc = fgPlatformWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; - wc.hInstance = fgDisplay.Instance; - wc.hIcon = LoadIcon( fgDisplay.Instance, _T("GLUT_ICON") ); + wc.hInstance = fgDisplay.pDisplay.Instance; + wc.hIcon = LoadIcon( fgDisplay.pDisplay.Instance, _T("GLUT_ICON") ); #if defined(_WIN32_WCE) wc.style = CS_HREDRAW | CS_VREDRAW; @@ -97,9 +97,9 @@ void fgPlatformInitialize( const char* displayName ) ReleaseDC( desktop, context ); } /* If we have a DisplayName try to use it for metrics */ - if( fgDisplay.DisplayName ) + if( fgDisplay.pDisplay.DisplayName ) { - HDC context = CreateDC(fgDisplay.DisplayName,0,0,0); + HDC context = CreateDC(fgDisplay.pDisplay.DisplayName,0,0,0); if( context ) { fgDisplay.ScreenWidth = GetDeviceCaps( context, HORZRES ); @@ -147,10 +147,10 @@ void fgPlatformDeinitialiseInputDevices ( void ) void fgPlatformCloseDisplay ( void ) { - if( fgDisplay.DisplayName ) + if( fgDisplay.pDisplay.DisplayName ) { - free( fgDisplay.DisplayName ); - fgDisplay.DisplayName = NULL; + free( fgDisplay.pDisplay.DisplayName ); + fgDisplay.pDisplay.DisplayName = NULL; } /* Reset the timer granularity */ @@ -329,3 +329,14 @@ int XParseGeometry ( +/* -- PLATFORM-SPECIFIC INTERFACE FUNCTION -------------------------------------------------- */ + + +void (__cdecl *__glutExitFunc)( int return_value ) = NULL; + +void FGAPIENTRY __glutInitWithExit( int *pargc, char **argv, void (__cdecl *exit_function)(int) ) +{ + __glutExitFunc = exit_function; + glutInit(pargc, argv); +} +