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

粒子组件 更多...

#include <Particle.h>

类 Particle 继承关系图:
SceneComponent LayerInterface ImageInterface Component base

Public 成员函数

 Particle ()
 
void Load (std::string name)
 加载粒子资源.
 
void SetMaxSpeed (float speed)
 设置粒子发射最大初速度.
 
void SetMinSpeed (float speed)
 设置粒子发射最小初速度.
 
void SetSizeRange (float lower, float upper)
 设置大小范围(倍率系数)
 
virtual void Update (float deltaTime) override
 
virtual void Render () override
 纯虚函数,继承的类都有它来实现渲染,world默认遍历函数实现渲染
 
void SetCapacity (int capacity)
 设置粒子容量
 
void SetGravity (int gravity)
 设置粒子重力
 
void SetLifetime (int lifetime)
 设置单个粒子生命周期
 
void SetIsLoop (bool isloop)
 设置粒子是否持续生产
 
void SetInterval (float Interval)
 
void SetFadingtime (float fadingtime)
 
void SetPattern (ParticlePattern pattern)
 
void SetCenter (Vector2D radius, Vector2D scoop)
 设置中心放射状参数
 
void SetLine (float length, float angle)
 设置线性放射状参数
 
- Public 成员函数 继承自 SceneComponent
void AttachTo (SceneComponent *par)
 设置所属组件
 
void DetachForm (SceneComponent *par)
 解除所属组件.
 
virtual void Destruct ()
 解除场景组件绑定并销毁
 
virtual void BeginPlay () override
 设置纯虚函数,把不能写在构造却需要优先实现的写在这.
 
virtual void EndPlay () override
 把一些不能写在析构函数的一些操作写在这里
 
Vector2D GetLocalPosition () const
 获取相对坐标
 
float GetLocalRotation () const
 获取相对角度
 
Vector2D GetLocalScale () const
 获取相对缩放大小
 
Vector2D GetWorldPosition () const
 获取场景组件的世界坐标
 
float GetWorldRotation () const
 获取场景组件的世界旋转角度
 
Vector2D GetWorldScale () const
 获取场景组件的世界的缩放大小
 
void SetLocalPosition (const Vector2D &pos)
 设置相对坐标
 
void SetLocalRotation (float rot)
 设置相对角度
 
void SetLocalScale (const Vector2D &scale)
 设置相对缩放大小
 
void AddPosition (const Vector2D &pos)
 加上一个坐标
 
void AddRotation (float rot)
 加上一个角度
 
- Public 成员函数 继承自 Component
void SetOwner (class Object *owner)
 设置绑定对象.
 
virtual void Activate ()
 激活组件
 
virtual void Deactivate ()
 停用组件
 
ObjectGetOwner () const
 获取绑定对象指针
 
- Public 成员函数 继承自 base
 base ()
 
virtual ~base ()
 
std::string GetName () const
 
void SetName (const std::string &name)
 
- Public 成员函数 继承自 LayerInterface
 LayerInterface ()
 构造图层顺序接口
 
 ~LayerInterface ()
 析构图层顺序接口,从world图层顺序容器中删去这个类
 
void SetLayer (int _layer)
 设置图层层级 要实现必须先把排好序的容器中删除已经排好序的对象,重新插入已经改变好的对象
 
int GetLayer () const
 获取图层层级
 
- Public 成员函数 继承自 ImageInterface
 ~ImageInterface ()
 析构函数 释放所有开辟的图像句柄资源
 
BYTE GetTransparency () const
 获取透明度
 
void SetTransparency (BYTE transparency)
 设置透明度
 
bool IsWave ()
 是否已经开启了波幅
 
void SetFilter (bool enable, COLORREF col=BLACK, int level=100)
 开启设置滤镜 会清空之前所有滤镜
 
void AddFilter (FilterInfo filterInfo)
 添加滤镜
 
void AddFilter (bool enable=true, COLORREF col=BLACK, int level=100, int layer=1)
 在滤镜上面继续添加滤镜 如果不写层级就会替换第一层
 
void RemoveFilter ()
 移除层级5滤镜
 
void RemoveFilter (int layer)
 移除滤镜
 
void EnableFilter ()
 开关整体滤镜
 
void EnableFilLayer (int layer)
 开关图层滤镜
 
void ExitWave ()
 关闭波幅
 
void MeanBlur (unsigned level)
 均值模糊(建议在Gameplay开始前预处理使用)
 
void WaveFrom (int x, int y, int stonesize, int stoneweight)
 波纹
 
void LoadSprite (std::string name)
 加载静态图像.
 
void SetStartAndEndLoc (Pair start, Pair end)
 截取非动画资源指定部分.
 

Private 成员函数

void produce ()
 生产器

 

Private 属性

std::deque< ParticleInfoparticle
 粒子容器 用于管理生产出来的每一个粒子
 
int capacity = 0
 粒子容量
 
float maxSpeed = 1.f
 粒子最大初速度
 
float minSpeed = 1.f
 粒子最小初速度
 
float gravity = 9.8f
 重力加速度
 
float lifetime = 1.f
 单个粒子的生命周期
 
bool isLoop = true
 是否循环生产
 
float Interval =0.1f
 生产间隔
 
float fadingtime = 0
 粒子逐渐消失的时间

 
IMAGE ** images =nullptr
 动画帧数组
 
int number = 0
 动画粒子总帧数
 
time_point< steady_clock > lasttime
 记录生产的时间点
 
Vector2D sizeRange
 大小范围(倍率系数)
 
ParticlePattern pattern = ParticlePattern::Center
 
Vector2D unitVector = Vector2D(0, 1)
 粒子方向单位向量
 
Vector2D radius = Vector2D(0, 0)
 内外半径 [内径,外径]
 
