📄 main.h
字号:
//-----------------------------------------------------------------------------
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -