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

📄 common.h

📁 游戏框架
💻 H
字号:
#ifndef GAME_FRAME_COMMON_FILE
#define GAME_FRAME_COMMON_FILE

#pragma once
#pragma warning(disable: 4251)

// TODO: 在此处引用程序要求的附加头文件
//模板库
#include "..\Common\Template.h"
#include "..\Common\IUnknownEx.h"

#ifndef _MFCDLL

//对象名称长度
#define MAX_NAME			64
#define INPUT_MOUSE_MOVE	1
#define INPUT_MOUSE_DOWN	2
#define INPUT_MOUSE_UP		3
#define INPUT_MOUSE_DBCLICK	4

#define CN_CONTROL_MESSAGE		WM_USER
#define CN_USER_DEFINE_MESSAGE	WM_USER+0xB00

#ifndef _Server_Kernel

//底层图形引擎类型定义
typedef HGE*	LPGDI;

typedef struct tagPoint
{
    float  x;
    float  y;

	tagPoint(){
		x = y =0;
	};

	tagPoint(float fx, float fy){
		x = fx;
		y = fy;
	};

	tagPoint operator+(tagPoint Point){
		tagPoint This(*this);
		This.x += Point.x;
		This.y += Point.y;
		return This;
	};

	tagPoint operator-(tagPoint Point){
		tagPoint This(*this);
		This.x -= Point.x;
		This.y -= Point.y;
		return This;
	};
}_POINT, *_LPPOINT;


typedef struct tagSize
{
    float  cx;
    float  cy;

	tagSize(){
		cx = cy = 0;
	};

	tagSize(float fcx, float fcy){
		cx = fcx;		cy = fcy;
	};

	tagSize operator+(tagSize Size){
		tagSize This(*this);
		This.cx += Size.cx;	This.cy += Size.cy;
		return This;
	};

	tagSize operator-(tagSize Size){
		tagSize This(*this);
		This.cx -= Size.cx;	This.cy -= Size.cy;
		return This;
	};
}_SIZE, *_LPSIZE;

typedef struct tagRect
{
    float	left;
    float	top;
	float	right;
	float	bottom;

	tagRect(){
		left = top = right = bottom = 0;
	};

	tagRect(float fleft, float ftop, float fright, float fbottom){
		left = fleft;	top = ftop;	right = fright;	bottom = fbottom;
	};

	tagRect operator+(tagRect Rect){
		tagRect This(*this);
		This.left += Rect.left;		This.top += Rect.top;
		This.right += Rect.right;	This.bottom += Rect.bottom;
		return This;
	};

	tagRect operator+(tagPoint Point){
		tagRect This(*this);
		This.left += Point.x;		This.top += Point.y;
		This.right += Point.x;		This.bottom += Point.y;
		return This;
	};

	tagRect operator+(tagSize Size){
		tagRect This(*this);
		This.right += Size.cx;		This.bottom += Size.cy;
		return This;
	};

	tagRect operator-(tagRect Rect){
		tagRect This(*this);
		This.left -= Rect.left;		This.top -= Rect.top;
		This.right -= Rect.right;	This.bottom -= Rect.bottom;
		return This;
	};

	tagRect operator-(tagPoint Point){
		tagRect This(*this);
		This.left -= Point.x;		This.top -= Point.y;
		This.right -= Point.x;		This.bottom -= Point.y;
		return This;
	};

	tagRect operator-(tagSize Size){
		tagRect This(*this);
		This.right -= Size.cx;		This.bottom -= Size.cy;
		return This;
	};

	bool Hitting(float x, float y){
		if(x>=left && y>=top && x<=right && y<=bottom)
			return true;

		return false;
	}

	bool Hitting(_POINT piPos){
		return Hitting(piPos.x, piPos.y);
	}
}_RECT, *_LPRECT;

//对象的基本资料
typedef struct tagBasal{
	_POINT		AnchorPos;			//中心点位置
	_POINT		LocalPos;			//对象位置
	_POINT		ContainerPos;		//容器位置
	_POINT		ScreenPos;			//屏幕位置
	_SIZE		Size;				//对象大小
	DWORD		Depth;				//对象层次
	bool		Visabled;			//是否可视
	bool		Disabled;			//是否禁止
	bool		Clickabled;			//是否可点击
}BASALINFO, *LPBASALINFO;

//扩展对象资料
typedef struct tagGameBasal{
	_RECT		Region;				//可视区域
	_SIZE		Scaling;			//缩放比率
	WORD		Z;					//层次
	DWORD		Color;				//颜色
	WORD		Alpha;				//透明度
	float		Angle;				//角度(弧度)
}GAMEBASALINFO, *LPGAMEBASALINFO;

typedef struct tagControlMessage{
	LPVOID		lpVoid;
	WPARAM		wParam;
	LPARAM		lParam;
}CONTROLMESSAGE;

#endif			// _MFCDLL
#endif
#endif

⌨️ 快捷键说明

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