当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECT3DDEVICE8::Clear方法代码示例

本文整理汇总了C++中LPDIRECT3DDEVICE8::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE8::Clear方法的具体用法?C++ LPDIRECT3DDEVICE8::Clear怎么用?C++ LPDIRECT3DDEVICE8::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDIRECT3DDEVICE8的用法示例。


在下文中一共展示了LPDIRECT3DDEVICE8::Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BeginFrame

bool RageDisplay_D3D::BeginFrame()
{
	GraphicsWindow::Update();

	switch( g_pd3dDevice->TestCooperativeLevel() )
	{
	case D3DERR_DEVICELOST:
		return false;
	case D3DERR_DEVICENOTRESET:
		{
			bool bIgnore = false;
			RString sError = SetD3DParams( bIgnore );
			if( sError != "" )
				RageException::Throw( sError );

			break;
		}
	}

	g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
						 D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
	g_pd3dDevice->BeginScene();

	return RageDisplay::BeginFrame();
}
开发者ID:SamDecrock,项目名称:stepmania5-http-post-scores,代码行数:25,代码来源:RageDisplay_D3D.cpp

示例2: update

void RenderingManagerC::update()
{

	

	// Clear the backbuffer to a blue color
	    g_pd3dDevice->Clear( 0L, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL, 
	                         D3DCOLOR_XRGB(0,0,255), 1.0f, 0L );
	
	    // Begin the scene
	    g_pd3dDevice->BeginScene();
	
		DrawBackground();
		DrawPlayer();
		
		DrawRaycast();

		DrawPortal(true);
		DrawPortal(false);

		DrawCrossHair();
		//DrawBox(71.0f, 673.0f, 1218.0f, 673.0f, 0x00000000, 0xFFFFFFFF);
		DrawStaticObjects();

	

		DrawTurrents();
	    // End the scene
	    g_pd3dDevice->EndScene();

		// Present the backbuffer contents to the display
		g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:maheshvele,项目名称:PortalClone,代码行数:33,代码来源:RenderingManager.cpp

示例3: render

void render()
{
   static RECT rc = {0, 0, 320, 100};   // rectangular region.. used for text drawing
   static DWORD frameCount = 0;
   static DWORD startTime = clock();
   char str[16];

   doMath();   // do the math.. :-P   
   
   frameCount++;   //  increment frame count
    
   // Clear the back buffer to a black... values r g b are 0-256
    lpD3DDevice8->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER ,D3DCOLOR_XRGB(256, 256, 256), 1.0f, 0);

   // render the cubes
   myRect1->render(clock());
   myRect2->render(clock());

   // this function writes a formatted string to a character string
   // in this case.. it will write "Avg fps" followed by the 
   // frames per second.. with 2 decimal places
   sprintf(str, "Avg fps %.2f", (float) frameCount / ((clock() - startTime) / 1000.0f));
      
   // draw the text string..
   lpD3DXFont->Begin();
   lpD3DXFont->DrawText(str, -1, &rc, DT_LEFT, 0xFFFFFFFF);
   lpD3DXFont->End();
   
    // present the back buffer.. or "flip" the page
    lpD3DDevice8->Present( NULL, NULL, NULL, NULL );   // these options are for using rectangular
    // regions for rendering/drawing...
    // 3rd is which target window.. NULL makes it use the currently set one (default)
    // last one is NEVER used.. that happens with DirectX often
}
开发者ID:pnchang,项目名称:advgraphics,代码行数:34,代码来源:example03.cpp

示例4: Render

//-----------------------------------------------------------------------------
// Name: Render()
// Desc: Draws the scene
//-----------------------------------------------------------------------------
VOID Render()
{
    // Clear the backbuffer and the zbuffer
    g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 
                         D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );
    
    // Begin the scene
    g_pd3dDevice->BeginScene();

    // Setup the world, view, and projection matrices
    SetupMatrices();

    // Meshes are divided into subsets, one for each material. Render them in
    // a loop
    for( DWORD i=0; i<g_dwNumMaterials; i++ )
    {
        // Set the material and texture for this subset
        g_pd3dDevice->SetMaterial( &g_pMeshMaterials[i] );
        g_pd3dDevice->SetTexture( 0, g_pMeshTextures[i] );
        
        // Draw the mesh subset
        g_pMesh->DrawSubset( i );
    }

    // End the scene
    g_pd3dDevice->EndScene();
    
    // Present the backbuffer contents to the display
    g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:grakidov,项目名称:Render3D,代码行数:34,代码来源:Meshes.cpp

