X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmswin%2Ffreeglut_init_mswin.c;h=c7457de96cc4266c9981ef8c113198c424b12eec;hb=c5b343fbd61bdd4946f2e076e9f37223975a66ee;hp=1777ebd4d881b22edf5dcdd4884bbb8fb8ffd554;hpb=3e5e3f51c272a95dc877b781281880061690b935;p=freeglut diff --git a/src/mswin/freeglut_init_mswin.c b/src/mswin/freeglut_init_mswin.c index 1777ebd..c7457de 100644 --- a/src/mswin/freeglut_init_mswin.c +++ b/src/mswin/freeglut_init_mswin.c @@ -25,8 +25,14 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#define FREEGLUT_BUILDING_LIB #include -#include "freeglut_internal_mswin.h" +#include "../Common/freeglut_internal.h" + + + +extern LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, + WPARAM wParam, LPARAM lParam ); /* @@ -38,9 +44,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 ) { @@ -57,8 +63,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; @@ -92,9 +98,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 ); @@ -142,17 +148,20 @@ 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 */ timeEndPeriod ( 1 ); } - +void fgPlatformDestroyContext ( SFG_PlatformDisplay pDisplay, SFG_WindowContextType MContext ) +{ + /* Do nothing -- this is required for X11 */ +} /* * Everything down to the end of the next two functions is copied from the X sources. @@ -324,3 +333,13 @@ 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); +} +