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


C++ LPD3DXSPRITE::End方法代码示例

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


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

示例1: Draw

void CMessageBoxScene::Draw(float dt)
{
	LPD3DXSPRITE pSprite = GetSprite();
	LPD3DXFONT pFont = GetFont();

	// Darken down any other Scenes that were drawn beneath the popup.
	float alpha = 1 - GetTransPos();
	GetEngine()->DrawColourTint(D3DXCOLOR(0, 0, 0, alpha * 2 / 3));

	// compute the sizes
	RECT scr = GetEngine()->GetWindowRect();
	D3DXVECTOR2 scrSize((float)scr.right, (float)scr.bottom);
	D3DXVECTOR2 textSize = GetTextSize(pFont, mText.c_str());
	D3DXVECTOR2 textPos = (scrSize - textSize) / 2;

	const int VPAD = 16, HPAD = 32;	// padding
	RECT bg;
	bg.left = (int)textPos.x - HPAD;
	bg.top = (int)textPos.y - VPAD;
	bg.right = bg.left + (int)textSize.x + HPAD * 2;
	bg.bottom = bg.top + (int)textSize.y + VPAD * 2;

	D3DCOLOR col = D3DCOLOR_ARGB((int)(255 * alpha), 255, 255, 255);
	pSprite->Begin(D3DXSPRITE_ALPHABLEND);	// must have ALPHABLEND or font looks awful
	// stretch the 8x8 background into its area
	DrawSprite(pSprite, mpTexture, bg, col);
	// add text (using the sprite batch)
	DrawD3DFontEx(pFont, pSprite, mText.c_str(), (int)textPos.x, (int)textPos.y,
		col);
	pSprite->End();
}
开发者ID:crystalised,项目名称:GDEV,代码行数:31,代码来源:MessageBoxScene.cpp

示例2: DrawSprite

void CImage::DrawSprite(LPD3DXSPRITE SpriteInterface, LPDIRECT3DTEXTURE9 TextureInterface, int PosX, int PosY, int Rotation, int Align)
{
	if(SpriteInterface == NULL || TextureInterface == NULL)
		return;

	D3DXVECTOR3 Vec;

	Vec.x = (FLOAT)PosX;
	Vec.y = (FLOAT)PosY;
	Vec.z = (FLOAT)0.0f;

	D3DXMATRIX mat;
	D3DXVECTOR2 scaling(1.0f, 1.0f);
	D3DSURFACE_DESC desc;
	TextureInterface->GetLevelDesc(0, &desc);
	D3DXVECTOR2 spriteCentre;
	if(Align == 1)
		spriteCentre = D3DXVECTOR2((FLOAT)desc.Width / 2, (FLOAT)desc.Height / 2);
	else
		spriteCentre = D3DXVECTOR2(0, 0);
	D3DXVECTOR2 trans = D3DXVECTOR2(0, 0);
	D3DXMatrixTransformation2D(&mat, NULL, 0.0, &scaling, &spriteCentre, (FLOAT)Rotation, &trans);

	SpriteInterface->SetTransform(&mat);
	SpriteInterface->Begin(D3DXSPRITE_ALPHABLEND);
	SpriteInterface->Draw(TextureInterface, NULL, NULL, &Vec, 0xFFFFFFFF);
	SpriteInterface->End();
}
开发者ID:JohnnyCrazy,项目名称:DX9-Overlay-API,代码行数:28,代码来源:Image.cpp

示例3: Render

void CGameEnd::Render(LPDIRECT3DDEVICE9& dxdevice, LPD3DXSPRITE& dxsprite)
{
	dxsprite->Begin(D3DXSPRITE_ALPHABLEND);
	dxsprite->Draw(GMAIN->m_pGameTex[6].m_pTex, &(GMAIN->rc), NULL, &(GMAIN->vcPos), D3DXCOLOR(1, 1, 1, 1.f));
	////////////////////////////////////////////////////////////////////////////////
	dxsprite->End();

	GMAIN->m_text.Begin();
	char	scoreBuf[80];
	TCHAR	fpsBuf[128];

	if (GMAIN->m_nGameBeforePhase == ST_MULTI) {
		sprintf(scoreBuf, "%d", GGAMEMULTI->score);//멀티 게임 점수
	}
	else {
		sprintf(scoreBuf, "%d", GGAME->score);//싱글 게임 점수.
	}
	

	GMAIN->m_text.Draw("Game Over", 355, 250, D3DXCOLOR(0, 0, 0, 1));

	GMAIN->m_text.Draw("Total Score", 355, 300, D3DXCOLOR(0, 0, 0, 1));
	GMAIN->m_text.Draw(scoreBuf, 355, 320, D3DXCOLOR(0, 0, 0, 1));

	GMAIN->m_text.Draw("Press Enter for going back to Menu", 250, 400, D3DXCOLOR(0, 0, 0, 1));

	////////////////////////////////////////////////////////////////////////////////
	//FPS 화면에 출력
	sprintf(fpsBuf, "FPS: %4.1f", GMAIN->m_fFps);
	GMAIN->m_text.Draw(fpsBuf, 700, 300);

	GMAIN->m_text.End();
}
开发者ID:serialkk,项目名称:rebelfighter2,代码行数:33,代码来源:GameEnd.cpp

