added support for WindowsCE (building on top of klimt)

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@484 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
drgoldie 2004-03-15 13:42:20 +00:00
parent 11d357efc4
commit 30aa3f91c3
15 changed files with 633 additions and 48 deletions

2
.gitattributes vendored
View File

@ -24,6 +24,8 @@ freeglut/freeglut/freeglut.dsw svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/freeglut.kdevelop svn_keywords=Author+Date+Id+Revision freeglut/freeglut/freeglut.kdevelop svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/freeglut.kdevprj svn_keywords=Author+Date+Id+Revision freeglut/freeglut/freeglut.kdevprj svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/freeglut.lsm svn_keywords=Author+Date+Id+Revision freeglut/freeglut/freeglut.lsm svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/freeglut_evc4.vcp svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/freeglut_evc4.vcw svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/freeglut_static.dsp svn_keywords=Author+Date+Id+Revision freeglut/freeglut/freeglut_static.dsp svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/include/GL/Makefile.am svn_keywords=Author+Date+Id+Revision freeglut/freeglut/include/GL/Makefile.am svn_keywords=Author+Date+Id+Revision
freeglut/freeglut/include/GL/freeglut.h svn_keywords=Author+Date+Id+Revision freeglut/freeglut/include/GL/freeglut.h svn_keywords=Author+Date+Id+Revision

View File

@ -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

View File

@ -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>
{{{
}}}
###############################################################################

View File

@ -70,8 +70,10 @@
/* link with Win32 shared freeglut lib */ /* link with Win32 shared freeglut lib */
# if defined(_MSC_VER) # if defined(_MSC_VER)
# ifndef _WIN32_WCE
# pragma comment (lib, "freeglut.lib") # pragma comment (lib, "freeglut.lib")
# endif # endif
# endif
# endif # endif
@ -81,11 +83,13 @@
/* Drag in other Windows libraries as required by FreeGLUT */ /* Drag in other Windows libraries as required by FreeGLUT */
# if defined(_MSC_VER) # if defined(_MSC_VER)
# ifndef _WIN32_WCE
# pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */ # pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */
# pragma comment (lib, "user32.lib") /* link Windows user lib */ # pragma comment (lib, "user32.lib") /* link Windows user lib */
# pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */ # pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */
# pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */ # pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */
# pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */ # pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
# endif //_WIN32_WCE
# endif # endif
#else #else

View File

