Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
Flint::GPUTexture Class Reference

Owns an SDL GPU texture and its associated sampler. More...

#include <flint/graphics/gpu/gpu-texture.h>

+ Collaboration diagram for Flint::GPUTexture:

Public Member Functions

 GPUTexture (const GPUTexture &)=delete
 
GPUTexture & operator= (const GPUTexture &)=delete
 
 GPUTexture (GPUTexture &&other) noexcept
 Move constructor; transfers GPU ownership from the other.
 
GPUTexture & operator= (GPUTexture &&other) noexcept
 Move-assignment; releases current resources then steals from the other.
 
bool loadFromMemory (SDL_GPUDevice *device, const void *data, size_t size)
 Upload an image from memory to the GPU.
 
void free ()
 
SDL_GPUTexture * getTexture () const
 Return the underlying SDL GPU texture handle.
 
SDL_GPUSampler * getSampler () const
 Return the sampler created alongside this texture.
 
int getWidth () const
 Return the texture width in pixels.
 
int getHeight () const
 Return the texture height in pixels.
 

Static Public Member Functions

static GPUTexture fromRenderer (SDL_GPUDevice *device, const void *data, size_t size)
 Factory: create a GPUTexture by loading from memory.
 

Detailed Description

Owns an SDL GPU texture and its associated sampler.

Loads image data from memory, uploads it to the GPU via a transfer buffer, and creates a nearest-neighbor sampler. Move-only; copying is deleted.

Definition at line 20 of file gpu-texture.h.


The documentation for this class was generated from the following file: