1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#include "levelBase.h"
/*
Base class for a level Object.
Loads the texture file and returns the sprites.
/**/
sf::Texture texture;
levelBase::levelBase(void)
{
texture.loadFromFile("resources/blocks1.png");
}
levelBase::~levelBase(void)
{
}
//Returns the particular tile from the grid
static sf::Sprite getTile(levelBase::Tile tile){
sf::Sprite sprite;
switch(tile){
case levelBase::GrassLeft:
{
return sf::Sprite(texture, sf::Rect<int>(172,36,31,31));
}
case levelBase::Grass1:
{
return sf::Sprite(texture, sf::Rect<int>(206,36,31,31));
}
case levelBase::Grass2:
{
return sf::Sprite(texture, sf::Rect<int>(240,36,31,31));
}
case levelBase::Grass3:
{
return sf::Sprite(texture, sf::Rect<int>(274,36,31,31));
}
case levelBase::Grass4:
{
return sf::Sprite(texture, sf::Rect<int>(308,36,31,31));
}
case levelBase::GrassRight:
{
return sf::Sprite(texture, sf::Rect<int>(342,36,31,31));
}
case levelBase::Dirt:
{
return sf::Sprite(texture, sf::Rect<int>(138,2,31,31));
}
}
}
|