📄 objectcom.h
字号:
// ***************************************************************
// ObjectCom version: 1.0
// -------------------------------------------------------------
// File Name: ObjectCom.h
// Created: 2007/07/18
// Modified: 2007/07/18 16:00
// 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 OBJECT_COM_HEAD_FILE
#define OBJECT_COM_HEAD_FILE
//////////////////////////////////////////////////////////////////////////
//导出定义
#ifndef OBJECT_COM_CLASS
#ifdef OBJECT_COM_DLL
#define OBJECT_COM_CLASS _declspec(dllexport)
#else
#define OBJECT_COM_CLASS _declspec(dllimport)
#endif
#endif
//模块定义
#ifdef _DEBUG
#define OBJECT_COM_DLL_NAME TEXT("ObjectComD.dll") //组件 DLL 名字
#else
#define OBJECT_COM_DLL_NAME TEXT("ObjectCom.dll") //组件 DLL 名字
#endif
//////////////////////////////////////////////////////////////////////////
//平台头文件
#include "..\Common\Common.h"
#include "Resource.h"
//////////////////////////////////////////////////////////////////////////
//导出类头文件
//////////////////////////////////////////////////////////////////////////
//对象类型枚举
enum enGameObjectType
{
Type_Unknow,
Type_Sprite,
Type_Animation,
Type_Particle,
Type_Button,
Type_Text,
Type_List,
Type_Radio,
Type_Frame,
Type_Group,
Type_Graph,
Type_Edit,
Type_Scroll,
Type_Slider,
Type_Layer,
Type_Scene,
Type_View,
Type_BufferPage,
Type_Custom,
Type_Properties,
};
typedef enum enAlignType{
Align_Left = 1,
Align_Right = 2,
Align_Center = 4,
Align_Top = 8,
Align_Bottom = 16,
Align_Middle = 32,
}AlignType;
typedef enum enGraphType{
Graph_DotLine,
Graph_Line,
Graph_Square,
Graph_Triangle,
Graph_Circular,
};
typedef enum enGraphLine{
Line_Normal,
Line_Dot,
};
typedef enum enEditCharScope{
CharScope_Undefine=0,
CharScope_Number=1,
CharScope_Letter=2,
CharScope_Symbol=4,
CharScope_Both=7,
};
//////////////////////////////////////////////////////////////////////////
#define VER_IBaseObject INTERFACE_VERSION(1,1)
static const GUID IID_IBaseObject={0xbd02b27d,0x7274,0x46a5,0x82,0x7b,0xc4,0x49,0x83,0xfe,0x8b,0x16};
interface IBaseObject : public IUnknownEx
{
//扩展方法
public:
//设置父对象
virtual void __cdecl SetParent(IUnknownEx* pIUnknownEx)=NULL;
//返回父对象
virtual IUnknownEx* __cdecl GetParent()=NULL;
//坐标相关
public:
//移动对象
virtual void __cdecl MoveTo(_POINT piPoint)=NULL;
// 返回对象坐标相对于屏幕
virtual _POINT __cdecl GetScreenPosition()=NULL;
// 返回对象相对于容器的坐标
virtual _POINT __cdecl GetLocalPosition()=NULL;
// 返回对象容器坐标
virtual _POINT __cdecl GetContainerPosition()=NULL;
//计算容器坐标
virtual void __cdecl CalcContainerPosition()=NULL;
//屏幕坐标转本地坐标
virtual _POINT __cdecl ScreenToLocal(_POINT piScreen)=NULL;
//本地坐标转屏幕坐标
virtual _POINT __cdecl LocalToScreen(_POINT piLocal)=NULL;
//共通属性
public:
//设置名字
virtual void __cdecl SetObjectName(LPCTSTR lpName)=NULL;
//获取名字
virtual LPCTSTR __cdecl GetObjectName()=NULL;
//设置类型
virtual void __cdecl SetObjectType(enGameObjectType enGameObjectType)=NULL;
//返回类型
virtual enGameObjectType __cdecl GetObjectType()=NULL;
//设置缓冲类型
virtual void __cdecl SetCacheType(WORD wType)=NULL;
//返回缓冲类型
virtual WORD __cdecl GetCacheType()=NULL;
//通知变动
virtual void __cdecl NotifiyChange()=NULL;
};
#define VER_IGameObjectEventSink INTERFACE_VERSION(1,1)
static const GUID IID_IGameObjectEventSink={0xbd02b27d,0x7274,0x46a5,0x82,0x7b,0xc4,0x49,0x83,0xfe,0x8b,0x96};
//事件钩子接口
interface IGameObjectEventSink : public IUnknownEx
{
//事件回调
public:
//鼠标移动
virtual bool __cdecl OnMouseMove(float x, float y, UINT nComboKey)=NULL;
//鼠标点击
virtual bool __cdecl OnMouseClick(float x, float y, int nType, UINT nMessage, UINT nComboKey)=NULL;
//鼠标点击
virtual bool __cdecl OnMouseDBClick(float x, float y, UINT nMessage, UINT nComboKey)=NULL;
////鼠标点击
//virtual bool __cdecl OnMouseUp(float x, float y, int nKey)=NULL;
////鼠标点击
//virtual bool __cdecl OnMouseDown(float x, float y, int nKey)=NULL;
//鼠标移入
virtual bool __cdecl OnMouseIn(float x, float y, int nType, UINT nMessage, UINT nComboKey)=NULL;
//鼠标移出
virtual bool __cdecl OnMouseOut(float x, float y, int nType, UINT nMessage, UINT nComboKey)=NULL;
//鼠标移过
virtual bool __cdecl OnMouseOver(float x, float y, int nType, UINT nMessage, UINT nComboKey)=NULL;
//键盘事件
virtual bool __cdecl OnKeyPass(TCHAR nKey, UINT nFlag)=NULL;
//键盘事件
virtual bool __cdecl OnKeyUp(UINT nKey, UINT nFlag)=NULL;
//键盘事件
virtual bool __cdecl OnKeyDown(UINT nKey, UINT nFlag)=NULL;
//每帧回调消息
virtual bool __cdecl OnFrameEvent()=NULL;
//调用事件消息
virtual bool __cdecl OnAttemperEvent()=NULL;
};
#define VER_IGameObject INTERFACE_VERSION(1,1)
static const GUID IID_IGameObject={0xbd02b27d,0x7274,0x46a5,0x82,0x7b,0xc4,0x49,0x83,0xfe,0x8b,0x76};
//基本对象接口
interface IGameObject : public IGameObjectEventSink
{
//扩展方法
public:
//设置父对象
virtual void __cdecl SetParent(IUnknownEx* pIUnknownEx)=NULL;
//返回父对象
virtual IUnknownEx* __cdecl GetParent()=NULL;
//坐标相关
public:
//移动对象
virtual void __cdecl MoveTo(_POINT piPoint)=NULL;
//移动对象
virtual void __cdecl MoveToOffset(_POINT piPoint)=NULL;
// 返回对象坐标相对于屏幕
virtual _POINT __cdecl GetScreenPosition()=NULL;
// 返回对象相对于容器的坐标
virtual _POINT __cdecl GetLocalPosition()=NULL;
// 返回对象容器坐标
virtual _POINT __cdecl GetContainerPosition()=NULL;
//返回中心点
virtual _POINT __cdecl GetAnchorPosition()=NULL;
//计算容器坐标
virtual void __cdecl CalcContainerPosition()=NULL;
//屏幕坐标转本地坐标
virtual _POINT __cdecl ScreenToLocal(_POINT piScreen)=NULL;
//本地坐标转屏幕坐标
virtual _POINT __cdecl LocalToScreen(_POINT piLocal)=NULL;
//共通属性
public:
//设置名字
virtual void __cdecl SetObjectName(LPCTSTR lpName)=NULL;
//获取名字
virtual LPCTSTR __cdecl GetObjectName()=NULL;
//设置类型
virtual void __cdecl SetObjectType(enGameObjectType enGameObjectType)=NULL;
//返回类型
virtual enGameObjectType __cdecl GetObjectType()=NULL;
//设置缓冲类型
virtual void __cdecl SetCacheType(WORD wType)=NULL;
//返回缓冲类型
virtual WORD __cdecl GetCacheType()=NULL;
//对象创建
virtual bool __cdecl Create(LPCTSTR lpName, _SIZE siSize, enGameObjectType enType, ...)=NULL;
//设置可视
virtual void __cdecl SetVisabled(bool bFlag)=NULL;
//设置禁用
virtual void __cdecl SetDisabled(bool bFlag)=NULL;
//设置点击
virtual void __cdecl SetClickabled(bool bFlag)=NULL;
//是否可视
virtual bool __cdecl IsVisabled()=NULL;
//是否禁用
virtual bool __cdecl IsDisabled()=NULL;
//是否可点击
virtual bool __cdecl IsClickabled()=NULL;
//设置角度
virtual void __cdecl SetAngle(float fAngle)=NULL;
//设置角度
virtual void __cdecl SetAngleOffset(float fAngle)=NULL;
//设置透明
virtual void __cdecl SetAlpha(WORD wAlpha)=NULL;
//设置透明
virtual void __cdecl SetAlphaOffset(WORD wAlpha)=NULL;
//设置Z空间
virtual void __cdecl SetZ(WORD wZ)=NULL;
//设置Z空间
virtual void __cdecl SetZOffset(WORD wZ)=NULL;
//设置缩放
virtual void __cdecl SetScaling(_SIZE siSize)=NULL;
//设置缩放
virtual void __cdecl SetScalingOffset(_SIZE siSize)=NULL;
//设置深度
virtual void __cdecl SetDepth(DWORD dwDepth)=NULL;
//设置中心
virtual void __cdecl SetAnchorPosition(_POINT piPoint)=NULL;
//设置中心
virtual void __cdecl SetAnchorPositionOffset(_POINT piPoint)=NULL;
//设置大小
virtual void __cdecl SetSize(_SIZE siSize)=NULL;
//返回角度
virtual float __cdecl GetAngle()=NULL;
//返回透明
virtual WORD __cdecl GetAlpha()=NULL;
//返回Z空间
virtual WORD __cdecl GetZ()=NULL;
//返回缩放
virtual _SIZE __cdecl GetScaling()=NULL;
//返回深度
virtual DWORD __cdecl GetDepth()=NULL;
//返回大小
virtual _SIZE __cdecl GetSize()=NULL;
//返回区域
virtual _RECT __cdecl GetRegion()=NULL;
//返回基本信息
virtual BASALINFO& __cdecl GetBasalInfo()=NULL;
//返回基本信息
virtual GAMEBASALINFO& __cdecl GetGameBasalInfo()=NULL;
//碰撞检测
virtual bool __cdecl Hitting(IGameObject* IBaseObject, bool bFlag)=NULL;
//碰撞检测
virtual bool __cdecl Hitting(float x, float y)=NULL;
//对象渲染
virtual void __cdecl Render(WPARAM wParam=NULL)=NULL;
//设置剪裁
virtual void __cdecl SetClipping(bool bFlag)=NULL;
//通知变动
virtual void __cdecl NotifiyChange()=NULL;
//Add By Randy 8.27
public:
//失去焦点 Randy 8-27
virtual void __cdecl FocusLost()=NULL;
//重获焦点 Randy 8-27
virtual void __cdecl FocusGain()=NULL;
};
#define VER_IGameObjectText INTERFACE_VERSION(1,1)
static const GUID IID_IGameObjectText={0xbd02b27d,0x7274,0x46a5,0x82,0x7b,0xc4,0x49,0x83,0xfe,0x8b,0xA6};
//文本对象接口
interface IGameObjectText : public IUnknownEx
{
public:
//设置文本
virtual void __cdecl SetText(LPCTSTR lpText, WORD wSize=NULL)=NULL;
//返回文本
virtual LPCTSTR __cdecl GetText()=NULL;
//返回文本长度
virtual WORD __cdecl GetTextLength()=NULL;
//设置缓冲区上限
virtual void __cdecl SetMaxLength(WORD wSize)=NULL;
//返回缓冲区上限
virtual WORD __cdecl GetMaxLength()=NULL;
//设置颜色
virtual void __cdecl SetColor(DWORD dwColor)=NULL;
//返回颜色
virtual DWORD __cdecl GetColor()=NULL;
//设置字体
virtual void __cdecl SetFont(LPCTSTR lpFont)=NULL;
//返回字体
virtual LPCTSTR __cdecl GetFont()=NULL;
//是否支持宽文本
virtual bool __cdecl IsSupportUnicode()=NULL;
//设置行间距
virtual void __cdecl SetSpacing(float fSpacing=1.0f)=NULL;
//设置对齐
virtual void __cdecl SetAlign(int nAlign)=NULL;
//设置字体大小
virtual void __cdecl SetFontSize(int nSize)=NULL;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -