easyx_framework V1.0.0
基于easyx的c++游戏框架
 
载入中...
搜索中...
未找到
Widget类 参考

基础小部件 更多...

#include <widgets.h>

类 Widget 继承关系图:
base LayerInterface Bar Image Panel Text Button GridPanel HorizontalPanel VerticalPanel

Public 成员函数

 Widget ()
 
virtual ~Widget ()
 析构函数 从mainworld容器区域中删去类
 
virtual void Update ()
 插入世界容器中进行一些交互处理 每一帧gengxin
 
virtual void BeginPlay ()
 
virtual void EndPlay ()
 
virtual void Render ()
 纯虚函数,继承的类都有它来实现渲染,world默认遍历函数实现渲染
 
void ShowInfoBox ()
 显示提示框
 
void DrawDebugRect ()
 绘制部件的边框
 
void SetLayoutPattern (LayoutPattern pattern)
 设置布局形式
 
void SetUiPattern (UiPattern pattern)
 设置部件可视性
 
void SetPosPattern (LayoutPositionPattern pattern)
 设置坐标系
 
LayoutPattern GetLayoutPattern () const
 获取布局形式
 
UiPattern GetUiPattern () const
 获取部件可视性
 
LayoutPositionPattern GetPosPattern () const
 获取坐标系
 
void EnableInfoBox (bool showinfo)
 是否开启提示框
 
void SetInfoText (std::string text)
 设置提示框内容
 
virtual Vector2D GetSize () const
 获取实际大小
 
void SetSize (Vector2D size)
 
void AttachTo (Widget *par)
 实现基础小部件的绑定
 
void DetachFrom (Widget *par)
 解除基础小部件的绑定
 
Vector2D GetScreenPosition () const
 获取相对屏幕绝对坐标
 
float GetScreenRotation () const
 获取相对屏幕坐标系的角度
 
Vector2D GetScreenScale () const
 获取绝对放缩比例
 
Vector2D GetRelativePosition () const
 获取小部件相对位置
 
float GetRelativeRotation () const
 获取小部件相对角度
 
Vector2D GetRelativeScale () const
 获取小部件相对放缩比例
 
void SetRelativePosition (Vector2D pos)
 设置相对坐标
 
void SetRelativeRotation (float rotation)
 设置相对角度
 
void SetRelativeScale (Vector2D scale)
 设置小部件相对放缩比例
 
- Public 成员函数 继承自 base
 base ()
 
virtual ~base ()
 
std::string GetName () const
 
void SetName (const std::string &name)
 
virtual void Update (float deltaTime)
 
- Public 成员函数 继承自 LayerInterface
 LayerInterface ()
 构造图层顺序接口
 
 ~LayerInterface ()
 析构图层顺序接口,从world图层顺序容器中删去这个类
 
void SetLayer (int _layer)
 设置图层层级 要实现必须先把排好序的容器中删除已经排好序的对象,重新插入已经改变好的对象
 
int GetLayer () const
 获取图层层级
 

Protected 成员函数

bool isUnderCursor () const
 鼠标是否在点击的状态
 

Protected 属性

Transform transform
 场景属性
 
Widgetparent = nullptr
 父节点
 
std::unordered_set< Widget * > children
 孩子容器
 
PanelattachedPanel = nullptr
 附着的容器面板
 
Vector2D size = {1,1}
 大小
 
LayoutPattern layoutpattern
 布局形式
 
UiPattern uipattern
 部件可视性
 
LayoutPositionPattern pospattern =LayoutPositionPattern::Center
 坐标系
 
Characters InfoText
 提示框
 
bool bInfoBox = false
 是否开启文本显示
 

Private 成员函数

Vector2D GetLayoutOffset () const
 获取父节点座标坐标相对于相对位置的偏移量
 

Private 属性

Pair point_lt { -1,-1 }
 左上角所在的区域
 
Pair point_rb { -1,-1 }
 右下角所在的区域
 

友元

class Panel
 
class HorizontalPanel
 

详细描述

基础小部件

结构类比component.

构造及析构函数说明

◆ Widget()

Widget::Widget ( )
inline

◆ ~Widget()

Widget::~Widget ( )
virtual

析构函数 从mainworld容器区域中删去类

成员函数说明

◆ AttachTo()

void Widget::AttachTo ( Widget * par)

实现基础小部件的绑定

◆ BeginPlay()

virtual void Widget::BeginPlay ( )
inlinevirtual

实现了 base.

◆ DetachFrom()

void Widget::DetachFrom ( Widget * par)

解除基础小部件的绑定