示例4: End

void Renderer::End(){
#if IS_XBOX
	// Present the backbuffer contents to the display
	//g_pd3dDevice->EndScene();
	m_sprite->End();
	g_pd3dDevice->Present( nullptr, nullptr, nullptr, nullptr );
#endif
}
开发者ID:ash9991win,项目名称:Xbox-Game,代码行数:8,代码来源:Renderer.cpp

示例5: myAdditions

static void myAdditions(LPDIRECT3DDEVICE9 Device_Interface)
{
	D3DXVECTOR3 imagepos;
	BOOL currentState = (BOOL)(GetAsyncKeyState(VK_INSERT) & 0x8000);

	//Switch ON and OFF
	if(!currentState && oldState) //Si la touche passe de enfoncée à relevée
		DRAW_CROSSHAIR ^= TRUE;
	oldState = currentState;

	if(DRAW_CROSSHAIR)
	{
		//Checks / Init =============================================================================================================
		if(imagetex == NULL)
		{	
			if(!SUCCEEDED(D3DXCreateTextureFromFileEx(Device_Interface, "crosshair.png", D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, &imageInfo, NULL, &imagetex)))
			{
				DRAW_CROSSHAIR = FALSE;
				return;
			}
		}
		if(sprite == NULL)
		{
			if(!SUCCEEDED(D3DXCreateSprite(Device_Interface, &sprite)))
			{
				DRAW_CROSSHAIR = FALSE;
				return;
			}
		}
		//=============================================================================================================

		if(SUCCEEDED(Device_Interface->BeginScene()))
		{
			//RESOLUTION ?
			D3DVIEWPORT9 vp;
			Device_Interface->GetViewport(&vp);

			imagepos.x = (vp.Width - imageInfo.Width)/2.0f;		//coord x of our sprite
			imagepos.y = (vp.Height - imageInfo.Height)/2.0f;		//coord y of out sprite
			imagepos.z = 0.0f;	

			if(SUCCEEDED(sprite->Begin(D3DXSPRITE_ALPHABLEND)))
			{
				sprite->Draw(imagetex, NULL, NULL, &imagepos, 0xFFFFFFFF);
				sprite->End();
			}
			Device_Interface->EndScene();
		}
	}
}
开发者ID:ergrelet,项目名称:mumble_ol,代码行数:50,代码来源:d3d9.cpp

示例6: Render

