コード例 #1
0
ファイル: system.c プロジェクト: dderby/avp_GLES
void InitEnvironmentFromLoad(void) 
{
	// in DB menus - we only destroy the current environment
	// after we have selected a leve, to load - WE could
	// be going TO ANY ENV or CHARACTER here (ughh) 

	// this is an entire game destroy (with no save) killing
	// both the env and the character followed by a complete
	// game restart 
	
	// environment clean up - sets up the load info
	Destroy_CurrentEnvironment();
	// then the REST
	DestroyAllStrategyBlocks();
	#if MaxImageGroups>1
	SetCurrentImageGroup(0); // FOR ENV
	DeallocateCurrentImages();
	#endif
	/* Patrick: 26/6/97
	Stop and remove all sounds here */	
	SoundSys_StopAll();
	SoundSys_RemoveAll(); 
	CDDA_Stop();

	// start the loading - we load the player
	InitCharacter();	// intis the char
	LoadRifFile();    // env

	// do all the ness processing
	// start games calles FormatSaveBuffer and
	// Process System Objects

	AssignAllSBNames();
	
	// Set the timer, or we have just taken
	// 10 secs for the frame

	/***** No need to do frame counter stuff in a computer! *****/

	/* Patrick: 26/6/97
	Load our sounds for the new env */	
	LoadSounds("PLAYER");
}
コード例 #2
0
HRESULT SWLPRVenusCameraParameter::Initialize(CSWString strFilePath)
{
	// 初始化前重新设置默认值
	ResetParam();
	
    // 先基类的初始化
    if (S_OK == CSWParameter<ModuleParams>::Initialize(strFilePath)
        && S_OK == InitSystem()
        && S_OK == InitCamera()
        && S_OK == InitHvDsp()
        && S_OK == InitCharacter()
        && S_OK == InitGB28181()
		&& S_OK == InitONVIF())
    {
        return S_OK ;
    }

    SW_TRACE_DEBUG("<SWLPRVenusCameraParameter> Initialize failed.\n");
    return E_FAIL ;
}
// エントリポイント
int WINAPI _tWinMain( HINSTANCE hInst, HINSTANCE, LPTSTR, int )
{
	LARGE_INTEGER			nNowTime, nLastTime;		// 現在とひとつ前の時刻
	LARGE_INTEGER			nTimeFreq;					// 時間単位

    // 画面サイズ
    g_nClientWidth  = VIEW_WIDTH;						// 幅
    g_nClientHeight = VIEW_HEIGHT;						// 高さ

	// Register the window class
    WNDCLASSEX wc = { sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0L, 0L,
                      GetModuleHandle( NULL ), NULL, NULL, NULL, NULL,
                      _T( "D3D Sample" ), NULL };
    RegisterClassEx( &wc );

	RECT rcRect;
	SetRect( &rcRect, 0, 0, g_nClientWidth, g_nClientHeight );
	AdjustWindowRect( &rcRect, WS_OVERLAPPEDWINDOW, FALSE );
    g_hWnd = CreateWindow( _T( "D3D Sample" ), _T( "Movement_2_1a" ),
						   WS_OVERLAPPEDWINDOW, 100, 20, rcRect.right - rcRect.left, rcRect.bottom - rcRect.top,
						   GetDesktopWindow(), NULL, wc.hInstance, NULL );

    // Initialize Direct3D
    if( SUCCEEDED( InitD3D() ) && SUCCEEDED( MakeShaders() ) )
    {
        // Create the shaders
        if( SUCCEEDED( InitDrawModes() ) )
        {
			if ( SUCCEEDED( InitGeometry() ) ) {					// ジオメトリ作成

				// Show the window
				ShowWindow( g_hWnd, SW_SHOWDEFAULT );
				UpdateWindow( g_hWnd );

				InitCharacter();									// キャラクタ初期化
				
				QueryPerformanceFrequency( &nTimeFreq );			// 時間単位
				QueryPerformanceCounter( &nLastTime );				// 1フレーム前時刻初期化

				// Enter the message loop
				MSG msg;
				ZeroMemory( &msg, sizeof( msg ) );
				while( msg.message != WM_QUIT )
				{
					Render();
					MoveCharacter();
					do {
						if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
						{
							TranslateMessage( &msg );
							DispatchMessage( &msg );
						}
						QueryPerformanceCounter( &nNowTime );
					} while( ( ( nNowTime.QuadPart - nLastTime.QuadPart ) < ( nTimeFreq.QuadPart / 90 ) ) &&
							 ( msg.message != WM_QUIT ) );
					while( ( ( nNowTime.QuadPart - nLastTime.QuadPart ) < ( nTimeFreq.QuadPart / 60 ) ) &&
						   ( msg.message != WM_QUIT ) )
					{
						QueryPerformanceCounter( &nNowTime );
					}
					nLastTime = nNowTime;
					g_pSwapChain->Present( 0, 0 );					// 表示
				}
			}
        }
    }

    // Clean up everything and exit the app
    Cleanup();
    UnregisterClass( _T( "D3D Sample" ), wc.hInstance );
    return 0;
}