Bomberman
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
RAY::Texture Class Reference

Object representation of a texture. More...

#include <Texture.hpp>

Inheritance diagram for RAY::Texture:
Collaboration diagram for RAY::Texture:

Public Member Functions

 Texture (const std::string &filename, bool lonely=false, float scale=1, float rotation=0)
 Create an texture, loading a file. More...
 
 Texture ()
 Create an empty texture. More...
 
 Texture (const Texture &)=default
 A texture is copy constructable. More...
 
 Texture (const Image &)
 A textrue can be loaded from an image. More...
 
Textureoperator= (const Texture &)=default
 An texture is assignable. More...
 
 ~Texture () override=default
 Texture destructor, will not unload ressources. More...
 
void drawOn (RAY::Window &) override
 draw texture on a window More...
 
Textureuse (const std::string &filename)
 Load texture from file, lets one use one entity for multiple files. More...
 
void unload ()
 Unload the current texture (calls to drawOn will no-op). More...
 
const std::string & getResourcePath () const
 
- Public Member Functions inherited from RAY::Drawables::Drawables2D::Rectangle
 Rectangle (const Vector2 &position, const Vector2 &dimensions, const Color &color=WHITE, float scale=1, float rotation=0)
 Rectangle constructor. More...
 
 Rectangle (int x, int y, int width, int height, const Color &color=WHITE)
 Rectangle constructor. More...
 
 Rectangle (const Rectangle &)=default
 A default copy constructor. More...
 
Rectangleoperator= (const Rectangle &)=default
 A rectangle is assignable. More...
 
 ~Rectangle () override=default
 A default destructor. More...
 
const Vector2getDimensions (void)
 
float getWidth (void) const
 
float getHeight (void) const
 
RectanglesetDimensions (const Vector2 &dimensions)
 set dimensions More...
 
RectangleincrementWidth (float width)
 increment width of the rectangle More...
 
RectangleincrementHeight (float height)
 increment height of the rectangle More...
 
RectanglesetHeight (float height)
 set rectangle's height More...
 
RectanglesetWidth (float width)
 set rectangle's width More...
 
RectanglesetDimensions (float x, float y)
 set dimensions More...
 
virtual void drawOn (RAY::Image &image) override
 Draw point on image. More...
 
- Public Member Functions inherited from RAY::Drawables::ADrawable2D
 ADrawable2D (const Vector2 &position, const RAY::Color &color, float scale=1, float rotation=0)
 ADrawable constructor. More...
 
 ADrawable2D (int x, int y, const RAY::Color &color, float scale=1, float rotation=0)
 ADrawable constructor. More...
 
 ADrawable2D (const ADrawable2D &)=default
 A default copy constructor. More...
 
 ~ADrawable2D () override=default
 A default destructor. More...
 
const RAY::Vector2getPosition (void) const
 
const RAY::ColorgetColor (void) const
 
ADrawable2DsetPosition (const Vector2 &position)
 set Top-left position More...
 
ADrawable2DsetPosition (int x, int y)
 set Top-left position More...
 
ADrawable2DsetColor (const Color &color)
 set color More...
 
float getScale () const
 scale getter More...
 
void setScale (float scale)
 scale setters More...
 
- Public Member Functions inherited from RAY::Drawables::IDrawable
virtual ~IDrawable ()=default
 

Private Attributes

std::shared_ptr<::Texture_texture
 Texture, really, that's just it... More...
 
std::string _resourcePath
 path to the file the texture is loaded from More...
 
INTERNAL __pad0__: operator ::Texture() const
 

Static Private Attributes

static Cache<::Texture_texturesCache
 

Additional Inherited Members

- Protected Attributes inherited from RAY::Drawables::Drawables2D::Rectangle
Vector2 _dimensions
 Diemnsions of the rectangle. More...
 
INTERNAL __pad0__: operator ::Rectangle() const
 
- Protected Attributes inherited from RAY::Drawables::ADrawable2D
float _rotation = 0
 rotation More...
 
float _scale = 1
 scale More...
 
Vector2 _position
 Top-left position. More...
 
Color _color
 Color of the ADrawable. More...
 

Detailed Description

Object representation of a texture.

Constructor & Destructor Documentation

◆ Texture() [1/4]

RAY::Texture::Texture ( const std::string &  filename,
bool  lonely = false,
float  scale = 1,
float  rotation = 0 
)
explicit

Create an texture, loading a file.

Parameters
filenamepath to file to load
lonelyshould be set to true if the entity's loaded data must be independant from others

◆ Texture() [2/4]

RAY::Texture::Texture ( )

Create an empty texture.

◆ Texture() [3/4]

RAY::Texture::Texture ( const Texture )
default

A texture is copy constructable.

◆ Texture() [4/4]

RAY::Texture::Texture ( const Image image)

A textrue can be loaded from an image.

◆ ~Texture()

RAY::Texture::~Texture ( )
overridedefault

Texture destructor, will not unload ressources.

Member Function Documentation

◆ drawOn()

void RAY::Texture::drawOn ( RAY::Window )
overridevirtual

draw texture on a window

Reimplemented from RAY::Drawables::Drawables2D::Rectangle.

◆ getResourcePath()

const std::string & RAY::Texture::getResourcePath ( ) const
Returns
path of loaded texture

◆ operator=()

Texture& RAY::Texture::operator= ( const Texture )
default

An texture is assignable.

◆ unload()

void RAY::Texture::unload ( )

Unload the current texture (calls to drawOn will no-op).

◆ use()

Texture & RAY::Texture::use ( const std::string &  filename)

Load texture from file, lets one use one entity for multiple files.

Member Data Documentation

◆ __pad0__

INTERNAL RAY::Texture::__pad0__
private

◆ _resourcePath

std::string RAY::Texture::_resourcePath
private

path to the file the texture is loaded from

◆ _texture

std::shared_ptr<::Texture> RAY::Texture::_texture
private

Texture, really, that's just it...

◆ _texturesCache

Cache<::Texture > RAY::Texture::_texturesCache
staticprivate

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