示例5: Render

//-----------------------------------------------------------------------------
// Name: Render()
// Desc: Draws the scene
//-----------------------------------------------------------------------------
VOID Render()
{
    // Clear the backbuffer and the zbuffer
    g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
                         D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );

    // Begin the scene
    g_pd3dDevice->BeginScene();

    // Setup the lights and materials
    SetupLights();

    // Setup the world, view, and projection matrices
    SetupMatrices();

    // Render the vertex buffer contents
    g_pd3dDevice->SetStreamSource( 0, g_pVB, sizeof(CUSTOMVERTEX) );
    g_pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX );
    g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2*50-2 );

    // End the scene
    g_pd3dDevice->EndScene();

    // Present the backbuffer contents to the display
    g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:grakidov,项目名称:Render3D,代码行数:30,代码来源:Lights.cpp

示例6: StartFrame

void StartFrame()
{
 d3ddevice->Clear( 0, NULL, D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );
 d3ddevice->BeginScene();



  
}
开发者ID:duhone,项目名称:Old3DWork,代码行数:9,代码来源:diffuse+specular+bump+map.cpp

示例7: Render

//-----------------------------------------------------------------------------
// Name: Render()
// Desc: Draws the scene
//-----------------------------------------------------------------------------
VOID Render()
{
    // Clear the backbuffer and the zbuffer
    g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
                         D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );

    // Begin the scene
    g_pd3dDevice->BeginScene();

    // Setup the world, view, and projection matrices
    SetupMatrices();

    // Setup our texture. Using textures introduces the texture stage states,
    // which govern how textures get blended together (in the case of multiple
    // textures) and lighting information. In this case, we are modulating
    // (blending) our texture with the diffuse color of the vertices.
    g_pd3dDevice->SetTexture( 0, g_pTexture );
    g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_MODULATE );
    g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
    g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
    g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_DISABLE );

#ifdef SHOW_HOW_TO_USE_TCI
    // Note: to use D3D texture coordinate generation, use the stage state
    // D3DTSS_TEXCOORDINDEX, as shown below. In this example, we are using
    // the position of the vertex in camera space to generate texture
    // coordinates. The tex coord index (TCI) parameters are passed into a
    // texture transform, which is a 4x4 matrix which transforms the x,y,z
    // TCI coordinates into tu, tv texture coordinates.

    // In this example, the texture matrix is setup to 
    // transform the texture from (-1,+1) position coordinates to (0,1) 
    // texture coordinate space:
    //    tu =  0.5*x + 0.5
    //    tv = -0.5*y + 0.5
    D3DXMATRIX mat;
    mat._11 = 0.25f; mat._12 = 0.00f; mat._13 = 0.00f; mat._14 = 0.00f;
    mat._21 = 0.00f; mat._22 =-0.25f; mat._23 = 0.00f; mat._24 = 0.00f;
    mat._31 = 0.00f; mat._32 = 0.00f; mat._33 = 1.00f; mat._34 = 0.00f;
    mat._41 = 0.50f; mat._42 = 0.50f; mat._43 = 0.00f; mat._44 = 1.00f;

    g_pd3dDevice->SetTransform( D3DTS_TEXTURE0, &mat );
    g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );
    g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION );
#endif

    // Render the vertex buffer contents
    g_pd3dDevice->SetStreamSource( 0, g_pVB, sizeof(CUSTOMVERTEX) );
    g_pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX );
    g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2*50-2 );

    // End the scene
    g_pd3dDevice->EndScene();

    // Present the backbuffer contents to the display
    g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:grakidov,项目名称:Render3D,代码行数:61,代码来源:Textures.cpp

示例8: defined

