1. 抽离了LApp的部分内容,以解耦其对Qt的依赖,并且尝试了拓展多渲染后端支持。

This commit is contained in:
2026-06-23 21:06:35 +08:00
parent 77d65014ab
commit d41c009a19
18 changed files with 691 additions and 172 deletions
+19 -9
View File
@@ -8,6 +8,7 @@
#pragma once
#include "LAppOpenGL.hpp"
#include "ISpriteRenderer.hpp" // [Misaki] 渲染后端抽象
/**
* @brief スプライトを実装するクラス。
@@ -15,7 +16,8 @@
* テクスチャID、Rectの管理。
*
*/
class LAppSprite
// class LAppSprite // [Misaki] 原
class LAppSprite : public ISpriteRenderer // [Misaki] 继承渲染抽象接口
{
public:
/**
@@ -40,7 +42,8 @@ public:
* @param[in] textureId テクスチャID
* @param[in] programId シェーダID
*/
LAppSprite(float x, float y, float width, float height, GLuint textureId, GLuint programId);
// LAppSprite(float x, float y, float width, float height, GLuint textureId, GLuint programId); // [Misaki] 原
LAppSprite(float x, float y, float width, float height, uintptr_t textureId, uintptr_t programId); // [Misaki] 抽象类型
/**
* @brief デストラクタ
@@ -51,7 +54,8 @@ public:
* @brief Getter テクスチャID
* @return テクスチャIDを返す
*/
GLuint GetTextureId() { return _textureId; }
// GLuint GetTextureId() { return _textureId; } // [Misaki] 原
uintptr_t GetTextureId() const override { return _textureId; } // [Misaki] 抽象类型
/**
* @brief 描画する
@@ -63,7 +67,8 @@ public:
* @brief テクスチャIDを指定して描画する
*
*/
void RenderImmidiate(GLuint textureId, const GLfloat uvVertex[8]) const;
// void RenderImmidiate(GLuint textureId, const GLfloat uvVertex[8]) const; // [Misaki] 原
void RenderImmidiate(uintptr_t textureId, const float uvVertex[8]) const override; // [Misaki] 抽象类型
/**
* @brief コンストラクタ
@@ -71,7 +76,8 @@ public:
* @param[in] pointX x座標
* @param[in] pointY y座標
*/
bool IsHit(float pointX, float pointY) const;
// bool IsHit(float pointX, float pointY) const; // [Misaki] 原
bool IsHit(float pointX, float pointY) const override; // [Misaki] 接口实现
/**
* @brief 色設定
@@ -81,7 +87,8 @@ public:
* @param[in] b (0.0~1.0)
* @param[in] a (0.0~1.0)
*/
void SetColor(float r, float g, float b, float a);
// void SetColor(float r, float g, float b, float a); // [Misaki] 原
void SetColor(float r, float g, float b, float a) override; // [Misaki] 接口实现
/**
* @brief サイズ再設定
@@ -91,7 +98,8 @@ public:
* @param[in] width 横幅
* @param[in] height 高さ
*/
void ResetRect(float x, float y, float width, float height);
// void ResetRect(float x, float y, float width, float height); // [Misaki] 原
void ResetRect(float x, float y, float width, float height) override; // [Misaki] 接口实现
/**
* @brief ウインドウサイズ設定
@@ -99,10 +107,12 @@ public:
* @param[in] width 横幅
* @param[in] height 高さ
*/
void SetWindowSize(int width, int height);
// void SetWindowSize(int width, int height); // [Misaki] 原
void SetWindowSize(int width, int height) override; // [Misaki] 接口实现
private:
GLuint _textureId; ///< テクスチャID
// GLuint _textureId; ///< テクスチャID [Misaki] 原
uintptr_t _textureId; ///< テクスチャID [Misaki] 抽象类型
Rect _rect; ///< 矩形
int _positionLocation; ///< 位置アトリビュート
int _uvLocation; ///< UVアトリビュート