Brunot
Loading...
Searching...
No Matches
Texture Class Reference

holds and manages textures for use with meshes in sprites More...

#include <Texture.h>

Public Member Functions

 Texture ()
 default ctor, don't use, it doesn't make sense.
 Texture (const std::string &fileName)
 ~Texture ()
 Texture (const Texture &other)
 Texture (Texture &&other) noexcept
auto operator= (const Texture &other) -> Texture &
auto operator= (Texture &&other) noexcept -> Texture &
auto activate () const -> void
auto deactivate () const -> void
auto loadFile (const std::string &fileName) -> void
auto getTextureWidth () const -> int
auto getTextureHeight () const -> int
auto getTilesWide () const -> unsigned
auto getTilesHigh () const -> unsigned
auto getFrames () const -> unsigned
auto save (Stream &stream) const -> void
auto load (Stream &stream) -> void
auto name () const -> const std::string &
auto name (const std::string &name) -> void
auto getTextureID () const -> GLuint
 get the opengl id of texture

Private Attributes

std::string _name
 Sprite will save the name of the texture it needs to load, so that multiple sprites can use the same texture.
std::string imagePath
 the path to the image that was loaded from
int textureWidth
int textureHeight
int numPerPixel
unsigned char * imageData
GLenum format {GL_RGBA}
GLuint textureID
unsigned tilesWide = 1
 The number of tiles wide of the image as a spritesheet.
unsigned tilesHigh = 1
unsigned frames = 1
 The total number of frames the texture has if it is a spritesheet.

Friends

auto to_json (json &j, const Texture &a) ->void
auto from_json (const json &j, Texture &a) ->void

Detailed Description

holds and manages textures for use with meshes in sprites

Constructor & Destructor Documentation

◆ Texture() [1/4]

Texture::Texture ( )

default ctor, don't use, it doesn't make sense.

only For Json

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Texture() [2/4]

Texture::Texture ( const std::string & fileName)
Here is the call graph for this function:

◆ ~Texture()

Texture::~Texture ( )
Here is the call graph for this function:

◆ Texture() [3/4]

Texture::Texture ( const Texture & other)
Here is the call graph for this function:

◆ Texture() [4/4]

Texture::Texture ( Texture && other)
noexcept
Here is the call graph for this function:

Member Function Documentation

◆ activate()

auto Texture::activate ( ) const->void

◆ deactivate()

auto Texture::deactivate ( ) const->void

◆ getFrames()

auto Texture::getFrames ( ) const->unsigned
nodiscard

◆ getTextureHeight()

auto Texture::getTextureHeight ( ) const->int
nodiscard

◆ getTextureID()

auto Texture::getTextureID ( ) const->GLuint

get the opengl id of texture

Here is the call graph for this function:

◆ getTextureWidth()

auto Texture::getTextureWidth ( ) const->int
nodiscard

◆ getTilesHigh()

auto Texture::getTilesHigh ( ) const->unsigned
nodiscard

◆ getTilesWide()

auto Texture::getTilesWide ( ) const->unsigned
nodiscard

◆ load()

auto Texture::load ( Stream & stream) ->void

◆ loadFile()

auto Texture::loadFile ( const std::string & fileName) ->void
Here is the call graph for this function:
Here is the caller graph for this function:

◆ name() [1/2]

auto Texture::name ( ) const->conststd::string &
nodiscard
Returns
the name of the Texture's .json
Here is the caller graph for this function:

◆ name() [2/2]

auto Texture::name ( const std::string & name) ->void
Parameters
namethe name of the texture's .json
Here is the call graph for this function:

◆ operator=() [1/2]

auto Texture::operator= ( const Texture & other) ->Texture &
Here is the call graph for this function:

◆ operator=() [2/2]

auto Texture::operator= ( Texture && other) ->Texture &
noexcept
Here is the call graph for this function:

◆ save()

auto Texture::save ( Stream & stream) const->void

◆ from_json

auto from_json ( const json & j,
Texture & a )->void
friend

◆ to_json

auto to_json ( json & j,
const Texture & a )->void
friend

Member Data Documentation

◆ _name

std::string Texture::_name
private

Sprite will save the name of the texture it needs to load, so that multiple sprites can use the same texture.

◆ format

GLenum Texture::format {GL_RGBA}
private

◆ frames

unsigned Texture::frames = 1
private

The total number of frames the texture has if it is a spritesheet.

◆ imageData

unsigned char* Texture::imageData
private

◆ imagePath

std::string Texture::imagePath
private

the path to the image that was loaded from

◆ numPerPixel

int Texture::numPerPixel
private

◆ textureHeight

int Texture::textureHeight
private

◆ textureID

GLuint Texture::textureID
private

◆ textureWidth

int Texture::textureWidth
private

◆ tilesHigh

unsigned Texture::tilesHigh = 1
private

◆ tilesWide

unsigned Texture::tilesWide = 1
private

The number of tiles wide of the image as a spritesheet.


The documentation for this class was generated from the following files:
  • /home/egrazil/sites/Brunot/The House/source/Graphics/Texture.h
  • /home/egrazil/sites/Brunot/The House/source/Graphics/Texture.cpp