Hi, I'm really new to SFML and objects and classes so please bare with me ^^.
I'm trying to just get started and display a set of 32x24 tiles depending on the value of the grid. My problem is that the sprite's just aren't displayed.
I know that the array 'grid' is full of 'G's so that shouldn't be a problem. SIZEX and SIZEY are both 10.
and as an added extra can anybody tell me why I get an unhandled exception error when I try to load from file ^^
Thanks.
void displayFloor(char grid[][SIZEY], sf::RenderWindow& window)
{
sf::Texture grass;
//if (!grass.loadFromFile("Grass.png"))
//{
// cout << "Can't load grass";
//}
sf::Sprite grassSprite;
//grassSprite.setTexture(grass);
grassSprite.setColor(sf::Color(50, 255, 50, 0));
grassSprite.setScale(32,24);
for( int row(1); row<=SIZEY; ++row )
{
for( int col(1); col<=SIZEX; ++col )
{
float x = 0 + col * 32;
float y = 0 + row * 24;
switch( grid[row][col] )
{
case 'G':
grassSprite.setPosition( x, y );
window.draw( grassSprite );
break;
}
}
}
}