Files
DNF_DEV/source/EngineFrame/Component/Sprite.h

46 lines
969 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#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();
};