void RageDisplay_D3D::ResolutionChanged()
{
#if defined(XBOX)
	D3DVIEWPORT8 viewData = { 0,0,640,480, 0.f, 1.f };
	g_pd3dDevice->SetViewport( &viewData );
	g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
						 D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
#endif
}
开发者ID:Prcuvu,项目名称:StepMania-3.95,代码行数:9,代码来源:RageDisplay_D3D.cpp

示例9: Begin

void Renderer::Begin(){
#if IS_XBOX
	// Clear the backbuffer and the zbuffer
	g_pd3dDevice->Clear( 0, nullptr, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
		D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );
	m_sprite->Begin();
#else
	startOpenGLDrawing();
#endif
}
开发者ID:ash9991win,项目名称:Xbox-Game,代码行数:10,代码来源:Renderer.cpp

示例10: Render

//-----------------------------------------------------------------------------
// Name: Render()
// Desc: Draws the scene
//-----------------------------------------------------------------------------
VOID Render()
{
    if( NULL == g_pd3dDevice )
        return;

    // Clear the backbuffer to a blue color
    g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );
    
    // Begin the scene
    g_pd3dDevice->BeginScene();
    
    // Rendering of scene objects can happen here
    
    // End the scene
    g_pd3dDevice->EndScene();
    
    // Present the backbuffer contents to the display
    g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:grakidov,项目名称:Render3D,代码行数:23,代码来源:CreateDevice.cpp

示例11: SetVideoMode

bool RageDisplay_D3D::BeginFrame()
{
#if !defined(XBOX)
	switch( g_pd3dDevice->TestCooperativeLevel() )
	{
	case D3DERR_DEVICELOST:
		return false;
	case D3DERR_DEVICENOTRESET:
	{
		bool bIgnore = false;
		CString sError = SetVideoMode( GraphicsWindow::GetParams(), bIgnore );
		if( sError != "" )
			RageException::Throw( sError );
		break;
	}
	}
#endif

	g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
						 D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
	g_pd3dDevice->BeginScene();
	return true;
}
开发者ID:Prcuvu,项目名称:StepMania-3.95,代码行数:23,代码来源:RageDisplay_D3D.cpp

示例12:

void RageDisplay_D3D::ClearZBuffer()
{
	g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
}
开发者ID:Prcuvu,项目名称:StepMania-3.95,代码行数:4,代码来源:RageDisplay_D3D.cpp

示例13: render

void render()
{
   static RECT rc = {0, 0, 320, 100};   // rectangular region.. used for text drawing
   static DWORD frameCount = 0;
   static DWORD startTime = clock();
   char str[16];
   DWORD val;

   doMath();   // do the math.. :-P   
   
   frameCount++;   //  increment frame count
    
   // Clear the back buffer to a black... values r g b are 0-256
   lpD3DDevice8->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(256, 256, 256), 1.0f, 0);
   
   lpD3DDevice8->GetRenderState(D3DRS_LIGHTING, &val);
   if (val)
   {
      D3DLIGHT8 light;                           // structure for light data
      ZeroMemory( &light, sizeof(D3DLIGHT8) );   // zero the mem
      light.Type = D3DLIGHT_POINT;               // set type, either SPOT, DIRECTIONAL, or POINT

      // light being put onto objects..
      light.Diffuse.r = 1.0f;
      light.Diffuse.g = 1.0f;
      light.Diffuse.b = 1.0f;
      // ambient light of the light source.. only on when light is on
      light.Ambient.r = 0.25f;
      light.Ambient.g = 0.25f;
      light.Ambient.b = 0.25f;

      // attenuation = Atten0 + Atten1 * d + Atten2 * d * d;
      // where d is distance
      // attenuation is decreasing brightness as 
      // a vertex is further away from the light source
      light.Attenuation0   = .5f;
      light.Attenuation1   = 0.10f;
      light.Attenuation2   = 0.01f;

      // spot lights and directional lights also have a direction
      // but a POINT light shines in all directions.. kinda like a light bulb
      
      light.Position = D3DXVECTOR3(0, 0, -2);

      light.Range = 15;   // after this range the light doesn't affect vertices
      lpD3DDevice8->SetLight( 0, &light );    // set the light as index 0
      lpD3DDevice8->LightEnable( 0, true );   // enable light at index 0
      
      // ambient light.. for everything.. not attached to 
      // this light, just lighting in general
      lpD3DDevice8->SetRenderState( D3DRS_AMBIENT, 0x00202020 );
   }

   // render the cubes
   myRect1->render(clock());
   myRect2->render(clock());
   myRect3->render(clock());
   myRect4->render(clock());
   myRect5->render(clock());

   // this function writes a formatted string to a character string
   // in this case.. it will write "Avg fps"  followed by the 
   // frames per second.. with 2 decimal places
   sprintf(str, "Avg fps %.2f", (float) frameCount / ((clock() - startTime) / 1000.0f));
      
   // draw the text string..
   lpD3DXFont->Begin();
   lpD3DXFont->DrawText(str, -1, &rc, DT_LEFT, 0xFFFFFFFF);
   lpD3DXFont->End();
   
   // present the back buffer.. or "flip" the page
   lpD3DDevice8->Present( NULL, NULL, NULL, NULL );   // these options are for using rectangular
      // regions for rendering/drawing...
      // 3rd is which target window.. NULL makes it use the currently set one (default)
      // last one is NEVER used.. that happens with DirectX often
}
开发者ID:pnchang,项目名称:advgraphics,代码行数:76,代码来源:example06.cpp