@ -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... * 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? */ XFlush( fgDisplay.Display ); /* XXX Is this really necessary? */
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
{ {
POINT coords; POINT coords;

View File

@ -59,7 +59,7 @@ void FGAPIENTRY glutSwapBuffers( void )
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_UNIX_X11
glXSwapBuffers( fgDisplay.Display, fgStructure.Window->Window.Handle ); glXSwapBuffers( fgDisplay.Display, fgStructure.Window->Window.Handle );
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
SwapBuffers( fgStructure.Window->Window.Device ); SwapBuffers( fgStructure.Window->Window.Device );
#endif #endif

View File

@ -111,7 +111,9 @@ static struct name_address_pair glut_functions[] =
{ "glutWindowStatusFunc", (void *) glutWindowStatusFunc }, { "glutWindowStatusFunc", (void *) glutWindowStatusFunc },
{ "glutKeyboardUpFunc", (void *) glutKeyboardUpFunc }, { "glutKeyboardUpFunc", (void *) glutKeyboardUpFunc },
{ "glutSpecialUpFunc", (void *) glutSpecialUpFunc }, { "glutSpecialUpFunc", (void *) glutSpecialUpFunc },
#if !TARGET_HOST_WINCE
{ "glutJoystickFunc", (void *) glutJoystickFunc }, { "glutJoystickFunc", (void *) glutJoystickFunc },
#endif //TARGET_HOST_WINCE
{ "glutSetColor", (void *) glutSetColor }, { "glutSetColor", (void *) glutSetColor },
{ "glutGetColor", (void *) glutGetColor }, { "glutGetColor", (void *) glutGetColor },
{ "glutCopyColormap", (void *) glutCopyColormap }, { "glutCopyColormap", (void *) glutCopyColormap },
@ -152,11 +154,13 @@ static struct name_address_pair glut_functions[] =
{ "glutReportErrors", (void *) glutReportErrors }, { "glutReportErrors", (void *) glutReportErrors },
{ "glutIgnoreKeyRepeat", (void *) glutIgnoreKeyRepeat }, { "glutIgnoreKeyRepeat", (void *) glutIgnoreKeyRepeat },
{ "glutSetKeyRepeat", (void *) glutSetKeyRepeat }, { "glutSetKeyRepeat", (void *) glutSetKeyRepeat },
#if !TARGET_HOST_WINCE
{ "glutForceJoystickFunc", (void *) glutForceJoystickFunc }, { "glutForceJoystickFunc", (void *) glutForceJoystickFunc },
{ "glutGameModeString", (void *) glutGameModeString }, { "glutGameModeString", (void *) glutGameModeString },
{ "glutEnterGameMode", (void *) glutEnterGameMode }, { "glutEnterGameMode", (void *) glutEnterGameMode },
{ "glutLeaveGameMode", (void *) glutLeaveGameMode }, { "glutLeaveGameMode", (void *) glutLeaveGameMode },
{ "glutGameModeGet", (void *) glutGameModeGet }, { "glutGameModeGet", (void *) glutGameModeGet },
#endif //TARGET_HOST_WINCE
/* freeglut extensions */ /* freeglut extensions */
{ "glutMainLoopEvent", (void *) glutMainLoopEvent }, { "glutMainLoopEvent", (void *) glutMainLoopEvent },
{ "glutLeaveMainLoop", (void *) glutLeaveMainLoop }, { "glutLeaveMainLoop", (void *) glutLeaveMainLoop },
@ -191,7 +195,7 @@ void *FGAPIENTRY glutGetProcAddress( const char *procName )
return glut_functions[ i ].address; return glut_functions[ i ].address;
/* Try core GL functions */ /* Try core GL functions */
#if TARGET_HOST_WIN32 #if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
return( void * )wglGetProcAddress( ( LPCSTR )procName ); return( void * )wglGetProcAddress( ( LPCSTR )procName );
#elif TARGET_HOST_UNIX_X11 && defined( GLX_ARB_get_proc_address ) #elif TARGET_HOST_UNIX_X11 && defined( GLX_ARB_get_proc_address )
return(void * )glXGetProcAddressARB( ( const GLubyte * )procName ); return(void * )glXGetProcAddressARB( ( const GLubyte * )procName );

View File

@ -107,7 +107,7 @@ void fghRememberState( void )
*/ */
# endif # endif
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
/* DEVMODE devMode; */ /* DEVMODE devMode; */
@ -204,7 +204,7 @@ void fghRestoreState( void )
*/ */
# endif # endif
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
/* /*
* Restore the previously rememebered desktop display settings * Restore the previously rememebered desktop display settings
@ -294,7 +294,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest )
*/ */
# endif # endif
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
unsigned int displayModes = 0, mode = 0xffffffff; unsigned int displayModes = 0, mode = 0xffffffff;
GLboolean success = GL_FALSE; GLboolean success = GL_FALSE;

View File

@ -70,7 +70,7 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */
0, /* FPSInterval */ 0, /* FPSInterval */
0, /* SwapCount */ 0, /* SwapCount */
0, /* SwapTime */ 0, /* SwapTime */
#if TARGET_HOST_WIN32 #if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
{ 0, GL_FALSE }, /* Time */ { 0, GL_FALSE }, /* Time */
#else #else
{ { 0, 0 }, GL_FALSE }, { { 0, 0 }, GL_FALSE },
@ -142,7 +142,7 @@ void fgInitialize( const char* displayName )
FALSE FALSE
); );
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
WNDCLASS wc; WNDCLASS wc;
ATOM atom; ATOM atom;
@ -152,7 +152,8 @@ void fgInitialize( const char* displayName )
*/ */
fgDisplay.Instance = GetModuleHandle( NULL ); fgDisplay.Instance = GetModuleHandle( NULL );
atom = GetClassInfo( fgDisplay.Instance, "FREEGLUT", &wc ); atom = GetClassInfo( fgDisplay.Instance, _T("FREEGLUT"), &wc );
if( atom == 0 ) if( atom == 0 )
{ {
ZeroMemory( &wc, sizeof(WNDCLASS) ); 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 Old code had "| CS_DBCLCKS" commented out. Plans for the
* XXX future? Dead-end idea? * XXX future? Dead-end idea?
*/ */
wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = fgWindowProc; wc.lpfnWndProc = fgWindowProc;
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
wc.cbWndExtra = 0; wc.cbWndExtra = 0;
wc.hInstance = fgDisplay.Instance; 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) if (!wc.hIcon)
wc.hIcon = LoadIcon( NULL, IDI_WINLOGO ); wc.hIcon = LoadIcon( NULL, IDI_WINLOGO );
#else //TARGET_HOST_WINCE
wc.style = CS_HREDRAW | CS_VREDRAW;
#endif
wc.hCursor = LoadCursor( NULL, IDC_ARROW ); wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = NULL; wc.hbrBackground = NULL;
wc.lpszMenuName = NULL; wc.lpszMenuName = NULL;
wc.lpszClassName = "FREEGLUT"; wc.lpszClassName = _T("FREEGLUT");
/* /*
* Register the window class * Register the window class
@ -204,8 +210,10 @@ void fgInitialize( const char* displayName )
#endif #endif
#if !TARGET_HOST_WINCE
fgJoystickInit( 0 ); fgJoystickInit( 0 );
fgJoystickInit( 1 ); fgJoystickInit( 1 );
#endif //!TARGET_HOST_WINCE
fgState.Initialised = GL_TRUE; fgState.Initialised = GL_TRUE;
} }
@ -249,7 +257,9 @@ void fgDeinitialize( void )
free( timer ); free( timer );
} }
#if !TARGET_HOST_WINCE
fgJoystickClose( ); fgJoystickClose( );
#endif //!TARGET_HOST_WINCE
fgState.Initialised = GL_FALSE; fgState.Initialised = GL_FALSE;
@ -321,7 +331,7 @@ void fgDeinitialize( void )
* Everything inside the following #ifndef is copied from the X sources. * 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( ); fgElapsedTime( );
/* check if GLUT_FPS env var is set */ /* check if GLUT_FPS env var is set */
#if !TARGET_HOST_WINCE
{ {
const char *fps = getenv( "GLUT_FPS" ); const char *fps = getenv( "GLUT_FPS" );
if( 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" * Have the display created now. If there wasn't a "-display"
* in the program arguments, we will use the DISPLAY environment * in the program arguments, we will use the DISPLAY environment

View File

@ -36,12 +36,18 @@
/* /*
* Freeglut is meant to be available under all Unix/X11 and Win32 platforms. * 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_UNIX_X11 0
# define TARGET_HOST_WIN32 1 # define TARGET_HOST_WIN32 1
# define TARGET_HOST_WINCE 0
#else #else
# define TARGET_HOST_UNIX_X11 1 # define TARGET_HOST_UNIX_X11 1
# define TARGET_HOST_WIN32 0 # define TARGET_HOST_WIN32 0
# define TARGET_HOST_WINCE 0
#endif #endif
#define FREEGLUT_MAX_MENUS 3 #define FREEGLUT_MAX_MENUS 3
@ -62,6 +68,7 @@
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
#include <mmsystem.h> #include <mmsystem.h>
#include <TCHAR.H>
#endif #endif
#if defined(_MSC_VER) #if defined(_MSC_VER)
@ -288,7 +295,7 @@ struct tagSFG_Display
#endif #endif
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
HINSTANCE Instance; /* The application's instance */ HINSTANCE Instance; /* The application's instance */
DEVMODE DisplayMode; /* Desktop's display settings */ DEVMODE DisplayMode; /* Desktop's display settings */
@ -322,7 +329,7 @@ struct tagSFG_Timer
typedef Window SFG_WindowHandleType ; typedef Window SFG_WindowHandleType ;
typedef GLXContext SFG_WindowContextType ; typedef GLXContext SFG_WindowContextType ;
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
typedef HWND SFG_WindowHandleType ; typedef HWND SFG_WindowHandleType ;
typedef HGLRC SFG_WindowContextType ; typedef HGLRC SFG_WindowContextType ;
@ -343,7 +350,7 @@ struct tagSFG_Context
XVisualInfo* VisualInfo; /* The window's visual information */ XVisualInfo* VisualInfo; /* The window's visual information */
Pixmap Pixmap; /* Used for offscreen rendering */ Pixmap Pixmap; /* Used for offscreen rendering */
/* GLXPixmap GLXPixMap; */ /* 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 */ HDC Device; /* The window's device context */
#endif #endif
@ -735,7 +742,7 @@ XVisualInfo* fgChooseVisual( void );
/* /*
* The window procedure for Win32 events handling * 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, LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam ); WPARAM wParam, LPARAM lParam );
GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,

View File

@ -84,8 +84,9 @@ static void fghReshapeWindowByHandle ( SFG_WindowHandleType handle,
width, height ); width, height );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ 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; RECT rect;
@ -132,6 +133,7 @@ static void fghReshapeWindowByHandle ( SFG_WindowHandleType handle,
SWP_NOZORDER SWP_NOZORDER
); );
} }
#endif //TARGET_HOST_WINCE
/* /*
* XXX Should update {window->State.OldWidth, window->State.OldHeight} * XXX Should update {window->State.OldWidth, window->State.OldHeight}
@ -227,7 +229,7 @@ static void fghcbDisplayWindow( SFG_Window *window,
INVOKE_WCB( *window, Display, ( ) ); INVOKE_WCB( *window, Display, ( ) );
fgSetWindow( current_window ); fgSetWindow( current_window );
} }
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
RedrawWindow( RedrawWindow(
window->Window.Handle, NULL, NULL, window->Window.Handle, NULL, NULL,
RDW_NOERASE | RDW_INTERNALPAINT | RDW_INVALIDATE | RDW_UPDATENOW 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 <= if( window->State.JoystickLastPoll + window->State.JoystickPollRate <=
checkTime ) checkTime )
{ {
#if !TARGET_HOST_WINCE
fgJoystickPollWindow( window ); fgJoystickPollWindow( window );
#endif //!TARGET_HOST_WINCE
window->State.JoystickLastPoll = checkTime; window->State.JoystickLastPoll = checkTime;
} }
@ -322,6 +326,8 @@ long fgElapsedTime( void )
return elapsed; return elapsed;
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32
return timeGetTime() - fgState.Time.Value; return timeGetTime() - fgState.Time.Value;
#elif TARGET_HOST_WINCE
return GetTickCount() - fgState.Time.Value;
#endif #endif
} }
else else
@ -330,6 +336,8 @@ long fgElapsedTime( void )
gettimeofday( &fgState.Time.Value, NULL ); gettimeofday( &fgState.Time.Value, NULL );
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32
fgState.Time.Value = timeGetTime (); fgState.Time.Value = timeGetTime ();
#elif TARGET_HOST_WINCE
fgState.Time.Value = GetTickCount();
#endif #endif
fgState.Time.Set = GL_TRUE ; fgState.Time.Set = GL_TRUE ;
@ -478,7 +486,7 @@ static void fgSleepForEvents( void )
if( -1 == err ) if( -1 == err )
fgWarning ( "freeglut select() error: %d\n", errno ); 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 ); MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLEVENTS );
#endif #endif
} }
@ -1047,7 +1055,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
} }
} }
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
MSG stMsg; MSG stMsg;
@ -1085,13 +1093,13 @@ void FGAPIENTRY glutMainLoop( void )
{ {
int action; int action;
#if TARGET_HOST_WIN32 #if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ; SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ;
#endif #endif
freeglut_assert_ready; 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 * 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, * 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. * 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; unsigned int current_DisplayMode = fgState.DisplayMode;
fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH; fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH;
#if !TARGET_HOST_WINCE
fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE ); fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE );
#endif
fgState.DisplayMode = current_DisplayMode; fgState.DisplayMode = current_DisplayMode;
if( fgStructure.MenuContext ) if( fgStructure.MenuContext )
@ -1228,7 +1238,9 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
} }
else else
{ {
#if !TARGET_HOST_WINCE
fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE ); fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE );
#endif
if( ! fgState.UseCurrentContext ) if( ! fgState.UseCurrentContext )
window->Window.Context = window->Window.Context =
@ -1258,8 +1270,13 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
if( window->State.Visible ) if( window->State.Visible )
{ {
window->State.NeedToResize = GL_TRUE; 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.Width = LOWORD(lParam);
window->State.Height = HIWORD(lParam); window->State.Height = HIWORD(lParam);
#endif //TARGET_HOST_WINCE
} }
break; break;
@ -1423,6 +1440,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
break; break;
} }
#if !TARGET_HOST_WINCE
if( GetSystemMetrics( SM_SWAPBUTTON ) ) if( GetSystemMetrics( SM_SWAPBUTTON ) )
{ {
if( button == GLUT_LEFT_BUTTON ) if( button == GLUT_LEFT_BUTTON )
@ -1431,6 +1449,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
if( button == GLUT_RIGHT_BUTTON ) if( button == GLUT_RIGHT_BUTTON )
button = GLUT_LEFT_BUTTON; button = GLUT_LEFT_BUTTON;
} }
#endif //!TARGET_HOST_WINCE
if( button == -1 ) if( button == -1 )
return DefWindowProc( hWnd, uMsg, lParam, wParam ); return DefWindowProc( hWnd, uMsg, lParam, wParam );
@ -1714,6 +1733,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
default: default:
{ {
#if !TARGET_HOST_WINCE
BYTE state[ 256 ]; BYTE state[ 256 ];
WORD code[ 2 ]; WORD code[ 2 ];
@ -1726,6 +1746,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
( (char)wParam, ( (char)wParam,
window->State.MouseX, window->State.MouseY ) 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 ); lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );
break; break;
#if !TARGET_HOST_WINCE
case WM_SYNCPAINT: /* 0x0088 */ case WM_SYNCPAINT: /* 0x0088 */
/* Another window has moved, need to update this one */ /* Another window has moved, need to update this one */
window->State.Redisplay = GL_TRUE; window->State.Redisplay = GL_TRUE;
@ -1864,6 +1886,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
break ; break ;
} }
} }
#endif //!TARGET_HOST_WINCE
/* We need to pass the message on to the operating system as well */ /* We need to pass the message on to the operating system as well */
lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); lRet = DefWindowProc( hWnd, uMsg, wParam, lParam );

