Calamity Engine 1.0.0
A cross-platform 2D game engine written in C++ and SDL3.
Loading...
Searching...
No Matches
Texture Class Reference

#include <definitions.hpp>

Public Member Functions

 Texture ()
 
 Texture (const std::string &path, std::shared_ptr< Window > window, TextureScaling scaling=TextureScaling::NEAREST)
 
 ~Texture ()
 
 Texture (const Texture &)=delete
 
Textureoperator= (const Texture &)=delete
 
 Texture (Texture &&other) noexcept
 
Textureoperator= (Texture &&other) noexcept
 
template<class Archive >
void load (Archive &ar)
 
template<class Archive >
void save (Archive &ar) const
 
void initialize (bool set=true)
 
void setWindow (std::shared_ptr< Window > window)
 

Public Attributes

SDL_Texture * handle
 
int width
 
int height
 
int textureWidth
 
int textureHeight
 
std::string path
 

Detailed Description

Texture class

Stores an image, its path, its width and its size.

Example usage:

Texture texture = Texture("res://path/to/texture.png");
Definition definitions.hpp:154
Texture()
Definition definitions.hpp:156

Properties and usage

You can set the TextureScaling ["TextureScaling"] of the texture:

Texture texture = Texture("res://path/to/texture.png", TextureScaling::PIXELART);

You can also define the size of the rendered texture on screen!

texture.width = 64;
texture.height = 64;
// Now the texture will be 64x64 pixels when rendered, even if the texture is bigger or smaller.
int width
Definition definitions.hpp:202
int height
Definition definitions.hpp:203

Constructor & Destructor Documentation

◆ Texture() [1/4]

Texture::Texture ( )
inline

◆ Texture() [2/4]

Texture::Texture ( const std::string &  path,
std::shared_ptr< Window window,
TextureScaling  scaling = TextureScaling::NEAREST 
)

◆ ~Texture()

Texture::~Texture ( )

◆ Texture() [3/4]

Texture::Texture ( const Texture )
delete

◆ Texture() [4/4]

Texture::Texture ( Texture &&  other)
inlinenoexcept

Member Function Documentation

◆ initialize()

void Texture::initialize ( bool  set = true)

◆ load()

template<class Archive >
void Texture::load ( Archive &  ar)
inline

◆ operator=() [1/2]

Texture & Texture::operator= ( const Texture )
delete

◆ operator=() [2/2]

Texture & Texture::operator= ( Texture &&  other)
inlinenoexcept

◆ save()

template<class Archive >
void Texture::save ( Archive &  ar) const
inline

◆ setWindow()

void Texture::setWindow ( std::shared_ptr< Window window)
inline

Member Data Documentation

◆ handle

SDL_Texture* Texture::handle

◆ height

int Texture::height

◆ path

std::string Texture::path

◆ textureHeight

int Texture::textureHeight

◆ textureWidth

int Texture::textureWidth

◆ width

int Texture::width

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