📄 headers.h
字号:
#ifndef CGE_HEADER_H
#define CGE_HEADER_H
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <mmsystem.h>
#include <d3d8.h>
#include <d3dx8.h>
#include <dinput.h>
#pragma warning (disable : 4243)
#pragma warning (disable : 4786)
#pragma warning (disable : 4800)
#include <map>
#include <deque>
#include <string>
#include <vector>
#include <algorithm>
#define USING using
#define NAMESPACE namespace
#define CGE_INLINE inline
#define SAFE_RELEASE(x) if (x) { x->Release();x = 0; }
#define SAFE_DELETE(x) if (x) { delete x;x = 0; }
#define SAFE_DELETE_ARRAY(x) if (x) { delete [] x; x = 0; }
#define CHECK_RANGE(x, min, max) x = (x<min ? min : x<max ? x : max);
#define BOOL_RANGE(x,min,max) (( x >= min ) && ( x <= max ) )
#define RANDOM (((float)rand())/RAND_MAX)
#define RANDOM_FLOAT (((float)rand()-(float)rand())/RAND_MAX)
#define RANDOM_VECTOR D3DXVECTOR3(RANDOM_FLOAT,RANDOM_FLOAT,RANDOM_FLOAT)
#define RANDOM_RANGE(min,max) (RANDOM*((max)-(min))+min)
#define KEYDOWN(name, key) (name[key] & 0x80)
#define MOUSEKEYDOWN(key) (key & 0x80)
#define LINEAR_INTERPOLATE(B,E,S) ((B)+((B)-(E))*(S))
#define RANDOM_LERP_RANGE(MIN,MAX,RATE) ((MIN)+((FLOAT)(rand()%(INT)(((MAX)-(MIN))*(RATE)))/(RATE)))
#define SQR(x) ((x) * (x))
#define RAND_COORD(x) ((float)rand()/RAND_MAX * (x))
#pragma comment(lib,"d3d8.lib")
#pragma comment(lib,"d3dx8.lib")
#pragma comment(lib,"d3dxof.lib")
#pragma comment(lib,"dinput8.lib")
#pragma comment(lib,"dxguid.lib")
#pragma comment(lib,"winmm.lib")
typedef struct D3DVERTEX {
union {
float x; /* Homogeneous coordinates */
float dvX;
};
union {
float y;
float dvY;
};
union {
float z;
float dvZ;
};
union {
float tu; /* Texture coordinates */
float dvTU;
};
union {
float tv;
float dvTV;
};
D3DVERTEX() { }
D3DVERTEX(const D3DVECTOR& v, float _tu, float _tv)
{
x = v.x; y = v.y; z = v.z;
tu = _tu; tv = _tv;
}
enum
{
D3DFVF_D3DVERTEX = (D3DFVF_XYZ|D3DFVF_TEX1)
};
}*LPD3DVERTEX;
CGE_INLINE DWORD FTODW( FLOAT f ) { return *((DWORD*)&f); }
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -