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

📄 gameobjectedit.h

📁 游戏框架
💻 H
字号:
// ***************************************************************
//  GameObjectButton   version:  1.0
//  -------------------------------------------------------------
//	File Name:	GameObjectEdit.h
//	Created:	2007/07/29
//	Modified:	2007/07/29   20:21
//	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_EDIT_HEAD_FILE
#define GAME_OBJECT_EDIT_HEAD_FILE

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

class OBJECT_COM_CLASS CGameObjectEdit :
	public CGameGroup, public IGameObjectEdit
{
protected:
	bool				m_bAcceptEnterKey;				//是否接受回车键
	bool				m_bAcceptTabKey;				//是否接受TAB键输入
	bool				m_bPassword;					//是否密码录入方式
	bool				m_bShowCur;						//是否显示光标
	CGameObjectText		m_GOText;						//内置文本对象
	CGameObjectGraph	m_GOGraph;						//内置底纹对象
	LPTSTR				m_lpTextBuffer;					//文本对象的缓冲区
	WORD				m_wCurPosition;					//光标当前位置
	enEditCharScope		m_enCharScope;					//录入字符集范围
	CResource*			m_pResource;					//资源指针
	HWND				m_hWnd;							//HGE窗口句柄

public:
	CGameObjectEdit(void);
	virtual ~CGameObjectEdit(void);

	//公共相关方法
public:
	//对象创建
	virtual bool __cdecl Create(LPCTSTR lpName, _SIZE siSize, CResource* pResource);
	//渲染对象
	virtual void __cdecl Render(WPARAM wParam=NULL);
	//重获焦点 Randy 8-27
	virtual void __cdecl FocusGain();

public:
	//接受输入回车键
	virtual void __cdecl AcceptEnterKey(bool bFlag);
	//接受TAB键
	virtual void __cdecl AcceptTabKey(bool bFlag);
	//清空输入内容
	virtual void __cdecl Clear();
	//返回背景纹理对象
	virtual IGameObjectGraph* __cdecl GetBGObject();
	//返回文本内容对象
	virtual IGameObjectText* __cdecl GetTextObject();
	//返回录入字符范围
	virtual enEditCharScope __cdecl GetCharScope();
	//返回当前光标位置
	virtual WORD __cdecl GetCurPosition();
	//返回录入内容
	virtual LPCTSTR __cdecl GetText();
	//返回录入内容的长度
	virtual WORD __cdecl GetTextLength();
	//是否接受回车键
	virtual bool __cdecl IsAcceptEnterKey();
	//是否接受TAB键
	virtual bool __cdecl IsAcceptTabKey();
	//是否密码录入方式
	virtual bool __cdecl IsPassword();
	//是否显示光标
	virtual bool __cdecl IsShowCursor();
	//设置为密码录入方式
	virtual void __cdecl Password(bool bFlag);
	//设置录入字符集
	virtual void __cdecl SetCharScope(enEditCharScope enCharScope);
	//设置光标位置
	virtual void __cdecl SetCurPosition(WORD wPosition);
	//设置文本内容
	virtual void __cdecl SetText(LPCTSTR lpText, WORD wLength=NULL);
	//显示光标
	virtual void __cdecl ShowCursor(bool bFlag);
	
	//模板方法
public:
	//是否有效
	virtual bool __cdecl IsValid() { return AfxIsValidAddress(this,sizeof(CGameObjectEdit))?true:false;};
	//释放对象
	virtual bool __cdecl Release() { if (IsValid()) delete this; return true; };
	//接口查询
	virtual void * __cdecl QueryInterface(const IID & Guid, DWORD dwQueryVer);

public:
	//鼠标点击
	virtual bool __cdecl OnMouseClick(float x, float y, int nType, UINT nMessage, UINT nComboKey);
	//键盘事件
	virtual bool __cdecl OnKeyPass(TCHAR nKey, UINT nFlag);
	//键盘事件
	virtual bool __cdecl OnKeyDown(TCHAR nKey, UINT nFlag);

public:
	//操作重载
	CGameObjectEdit& operator=(CGameObjectEdit& GamoObject);
};

#endif

⌨️ 快捷键说明

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