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

📄 main.h

📁 <B>很多DirectX 9.0游戏编程源码例子</B>
💻 H
字号:
//-----------------------------------------------------------------------------
// Name: D3DFrame_3DTiles
//
// Description: Example code showing how to load and render 3D tiles.
//
// File Function: Header file for the program (main.h)
//
// Code: 
//		Copyright (c) 2002 LostLogic Corporation. All rights reserved.
//
// Libraries Required:
//		d3d9.lib dxguid.lib d3dx9dt.lib d3dxof.lib comctl32.lib winmm.lib
//
// DX Files Required:
//		d3dapp.cpp
//		d3denumeration.cpp
//		d3dfile.cpp
//		d3dfont.cpp
//		d3dsettings.cpp
//		d3dutil.cpp
//		dxutil.cpp
//
// Local Files Required:
//		main.cpp
//		main.h
//
// Original D3D Application Shell Code: 
//		Copyright (c) 1997-2001 Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#define STRICT
#include <windows.h>
#include <commctrl.h>
#include <commdlg.h>
#include <math.h>
#include <tchar.h>
#include <stdio.h>
#include <D3DX9.h>
#include "DXUtil.h"
#include "D3DEnumeration.h"
#include "D3DSettings.h"
#include "D3DApp.h"
#include "D3DFont.h"
#include "D3DFile.h"
#include "D3DUtil.h"

// Number of 3D meshes loaded
int	g_iNumTiles = 2;

// Structure for the tile vertex data
struct D3DVERTEX
{
    D3DXVECTOR3		p;
    D3DXVECTOR3		n;
    FLOAT			tu, tv;

    static const	DWORD FVF;
};

// Vertex format for the tiles
// D3DFVF_XYZ		= Coordinate information
// D3DFVF_NORMAL	= Normal information
// D3DFVF_TEX1		= Texture information
const DWORD D3DVERTEX::FVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1;

//-----------------------------------------------------------------------------
// Desc: Application class. The base class (CD3DApplication) provides the 
//       generic functionality needed in all Direct3D samples. CD3DFramework 
//       adds functionality specific to this sample program.
//-----------------------------------------------------------------------------
class CD3DFramework : public CD3DApplication
{
    CD3DFont*		m_pStatsFont;

    TCHAR			m_strFont[LF_FACESIZE];
    DWORD			m_dwFontSize;
	
	// 3D Object data
	CD3DMesh*		m_pObject[ 32 ];

	// Integer array used for tile map
	int				m_iTileMap[ 100 ];
	short			m_shTileMapWidth;
	short			m_shTileMapHeight;
	// Window dimensions
	short			m_shWindowWidth;
	short			m_shWindowHeight;

protected:
    HRESULT OneTimeSceneInit();
    HRESULT InitDeviceObjects();
    HRESULT RestoreDeviceObjects();
    HRESULT InvalidateDeviceObjects();
    HRESULT DeleteDeviceObjects();
    HRESULT Render();
    HRESULT FrameMove();
    HRESULT FinalCleanup();
    HRESULT CreateD3DXTextMesh( LPD3DXMESH* ppMesh, TCHAR* pstrFont, DWORD dwSize );

public:
    LRESULT MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
    CD3DFramework();
};

⌨️ 快捷键说明

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