gpu errors

This commit is contained in:
2026-05-02 21:56:33 +02:00
parent fcc598adb1
commit c46443e2f4
6 changed files with 103 additions and 4 deletions

View File

@@ -17,11 +17,16 @@ namespace Game::Renderer {
// Build the texture for the font; Call getSDLTexture() afterwards
void build(SDL_Color color, std::string text);
// Rebuild GPU-backed texture after a renderer/device reset
bool reload(SDL_Renderer* renderer);
SDL_Texture* getSDLTexture();
std::string getId();
private:
TTF_Font* mFont;
SDL_Renderer* mRenderer;
// Remember last build params so we can rebuild fonts on device reset
std::string mLastText;
SDL_Color mLastColor;
};
}

View File

@@ -21,10 +21,15 @@ namespace Game::Renderer {
float getHeight();
bool isTiled() { return mIsTiled; }
void setTiled(bool tiled) { mIsTiled = tiled; }
// Reload GPU-backed texture using a new renderer after device reset
virtual bool reload(SDL_Renderer* renderer);
protected:
SDL_Texture* mTex;
std::string mId;
// For textures created from disk, store the path so we can reload on device reset
std::string mPath;
bool mIsFromFile = false;
private:
bool mIsTiled = false; // Whether the texture is a tileset that should be rendered as a single tile or not
};