|
Flint Engine
Modular C++20 2D game engine powered by SDL3
|
Owns an SDL_Texture loaded from memory or created as a render target. More...
#include <flint/graphics/texture.h>
Collaboration diagram for Flint::Texture:Public Member Functions | |
| Texture (const Texture &)=delete | |
| Texture & | operator= (const Texture &)=delete |
| FLINT_API | Texture (Texture &&other) noexcept |
Move constructor; transfers SDL_Texture ownership from the other. | |
| FLINT_API Texture & | operator= (Texture &&other) noexcept |
Move-assignment; releases current texture then steals from the other. | |
| FLINT_API bool | loadFromMemory (SDL_Renderer *renderer, const void *data, size_t size) |
| Load a texture from an in-memory image file. | |
| FLINT_API void | free () |
| FLINT_API SDL_Texture * | getSDLTexture () const |
| Return the underlying SDL_Texture handle. | |
| FLINT_API int | getWidth () const |
| Return the texture width in pixels. | |
| FLINT_API int | getHeight () const |
| Return the texture height in pixels. | |
| FLINT_API bool | createRenderTarget (SDL_Renderer *renderer, int width, int height) |
| Create a render-target texture of the given dimensions. | |
Static Public Member Functions | |
| static FLINT_API Texture | fromRenderer (SDL_Renderer *renderer, int width, int height) |
Owns an SDL_Texture loaded from memory or created as a render target.
| FLINT_API bool Flint::Texture::createRenderTarget | ( | SDL_Renderer * | renderer, |
| int | width, | ||
| int | height ) |
Create a render-target texture of the given dimensions.
Any existing texture is freed before the new one is created.
| renderer | SDL renderer. |
| width | Target width in pixels. |
| height | Target height in pixels. |
| FLINT_API bool Flint::Texture::loadFromMemory | ( | SDL_Renderer * | renderer, |
| const void * | data, | ||
| size_t | size ) |
Load a texture from an in-memory image file.
Decodes the image with SDL_image, creates an SDL_Texture from the resulting surface, and applies nearest-neighbor scaling.
| renderer | SDL renderer to create the texture on. |
| data | Pointer to raw image file bytes. |
| size | Number of bytes in data. |