示例14: D3DM_InitDevices


//.........这里部分代码省略.........

			if(DrawSetting.full_16bit){
				d3dppApp.BackBufferFormat=D3DFMT_UNKNOWN;
				for(i=0;i<D3DCapsStruct.m_DisplayModeNum;i++){
					if( D3DCapsStruct.m_DisplayMode[i].Width  == 800 && D3DCapsStruct.m_DisplayMode[i].Height == 600 ){
						switch( D3DCapsStruct.m_DisplayMode[i].Format ){
							case D3DFMT_R5G6B5:		case D3DFMT_X1R5G5B5:
							case D3DFMT_A1R5G5B5:	case D3DFMT_A4R4G4B4:
							case D3DFMT_X4R4G4B4:
								D3DCapsStruct.m_FullModeNum=i;
								d3dppApp.BackBufferFormat = D3DCapsStruct.m_DisplayMode[i].Format;	
								break;
						}
					}
					if(d3dppApp.BackBufferFormat!=D3DFMT_UNKNOWN) break;
				}
			}else{
				d3dppApp.BackBufferFormat = D3DCapsStruct.m_NowDisplayMode.Format;
			}

			ret = pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_HARDWARE_VERTEXPROCESSING,&d3dppApp,&pD3DDevice);
			if( FAILED(ret) ){	
				ret = pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hwnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dppApp,&pD3DDevice);
				if( FAILED(ret) ){	
					switch(ret){
					default:
					case D3DERR_OUTOFVIDEOMEMORY:
						DebugBox( NULL, "Direct3D が処理を行うのに十分なディスプレイ メモリがありません。" );
						RELEASE_3D(pD3D);
						return FALSE;
					case D3DERR_INVALIDCALL:
						DebugBox( NULL, "Direct3Dの初期化に失敗しました[D3DERR_INVALIDCALL]\nこのグラフィックカードは必要な機能をサポートしていないか、\nあるいはDirectX8に対応したドライバが入っていません。" );
						RELEASE_3D(pD3D);
						return FALSE;
					case D3DERR_NOTAVAILABLE:
						DebugBox( NULL, "Direct3Dの初期化に失敗しました[D3DERR_NOTAVAILABLE]\nこのグラフィックカードは必要な機能をサポートしていないか、\nあるいはDirectX8に対応したドライバが入っていません。" );
						RELEASE_3D(pD3D);
						return FALSE;
					}
				}
			}
		}
	}



	if( FAILED(pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&D3DCapsStruct.m_NowDisplayMode)) ){	
		MessageBox(NULL,"ディスプレイモードの取得に失敗しました。[なにゆえ?]","致命的なエラー", MB_OK | MB_ICONSTOP);
		RELEASE_3D(pD3D);
		return FALSE;
	}
	D3DCapsStruct.m_ttCaps.m_R8G8B8		= IsTextureFormatOk( D3DFMT_R8G8B8,   D3DCapsStruct.m_NowDisplayMode.Format);
	D3DCapsStruct.m_ttCaps.m_X8R8G8B8	= IsTextureFormatOk( D3DFMT_X8R8G8B8, D3DCapsStruct.m_NowDisplayMode.Format);
	D3DCapsStruct.m_ttCaps.m_A8R8G8B8	= IsTextureFormatOk( D3DFMT_A8R8G8B8, D3DCapsStruct.m_NowDisplayMode.Format);

	D3DCapsStruct.m_ttCaps.m_R5G6B5		= IsTextureFormatOk( D3DFMT_R5G6B5,   D3DCapsStruct.m_NowDisplayMode.Format);
	D3DCapsStruct.m_ttCaps.m_X1R5G5B5	= IsTextureFormatOk( D3DFMT_X1R5G5B5, D3DCapsStruct.m_NowDisplayMode.Format);
	D3DCapsStruct.m_ttCaps.m_A1R5G5B5	= IsTextureFormatOk( D3DFMT_A1R5G5B5, D3DCapsStruct.m_NowDisplayMode.Format);

	D3DCapsStruct.m_ttCaps.m_X4R4G4B4	= IsTextureFormatOk( D3DFMT_X4R4G4B4, D3DCapsStruct.m_NowDisplayMode.Format);
	D3DCapsStruct.m_ttCaps.m_A4R4G4B4	= IsTextureFormatOk( D3DFMT_A4R4G4B4, D3DCapsStruct.m_NowDisplayMode.Format);

	D3DCapsStruct.m_ttCaps.m_A8P8		= IsTextureFormatOk( D3DFMT_A8P8,     D3DCapsStruct.m_NowDisplayMode.Format);
	D3DCapsStruct.m_ttCaps.m_P8			= IsTextureFormatOk( D3DFMT_P8,       D3DCapsStruct.m_NowDisplayMode.Format);
	D3DCapsStruct.m_ttCaps.m_A8			= IsTextureFormatOk( D3DFMT_A8,       D3DCapsStruct.m_NowDisplayMode.Format);
	
	D3DD_SetBackBuffer( WinWidth, WinHeight );
	pD3DDevice->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_ARGB(0,0,0,0),1.0,0);

	if(0){
		char	buf2[512];

		wsprintf( buf, "実行ディスプレイモード[%s]\n", TxFmtMode[ LIM(d3dppApp.BackBufferFormat,0,D3DFMT_D3DD_MAX-1) ] );
		MBS_CPY(buf2,buf);

		MBS_CAT(buf2,"使用可能テクスチャ列挙\n");
		for(i=1;i<D3DFMT_D3DD_MAX-1;i++){
			if( TxFmtMode[i] ){
				j = IsTextureFormatOk( (D3DFORMAT)i, D3DCapsStruct.m_NowDisplayMode.Format);
				if(j){
					wsprintf(buf,"%-15s[%s]\n", TxFmtMode[i], (j==2)?"OK":"OK(NotRenderTarget)" );
					MBS_CAT(buf2,buf);
				}else{
					wsprintf(buf,"%-15s[%s]\n", TxFmtMode[i], "--Not--" );
					MBS_CAT(buf2,buf);
				}
			}
		}

		
		DebugBox(NULL,buf2);



	}

	D3DD_CreateTable();

	return TRUE;
}
开发者ID:0xrofi,项目名称:Aquaplus,代码行数:101,代码来源:d3d_main.cpp

