📄 gameobjecttext.h
字号:
// ***************************************************************
// GameObjectText version: 1.0
// -------------------------------------------------------------
// File Name: GameObjectText.h
// Created: 2007/07/18
// Modified: 2007/07/18 15:53
// 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_TEXT_HEAD_FILE
#define GAME_OBJECT_TEXT_HEAD_FILE
#pragma once
#include "gameobject.h"
//***************************************************************
// 文本对象,提供文本输出、控制功能。
//***************************************************************
class OBJECT_COM_CLASS CGameObjectText :
public IGameObjectText, public CGameObject
{
protected:
LPTSTR m_szText; //文本输出内容
TCHAR m_szFont[32]; //字体
hgeFont* m_hgeFont; //HGE对象
DWORD m_dwColor; //字体颜色
bool m_bSupportUnicode; //是否支持多字节
int m_nAlign; //文本对齐方式
int m_nFontSize; //文本大小
WORD m_nBufferSize; //缓冲区大小
WORD m_nTextLength; //文本长度
public:
//构造函数
CGameObjectText(void);
//析构函数
virtual ~CGameObjectText(void);
//返回缓冲指针
virtual LPCTSTR __cdecl GetBuffer();
//公共相关方法
public:
//对象创建
virtual bool __cdecl Create(LPCTSTR lpName, _SIZE siSize, LPCTSTR szFont="default", int nFontSize=0);
//渲染对象
virtual void __cdecl Render(WPARAM wParam=NULL);
public:
//设置模式
virtual bool __cdecl SetMode(WORD wMode = 0);
//文本相关方法
public:
//设置文本
virtual void __cdecl SetText(LPCTSTR lpText, WORD wSize=0);
//返回文本
virtual LPCTSTR __cdecl GetText();
//返回文本长度
virtual WORD __cdecl GetTextLength();
//设置缓冲区上限
virtual void __cdecl SetMaxLength(WORD wSize);
//返回缓冲区上限
virtual WORD __cdecl GetMaxLength();
//设置颜色
virtual void __cdecl SetColor(DWORD dwColor);
//返回颜色
virtual DWORD __cdecl GetColor();
//设置字体
virtual void __cdecl SetFont(LPCTSTR lpFont);
//返回字体
virtual LPCTSTR __cdecl GetFont();
//是否支持宽文本
virtual bool __cdecl IsSupportUnicode();
//设置行间距
virtual void __cdecl SetSpacing(float fSpacing=1.0f);
//设置对齐
virtual void __cdecl SetAlign(int nAlign);
//设置字体大小
virtual void __cdecl SetFontSize(int nSize);
//设置角度
virtual void __cdecl SetAngle(float fAngle);
//设置角度
virtual void __cdecl SetAngleOffset(float fAngle);
//返回字串宽度
virtual float __cdecl GetStringWidth();
//返回字体高度
virtual float __cdecl GetHeight();
//返回行间距
virtual float __cdecl GetSpacing();
//返回对齐
virtual int __cdecl GetAlign();
//返回字体大小
virtual int __cdecl GetFontSize();
//模板方法
public:
//是否有效
virtual bool __cdecl IsValid() { return AfxIsValidAddress(this,sizeof(CGameObjectText))?true:false;};
//释放对象
virtual bool __cdecl Release() { if (IsValid()) delete this; return true; };
//接口查询
virtual void * __cdecl QueryInterface(const IID & Guid, DWORD dwQueryVer);
public:
//操作重载
CGameObjectText& operator=(CGameObjectText& GamoObject);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -