Help drawing a map with a vector

Page 1 of 1

1 Replies - 403 Views - Last Post: 23 March 2014 - 08:07 PM Rate Topic: -----

#1 Nicky24   User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 93
  • Joined: 23-December 13

Help drawing a map with a vector

Posted 23 March 2014 - 03:05 PM

Hello everyone.
I have a problem, the thing is that I am parsing the .TMX (Tiled map editor) format for drawing the tiles.
The .TMX format has an CSV data encoding, which I think should be very easy to parse. I have parsed everything of the map file...

The problem is that I am storing the tile map gids in a c++ vector, the data in the map file looks like this:

<data encoding="csv">
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,1,1,42,42,42,
42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,1,42,42,42
</data>


And I have a method to store all the data into a vector, like this:

stringstream ss(_tile);
	int i;
	vector <int> Vect;
	while (ss >> i)
	{
		Vect.push_back(i);

		if (ss.peek() == ',')
			ss.ignore();
	}


So for example if my Map is 20x20 tiles, then the vector has a size() = 400 (20*20).

But I can't find the way to draw the map, because if I do it with a for loop, the map is drawing in one way only...
I have tried a lot of ways for doing that, and I still can't find the answer...

I am using Allegro 5.

Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Help drawing a map with a vector

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14045
  • View blog
  • Posts: 56,201
  • Joined: 12-June 08

Re: Help drawing a map with a vector

Posted 23 March 2014 - 08:07 PM

Please do not create duplicate topics. Closing.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1