示例15: main


//.........这里部分代码省略.........
			g_pWorld->pPlayer[0]->Theta = 3.1415f/2.0f;
			g_pWorld->pPlayer[0]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[0]->Firing = 0;

			g_pWorld->pPlayer[1]->Dead = 0;
			g_pWorld->pPlayer[1]->TransX = 2.5f;
			g_pWorld->pPlayer[1]->TransY = 80.0f - 5.0f;
			g_pWorld->pPlayer[1]->Theta = -3.1415f/2.0f;
			g_pWorld->pPlayer[1]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[1]->Firing = 0;

			g_pWorld->pPlayer[2]->Dead = 0;
			g_pWorld->pPlayer[2]->TransX = 180.0f - 2.5f;
			g_pWorld->pPlayer[2]->TransY = 5.0f;
			g_pWorld->pPlayer[2]->Theta = 3.1415f/2.0f;
			g_pWorld->pPlayer[2]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[2]->Firing = 0;

			g_pWorld->pPlayer[3]->Dead = 0;
			g_pWorld->pPlayer[3]->TransX = 180.0f - 2.5f;
			g_pWorld->pPlayer[3]->TransY = 80.0f - 5.0f;
			g_pWorld->pPlayer[3]->Theta = -3.1415f/2.0f;
			g_pWorld->pPlayer[3]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[3]->Firing = 0;

			g_pWorld->bfirstblood = 0;

			g_pWorld->redwins->Play(0);
			(g_pWorld->CurrLevel)++;
			if(g_pWorld->CurrLevel == 5)
				g_pWorld->CurrLevel = 0;
			(g_pWorld->Boards) = &((g_pWorld->BoardsAll)[g_pWorld->CurrLevel][0]);

			for(int i=0; i<150; i++)
			{
				g_pWorld->Balls[i].State = 0;
			}
			g_pWorld->wait = 800;
		}
		
		if(g_pWorld->pPlayer[2]->Dead != 0 && g_pWorld->pPlayer[3]->Dead != 0)
		{
			WinnerColor = D3DCOLOR_XRGB(0, 0, 150);
			g_pWorld->pPlayer[0]->Dead = 0;
			g_pWorld->pPlayer[0]->TransX = 2.5f;
			g_pWorld->pPlayer[0]->TransY = 5.0f;
			g_pWorld->pPlayer[0]->Theta = 3.1415f/2.0f;
			g_pWorld->pPlayer[0]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[0]->Firing = 0;

			g_pWorld->pPlayer[1]->Dead = 0;
			g_pWorld->pPlayer[1]->TransX = 2.5f;
			g_pWorld->pPlayer[1]->TransY = 80.0f - 5.0f;
			g_pWorld->pPlayer[1]->Theta = -3.1415f/2.0f;
			g_pWorld->pPlayer[1]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[1]->Firing = 0;

			g_pWorld->pPlayer[2]->Dead = 0;
			g_pWorld->pPlayer[2]->TransX = 180.0f - 2.5f;
			g_pWorld->pPlayer[2]->TransY = 5.0f;
			g_pWorld->pPlayer[2]->Theta = 3.1415f/2.0f;
			g_pWorld->pPlayer[2]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[2]->Firing = 0;

			g_pWorld->pPlayer[3]->Dead = 0;
			g_pWorld->pPlayer[3]->TransX = 180.0f - 2.5f;
			g_pWorld->pPlayer[3]->TransY = 80.0f - 5.0f;
			g_pWorld->pPlayer[3]->Theta = -3.1415f/2.0f;
			g_pWorld->pPlayer[3]->Phi = 3.1415f/2.0f;
			g_pWorld->pPlayer[3]->Firing = 0;

			g_pWorld->bfirstblood = 0;

			g_pWorld->bluewins->Play(0);
		
			(g_pWorld->CurrLevel)++;
			if(g_pWorld->CurrLevel == 5)
				g_pWorld->CurrLevel = 0;
			(g_pWorld->Boards) = &((g_pWorld->BoardsAll)[g_pWorld->CurrLevel][0]);

			for(int i=0; i<150; i++)
			{
				g_pWorld->Balls[i].State = 0;
			}
			g_pWorld->wait = 800;
		}

		g_pD3DDevice->SetViewport(&viewport);

		g_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, WinnerColor, 0.0f, 0);

		g_pD3DDevice->BeginScene();

		g_pWorld->UpdateWorld();

		g_pD3DDevice->EndScene();

		g_pD3DDevice->Present(NULL, NULL, NULL, NULL);
	}
}
开发者ID:tqfoley,项目名称:xboxpaintball,代码行数:101,代码来源:Main.cpp


注:本文中的LPDIRECT3DDEVICE8::Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。