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

📄 commondefine.h

📁 里面包含了许多实用的游戏开发包
💻 H
字号:
/////////////////   define.h   /////////////////////
///////////// 一些公共的数据和定义  ////////////////

#pragma warning(disable: 4201)			// 取消一些警告
#pragma warning(disable: 4514)
#pragma warning(disable: 4100)

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <time.h>

#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <commctrl.h>
#include <vfw.h>

#include <ddraw.h>
#include <dinput.h>
#include <dsound.h>

#define DllImport    __declspec( dllimport )                // DLL 引入
#define DllExport    __declspec( dllexport )                // DLL 输出

#define randomize()   srand((unsigned)time(NULL))           // 设置随机种子
#define random(num)   (rand() % (num))                      // 随机函数


#define RGB16(r,g,b)  ((((BYTE)r/8)<<11) + (((BYTE)g/4)<<5) + ((BYTE)b/8))

typedef struct                          // 鼠标数据结构
{
    BYTE  Exist;                // 鼠标存在 ?         1=存在 0=不存在
    BYTE  Visible;              // 鼠标光标已经显示 ? 1=可见 0=不可见
    
    BYTE  Button;               // 按钮状态(0,1,2,3)
    BYTE  LeftButton;           // 鼠标左键按下       1=按下 0=没有按下
    BYTE  RightButton;          // 鼠标右键按下       同上

    BYTE  CursorWidth;          // 光标高度
    BYTE  CursorHeight;         // 光标宽度

    short X;                    // 当前鼠标光标位置 X
    short Y;                    // 当前鼠标光标位置 Y

    LPDIRECTDRAWSURFACE3 Cursor;// 缺省的鼠标光标
} MouseData;

typedef struct
{
	BYTE MainVersion;		// 主版本号
	BYTE SecondVersion;		// 次版本号
	char VersionType[81];	// 版本类型,描述软件的类型
	char VersionRelease[5]; // 版本发放
	char VersionDate[11];   // 日期
	char WorkGroup[81];     // 制作组
} VERSIONINFORMATION;		// 版本信息

typedef struct                          // WAVE 声音文件头数据结构
{
	DWORD       dwDSize;          // 声音数据的大小(不包括数据头)
	DWORD       dwSRate;          // 数据的采样率
	WORD        BitsPerSample;    // 样本的比特位数
	WORD        wChnls;           // 声道数:1-单声道,2-立体声
	WORD        wBlkAlign;        // 数据块对齐,单声道和立体声都为1
    WORD        ID;               // 声音开始表识 - 0x5644
} SOUND;

typedef struct
{
	int xImageWidth;			//图像的宽度
    int yImageHeight;			//图像的高度
    int iLineBytes;				//图像每行需要的字节数
    BOOL bExistAlpha;			//是否存在Alpha通道	TRUE:存在	FALSE:不存在
    char *ImageBuff;			//图像数据缓冲区
    BYTE *AlphaBuff;			//Alpha通道缓冲区
}GLB_BIT_MAP;					//与外界接口图像数据格式(其中的数据全部没用压缩,而且数据为16BIT)

⌨️ 快捷键说明

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