📄 main.h
字号:
//-----------------------------------------------------------------------------
// Name: D3D_Pathfinding
//
// Description: Example code showing how to perform path finding.
//
// 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 comctl32.lib winmm.lib
//
// Local Files Required:
// main.cpp
// main.h
// CPathFinder.h
// CPathFinder.cpp
//
// DX Files:
// Copyright (c) 1997-2001 Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#ifndef MAIN_H
#define MAIN_H
// Set the direct input version
#define DIRECTINPUT_VERSION 0x0800
#define STRICT
#include <windows.h>
#include <stdio.h>
#include <D3DX9.h>
#include "CPathFinder.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 tiles
LPDIRECT3DTEXTURE9 g_pTexture[ 32 ];
LPDIRECT3DTEXTURE9 g_pArrowTextures[ 8 ];
LPDIRECT3DTEXTURE9 g_pRabbitTextures[ 8 ];
// Viewable window offsets
int g_iXOffset = 0;
int g_iYOffset = 0;
// Window dimensions
int g_iWindowWidth = 640;
int g_iWindowHeight = 480;
// Mouse buttons
int g_iLeftButtonDown = 0;
// Tile Map Info
int g_iTileSize = 32;
int g_iTilesWide = 20;
int g_iTilesHigh = 15;
int g_iMapWidth = 100;
int g_iMapHeight = 100;
int g_iXPos = 0;
int g_iYPos = 0;
int g_iTileMap[ 10000 ][ 4 ];
int g_iTotalTiles = 21;
// Rabbit Data
int g_iRabbitXPos = 3;
int g_iRabbitYPos = 7;
int g_iRabbitDir = 2;
int g_iArrowMap[ 10000 ];
// 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 vInitMap( void );
void vCreateToolbar( HWND hwnd, HINSTANCE hinst );
void vLoadMap( char *szMapName = NULL );
void vInitPathing( void );
int vFindDirection( int iStartX, int iStartY, int iEndX, int iEndY );
// Global handle to the game window
HWND g_hWnd;
// Global handle to the game instance
HINSTANCE g_hInstance;
// Font to display text fields
LPD3DXFONT pD3DXFont = NULL;
HFONT hFont = NULL;
// Toolbar data
HWND hWndToolBar;
const int ID_BUTTON_LOAD = 40004;
const int ID_BUTTON_GO = 40005;
HWND hBUTTON_LOAD = NULL;
HWND hBUTTON_GO = NULL;
// Path Debug information
char g_szPathStatus[ 256 ];
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -