From: Daniel Wagner Date: Mon, 15 Mar 2004 13:42:20 +0000 (+0000) Subject: added support for WindowsCE (building on top of klimt) X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=d67937396dc33c86017012859b2d9ed010fc6c88;p=freeglut added support for WindowsCE (building on top of klimt) git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@484 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/freeglut_evc4.vcp b/freeglut_evc4.vcp new file mode 100644 index 0000000..3abea54 --- /dev/null +++ b/freeglut_evc4.vcp @@ -0,0 +1,384 @@ +# Microsoft eMbedded Visual Tools Project File - Name="freeglut" - Package Owner=<4> +# Microsoft eMbedded Visual Tools Generated Build File, Format Version 6.02 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (WCE ARMV4) Dynamic-Link Library" 0xa302 + +CFG=freeglut - Win32 (WCE ARMV4) Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "freeglut_evc4.vcn". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "freeglut_evc4.vcn" CFG="freeglut - Win32 (WCE ARMV4) Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "freeglut - Win32 (WCE ARMV4) Release" (based on "Win32 (WCE ARMV4) Dynamic-Link Library") +!MESSAGE "freeglut - Win32 (WCE ARMV4) Debug" (based on "Win32 (WCE ARMV4) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +# PROP ATL_Project 2 +CPP="C:\Program Files\Microsoft eMbedded C++ 4.0\EVC\WCE420\bin\xicle42" +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "freeglut - Win32 (WCE ARMV4) Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ARMV4Rel" +# PROP BASE Intermediate_Dir "ARMV4Rel" +# PROP BASE CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}" +# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ARMV4Rel" +# PROP Intermediate_Dir "ARMV4Rel" +# PROP CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}" +# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "NDEBUG" /d "UNICODE" /d "_UNICODE" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /d "ARMV4" /r +# ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "NDEBUG" /d "UNICODE" /d "_UNICODE" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /d "ARMV4" /r +# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "FREEGLUT_EXPORTS" /YX /O2 /M$(CECrtMT) /c +# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "FREEGLUT_EXPORTS" /YX /O2 /M$(CECrtMT) /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32="C:\Program Files\Microsoft eMbedded C++ 4.0\EVC\WCE420\bin\xilinke42" +# ADD BASE LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM +# ADD LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /nodefaultlib:"$(CENoDefaultLib)" /out:"ARMV4Rel/freeglut.dll" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM + +!ELSEIF "$(CFG)" == "freeglut - Win32 (WCE ARMV4) Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ARMV4Dbg" +# PROP BASE Intermediate_Dir "ARMV4Dbg" +# PROP BASE CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}" +# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "ARMV4Dbg" +# PROP Intermediate_Dir "ARMV4Dbg" +# PROP CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}" +# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "DEBUG" /d "UNICODE" /d "_UNICODE" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /d "ARMV4" /r +# ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "DEBUG" /d "UNICODE" /d "_UNICODE" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /d "ARMV4" /r +# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "FREEGLUT_EXPORTS" /YX /M$(CECrtMTDebug) /c +# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "FREEGLUT_EXPORTS" /YX /M$(CECrtMTDebug) /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32="C:\Program Files\Microsoft eMbedded C++ 4.0\EVC\WCE420\bin\xilinke42" +# ADD BASE LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM +# ADD LINK32 commctrl.lib coredll.lib /nologo /base:"0x00100000" /stack:0x10000,0x1000 /entry:"_DllMainCRTStartup" /dll /debug /nodefaultlib:"$(CENoDefaultLib)" /out:"ARMV4Dbg/freeglutD.dll" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM + +!ENDIF + +# Begin Target + +# Name "freeglut - Win32 (WCE ARMV4) Release" +# Name "freeglut - Win32 (WCE ARMV4) Debug" +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\src\freeglut_callbacks.c +DEP_CPP_FREEG=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEG=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_cursor.c +DEP_CPP_FREEGL=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGL=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_display.c +DEP_CPP_FREEGLU=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLU=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_ext.c +DEP_CPP_FREEGLUT=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLUT=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_font.c +DEP_CPP_FREEGLUT_=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLUT_=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_font_data.c +DEP_CPP_FREEGLUT_F=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLUT_F=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_gamemode.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_geometry.c +DEP_CPP_FREEGLUT_G=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLUT_G=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_glutfont_definitions.c +DEP_CPP_FREEGLUT_GL=\ + ".\src\freeglut_internal.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_init.c +DEP_CPP_FREEGLUT_I=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLUT_I=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_internal.h +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_joystick.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_main.c +DEP_CPP_FREEGLUT_M=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLUT_M=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_menu.c +DEP_CPP_FREEGLUT_ME=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLUT_ME=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_misc.c +DEP_CPP_FREEGLUT_MI=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLUT_MI=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_overlay.c +DEP_CPP_FREEGLUT_O=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLUT_O=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_state.c +DEP_CPP_FREEGLUT_S=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLUT_S=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_stroke_mono_roman.c +DEP_CPP_FREEGLUT_ST=\ + ".\src\freeglut_internal.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_stroke_roman.c +DEP_CPP_FREEGLUT_STR=\ + ".\src\freeglut_internal.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_structure.c +DEP_CPP_FREEGLUT_STRU=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLUT_STRU=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_teapot.c +DEP_CPP_FREEGLUT_T=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLUT_T=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_videoresize.c +DEP_CPP_FREEGLUT_V=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLUT_V=\ + ".\src\config.h"\ + +# End Source File +# Begin Source File + +SOURCE=.\src\freeglut_window.c +DEP_CPP_FREEGLUT_W=\ + ".\src\freeglut_internal.h"\ + {$(INCLUDE)}"GL\freeglut.h"\ + {$(INCLUDE)}"GL\freeglut_ext.h"\ + {$(INCLUDE)}"GL\freeglut_std.h"\ + +NODEP_CPP_FREEGLUT_W=\ + ".\src\config.h"\ + +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\include\GL\freeglut.h +# End Source File +# Begin Source File + +SOURCE=.\include\GL\freeglut_ext.h +# End Source File +# Begin Source File + +SOURCE=.\include\GL\freeglut_std.h +# End Source File +# Begin Source File + +SOURCE=.\include\GL\glut.h +# End Source File +# End Group +# End Target +# End Project diff --git a/freeglut_evc4.vcw b/freeglut_evc4.vcw new file mode 100644 index 0000000..fc75d0c --- /dev/null +++ b/freeglut_evc4.vcw @@ -0,0 +1,44 @@ +Microsoft eMbedded Visual Tools Workspace File, Format Version 4.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "Klimt"=..\..\klimt\klimt\build\EVC4\Klimt.vcp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "freeglut"=.\freeglut_evc4.vcp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name Klimt + End Project Dependency +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/include/GL/freeglut_std.h b/include/GL/freeglut_std.h index 9250c3c..2acbabd 100644 --- a/include/GL/freeglut_std.h +++ b/include/GL/freeglut_std.h @@ -70,7 +70,9 @@ /* link with Win32 shared freeglut lib */ # if defined(_MSC_VER) -# pragma comment (lib, "freeglut.lib") +# ifndef _WIN32_WCE +# pragma comment (lib, "freeglut.lib") +# endif # endif # endif @@ -81,11 +83,13 @@ /* Drag in other Windows libraries as required by FreeGLUT */ # if defined(_MSC_VER) -# pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */ -# pragma comment (lib, "user32.lib") /* link Windows user lib */ -# pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */ -# pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */ -# pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */ +# ifndef _WIN32_WCE +# pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */ +# pragma comment (lib, "user32.lib") /* link Windows user lib */ +# pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */ +# pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */ +# pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */ +# endif //_WIN32_WCE # endif #else diff --git a/src/freeglut_cursor.c b/src/freeglut_cursor.c index 50f0b42..78841be 100644 --- a/src/freeglut_cursor.c +++ b/src/freeglut_cursor.c @@ -186,7 +186,7 @@ void FGAPIENTRY glutSetCursor( int cursorID ) } } -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE /* * This is a temporary solution only... @@ -250,7 +250,7 @@ void FGAPIENTRY glutWarpPointer( int x, int y ) ); XFlush( fgDisplay.Display ); /* XXX Is this really necessary? */ -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE { POINT coords; diff --git a/src/freeglut_display.c b/src/freeglut_display.c index eeac0ac..b29f1cc 100644 --- a/src/freeglut_display.c +++ b/src/freeglut_display.c @@ -59,7 +59,7 @@ void FGAPIENTRY glutSwapBuffers( void ) #if TARGET_HOST_UNIX_X11 glXSwapBuffers( fgDisplay.Display, fgStructure.Window->Window.Handle ); -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE SwapBuffers( fgStructure.Window->Window.Device ); #endif diff --git a/src/freeglut_ext.c b/src/freeglut_ext.c index 9c8da14..cf2f4f9 100644 --- a/src/freeglut_ext.c +++ b/src/freeglut_ext.c @@ -111,7 +111,9 @@ static struct name_address_pair glut_functions[] = { "glutWindowStatusFunc", (void *) glutWindowStatusFunc }, { "glutKeyboardUpFunc", (void *) glutKeyboardUpFunc }, { "glutSpecialUpFunc", (void *) glutSpecialUpFunc }, +#if !TARGET_HOST_WINCE { "glutJoystickFunc", (void *) glutJoystickFunc }, +#endif //TARGET_HOST_WINCE { "glutSetColor", (void *) glutSetColor }, { "glutGetColor", (void *) glutGetColor }, { "glutCopyColormap", (void *) glutCopyColormap }, @@ -152,11 +154,13 @@ static struct name_address_pair glut_functions[] = { "glutReportErrors", (void *) glutReportErrors }, { "glutIgnoreKeyRepeat", (void *) glutIgnoreKeyRepeat }, { "glutSetKeyRepeat", (void *) glutSetKeyRepeat }, +#if !TARGET_HOST_WINCE { "glutForceJoystickFunc", (void *) glutForceJoystickFunc }, { "glutGameModeString", (void *) glutGameModeString }, { "glutEnterGameMode", (void *) glutEnterGameMode }, { "glutLeaveGameMode", (void *) glutLeaveGameMode }, { "glutGameModeGet", (void *) glutGameModeGet }, +#endif //TARGET_HOST_WINCE /* freeglut extensions */ { "glutMainLoopEvent", (void *) glutMainLoopEvent }, { "glutLeaveMainLoop", (void *) glutLeaveMainLoop }, @@ -191,7 +195,7 @@ void *FGAPIENTRY glutGetProcAddress( const char *procName ) return glut_functions[ i ].address; /* Try core GL functions */ -#if TARGET_HOST_WIN32 +#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE return( void * )wglGetProcAddress( ( LPCSTR )procName ); #elif TARGET_HOST_UNIX_X11 && defined( GLX_ARB_get_proc_address ) return(void * )glXGetProcAddressARB( ( const GLubyte * )procName ); diff --git a/src/freeglut_gamemode.c b/src/freeglut_gamemode.c index 703005d..afa0e7a 100644 --- a/src/freeglut_gamemode.c +++ b/src/freeglut_gamemode.c @@ -107,7 +107,7 @@ void fghRememberState( void ) */ # endif -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE /* DEVMODE devMode; */ @@ -204,7 +204,7 @@ void fghRestoreState( void ) */ # endif -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE /* * Restore the previously rememebered desktop display settings @@ -294,7 +294,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest ) */ # endif -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE unsigned int displayModes = 0, mode = 0xffffffff; GLboolean success = GL_FALSE; diff --git a/src/freeglut_init.c b/src/freeglut_init.c index 8fce87f..2e18660 100644 --- a/src/freeglut_init.c +++ b/src/freeglut_init.c @@ -70,7 +70,7 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */ 0, /* FPSInterval */ 0, /* SwapCount */ 0, /* SwapTime */ -#if TARGET_HOST_WIN32 +#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE { 0, GL_FALSE }, /* Time */ #else { { 0, 0 }, GL_FALSE }, @@ -142,7 +142,7 @@ void fgInitialize( const char* displayName ) FALSE ); -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE WNDCLASS wc; ATOM atom; @@ -152,7 +152,8 @@ void fgInitialize( const char* displayName ) */ fgDisplay.Instance = GetModuleHandle( NULL ); - atom = GetClassInfo( fgDisplay.Instance, "FREEGLUT", &wc ); + atom = GetClassInfo( fgDisplay.Instance, _T("FREEGLUT"), &wc ); + if( atom == 0 ) { ZeroMemory( &wc, sizeof(WNDCLASS) ); @@ -165,19 +166,24 @@ void fgInitialize( const char* displayName ) * XXX Old code had "| CS_DBCLCKS" commented out. Plans for the * XXX future? Dead-end idea? */ - wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = fgWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = fgDisplay.Instance; - wc.hIcon = LoadIcon( fgDisplay.Instance, "GLUT_ICON" ); + wc.hIcon = LoadIcon( fgDisplay.Instance, _T("GLUT_ICON") ); + +#if TARGET_HOST_WIN32 + wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; if (!wc.hIcon) wc.hIcon = LoadIcon( NULL, IDI_WINLOGO ); +#else //TARGET_HOST_WINCE + wc.style = CS_HREDRAW | CS_VREDRAW; +#endif wc.hCursor = LoadCursor( NULL, IDC_ARROW ); wc.hbrBackground = NULL; wc.lpszMenuName = NULL; - wc.lpszClassName = "FREEGLUT"; + wc.lpszClassName = _T("FREEGLUT"); /* * Register the window class @@ -204,8 +210,10 @@ void fgInitialize( const char* displayName ) #endif +#if !TARGET_HOST_WINCE fgJoystickInit( 0 ); fgJoystickInit( 1 ); +#endif //!TARGET_HOST_WINCE fgState.Initialised = GL_TRUE; } @@ -249,7 +257,9 @@ void fgDeinitialize( void ) free( timer ); } +#if !TARGET_HOST_WINCE fgJoystickClose( ); +#endif //!TARGET_HOST_WINCE fgState.Initialised = GL_FALSE; @@ -321,7 +331,7 @@ void fgDeinitialize( void ) * Everything inside the following #ifndef is copied from the X sources. */ -#if TARGET_HOST_WIN32 +#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE /* @@ -516,6 +526,7 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) fgElapsedTime( ); /* check if GLUT_FPS env var is set */ +#if !TARGET_HOST_WINCE { const char *fps = getenv( "GLUT_FPS" ); if( fps ) @@ -612,6 +623,8 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) } } +#endif //TARGET_HOST_WINCE + /* * Have the display created now. If there wasn't a "-display" * in the program arguments, we will use the DISPLAY environment diff --git a/src/freeglut_internal.h b/src/freeglut_internal.h index 151d960..013cae8 100644 --- a/src/freeglut_internal.h +++ b/src/freeglut_internal.h @@ -36,12 +36,18 @@ /* * Freeglut is meant to be available under all Unix/X11 and Win32 platforms. */ -#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) +#if defined(_WIN32_WCE) +# define TARGET_HOST_UNIX_X11 0 +# define TARGET_HOST_WIN32 0 +# define TARGET_HOST_WINCE 1 +#elif defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) # define TARGET_HOST_UNIX_X11 0 # define TARGET_HOST_WIN32 1 +# define TARGET_HOST_WINCE 0 #else # define TARGET_HOST_UNIX_X11 1 # define TARGET_HOST_WIN32 0 +# define TARGET_HOST_WINCE 0 #endif #define FREEGLUT_MAX_MENUS 3 @@ -62,6 +68,7 @@ #include #include #include +#include #endif #if defined(_MSC_VER) @@ -288,7 +295,7 @@ struct tagSFG_Display #endif -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE HINSTANCE Instance; /* The application's instance */ DEVMODE DisplayMode; /* Desktop's display settings */ @@ -322,7 +329,7 @@ struct tagSFG_Timer typedef Window SFG_WindowHandleType ; typedef GLXContext SFG_WindowContextType ; -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE typedef HWND SFG_WindowHandleType ; typedef HGLRC SFG_WindowContextType ; @@ -343,7 +350,7 @@ struct tagSFG_Context XVisualInfo* VisualInfo; /* The window's visual information */ Pixmap Pixmap; /* Used for offscreen rendering */ /* GLXPixmap GLXPixMap; */ /* Used for offscreen rendering */ -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE HDC Device; /* The window's device context */ #endif @@ -735,7 +742,7 @@ XVisualInfo* fgChooseVisual( void ); /* * The window procedure for Win32 events handling */ -#if TARGET_HOST_WIN32 +#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, diff --git a/src/freeglut_main.c b/src/freeglut_main.c index a356c1b..05adca8 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -84,8 +84,9 @@ static void fghReshapeWindowByHandle ( SFG_WindowHandleType handle, width, height ); XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE +#if !TARGET_HOST_WINCE { RECT rect; @@ -132,6 +133,7 @@ static void fghReshapeWindowByHandle ( SFG_WindowHandleType handle, SWP_NOZORDER ); } +#endif //TARGET_HOST_WINCE /* * XXX Should update {window->State.OldWidth, window->State.OldHeight} @@ -227,7 +229,7 @@ static void fghcbDisplayWindow( SFG_Window *window, INVOKE_WCB( *window, Display, ( ) ); fgSetWindow( current_window ); } -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE RedrawWindow( window->Window.Handle, NULL, NULL, RDW_NOERASE | RDW_INTERNALPAINT | RDW_INVALIDATE | RDW_UPDATENOW @@ -262,7 +264,9 @@ static void fghcbCheckJoystickPolls( SFG_Window *window, if( window->State.JoystickLastPoll + window->State.JoystickPollRate <= checkTime ) { +#if !TARGET_HOST_WINCE fgJoystickPollWindow( window ); +#endif //!TARGET_HOST_WINCE window->State.JoystickLastPoll = checkTime; } @@ -322,6 +326,8 @@ long fgElapsedTime( void ) return elapsed; #elif TARGET_HOST_WIN32 return timeGetTime() - fgState.Time.Value; +#elif TARGET_HOST_WINCE + return GetTickCount() - fgState.Time.Value; #endif } else @@ -330,6 +336,8 @@ long fgElapsedTime( void ) gettimeofday( &fgState.Time.Value, NULL ); #elif TARGET_HOST_WIN32 fgState.Time.Value = timeGetTime (); +#elif TARGET_HOST_WINCE + fgState.Time.Value = GetTickCount(); #endif fgState.Time.Set = GL_TRUE ; @@ -478,7 +486,7 @@ static void fgSleepForEvents( void ) if( -1 == err ) fgWarning ( "freeglut select() error: %d\n", errno ); } -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLEVENTS ); #endif } @@ -1047,7 +1055,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) } } -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE MSG stMsg; @@ -1085,13 +1093,13 @@ void FGAPIENTRY glutMainLoop( void ) { int action; -#if TARGET_HOST_WIN32 +#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ; #endif freeglut_assert_ready; -#if TARGET_HOST_WIN32 +#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE /* * Processing before the main loop: If there is a window which is open and * which has a visibility callback, call it. I know this is an ugly hack, @@ -1163,7 +1171,7 @@ void FGAPIENTRY glutLeaveMainLoop( void ) } -#if TARGET_HOST_WIN32 +#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE /* * Determine a GLUT modifer mask based on MS-WINDOWS system info. */ @@ -1208,7 +1216,9 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, { unsigned int current_DisplayMode = fgState.DisplayMode; fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH; +#if !TARGET_HOST_WINCE fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE ); +#endif fgState.DisplayMode = current_DisplayMode; if( fgStructure.MenuContext ) @@ -1228,7 +1238,9 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, } else { +#if !TARGET_HOST_WINCE fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE ); +#endif if( ! fgState.UseCurrentContext ) window->Window.Context = @@ -1258,8 +1270,13 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, if( window->State.Visible ) { window->State.NeedToResize = GL_TRUE; +#if TARGET_HOST_WINCE + window->State.Width = HIWORD(lParam); + window->State.Height = LOWORD(lParam); +#else window->State.Width = LOWORD(lParam); window->State.Height = HIWORD(lParam); +#endif //TARGET_HOST_WINCE } break; @@ -1423,6 +1440,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, break; } +#if !TARGET_HOST_WINCE if( GetSystemMetrics( SM_SWAPBUTTON ) ) { if( button == GLUT_LEFT_BUTTON ) @@ -1431,6 +1449,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, if( button == GLUT_RIGHT_BUTTON ) button = GLUT_LEFT_BUTTON; } +#endif //!TARGET_HOST_WINCE if( button == -1 ) return DefWindowProc( hWnd, uMsg, lParam, wParam ); @@ -1714,6 +1733,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, default: { +#if !TARGET_HOST_WINCE BYTE state[ 256 ]; WORD code[ 2 ]; @@ -1726,6 +1746,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, ( (char)wParam, window->State.MouseX, window->State.MouseY ) ); +#endif //!TARGET_HOST_WINCE } } @@ -1787,6 +1808,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); break; +#if !TARGET_HOST_WINCE case WM_SYNCPAINT: /* 0x0088 */ /* Another window has moved, need to update this one */ window->State.Redisplay = GL_TRUE; @@ -1864,6 +1886,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, break ; } } +#endif //!TARGET_HOST_WINCE /* We need to pass the message on to the operating system as well */ lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); diff --git a/src/freeglut_menu.c b/src/freeglut_menu.c index bdff2a5..33d82a2 100644 --- a/src/freeglut_menu.c +++ b/src/freeglut_menu.c @@ -56,7 +56,7 @@ * that that wasn't the original intent...if not, perhaps we need another * symbolic constant, FREEGLUT_MENU_ITEM_BORDER, or such.) */ -#if TARGET_HOST_WIN32 +#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE #define FREEGLUT_MENU_FONT GLUT_BITMAP_8_BY_13 #else #define FREEGLUT_MENU_FONT GLUT_BITMAP_HELVETICA_18 @@ -75,7 +75,7 @@ * too. These variables should be stuffed into global state and initialized * via the glutInit*() system. */ -#if TARGET_HOST_WIN32 +#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE static float menu_pen_fore [4] = {0.0f, 0.0f, 0.0f, 1.0f}; static float menu_pen_back [4] = {0.85f, 0.85f, 0.85f, 1.0f}; static float menu_pen_hfore [4] = {1.0f, 1.0f, 1.0f, 1.0f}; diff --git a/src/freeglut_misc.c b/src/freeglut_misc.c index e232d6d..62633c5 100644 --- a/src/freeglut_misc.c +++ b/src/freeglut_misc.c @@ -137,10 +137,12 @@ void FGAPIENTRY glutSetKeyRepeat( int repeatMode ) */ void FGAPIENTRY glutForceJoystickFunc( void ) { +#if !TARGET_HOST_WINCE freeglut_assert_ready; freeglut_return_if_fail( fgStructure.Window != NULL ); freeglut_return_if_fail( FETCH_WCB( *( fgStructure.Window ), Joystick ) ); fgJoystickPollWindow( fgStructure.Window ); +#endif //!TARGET_HOST_WINCE } /* diff --git a/src/freeglut_state.c b/src/freeglut_state.c index 0ea47a4..7b7eedc 100644 --- a/src/freeglut_state.c +++ b/src/freeglut_state.c @@ -124,7 +124,7 @@ void FGAPIENTRY glutSetOption( GLenum eWhat, int value ) */ int FGAPIENTRY glutGet( GLenum eWhat ) { -#if TARGET_HOST_WIN32 +#if TARGET_HOST_WIN32 || TARGET_HOST_WINCE int returnValue ; GLboolean boolValue ; #endif @@ -281,7 +281,7 @@ int FGAPIENTRY glutGet( GLenum eWhat ) return fgStructure.Window->Window.VisualInfo->visualid; -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE /* * Handle the OpenGL inquiries @@ -376,6 +376,8 @@ int FGAPIENTRY glutGet( GLenum eWhat ) /* * ...then we've got to correct the results we've just received... */ + +#if !TARGET_HOST_WINCE if ( ( fgStructure.GameMode != fgStructure.Window ) && ( fgStructure.Window->Parent == NULL ) && ( ! fgStructure.Window->IsMenu ) ) { @@ -384,6 +386,7 @@ int FGAPIENTRY glutGet( GLenum eWhat ) winRect.top += GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION ); winRect.bottom -= GetSystemMetrics( SM_CYSIZEFRAME ); } +#endif //TARGET_HOST_WINCE switch( eWhat ) { @@ -396,18 +399,33 @@ int FGAPIENTRY glutGet( GLenum eWhat ) break; case GLUT_WINDOW_BORDER_WIDTH : +#if TARGET_HOST_WINCE + return 0; +#else return GetSystemMetrics( SM_CXSIZEFRAME ); +#endif //TARGET_HOST_WINCE case GLUT_WINDOW_HEADER_HEIGHT : +#if TARGET_HOST_WINCE + return 0; +#else return GetSystemMetrics( SM_CYCAPTION ); +#endif //TARGET_HOST_WINCE case GLUT_DISPLAY_MODE_POSSIBLE: +#if TARGET_HOST_WINCE + return GL_FALSE; +#else return fgSetupPixelFormat( fgStructure.Window, GL_TRUE, PFD_MAIN_PLANE ); +#endif //TARGET_HOST_WINCE + case GLUT_WINDOW_FORMAT_ID: +#if !TARGET_HOST_WINCE if( fgStructure.Window != NULL ) return GetPixelFormat( fgStructure.Window->Window.Device ); +#endif //TARGET_HOST_WINCE return 0; #endif @@ -503,7 +521,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat ) */ return 3 ; -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE case GLUT_HAS_MOUSE: /* @@ -516,7 +534,11 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat ) /* * We are much more fortunate under Win32 about this... */ +#if TARGET_HOST_WINCE + return 1; +#else return GetSystemMetrics( SM_CMOUSEBUTTONS ); +#endif //TARGET_HOST_WINCE #endif @@ -619,7 +641,7 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat ) case GLUT_OVERLAY_DAMAGED: return -1; -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE case GLUT_OVERLAY_POSSIBLE: /* return fgSetupPixelFormat( fgStructure.Window, GL_TRUE, diff --git a/src/freeglut_window.c b/src/freeglut_window.c index dc00029..8933a30 100644 --- a/src/freeglut_window.c +++ b/src/freeglut_window.c @@ -32,6 +32,23 @@ #include #include "freeglut_internal.h" +#if TARGET_HOST_WINCE +#include +#pragma comment( lib, "Aygshell.lib" ) + +wchar_t* wstr_from_str(const char* str) +{ + int i,len=strlen(str); + wchar_t* wstr = (wchar_t*)malloc(2*len+2); + for(i=0; iWindow.Device, pixelformat, ppfd ); +#endif //TARGET_HOST_WINCE } #endif @@ -227,7 +248,7 @@ void fgSetWindow ( SFG_Window *window ) window->Window.Handle, window->Window.Context ); -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE if( fgStructure.Window ) ReleaseDC( fgStructure.Window->Window.Handle, fgStructure.Window->Window.Device ); @@ -425,10 +446,17 @@ void fgOpenWindow( SFG_Window* window, const char* title, * that they should replace a window manager that they like, and which * works, just because *we* think that it's not "modern" enough. */ +#if TARGET_HOST_WINCE + sizeHints.x = 0; + sizeHints.y = 0; + sizeHints.width = 320; + sizeHints.height = 240; +#else sizeHints.x = x; sizeHints.y = y; sizeHints.width = w; sizeHints.height = h; +#endif //TARGET_HOST_WINCE wmHints.flags = StateHint; wmHints.initial_state = fgState.ForceIconic ? IconicState : NormalState; @@ -454,7 +482,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, XMapWindow( fgDisplay.Display, window->Window.Handle ); -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE WNDCLASS wc; DWORD flags; @@ -466,7 +494,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, /* * Grab the window class we have registered on glutInit(): */ - atom = GetClassInfo( fgDisplay.Instance, "FREEGLUT", &wc ); + atom = GetClassInfo( fgDisplay.Instance, _T("FREEGLUT"), &wc ); assert( atom != 0 ); if( gameMode ) @@ -481,6 +509,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, } else { +#if !TARGET_HOST_WINCE if ( ( ! isSubWindow ) && ( ! window->IsMenu ) ) { /* @@ -492,6 +521,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, h += (GetSystemMetrics( SM_CYSIZEFRAME ) )*2 + GetSystemMetrics( SM_CYCAPTION ); } +#endif //TARGET_HOST_WINCE if( ! fgState.Position.Use ) { @@ -515,12 +545,39 @@ void fgOpenWindow( SFG_Window* window, const char* title, flags |= WS_POPUP; exFlags |= WS_EX_TOOLWINDOW; } +#if !TARGET_HOST_WINCE else if( window->Parent == NULL ) flags |= WS_OVERLAPPEDWINDOW; +#endif else flags |= WS_CHILD; } +#if TARGET_HOST_WINCE + { + wchar_t* wstr = wstr_from_str(title); + + window->Window.Handle = CreateWindow( + _T("FREEGLUT"), + wstr, + WS_VISIBLE | WS_POPUP, + 0,0, 240,320, + NULL, + NULL, + fgDisplay.Instance, + (LPVOID) window + ); + + free(wstr); + + SHFullScreen(window->Window.Handle, SHFS_HIDESTARTICON); + SHFullScreen(window->Window.Handle, SHFS_HIDESIPBUTTON); + SHFullScreen(window->Window.Handle, SHFS_HIDETASKBAR); + MoveWindow(window->Window.Handle, 0, 0, 240, 320, TRUE); + ShowWindow(window->Window.Handle, SW_SHOW); + UpdateWindow(window->Window.Handle); + } +#else window->Window.Handle = CreateWindowEx( exFlags, "FREEGLUT", @@ -532,11 +589,18 @@ void fgOpenWindow( SFG_Window* window, const char* title, fgDisplay.Instance, (LPVOID) window ); +#endif TARGET_HOST_WINCE + if( !( window->Window.Handle ) ) fgError( "Failed to create a window (%s)!", title ); +#if TARGET_HOST_WINCE + ShowWindow( window->Window.Handle, SW_SHOW ); +#else ShowWindow( window->Window.Handle, fgState.ForceIconic ? SW_SHOWMINIMIZED : SW_SHOW ); +#endif //TARGET_HOST_WINCE + UpdateWindow( window->Window.Handle ); ShowCursor( TRUE ); /* XXX Old comments say "hide cusror"! */ @@ -569,7 +633,7 @@ void fgCloseWindow( SFG_Window* window ) XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE /* * Make sure we don't close a window with current context active @@ -694,7 +758,7 @@ void FGAPIENTRY glutShowWindow( void ) XMapWindow( fgDisplay.Display, fgStructure.Window->Window.Handle ); XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE ShowWindow( fgStructure.Window->Window.Handle, SW_SHOW ); @@ -722,7 +786,7 @@ void FGAPIENTRY glutHideWindow( void ) fgStructure.Window->Window.Handle ); XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE ShowWindow( fgStructure.Window->Window.Handle, SW_HIDE ); @@ -746,7 +810,7 @@ void FGAPIENTRY glutIconifyWindow( void ) fgDisplay.Screen ); XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE ShowWindow( fgStructure.Window->Window.Handle, SW_MINIMIZE ); @@ -785,6 +849,14 @@ void FGAPIENTRY glutSetWindowTitle( const char* title ) SetWindowText( fgStructure.Window->Window.Handle, title ); +#elif TARGET_HOST_WINCE + { + wchar_t* wstr = wstr_from_str(title); + + SetWindowText( fgStructure.Window->Window.Handle, wstr ); + + free(wstr); + } #endif } } @@ -820,6 +892,14 @@ void FGAPIENTRY glutSetIconTitle( const char* title ) SetWindowText( fgStructure.Window->Window.Handle, title ); +#elif TARGET_HOST_WINCE + { + wchar_t* wstr = wstr_from_str(title); + + SetWindowText( fgStructure.Window->Window.Handle, wstr ); + + free(wstr); + } #endif } } @@ -851,7 +931,7 @@ void FGAPIENTRY glutPositionWindow( int x, int y ) x, y ); XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE { RECT winRect; @@ -882,7 +962,7 @@ void FGAPIENTRY glutPushWindow( void ) XLowerWindow( fgDisplay.Display, fgStructure.Window->Window.Handle ); -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE SetWindowPos( fgStructure.Window->Window.Handle, @@ -906,7 +986,7 @@ void FGAPIENTRY glutPopWindow( void ) XRaiseWindow( fgDisplay.Display, fgStructure.Window->Window.Handle ); -#elif TARGET_HOST_WIN32 +#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE SetWindowPos( fgStructure.Window->Window.Handle,