建档
This commit is contained in:
77
source/EngineFrame/Component/Sprite.h
Normal file
77
source/EngineFrame/Component/Sprite.h
Normal file
@@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Asset/Asset_ImagePack.h"
|
||||
#include "EngineFrame/Component/RenderBase.h"
|
||||
#include "EngineFrame/Render/Texture.h"
|
||||
|
||||
class Game;
|
||||
/**
|
||||
* @brief Sprite类,继承自Component类,用于表示游戏中的精灵组件
|
||||
*/
|
||||
class Sprite : public RenderBase
|
||||
{
|
||||
protected:
|
||||
/* data */
|
||||
RefPtr<Texture> m_texture = nullptr;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Sprite类的默认构造函数
|
||||
*/
|
||||
Sprite(/* args */);
|
||||
/**
|
||||
* @brief Sprite类的带参数构造函数
|
||||
* @param imgPath 纹理图片路径
|
||||
* @param Index 索引值
|
||||
*/
|
||||
Sprite(std::string imgPath, int Index);
|
||||
/**
|
||||
* @brief Sprite类的带参数构造函数
|
||||
* @param imgPath 纹理图片文件路径
|
||||
*/
|
||||
Sprite(std::string PngPath);
|
||||
/**
|
||||
* @brief Sprite类的析构函数
|
||||
*/
|
||||
~Sprite();
|
||||
/**
|
||||
* @brief 处理事件
|
||||
* @param e SDL事件指针
|
||||
*/
|
||||
void HandleEvents(SDL_Event *e) override;
|
||||
/**
|
||||
* @brief 更新组件状态
|
||||
* @param deltaTime 时间增量
|
||||
*/
|
||||
void Update(float deltaTime) override;
|
||||
/**
|
||||
* @brief 渲染组件
|
||||
* @param deltaTime 时间增量
|
||||
*/
|
||||
void Render() override;
|
||||
/**
|
||||
* @brief 清理组件资源
|
||||
*/
|
||||
void Clear() override;
|
||||
|
||||
/**
|
||||
* @brief 获取纹理
|
||||
* @return SDL_Texture* 纹理指针
|
||||
*/
|
||||
RefPtr<Texture> GetTexture();
|
||||
|
||||
void SetIterationPos(VecFPos pos) override;
|
||||
|
||||
public:
|
||||
RenderGuidanceInfo _RenderGuidanceInfo;
|
||||
std::string imgPath;
|
||||
int Index;
|
||||
|
||||
public:
|
||||
// 计算渲染信息
|
||||
void CalcRenderInfoLogic();
|
||||
// 设置混合模式
|
||||
void SetBlendMode(SDL_BlendMode blendMode);
|
||||
// 获取混合模式
|
||||
SDL_BlendMode GetBlendMode();
|
||||
};
|
||||
Reference in New Issue
Block a user