31 lines
725 B
C++
31 lines
725 B
C++
#include "background.h"
|
|
|
|
// Constructor
|
|
Background::Background()
|
|
{
|
|
init(0, 0, 0, 0, NULL);
|
|
}
|
|
|
|
// Inicializador
|
|
void Background::init(int x, int y, int w, int h, LTexture *texture)
|
|
{
|
|
// Establece el alto y el ancho del sprite del fondo
|
|
mSprite.setWidth(w);
|
|
mSprite.setHeight(h);
|
|
|
|
// Establece la posición X,Y del sprite del fondo
|
|
mSprite.setPosX(x);
|
|
mSprite.setPosY(y);
|
|
|
|
// Establece la textura donde están los gráficos para el sprite del fondo
|
|
mSprite.setTexture(*texture);
|
|
|
|
// Establece el rectangulo de donde coger la imagen
|
|
mSprite.setSpriteClip(0, 0, mSprite.getWidth(), mSprite.getHeight());
|
|
}
|
|
|
|
// Pinta el fondo en la pantalla
|
|
void Background::render()
|
|
{
|
|
mSprite.render();
|
|
} |