View File

@ -56,7 +56,7 @@
* that that wasn't the original intent...if not, perhaps we need another * that that wasn't the original intent...if not, perhaps we need another
* symbolic constant, FREEGLUT_MENU_ITEM_BORDER, or such.) * 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 #define FREEGLUT_MENU_FONT GLUT_BITMAP_8_BY_13
#else #else
#define FREEGLUT_MENU_FONT GLUT_BITMAP_HELVETICA_18 #define FREEGLUT_MENU_FONT GLUT_BITMAP_HELVETICA_18
@ -75,7 +75,7 @@
* too. These variables should be stuffed into global state and initialized * too. These variables should be stuffed into global state and initialized
* via the glutInit*() system. * 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_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_back [4] = {0.85f, 0.85f, 0.85f, 1.0f};
static float menu_pen_hfore [4] = {1.0f, 1.0f, 1.0f, 1.0f}; static float menu_pen_hfore [4] = {1.0f, 1.0f, 1.0f, 1.0f};

View File

@ -137,10 +137,12 @@ void FGAPIENTRY glutSetKeyRepeat( int repeatMode )
*/ */
void FGAPIENTRY glutForceJoystickFunc( void ) void FGAPIENTRY glutForceJoystickFunc( void )
{ {
#if !TARGET_HOST_WINCE
freeglut_assert_ready; freeglut_assert_ready;
freeglut_return_if_fail( fgStructure.Window != NULL ); freeglut_return_if_fail( fgStructure.Window != NULL );
freeglut_return_if_fail( FETCH_WCB( *( fgStructure.Window ), Joystick ) ); freeglut_return_if_fail( FETCH_WCB( *( fgStructure.Window ), Joystick ) );
fgJoystickPollWindow( fgStructure.Window ); fgJoystickPollWindow( fgStructure.Window );
#endif //!TARGET_HOST_WINCE
} }
/* /*

View File

@ -124,7 +124,7 @@ void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
*/ */
int FGAPIENTRY glutGet( GLenum eWhat ) int FGAPIENTRY glutGet( GLenum eWhat )
{ {
#if TARGET_HOST_WIN32 #if TARGET_HOST_WIN32 || TARGET_HOST_WINCE
int returnValue ; int returnValue ;
GLboolean boolValue ; GLboolean boolValue ;
#endif #endif
@ -281,7 +281,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
return fgStructure.Window->Window.VisualInfo->visualid; return fgStructure.Window->Window.VisualInfo->visualid;
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
/* /*
* Handle the OpenGL inquiries * 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... * ...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 ) && if ( ( fgStructure.GameMode != fgStructure.Window ) && ( fgStructure.Window->Parent == NULL ) &&
( ! fgStructure.Window->IsMenu ) ) ( ! fgStructure.Window->IsMenu ) )
{ {
@ -384,6 +386,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
winRect.top += GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION ); winRect.top += GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION );
winRect.bottom -= GetSystemMetrics( SM_CYSIZEFRAME ); winRect.bottom -= GetSystemMetrics( SM_CYSIZEFRAME );
} }
#endif //TARGET_HOST_WINCE
switch( eWhat ) switch( eWhat )
{ {
@ -396,18 +399,33 @@ int FGAPIENTRY glutGet( GLenum eWhat )
break; break;
case GLUT_WINDOW_BORDER_WIDTH : case GLUT_WINDOW_BORDER_WIDTH :
#if TARGET_HOST_WINCE
return 0;
#else
return GetSystemMetrics( SM_CXSIZEFRAME ); return GetSystemMetrics( SM_CXSIZEFRAME );
#endif //TARGET_HOST_WINCE
case GLUT_WINDOW_HEADER_HEIGHT : case GLUT_WINDOW_HEADER_HEIGHT :
#if TARGET_HOST_WINCE
return 0;
#else
return GetSystemMetrics( SM_CYCAPTION ); return GetSystemMetrics( SM_CYCAPTION );
#endif //TARGET_HOST_WINCE
case GLUT_DISPLAY_MODE_POSSIBLE: case GLUT_DISPLAY_MODE_POSSIBLE:
#if TARGET_HOST_WINCE
return GL_FALSE;
#else
return fgSetupPixelFormat( fgStructure.Window, GL_TRUE, return fgSetupPixelFormat( fgStructure.Window, GL_TRUE,
PFD_MAIN_PLANE ); PFD_MAIN_PLANE );
#endif //TARGET_HOST_WINCE
case GLUT_WINDOW_FORMAT_ID: case GLUT_WINDOW_FORMAT_ID:
#if !TARGET_HOST_WINCE
if( fgStructure.Window != NULL ) if( fgStructure.Window != NULL )
return GetPixelFormat( fgStructure.Window->Window.Device ); return GetPixelFormat( fgStructure.Window->Window.Device );
#endif //TARGET_HOST_WINCE
return 0; return 0;
#endif #endif
@ -503,7 +521,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
*/ */
return 3 ; return 3 ;
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
case GLUT_HAS_MOUSE: case GLUT_HAS_MOUSE:
/* /*
@ -516,7 +534,11 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
/* /*
* We are much more fortunate under Win32 about this... * We are much more fortunate under Win32 about this...
*/ */
#if TARGET_HOST_WINCE
return 1;
#else
return GetSystemMetrics( SM_CMOUSEBUTTONS ); return GetSystemMetrics( SM_CMOUSEBUTTONS );
#endif //TARGET_HOST_WINCE
#endif #endif
@ -619,7 +641,7 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat )
case GLUT_OVERLAY_DAMAGED: case GLUT_OVERLAY_DAMAGED:
return -1; return -1;
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
case GLUT_OVERLAY_POSSIBLE: case GLUT_OVERLAY_POSSIBLE:
/* return fgSetupPixelFormat( fgStructure.Window, GL_TRUE, /* return fgSetupPixelFormat( fgStructure.Window, GL_TRUE,

View File

@ -32,6 +32,23 @@
#include <GL/freeglut.h> #include <GL/freeglut.h>
#include "freeglut_internal.h" #include "freeglut_internal.h"
#if TARGET_HOST_WINCE
#include <aygshell.h>
#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; i<len; i++)
wstr[i] = str[i];
wstr[len] = 0;
return wstr;
}
#endif //TARGET_HOST_WINCE
/* /*
* TODO BEFORE THE STABLE RELEASE: * TODO BEFORE THE STABLE RELEASE:
* *
@ -154,6 +171,9 @@ XVisualInfo* fgChooseVisual( void )
GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
unsigned char layer_type ) unsigned char layer_type )
{ {
#if TARGET_HOST_WINCE
return GL_TRUE;
#else
PIXELFORMATDESCRIPTOR* ppfd, pfd; PIXELFORMATDESCRIPTOR* ppfd, pfd;
int flags, pixelformat; int flags, pixelformat;
@ -211,6 +231,7 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
if( checkOnly ) if( checkOnly )
return GL_TRUE; return GL_TRUE;
return SetPixelFormat( window->Window.Device, pixelformat, ppfd ); return SetPixelFormat( window->Window.Device, pixelformat, ppfd );
#endif //TARGET_HOST_WINCE
} }
#endif #endif
@ -227,7 +248,7 @@ void fgSetWindow ( SFG_Window *window )
window->Window.Handle, window->Window.Handle,
window->Window.Context window->Window.Context
); );
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
if( fgStructure.Window ) if( fgStructure.Window )
ReleaseDC( fgStructure.Window->Window.Handle, ReleaseDC( fgStructure.Window->Window.Handle,
fgStructure.Window->Window.Device ); 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 * that they should replace a window manager that they like, and which
* works, just because *we* think that it's not "modern" enough. * 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.x = x;
sizeHints.y = y; sizeHints.y = y;
sizeHints.width = w; sizeHints.width = w;
sizeHints.height = h; sizeHints.height = h;
#endif //TARGET_HOST_WINCE
wmHints.flags = StateHint; wmHints.flags = StateHint;
wmHints.initial_state = fgState.ForceIconic ? IconicState : NormalState; 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 ); XMapWindow( fgDisplay.Display, window->Window.Handle );
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
WNDCLASS wc; WNDCLASS wc;
DWORD flags; DWORD flags;
@ -466,7 +494,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
/* /*
* 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, _T("FREEGLUT"), &wc );
assert( atom != 0 ); assert( atom != 0 );
if( gameMode ) if( gameMode )
@ -481,6 +509,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
} }
else else
{ {
#if !TARGET_HOST_WINCE
if ( ( ! isSubWindow ) && ( ! window->IsMenu ) ) if ( ( ! isSubWindow ) && ( ! window->IsMenu ) )
{ {
/* /*
@ -492,6 +521,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
h += (GetSystemMetrics( SM_CYSIZEFRAME ) )*2 + h += (GetSystemMetrics( SM_CYSIZEFRAME ) )*2 +
GetSystemMetrics( SM_CYCAPTION ); GetSystemMetrics( SM_CYCAPTION );
} }
#endif //TARGET_HOST_WINCE
if( ! fgState.Position.Use ) if( ! fgState.Position.Use )
{ {
@ -515,12 +545,39 @@ void fgOpenWindow( SFG_Window* window, const char* title,
flags |= WS_POPUP; flags |= WS_POPUP;
exFlags |= WS_EX_TOOLWINDOW; exFlags |= WS_EX_TOOLWINDOW;
} }
#if !TARGET_HOST_WINCE
else if( window->Parent == NULL ) else if( window->Parent == NULL )
flags |= WS_OVERLAPPEDWINDOW; flags |= WS_OVERLAPPEDWINDOW;
#endif
else else
flags |= WS_CHILD; 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( window->Window.Handle = CreateWindowEx(
exFlags, exFlags,
"FREEGLUT", "FREEGLUT",
@ -532,11 +589,18 @@ void fgOpenWindow( SFG_Window* window, const char* title,
fgDisplay.Instance, fgDisplay.Instance,
(LPVOID) window (LPVOID) window
); );
#endif TARGET_HOST_WINCE
if( !( window->Window.Handle ) ) if( !( window->Window.Handle ) )
fgError( "Failed to create a window (%s)!", title ); fgError( "Failed to create a window (%s)!", title );
#if TARGET_HOST_WINCE
ShowWindow( window->Window.Handle, SW_SHOW );
#else
ShowWindow( window->Window.Handle, ShowWindow( window->Window.Handle,
fgState.ForceIconic ? SW_SHOWMINIMIZED : SW_SHOW ); fgState.ForceIconic ? SW_SHOWMINIMIZED : SW_SHOW );
#endif //TARGET_HOST_WINCE
UpdateWindow( window->Window.Handle ); UpdateWindow( window->Window.Handle );
ShowCursor( TRUE ); /* XXX Old comments say "hide cusror"! */ 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 */ 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 * 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 ); XMapWindow( fgDisplay.Display, fgStructure.Window->Window.Handle );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ 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 ); ShowWindow( fgStructure.Window->Window.Handle, SW_SHOW );
@ -722,7 +786,7 @@ void FGAPIENTRY glutHideWindow( void )
fgStructure.Window->Window.Handle ); fgStructure.Window->Window.Handle );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ 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 ); ShowWindow( fgStructure.Window->Window.Handle, SW_HIDE );
@ -746,7 +810,7 @@ void FGAPIENTRY glutIconifyWindow( void )
fgDisplay.Screen ); fgDisplay.Screen );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ 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 ); ShowWindow( fgStructure.Window->Window.Handle, SW_MINIMIZE );
@ -785,6 +849,14 @@ void FGAPIENTRY glutSetWindowTitle( const char* title )
SetWindowText( fgStructure.Window->Window.Handle, 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 #endif
} }
} }
@ -820,6 +892,14 @@ void FGAPIENTRY glutSetIconTitle( const char* title )
SetWindowText( fgStructure.Window->Window.Handle, 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 #endif
} }
} }
@ -851,7 +931,7 @@ void FGAPIENTRY glutPositionWindow( int x, int y )
x, y ); x, y );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */ XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
{ {
RECT winRect; RECT winRect;
@ -882,7 +962,7 @@ void FGAPIENTRY glutPushWindow( void )
XLowerWindow( fgDisplay.Display, fgStructure.Window->Window.Handle ); XLowerWindow( fgDisplay.Display, fgStructure.Window->Window.Handle );
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
SetWindowPos( SetWindowPos(
fgStructure.Window->Window.Handle, fgStructure.Window->Window.Handle,
@ -906,7 +986,7 @@ void FGAPIENTRY glutPopWindow( void )
XRaiseWindow( fgDisplay.Display, fgStructure.Window->Window.Handle ); XRaiseWindow( fgDisplay.Display, fgStructure.Window->Window.Handle );
#elif TARGET_HOST_WIN32 #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
SetWindowPos( SetWindowPos(
fgStructure.Window->Window.Handle, fgStructure.Window->Window.Handle,