* A Texture that is not managed by C++ RAII. * * Make sure to Unload() this if needed, otherwise use raylib::Texture. * * @see raylib::Texture */
| 19 | * @see raylib::Texture |
| 20 | */ |
| 21 | class TextureUnmanaged : public ::Texture { |
| 22 | public: |
| 23 | /** |
| 24 | * Default texture constructor. |
| 25 | */ |
| 26 | TextureUnmanaged() : ::Texture{0, 0, 0, 0, 0} { |
| 27 | // Nothing. |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Move/Create a texture structure manually. |
| 32 | */ |
| 33 | TextureUnmanaged( |
| 34 | unsigned int id, |
| 35 | int width, |
| 36 | int height, |
| 37 | int mipmaps = 1, |
| 38 | int format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8) |
| 39 | : ::Texture{id, width, height, mipmaps, format} { |
| 40 | // Nothing. |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Creates a texture object based on the given Texture struct data. |
| 45 | */ |
| 46 | TextureUnmanaged(const ::Texture& texture) |
| 47 | : ::Texture{texture.id, texture.width, texture.height, texture.mipmaps, texture.format} { |
| 48 | // Nothing. |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Creates a texture from the given Image. |
| 53 | * |
| 54 | * @throws raylib::RaylibException Throws if failed to create the texture from the given image. |
| 55 | */ |
| 56 | TextureUnmanaged(const ::Image& image) { Load(image); } |
| 57 | |
| 58 | /** |
| 59 | * Load cubemap from image, multiple image cubemap layouts supported. |
| 60 | * |
| 61 | * @throws raylib::RaylibException Throws if failed to create the texture from the given cubemap. |
| 62 | * |
| 63 | * @see LoadTextureCubemap() |
| 64 | */ |
| 65 | TextureUnmanaged(const ::Image& image, int layout) { Load(image, layout); } |
| 66 | |
| 67 | /** |
| 68 | * Load texture from file into GPU memory (VRAM) |
| 69 | * |
| 70 | * @throws raylib::RaylibException Throws if failed to create the texture from the given file. |
| 71 | */ |
| 72 | TextureUnmanaged(const std::string& fileName) { Load(fileName); } |
| 73 | |
| 74 | TextureUnmanaged(::Texture&& other) : ::Texture{other.id, other.width, other.height, other.mipmaps, other.format} { |
| 75 | // Nothing. |
| 76 | } |
| 77 | |
| 78 | GETTER(unsigned int, Id, id) |
nothing calls this directly
no outgoing calls
no test coverage detected