#pragma once #include #include #include #include namespace Game::Renderer { class Texture { public: Texture(std::string id = "noname"); Texture(const std::string& path, SDL_Renderer* renderer, std::string id = "noname"); Texture(const Texture&); Texture& operator=(const Texture&); DISABLE_MOVE(Texture); virtual ~Texture(); SDL_Texture* getSDLTexture(); std::string getId(); float getWidth(); 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 }; }