46 lines
969 B
C++
46 lines
969 B
C++
#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:
|
||
RefPtr<Texture> m_texture = nullptr;
|
||
|
||
public:
|
||
Sprite() = default;
|
||
Sprite(std::string imgPath, int Index);
|
||
Sprite(std::string PngPath);
|
||
~Sprite();
|
||
void Render() override;
|
||
void PreRender() override;
|
||
void Clear() override;
|
||
void Init() override;
|
||
void SetTexture(RefPtr<Texture> texture);
|
||
|
||
RefPtr<Texture> GetTexture();
|
||
|
||
public:
|
||
// 渲染信息
|
||
RenderGuidanceInfo _RenderGuidanceInfo;
|
||
|
||
std::string imgPath;
|
||
int Index;
|
||
|
||
Matrix3x2 transform_matrix_;
|
||
|
||
GlMatrix matrix3x2ToGLMatrix(const Matrix3x2 &mat);
|
||
|
||
public:
|
||
// 计算渲染信息
|
||
void CalcRenderInfoLogic();
|
||
// 混合
|
||
void Blend();
|
||
};
|