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

📄 gameobjectbutton.h

📁 游戏框架
💻 H
字号:
// ***************************************************************
//  GameObjectButton   version:  1.0
//  -------------------------------------------------------------
//	File Name:	GameObjectButton.h
//	Created:	2007/07/18
//	Modified:	2007/07/18   15:45
//	Author:		William.Liang
//  Msn:		lwq49@msn.com
//  Email:		lwq49@21cn.com, lwq49@msn.com
//	Description:
//
//	Purpose:	
//  -------------------------------------------------------------
//  license:
//
//  The contents of this file are subject to the Mozilla Public
//  License Version 1.1 (the "License"); you may not use this file
//  except in compliance with the License. You may obtain a copy
//  of the License at http://www.mozilla.org/MPL/ Software dis-
//  tributed under the License is distributed on an "AS IS" 
//  basis, WITHOUT WARRANTY OF ANY KIND, either express or im-
//  plied. See the License for the specific language governing
//  rights and limitations under the License.
//
//  The Initial Developer of the Original Code is William.Liang .
//  Copyright (C) 2007 - All Rights Reserved.
// ***************************************************************
#ifndef GAME_OBJECT_BUTTON_HEAD_FILE
#define GAME_OBJECT_BUTTON_HEAD_FILE

#pragma once
#include "GameGroup.h"
#include "GameObjectSprite.h"
#include "GameObjectText.h"

typedef enum enButtonStatus{
	Button_Normal,
	Button_Click,
	Button_MoveIn,
	Button_Disabled,
	Button_UnClickabled,
};
//***************************************************************
//	按钮对象。提供简单的按钮质性功能。
//***************************************************************
class OBJECT_COM_CLASS CGameObjectButton :
	public CGameGroup, public IGameObjectButton
{
protected:
	_RECT				m_rcStatus[5];			//按钮状态的帖图坐标
	CGameObjectSprite	m_Sprite;				//图片精灵
	CGameObjectText		m_Caption;				//按钮标题

public:
	//构造函数
	CGameObjectButton(void);
	//析构函数
	virtual ~CGameObjectButton(void);

	//公共相关方法
public:
	//对象创建
	virtual bool __cdecl Create(LPCTSTR lpName, _SIZE siSize, CResource* pResource, LPCTSTR lpCaption="", LPCTSTR szFont="default.fnt", int nAlign=Align_Left|Align_Top);
	//对象创建  Randy 8月15日
	virtual bool __cdecl Create(LPCTSTR lpName, _RECT rcRes, CResource* pResource, LPCTSTR lpCaption="", LPCTSTR szFont="default.fnt", int nAlign=Align_Left|Align_Top);
	//渲染对象
	virtual void __cdecl Render(WPARAM wParam=NULL);

public:
	//设置标题
	virtual void __cdecl SetCaption(LPCTSTR lpCaption, int nAlign=Align_Left|Align_Top);
	//返回标题
	virtual LPCTSTR __cdecl GetCaption();
	//设置标题对齐
	virtual void __cdecl SetCaptionAlign(int nAlign);
	//返回标题对齐方式
	virtual WORD __cdecl GetCaptionAlign();
	//返回标题对象
	virtual IGameObjectText* GetCaptionObject();
	//返回图片对象
	virtual IGameObjectSprite* GetSpriteObject();
	//设置禁用
	virtual void __cdecl SetDisabled(bool bFlag);
	//设置点击
	virtual void __cdecl SetClickabled(bool bFlag);

	//鼠标事件
public:
	//鼠标移入
	virtual bool __cdecl OnMouseIn(float x, float y, int nType, UINT nMessage, UINT nComboKey);
	//鼠标移出
	virtual bool __cdecl OnMouseOut(float x, float y, int nType, UINT nMessage, UINT nComboKey);
	//鼠标点击
	virtual bool __cdecl OnMouseClick(float x, float y, int nType, UINT nMessage, UINT nComboKey);

	//模板方法
public:
	//是否有效
	virtual bool __cdecl IsValid() { return AfxIsValidAddress(this,sizeof(CGameObjectButton))?true:false;};
	//释放对象
	virtual bool __cdecl Release() { if (IsValid()) delete this; return true; };
	//接口查询
	virtual void * __cdecl QueryInterface(const IID & Guid, DWORD dwQueryVer);
	
public:
	//操作重载
	CGameObjectButton& operator=(CGameObjectButton& GamoObject);
};

#endif

⌨️ 快捷键说明

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