Vector2D scoop = Vector2D(0, 360)
 
float length = 1.f
 放射范围 [起始范围,结束范围]
 
float angle = 0.f
 相对于线的角度
 

额外继承的成员函数

- Protected 成员函数 继承自 SceneComponent
void process_Destruct ()
 销毁组件
 
- Protected 成员函数 继承自 ImageInterface
void RotateImage (double radian)
 旋转照片
 
void FilterImage ()
 给图片施加滤镜 滤镜实现
 
- Protected 属性 继承自 SceneComponent
SceneComponentparent = nullptr
 父指针
 
- Protected 属性 继承自 Component
class ObjectpOwner = nullptr
 处理控制逻辑 有对象物体的指针才能进行控制
 
bool bIsEnabled = true
 是否激活
 
- Protected 属性 继承自 ImageInterface
IMAGE * sprite = nullptr
 存储指针节省空间 用来指向我们当前需要的从资源库查找到的地址
 
struct ImageInterface::SpriteInfo spriteinfo
 
BYTE alpha = 255
 设置透明度
 
float angle = 0
 逆时针旋转角度
 
IMAGE * copy = nullptr
 旋转图像句柄
 
IMAGE * filter = nullptr
 滤镜图像句柄
 
bool bFilterEnable = false
 滤镜开关
 
std::set< FilterInfo, FilterSortFilterLayer
 滤镜层级容器 按照指定层级来排序滤镜
 
IMAGE * blur {}
 滤波之后的句柄
 
IMAGE * wave {}
 波幅句柄
 
bool bIsWave =false
 是否开启波幅
 

详细描述

粒子组件

备注
生产和管理粒子销毁.
跟渲染组件差不多 但是需要动画图片和帧数 来实现随机发射不同帧数的图片

构造及析构函数说明

◆ Particle()

Particle::Particle ( )
inline

成员函数说明

◆ Load()

void Particle::Load ( std::string name)

加载粒子资源.

参数
[in]name动画资源名

◆ produce()

void Particle::produce ( )
private

生产器

相当于初始化粒子结构数据

◆ Render()

void Particle::Render ( )
overridevirtual

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

参见
SpriteRenderer::Render()

实现了 LayerInterface.

◆ SetCapacity()

void Particle::SetCapacity ( int capacity)
inline

设置粒子容量

◆ SetCenter()

void Particle::SetCenter ( Vector2D radius,
Vector2D scoop )
inline

设置中心放射状参数

参数
[in]radius放射圆环的内外径
[in]scoop放射扇形的角度范围

◆ SetFadingtime()

void Particle::SetFadingtime ( float fadingtime)
inline

◆ SetGravity()

void Particle::SetGravity ( int gravity)
inline

设置粒子重力

◆ SetInterval()

void Particle::SetInterval ( float Interval)
inline

◆ SetIsLoop()

void Particle::SetIsLoop ( bool isloop)
inline

设置粒子是否持续生产

◆ SetLifetime()

void Particle::SetLifetime ( int lifetime)
inline

设置单个粒子生命周期

◆ SetLine()

void Particle::SetLine ( float length,
float angle )
inline

设置线性放射状参数

备注
默认初始坐标系为向下的y 外部认知为顺时针
参数
[in]length放射线段长度
[in]angle线段与水平夹角 根据坐标系方向

◆ SetMaxSpeed()

void Particle::SetMaxSpeed ( float speed)
inline

设置粒子发射最大初速度.

参数
[in]speed最大速度

◆ SetMinSpeed()

void Particle::SetMinSpeed ( float speed)
inline

设置粒子发射最小初速度.

参数
[in]speed最小速度

◆ SetPattern()

void Particle::SetPattern ( ParticlePattern pattern)
inline

◆ SetSizeRange()

void Particle::SetSizeRange ( float lower,
float upper )
inline

设置大小范围(倍率系数)

参数
[in]lower最小倍率
[in]upper最大倍率

◆ Update()

void Particle::Update ( float deltaTime)
overridevirtual

重载 SceneComponent .

类成员变量说明

◆ angle

float Particle::angle = 0.f
private

相对于线的角度

◆ capacity

int Particle::capacity = 0
private

粒子容量

◆ fadingtime

float Particle::fadingtime = 0
private

粒子逐渐消失的时间

主要是实现过渡效果

◆ gravity

float Particle::gravity = 9.8f
private

重力加速度

◆ images

IMAGE** Particle::images =nullptr
private

动画帧数组

◆ Interval

float Particle::Interval =0.1f
private

生产间隔

◆ isLoop

bool Particle::isLoop = true
private

是否循环生产

◆ lasttime

time_point<steady_clock> Particle::lasttime
private

记录生产的时间点

◆ length

float Particle::length = 1.f
private

放射范围 [起始范围,结束范围]

线长度

◆ lifetime

float Particle::lifetime = 1.f
private

单个粒子的生命周期

◆ maxSpeed

float Particle::maxSpeed = 1.f
private

粒子最大初速度

◆ minSpeed

float Particle::minSpeed = 1.f
private

粒子最小初速度

◆ number

int Particle::number = 0
private

动画粒子总帧数

◆ particle

std::deque<ParticleInfo> Particle::particle
private

粒子容器 用于管理生产出来的每一个粒子

◆ pattern

ParticlePattern Particle::pattern = ParticlePattern::Center
private

◆ radius

Vector2D Particle::radius = Vector2D(0, 0)
private

内外半径 [内径,外径]

◆ scoop

Vector2D Particle::scoop = Vector2D(0, 360)
private

◆ sizeRange

Vector2D Particle::sizeRange
private

大小范围(倍率系数)

◆ unitVector

Vector2D Particle::unitVector = Vector2D(0, 1)
private

粒子方向单位向量