⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 game_interface.cpp

📁 自己写的一个D3D游戏Dome。实现了基本的游戏功能
💻 CPP
字号:
#include "..\Include\Game_Interface.h"

void Game_Interface::InitInterface(wstring texName,int nWidth,int nHeight,D3DXVECTOR2 scale,D3DXVECTOR2 pos,bool bShow){
	m_nWidth=nWidth;
	m_ShownRect.top=0;
	m_ShownRect.left=0;
	m_ShownRect.bottom=30;
	m_ShownRect.right=nWidth;
	m_Position=pos;
	m_Scale=scale;
	m_bShow=bShow;
	m_pTexture=Game_Resource::Instance()->GetTexture(texName);
}

void Game_Interface::Render(){
	g_sGlobal.g_pSprite->Begin(D3DXSPRITE_ALPHABLEND);

	D3DXMATRIX mat;
	D3DXMatrixIdentity(&mat);

	//得到2D坐标转换矩阵
	D3DXMatrixTransformation2D(&mat, NULL, 0.0f, &m_Scale, NULL, 0.0f, &m_Position);
	g_sGlobal.g_pSprite->SetTransform(&mat);
	if (m_nWidth<=0){
		m_nWidth=0;
	}

	//渲染精灵
	g_sGlobal.g_pSprite->Draw(m_pTexture, NULL, NULL, NULL, 0xffffffff);

	g_sGlobal.g_pSprite->End();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -