From: <at...@us...> - 2007-09-11 01:50:15
|
Revision: 512 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=512&view=rev Author: atani Date: 2007-09-10 18:50:14 -0700 (Mon, 10 Sep 2007) Log Message: ----------- init flags support on win32 Modified Paths: -------------- tiki/win32/src/init_shutdown.cpp tiki/win32/src/platgl.cpp tiki/win32/src/plathid.cpp tiki/win32/tiki.vcproj Property Changed: ---------------- tiki/examples/net/httpclient/resources/ Property changes on: tiki/examples/net/httpclient/resources ___________________________________________________________________ Name: svn:ignore + cookies.xml Modified: tiki/win32/src/init_shutdown.cpp =================================================================== --- tiki/win32/src/init_shutdown.cpp 2007-09-10 23:35:51 UTC (rev 511) +++ tiki/win32/src/init_shutdown.cpp 2007-09-11 01:50:14 UTC (rev 512) @@ -16,31 +16,41 @@ // Let us run with millisecond precision if possible. timeBeginPeriod( 1 ); - ALCdevice *dev = NULL; - ALCcontext *ctx = NULL; + if(g_tiki_init_flags & INIT_AUDIO_MASK) { + ALCdevice *dev = NULL; + ALCcontext *ctx = NULL; - dev = alcOpenDevice( getenv( "OPENAL_DEVICE" ) ); // getenv()==NULL is okay. - if ( dev != NULL ) { - ctx = alcCreateContext( dev, 0 ); - if ( ctx != NULL ) { - alcMakeContextCurrent( ctx ); - alcProcessContext( ctx ); + dev = alcOpenDevice( getenv( "OPENAL_DEVICE" ) ); // getenv()==NULL is okay. + if ( dev != NULL ) { + ctx = alcCreateContext( dev, 0 ); + if ( ctx != NULL ) { + alcMakeContextCurrent( ctx ); + alcProcessContext( ctx ); + } // if } // if - } // if + if(g_tiki_init_flags & INIT_AUDIO_SFX) { + Audio::Sound::initGlobal(); + } + if(g_tiki_init_flags & INIT_AUDIO_STREAM) { + Audio::Stream::initGlobal(); + } + } - Audio::Stream::initGlobal(); - Audio::Sound::initGlobal(); - - GL::Plxcompat::plx_mat3d_init( 640, 480 ); - Hid::init(); - - return true; + if(g_tiki_init_flags & INIT_AUDIO_STREAM) { + GL::Plxcompat::plx_mat3d_init( 640, 480 ); + } + + return Hid::init(); } void Tiki::shutdown() { Hid::shutdown(); - Audio::Sound::shutdownGlobal(); - Audio::Stream::shutdownGlobal(); + if(g_tiki_init_flags & INIT_AUDIO_STREAM) { + Audio::Stream::shutdownGlobal(); + } + if(g_tiki_init_flags & INIT_AUDIO_SFX) { + Audio::Sound::shutdownGlobal(); + } timeEndPeriod( 1 ); } Modified: tiki/win32/src/platgl.cpp =================================================================== --- tiki/win32/src/platgl.cpp 2007-09-10 23:35:51 UTC (rev 511) +++ tiki/win32/src/platgl.cpp 2007-09-11 01:50:14 UTC (rev 512) @@ -107,15 +107,26 @@ m_hThread = CreateThread( NULL, 0, GameThread, lpCmdLine, 0, &m_dwThreadID ); - while ( m_hThread != NULL ) { - do { - if ( GetMessage( &msg, NULL, NULL, NULL ) ) { - TranslateMessage( &msg ); - DispatchMessage( &msg ); - } + UINT min = WM_KEYFIRST, max = WM_MOUSELAST; - } while ( ::PeekMessage( &msg, NULL, NULL, NULL, PM_REMOVE ) ); + if(g_tiki_init_flags & INIT_HID_KEYBOARD && + !(g_tiki_init_flags & INIT_HID_MOUSE)) { + max = WM_KEYLAST; + } + else if(g_tiki_init_flags & INIT_HID_MOUSE && + !(g_tiki_init_flags & INIT_HID_KEYBOARD)) { + min = WM_MOUSEFIRST; + } + while ( m_hThread != NULL ) { + if ( ::PeekMessage( &msg, m_hWndMain, WM_NULL, WM_KEYFIRST - 1, PM_REMOVE ) ) { + TranslateMessage( &msg ); + DispatchMessage( &msg ); + } + else if ( ::PeekMessage( &msg, m_hWndMain, min, max, PM_REMOVE ) ) { + TranslateMessage( &msg ); + DispatchMessage( &msg ); + } Sleep( 2 ); } @@ -138,23 +149,22 @@ case WM_RBUTTONDOWN: case WM_RBUTTONUP: #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) //WM_MOUSEWHEEL requires Windows 98 or above - case WM_MOUSEWHEEL: #endif - - Tiki::RecvEvent( iMsg, wParam, lParam ); - break; + Tiki::RecvEvent( iMsg, wParam, lParam ); + break; case WM_CLOSE: - Tiki::RecvQuit(); - return 0; - break; + case WM_QUIT: + Tiki::RecvQuit(); + return 0; + break; case WM_DESTROY: - DestroyApplication(); - PostQuitMessage( 0 ); - break; + DestroyApplication(); + PostQuitMessage( 0 ); + break; default: - return DefWindowProc( hWnd, iMsg, wParam, lParam ); + return DefWindowProc( hWnd, iMsg, wParam, lParam ); } return 0L; } @@ -326,7 +336,6 @@ totalFrameCnt++; #ifdef _DEBUG - if ( frameCnt && !( frameCnt % 250 ) ) { Debug::printf( "frame %d, fps = %.2f\n", ( int ) frameCnt, ( double ) Tiki::GL::Frame::getFrameRate() ); Modified: tiki/win32/src/plathid.cpp =================================================================== --- tiki/win32/src/plathid.cpp 2007-09-10 23:35:51 UTC (rev 511) +++ tiki/win32/src/plathid.cpp 2007-09-11 01:50:14 UTC (rev 512) @@ -28,17 +28,16 @@ } }; -static RefPtr<KbDevice> win32kb; -static RefPtr<MouseDevice> win32mouse; +static RefPtr<KbDevice> win32kb = NULL; +static RefPtr<MouseDevice> win32mouse = NULL; bool Hid::platInit() { win32kb = new KbDevice(); - win32mouse = new MouseDevice(); - Event evt( Event::EvtAttach ); evt.dev = win32kb; sendEvent( evt ); + win32mouse = new MouseDevice(); evt.dev = win32mouse; sendEvent( evt ); return true; @@ -229,7 +228,6 @@ } break; #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) //WM_MOUSEWHEEL requires Windows 98 or above - case WM_MOUSEWHEEL: { Event evt( Event::EvtBtnPress ); evt.dev = win32mouse; Modified: tiki/win32/tiki.vcproj =================================================================== --- tiki/win32/tiki.vcproj 2007-09-10 23:35:51 UTC (rev 511) +++ tiki/win32/tiki.vcproj 2007-09-11 01:50:14 UTC (rev 512) @@ -43,7 +43,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""$(ProjectDir)\include";"$(ProjectDir)\..\include";"C:\Program Files\OpenAL 1.1 SDK\include";"$(ProjectDir)\..\3rdparty\libjpeg";"$(ProjectDir)\..\3rdparty\libogg\include";"$(ProjectDir)\..\3rdparty\libpng";"$(ProjectDir)\..\3rdparty\libvorbis\include";"$(ProjectDir)\..\3rdparty\zlib";"$(ProjectDir)\..\3rdparty\tinyxml"" - PreprocessorDefinitions="_WIN32_WINNT=0x0500;_CRT_SECURE_NO_WARNINGS=1" + PreprocessorDefinitions="_WIN32_WINNT=0x0500;_CRT_SECURE_NO_WARNINGS=1;_DEBUG=1" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -228,6 +228,10 @@ > </File> <File + RelativePath="..\src\base\init_flags_default.cpp" + > + </File> + <File RelativePath="..\src\base\object.cpp" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |