Files
2026-02-08 16:20:50 +08:00

36 lines
793 B
C++
Raw Permalink 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/Render/Texture.h"
#include "EngineFrame/Base/Actor.h"
class Game;
/**
* @brief Sprite类继承自Component类用于表示游戏中的精灵组件
*/
class Sprite : public Actor
{
protected:
RefPtr<Texture> m_texture = nullptr;
public:
Sprite() = default;
Sprite(std::string imgPath, int Index);
Sprite(std::string PngPath);
~Sprite();
void SetTexture(RefPtr<Texture> texture);
RefPtr<Texture> GetTexture();
/**重载生成渲染矩阵函数 */
void GenerateRenderMatrix() const override;
/**重载初始化函数 */
void Init() override;
/**重载渲染函数 */
void OnRender() override;
public:
std::string imgPath;
int Index;
};