36 lines
793 B
C++
36 lines
793 B
C++
#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;
|
||
};
|