Primer commit
This commit is contained in:
31
background.cpp
Normal file
31
background.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#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();
|
||||
}
|
||||
Reference in New Issue
Block a user