Hi D.I.C.
I was looking over RevTorA's tile engine tutorial and I decided to fool around with it. I changed some stuff as I'm using SFML 2.0, and not using XML to load the stage data (I like to write my own files), however that shouldn't have much to do with my error.
Anyways, I'm trying to see if I can draw the tiles to the screen using this code inside of Engine::Draw(), and I'm getting an access writing violation error in this function, which I'm not sure why or even how I can get such a thing. The vector map contains Tile objects and Draw( int x, int y, sf::RenderWindow* rw ) is not private.
VC++2010 opens Transformable.cpp and points to line 57 like that means a damn thing to me. There shouldn't be an access violation reading or writing as far as I know, unless I can't use map like that. SO....I tried this instead:
Still doesn't work.
The Draw function inside Tile is as follows:
As usual, thanks for reading. If there is a noob solution for this, please take it easy on me when you respond
I was looking over RevTorA's tile engine tutorial and I decided to fool around with it. I changed some stuff as I'm using SFML 2.0, and not using XML to load the stage data (I like to write my own files), however that shouldn't have much to do with my error.
Anyways, I'm trying to see if I can draw the tiles to the screen using this code inside of Engine::Draw(), and I'm getting an access writing violation error in this function, which I'm not sure why or even how I can get such a thing. The vector map contains Tile objects and Draw( int x, int y, sf::RenderWindow* rw ) is not private.
void Level::Draw( sf::RenderWindow* rw ) { for( int x = 0; x != map.size(); ++x ) { for( int y = 0; y != map.at( x ).size(); ++y ) { map.at( x ).at( y )->Draw( ( x * 24 ), ( y * 30 ), rw ); } } }
VC++2010 opens Transformable.cpp and points to line 57 like that means a damn thing to me. There shouldn't be an access violation reading or writing as far as I know, unless I can't use map like that. SO....I tried this instead:
void Level::Draw( sf::RenderWindow* rw ) { for( int x = 0; x != map.size(); ++x ) { for( int y = 0; y != map.at( x ).size(); ++y ) { GetTile( x, y )->Draw( ( x * 24 ), ( y * 30 ), rw ); } } }
Still doesn't work.
The Draw function inside Tile is as follows:
void Tile::Draw( int x, int y, sf::RenderWindow* rw ) { baseSprite.setPosition( (float)x, (float)y ); rw->draw( baseSprite ); }
As usual, thanks for reading. If there is a noob solution for this, please take it easy on me when you respond