//-----------------------------------------------------------------------------
// Name: Render()
// Desc: Draws the scene
//-----------------------------------------------------------------------------
VOID Render()
{
	renderDevice->Clear(0,NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0);
	renderDevice->BeginScene();
	if(bg->getTexture())
	{
		sprite->Begin(D3DXSPRITE_ALPHABLEND);
		sprite->Draw(bg->getTexture(), bg->getSource(), bg->getCenter(), bg->getPosition(), 0xFFFFFFFF);
		sprite->End();
		// End the scene
	}
	renderDevice->EndScene();
	renderDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:JueSungMun,项目名称:TOK,代码行数:18,代码来源:main.cpp

示例7: center

void HookD3D9::DrawSprite(unsigned int texId, long left, long top, long right, long bottom, float posX,
						  float posY, int r, int g, int b, int a)
{
	RECT destRect = {left, top, right, bottom};
	LPD3DXSPRITE sprite = sprites[texId];
	LPDIRECT3DTEXTURE9 texture = textures[texId];
	D3DXVECTOR3 center(0.0f, 0.0f, 0.0f);
	D3DXVECTOR3 pos(posX, posY, 0.0f);

	sprite->Begin(D3DXSPRITE_ALPHABLEND);

    sprite->Draw(texture, NULL, NULL, &pos, D3DCOLOR_RGBA(r, g, b, a));

	sprite->End();
}
开发者ID:lenny93,项目名称:TouchEnabler,代码行数:15,代码来源:hook_d3d9.cpp

示例8: dx9vid_render

BOOL dx9vid_render()
{
   // clear the window to a deep blue
   d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 40, 100), 1.0f, 0);
   d3ddev->BeginScene();    // begins the 3D scene
   g_screenSprite->Begin( 0 );

   d3ddev->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
   d3ddev->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
   d3ddev->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);

   g_screenSprite->Draw( g_screenTex, &srcRect, &vCenter, &vPosition,
                     D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f) );
   g_screenSprite->End();
   d3ddev->EndScene();    // ends the 3D scene
   d3ddev->Present(NULL, NULL, NULL, NULL);   // displays the created frame on the screen
   return TRUE;
}
开发者ID:frangarcj,项目名称:neogpc,代码行数:18,代码来源:video_directx.cpp

示例9: Render

void TextBox::Render()
{
	LPD3DXSPRITE sprite;
	D3DXCreateSprite(device, &sprite);
	sprite->Begin(0);

	if (!masked) font->DrawText(sprite, (label + text).c_str(), -1, &surface, DT_LEFT|DT_NOCLIP, color);
	else
	{
		std::string mask = "";
		for(unsigned int i = 0; i < text.length(); ++i)
			mask.push_back('*');

		font->DrawText(sprite, (label + mask).c_str(), -1, &surface, DT_LEFT|DT_NOCLIP,  color);
	}

	sprite->End();
	sprite->Release();
}
开发者ID:laszlo-dobcsanyi,项目名称:Everlost,代码行数:19,代码来源:TextBox.cpp

示例10: DrawTexture

	void DrawTexture(Texture *texture, int x, int y) {
		if(texture->imageLoaded == false) {
			return;
		}

		D3DXVECTOR3 pos(x, y, 0);
		//draw sprite with or without alpha-channel transparency
		if(transparent) {
			spriteHandler->Begin(D3DXSPRITE_ALPHABLEND);
		} else {
			spriteHandler->Begin(NULL);
		}

		TransformTexture();

		spriteHandler->Draw(textureList[texture->textureIndex], NULL, NULL, &pos,
												texture->color);

		spriteHandler->End();
	}
开发者ID:gejben,项目名称:Pathfinding,代码行数:20,代码来源:Graphics.cpp

示例11: render

HRESULT Game::render( IDirect3DDevice9 *d3dDevice, double totalTime,
					 float elapsedTime, void *data )
{
	HRESULT hr;

	V(d3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(0, 45, 50, 170), 1.0f, 0));
	if(SUCCEEDED(d3dDevice->BeginScene()))
	{
		LPD3DXSPRITE sprite = ClientController::instance().getSprite();
		if(SUCCEEDED(sprite->Begin(0)))
			V(sprite->End());
		wObjects.swap();
		world->Render();
		terrainTest->Render();
		particleTest->render();
		V(d3dDevice->EndScene());
		d3dDevice->Present(NULL, NULL, NULL, NULL);
		// Update Sound
		sound.DoWork();
	}
	return S_OK;
}
开发者ID:wtacquard,项目名称:resource-robbers,代码行数:22,代码来源:Game.cpp

示例12: Render

void CGameStart::Render(LPDIRECT3DDEVICE9& dxdevice, LPD3DXSPRITE& dxsprite)
{
	dxsprite->Begin(D3DXSPRITE_ALPHABLEND);
	dxsprite->Draw(GMAIN->m_pGameTex[5].m_pTex, &(GMAIN->rc), NULL, &(GMAIN->vcPos), D3DXCOLOR(1, 1, 1, 1.f));
	dxsprite->End();
}
开发者ID:serialkk,项目名称:rebelfighter2,代码行数:6,代码来源:GameStart.cpp

示例13: DrawSprite

