main.h
来自「<B>很多DirectX 9.0游戏编程源码例子</B>」· C头文件 代码 · 共 89 行
H
89 行
//-----------------------------------------------------------------------------
// Name: D3D_Particles
//
// Description: Example code showing how to create simple particles.
//
// File Function: Header file for the program (main.h)
//
// Code:
// Copyright (c) 2003 LostLogic Corporation. All rights reserved.
//
// Libraries Required:
// d3d9.lib dxguid.lib d3dx9dt.lib d3dxof.lib
//
// Local Files Required:
// main.cpp
// main.h
// CParticle.cpp
// CParticle.h
//
// DX Files:
// Copyright (c) 1997-2001 Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#ifndef MAIN_H
#define MAIN_H
#include <windows.h>
#include <stdio.h>
#include <D3DX9.h>
#include "CParticle.h"
//-----------------------------------------------------------------------------
// Global variables
//-----------------------------------------------------------------------------
LPDIRECT3D9 g_pD3D = NULL; // Used to create the D3DDevice
LPDIRECT3DDEVICE9 g_pd3dDevice = NULL; // Our rendering device
LPDIRECT3DVERTEXBUFFER9 g_pVBInterface = NULL; // Buffer to hold vertices
// Global array to hold textures
LPDIRECT3DTEXTURE9 g_pTexture[ 64 ];
// Viewable window offsets
int g_iXOffset = 0;
int g_iYOffset = 0;
// Window dimensions
int g_iWindowWidth = 640;
int g_iWindowHeight = 480;
// Tile Map Info
int g_iParticleSize = 32;
int g_iTotalParticles = 6;
// A structure for our custom vertex type
struct CUSTOMVERTEX
{
D3DXVECTOR3 position; // The position
D3DXVECTOR3 vecNorm; // The normal
FLOAT tu, tv; // The texture coordinates
FLOAT tu2, tv2; // The texture coordinates
};
// Custom FVF, which describes the custom vertex structure
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX2)
//-----------------------------------------------------------------------------
// Function headers
//-----------------------------------------------------------------------------
void vDrawInterfaceObject( int iXPos, int iYPos, float fXSize, float fYSize, LPDIRECT3DTEXTURE9 tex );
void vInitInterfaceObjects( void );
LRESULT WINAPI fnMessageProcessor( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
HRESULT InitD3D( HWND hWnd );
void vRender( void );
void vCleanup( void );
void vInitParticles( void );
// Global handle to the game window
HWND g_hWnd;
HINSTANCE g_hInstance;
// Font to display text fields
LPD3DXFONT pD3DXFont = NULL;
HFONT hFont = NULL;
// Particle data
const int TOTAL_PARTICLES = 100;
CParticle *g_partExplosion = new CParticle[ TOTAL_PARTICLES ];
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?