备注
!!!用户慎用

◆ DrawDebugRect()

void Widget::DrawDebugRect ( )

绘制部件的边框

◆ EnableInfoBox()

void Widget::EnableInfoBox ( bool showinfo)
inline

是否开启提示框

◆ EndPlay()

virtual void Widget::EndPlay ( )
inlinevirtual

实现了 base.

◆ GetLayoutOffset()

Vector2D Widget::GetLayoutOffset ( ) const
private

获取父节点座标坐标相对于相对位置的偏移量

@reamrk 受坐标系影响

◆ GetLayoutPattern()

LayoutPattern Widget::GetLayoutPattern ( ) const
inline

获取布局形式

◆ GetPosPattern()

LayoutPositionPattern Widget::GetPosPattern ( ) const
inline

获取坐标系

◆ GetRelativePosition()

Vector2D Widget::GetRelativePosition ( ) const
inline

获取小部件相对位置

◆ GetRelativeRotation()

float Widget::GetRelativeRotation ( ) const
inline

获取小部件相对角度

◆ GetRelativeScale()

Vector2D Widget::GetRelativeScale ( ) const
inline

获取小部件相对放缩比例

◆ GetScreenPosition()

Vector2D Widget::GetScreenPosition ( ) const

获取相对屏幕绝对坐标

◆ GetScreenRotation()

float Widget::GetScreenRotation ( ) const

获取相对屏幕坐标系的角度

◆ GetScreenScale()

Vector2D Widget::GetScreenScale ( ) const

获取绝对放缩比例

◆ GetSize()

Vector2D Widget::GetSize ( ) const
virtual

获取实际大小

GridPanel, HorizontalPanel , 以及 VerticalPanel 重载.

◆ GetUiPattern()

UiPattern Widget::GetUiPattern ( ) const
inline

获取部件可视性

◆ isUnderCursor()

bool Widget::isUnderCursor ( ) const
protected

鼠标是否在点击的状态

◆ Render()

virtual void Widget::Render ( )
inlinevirtual

纯虚函数,继承的类都有它来实现渲染,world默认遍历函数实现渲染

参见
SpriteRenderer::Render()

实现了 LayerInterface.

Bar, Image , 以及 Text 重载.

◆ SetInfoText()

void Widget::SetInfoText ( std::string text)
inline

设置提示框内容

参见
Characters

◆ SetLayoutPattern()

void Widget::SetLayoutPattern ( LayoutPattern pattern)
inline

设置布局形式

◆ SetPosPattern()

void Widget::SetPosPattern ( LayoutPositionPattern pattern)
inline

设置坐标系

◆ SetRelativePosition()

void Widget::SetRelativePosition ( Vector2D pos)
inline

设置相对坐标

◆ SetRelativeRotation()

void Widget::SetRelativeRotation ( float rotation)
inline

设置相对角度

◆ SetRelativeScale()

void Widget::SetRelativeScale ( Vector2D scale)
inline

设置小部件相对放缩比例

◆ SetSize()

void Widget::SetSize ( Vector2D size)
inline

◆ SetUiPattern()

void Widget::SetUiPattern ( UiPattern pattern)

设置部件可视性

◆ ShowInfoBox()

void Widget::ShowInfoBox ( )

显示提示框

◆ Update()

void Widget::Update ( )
virtual

插入世界容器中进行一些交互处理 每一帧gengxin

Bar, Button, Image, Panel , 以及 Text 重载.

友元及相关符号说明

◆ HorizontalPanel

friend class HorizontalPanel
friend

◆ Panel

friend class Panel
friend

类成员变量说明

◆ attachedPanel

Panel* Widget::attachedPanel = nullptr
protected

附着的容器面板

◆ bInfoBox

bool Widget::bInfoBox = false
protected

是否开启文本显示

◆ children

std::unordered_set<Widget*> Widget::children
protected

孩子容器

◆ InfoText

Characters Widget::InfoText
protected

提示框

◆ layoutpattern

LayoutPattern Widget::layoutpattern
protected

布局形式

◆ parent

Widget* Widget::parent = nullptr
protected

父节点

◆ point_lt

Pair Widget::point_lt { -1,-1 }
private

左上角所在的区域

◆ point_rb

Pair Widget::point_rb { -1,-1 }
private

右下角所在的区域

◆ pospattern

坐标系

◆ size

Vector2D Widget::size = {1,1}
protected

大小

◆ transform

Transform Widget::transform
protected

场景属性

◆ uipattern

UiPattern Widget::uipattern
protected

部件可视性