dl
dl_component.h 文件参考

组件系统 更多...

#include <typeinfo>
#include <typeindex>
#include <string>
#include <vector>
#include <array>
#include <functional>
#include "dl_type.h"
#include "math/dl_align.h"
#include "math/dl_coor.h"

浏览该文件的源代码.

类

class  dl::Cpt::Variable< T, UID >
 变量,注意模板参数 需要实例化后不重复 更多...
 
class  dl::Cpt::Function< T, UID >
 
class  dl::AnyType
 任意类型包装 更多...
 
class  dl::VectorAny
 
class  dl::Components
 
class  dl::Cpt::Lang
 语言本地化 更多...
 
class  dl::Cpt::ElementData
 元素通用属性(默认左上对齐,便于理解) 更多...
 

命名空间

namespace  dl
 
namespace  dl::Cpt
 子组件命名空间
 

类型定义

using dl::Cpt::IsPickup = Function<std::function<bool()>, str_uid("IsPickup")>
 ---------------------------—具体组件----------------------------------—
 
using dl::Cpt::IsSelect = Function<std::function<bool()>, str_uid("IsSelect")>
 选择
 
using dl::Cpt::IsClick = Function<std::function<bool()>, str_uid("IsClick")>
 点击
 
using dl::Cpt::IsDown = Function<std::function<bool()>, str_uid("IsDown")>
 按下状态
 
using dl::Cpt::GetCoor = Function<std::function<dl::Coor* ()>, str_uid("GetCoor")>
 返回坐标系
 
using dl::Cpt::GetOrder = Function<std::function<float()>, str_uid("GetOrder")>
 返回order
 
using dl::Cpt::Update = Function<std::function<void()>, str_uid("Update")>
 逻辑
 
using dl::Cpt::Render = Function<std::function<void()>, str_uid("Render")>
 绘制
 
using dl::Cpt::SetOrder = Function<std::function<void(float)>, str_uid("SetOrder")>
 设置order
 
using dl::Cpt::SetSelect = Function<std::function<void(bool)>, str_uid("SetSelect")>
 设置是否选择
 
using dl::Cpt::DeleteThis = Function<std::function<void()>, str_uid("DeleteThis")>
 删除自身
 
using dl::Cpt::Clone = Function<std::function<Components* ()>, str_uid("Clone")>
 克隆
 

函数

Components * dl::createComponents (std::string_view name={})
 
template<typename T>
std::vector< T * > dl::Cpt::GetComp (std::vector< Components * > &vec)
 从vector<Components*>返回指定类型的所有组件
 
template<typename T>
T * dl::Cpt::GetFirst (std::vector< Components * > &vec)
 从vector<Components*>返回指定类型的第一个元素
 
template<typename T>
T * dl::Cpt::GetN (std::vector< Components * > &vec, size_t n)
 从vector<Components*>返回指定类型的第n个元素
 

详细描述

组件系统

版本
1.0
作者
lveyou
日期
22-01-01
注解
用于取代绑定于代码的静态继承关系,动态化功能组件
避免使用std::any,以完全掌控性能
如果没有组件需求,直接使用vector<any>即可
组件仅仅是{AnyType,VectorAny}的组合
命名缩写规范:ele表示多个Components(单个元素)、cpt表示Components、comp表示单个组件

在文件 dl_component.h 中定义.