void Renderer::DrawSprite(Vector2 position, float width, float height, TexCoord textureCoordinates, float angle,Vector2 rotationPoint)
{
#if IS_XBOX

	// Convert Param Information into proper structures

	XGVECTOR2 scale;
	scale.x = (IMAGE_TO_SCREEN_X / SCREEN_WIDTH) / textureCoordinates.width  * width;
	scale.y = (IMAGE_TO_SCREEN_Y / SCREEN_HEIGHT) / textureCoordinates.height * height;

	RECT tex;
	tex.top = (LONG)((textureCoordinates.y)*IMAGE_HEIGHT);
	tex.bottom = (LONG)((textureCoordinates.y + textureCoordinates.height)*IMAGE_HEIGHT);
	tex.left = (LONG)((textureCoordinates.x)*IMAGE_WIDTH);
	tex.right = (LONG)((textureCoordinates.x + textureCoordinates.width)*IMAGE_WIDTH);
	
	XGVECTOR2 rot;
	rot.x = rotationPoint.x - position.x;
	rot.y = rotationPoint.y - position.y;

	XGVECTOR2 pos;
	pos.x = position.x;
	pos.y = position.y;

	m_sprite->Begin();

	// Transform and Draw the Sprite
#	if FALSE 
	// Apply Transform Matrix
	D3DXMATRIX matWorld;
	D3DXMatrixIdentity(&matWorld);
	D3DXMATRIX matTransform;
	D3DXMatrixScaling(&matTransform, scale.x, scale.y, 1);
	D3DXMatrixMultiply(&matWorld, &matWorld, &matTransform);

	if(angle != 0){
		D3DXMatrixTranslation(&matTransform, - rotationPoint.x, - rotationPoint.y , 0.0f);
		D3DXMatrixMultiply(&matWorld, &matWorld, &matTransform);
		D3DXMatrixRotationZ(&matTransform, angle);
		D3DXMatrixMultiply(&matWorld, &matWorld, &matTransform);
		D3DXMatrixTranslation(&matTransform, rotationPoint.x, rotationPoint.y , 0.0f);
		D3DXMatrixMultiply(&matWorld, &matWorld, &matTransform);
	}

	D3DXMatrixTranslation(&matTransform, position.x, position.y, 0.0f);
	D3DXMatrixMultiply(&matWorld, &matWorld, &matTransform);

	m_sprite->DrawTransform(g_pTextureMap[currentID], &tex, &matWorld,  0xffffffff);
#	else
	// Trust Draw Method
	m_sprite->Draw(g_pTextureMap[currentID], &tex, &scale, &rot, angle, &pos, 0xffffffff);
#	endif

	m_sprite->End();
#else
	// Simple inversion of the texture for DirectX
	textureCoordinates.y = 1 - textureCoordinates.y;

	GLdouble matrix[16];
	glGetDoublev(GL_MODELVIEW_MATRIX, matrix);

	Vector2 topLeft, topRight, bottomLeft, bottomRight;
	topLeft = position;
	topRight = position;
	bottomLeft = position;
	bottomRight = position;

	topRight.x += width;

	bottomLeft.y += height;

	bottomRight.x += width;
	bottomRight.y += height;

	if (angle != 0) {
		topLeft.rotateOnPivot(angle, &rotationPoint);
		topRight.rotateOnPivot(angle, &rotationPoint);
		bottomLeft.rotateOnPivot(angle, &rotationPoint);
		bottomRight.rotateOnPivot(angle, &rotationPoint);
	}

	glGetDoublev(GL_MODELVIEW_MATRIX, matrix);

	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, mTextureID[currentID]);
	glBegin(GL_QUADS);
	glTexCoord2f(textureCoordinates.x, textureCoordinates.y);

	glVertex2f(topLeft.x, topLeft.y);
	glTexCoord2f(textureCoordinates.x, textureCoordinates.y - textureCoordinates.height);

	glVertex2f(bottomLeft.x, bottomLeft.y );

	glTexCoord2f(textureCoordinates.x + textureCoordinates.width, textureCoordinates.y - textureCoordinates.height);
	glVertex2f(bottomRight.x  , bottomRight.y );

	glTexCoord2f(textureCoordinates.x + textureCoordinates.width, textureCoordinates.y);

	glVertex2f(topRight.x, topRight.y);

//.........这里部分代码省略.........
开发者ID:ash9991win,项目名称:Xbox-Game,代码行数:101,代码来源:Renderer.cpp

示例14: EndSpriteRender

void EndSpriteRender()
{
	ddraw->End();
}
开发者ID:ppeschke,项目名称:hexar,代码行数:4,代码来源:direct3d.cpp


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