R-TYPE
Public Member Functions | List of all members
ECS::Sprite Class Reference

#include <Sprite.hpp>

Inheritance diagram for ECS::Sprite:
ECS::IComp

Public Member Functions

 Sprite (const sf::Texture &texture, sf::Vector2f scale, sf::IntRect intRect=sf::IntRect(0, 0, 0, 0), sf::Vector2f pos=sf::Vector2f(0, 0)) noexcept
 
 Sprite (const sf::Texture &texture, int scaleX, int scaleY, sf::IntRect intRect, sf::Vector2f pos) noexcept
 
 Sprite (const sf::Texture &texture, int scaleX, int scaleY, int left, int top, int width, int height, sf::Vector2f pos) noexcept
 
 Sprite (const Sprite &sprite) noexcept
 
 Sprite (Sprite &&) noexcept=delete
 
 ~Sprite () noexcept override=default
 
void setSprite (sf::Sprite *sprite) noexcept
 
void setTexture (const sf::Texture &texture) noexcept
 
sf::Sprite * getSprite () const noexcept
 
const sf::Texture * getTexture () const noexcept
 
void setIntRect (sf::IntRect rect) noexcept
 
void setIntRect (int left, int top, int width, int height) noexcept
 
sf::IntRect getIntRect () const noexcept
 
void setScale (int x, int y) noexcept
 
void setScale (sf::Vector2f scale) noexcept
 
sf::Vector2f getScale () const noexcept
 
void setPosition (int x, int y) noexcept
 
void setPosition (sf::Vector2f pos) noexcept
 
sf::Vector2f getPosition () const noexcept
 
Spriteoperator= (const Sprite &) const noexcept=delete
 
Spriteoperator= (Sprite &&) const noexcept=delete
 
- Public Member Functions inherited from ECS::IComp
virtual ~IComp () noexcept=default
 

Constructor & Destructor Documentation

◆ Sprite() [1/5]

ECS::Sprite::Sprite ( const sf::Texture &  texture,
sf::Vector2f  scale,
sf::IntRect  intRect = sf::IntRect(0, 0, 0, 0),
sf::Vector2f  pos = sf::Vector2f(0, 0) 
)
explicitnoexcept

Sprite(const sf::Texture& texture, sf::Vector2f scale, sf::IntRect intRect, sf::Vector2f pos) noexcept

This function takes in a texture, a scale, an intRect, and a position, and creates a sprite with those parameters

Parameters
textureThe texture to use for the sprite.
scaleThe scale of the sprite.
intRectThe rectangle of the texture that you want to use.
posThe position of the sprite.

◆ Sprite() [2/5]

ECS::Sprite::Sprite ( const sf::Texture &  texture,
int  scaleX,
int  scaleY,
sf::IntRect  intRect,
sf::Vector2f  pos 
)
explicitnoexcept

Sprite(const sf::Texture& texture, int scaleX, int scaleY, sf::IntRect intRect, sf::Vector2f pos) noexcept

This function takes in a texture, a scale, an intRect, and a position, and creates a sprite with those values

Parameters
textureThe texture to use for the sprite.
scaleXThe scale of the sprite on the X axis.
scaleYThe scale of the sprite on the Y axis.
intRectThe rectangle of the texture you want to use.
posThe position of the sprite.

◆ Sprite() [3/5]

ECS::Sprite::Sprite ( const sf::Texture &  texture,
int  scaleX,
int  scaleY,
int  left,
int  top,
int  width,
int  height,
sf::Vector2f  pos 
)
explicitnoexcept

Sprite(const sf::Texture& texture, int scaleX, int scaleY, int left, int top, int width, int height, sf::Vector2f pos) noexcept

This function takes in a texture, a scale, a rectangle, and a position, and creates a sprite with those values

Parameters
textureThe texture to use for the sprite.
scaleXThe scale of the sprite on the X axis.
scaleYThe scale of the sprite on the Y axis.
leftThe left position of the sprite in the texture.
topthe top of the sprite in the texture
widthThe width of the sprite.
heightThe height of the sprite.
posThe position of the sprite.

◆ Sprite() [4/5]

ECS::Sprite::Sprite ( const Sprite sprite)
noexcept

Copy constructor for the Sprite class.

Parameters
spriteThe sprite to copy

◆ Sprite() [5/5]

ECS::Sprite::Sprite ( Sprite &&  )
explicitdeletenoexcept

◆ ~Sprite()

ECS::Sprite::~Sprite ( )
overridedefaultnoexcept

Member Function Documentation

◆ getIntRect()

sf::IntRect ECS::Sprite::getIntRect ( ) const
noexcept

Returns the IntRect of the sprite.

Returns
The intRect of the sprite.

◆ getPosition()

sf::Vector2f ECS::Sprite::getPosition ( ) const
noexcept

Returns the position of the sprite.

Returns
The position of the sprite.

◆ getScale()

sf::Vector2f ECS::Sprite::getScale ( ) const
noexcept

Returns the scale of the sprite.

Returns
The scale of the sprite.

◆ getSprite()

sf::Sprite * ECS::Sprite::getSprite ( ) const
noexcept

Returns a pointer to the sprite.

Returns
A pointer to the sprite.

◆ getTexture()

const sf::Texture * ECS::Sprite::getTexture ( ) const
noexcept

Returns a pointer to the texture of the sprite.

Returns
A pointer to the texture of the sprite.

◆ operator=() [1/2]

Sprite& ECS::Sprite::operator= ( const Sprite ) const
deletenoexcept

◆ operator=() [2/2]

Sprite& ECS::Sprite::operator= ( Sprite &&  ) const
deletenoexcept

◆ setIntRect() [1/2]

void ECS::Sprite::setIntRect ( int  left,
int  top,
int  width,
int  height 
)
noexcept

void ECS::Sprite::setIntRect(int left, int top, int width, int height) noexcept

The function takes four integers as parameters and returns nothing

Parameters
leftThe x-coordinate of the top-left corner of the rectangle.
topThe top position of the rectangle.
widthThe width of the texture in pixels.
heightThe height of the rectangle.

◆ setIntRect() [2/2]

void ECS::Sprite::setIntRect ( sf::IntRect  rec)
noexcept

Sets the sprite's texture rectangle to the given rectangle

Parameters
recThe new IntRect to set the sprite to.

◆ setPosition() [1/2]

void ECS::Sprite::setPosition ( int  x,
int  y 
)
noexcept

It sets the position of the sprite

Parameters
xThe x position of the sprite
yThe y position of the sprite.

◆ setPosition() [2/2]

void ECS::Sprite::setPosition ( sf::Vector2f  pos)
noexcept

It sets the position of the sprite

Parameters
posThe position to set the sprite to.

◆ setScale() [1/2]

void ECS::Sprite::setScale ( int  x,
int  y 
)
noexcept

Sets the scale of the sprite.

Parameters
xThe x position of the sprite
yThe y position of the sprite.

◆ setScale() [2/2]

void ECS::Sprite::setScale ( sf::Vector2f  scale)
noexcept

Sets the scale of the sprite

Parameters
scaleThe scale of the sprite.

◆ setSprite()

void ECS::Sprite::setSprite ( sf::Sprite *  sprite)
noexcept

Sets the sprite to the given sprite.

Parameters
spriteThe sprite to be set.

◆ setTexture()

void ECS::Sprite::setTexture ( const sf::Texture &  text)
noexcept

Sets the texture of the sprite

Parameters
textThe texture to use for the sprite.

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