Files
DNF_DEV/source/EngineFrame/Component/Sprite.h
2025-10-23 15:21:12 +08:00

48 lines
1.0 KiB
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;
// 混合模式
LE_BlEND_MODE _BlendMode = NONE;
std::string imgPath;
int Index;
public:
// 计算渲染信息
void CalcRenderInfoLogic();
// 设置混合模式
void SetBlendMode(LE_BlEND_MODE mode);
// 混合
void Blend();
// 获取混合模式
LE_BlEND_MODE GetBlendMode();
};