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

📄 cgamerender.cpp

📁 俄罗斯方块3D 程序+源码俄罗斯方块3D(程序+源码
💻 CPP
字号:
#include "CGameRender.h"
#include "CBlockFollowing.h"
#include "CBlockPool.h"
#include "CBlockMesh.h"
#include "CGameState.h"


extern CBlockFollowing	theBlockFollowing;
extern CBlockPool		theBlockPool;
extern CBlockMesh		theBlockMesh;
extern CGameState		theGameState;

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CGameRender::CGameRender()
{

}

CGameRender::~CGameRender()
{

}


//////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////
bool CGameRender::Init( IDirect3DDevice9 *pD )
{
	bool re = m_BlockMesh.Init( pD );
	re &= m_BlockPoolMesh.Init( pD );
	return re;
}


//////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////
void CGameRender::Free()
{
	m_BlockMesh.Free();
	m_BlockPoolMesh.Free();
}


//////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////
void CGameRender::Draw( IDirect3DDevice9 *pD )
{
	pD->SetRenderState( D3DRS_SHADEMODE, D3DSHADE_FLAT );


	//画BlockFollowing
	for ( int i = 0; i < theBlockFollowing.GetNumBlock(); ++i )
	{
		m_BlockMesh.Draw( pD, theBlockFollowing.m_BlockArray[i] );
	}


	//画方块池
	int material;
	for ( i = 0; i <= theBlockPool.m_iHighestLine; ++i )
	{
		for ( int j = 0; j < theBlockPool.m_iColumn; ++j )
		{
			material = theBlockPool.m_BlockPool[i][j].GetData();
			if ( material > 0 )
				m_BlockMesh.Draw( pD, i, j, material );
		}
	}

	m_BlockPoolMesh.Draw( pD );
}

⌨️ 快捷键说明

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