SFML community forums

Help => Graphics => Topic started by: wojo1086 on December 20, 2013, 12:26:41 am

Title: Setting a tilemap into a vertex array
Post by: wojo1086 on December 20, 2013, 12:26:41 am
I am familiar with C++, but a completely new to SFML. I've read through the tutorials for SFML here on this site, but I still can't seem to grasp hold of the tilemap to vertex array section. The example this site uses only uses a 2x2 tilemap and then they use quad to store the 4 coordinates into the vertex array. I can manipulate the tutorial to make it display a 2x2 tilemap that I have. However, how would I load a bigger tilemap into a vertex array? Would I still use quad? Or, is there a way to divide a sprite tilemap into specific pixel sizes and then store them into a multidimensional array?
Title: Re: Setting a tilemap into a vertex array
Post by: Laurent on December 20, 2013, 07:45:19 am
2x2 is not special. The same code would work with 5x5 or 40x40.
Title: Re: Setting a tilemap into a vertex array
Post by: wojo1086 on December 20, 2013, 06:26:48 pm
Hmm...but what, in the tutorial code,  would need to be changed in order to accommodate a bigger tilemap? I tried adding quads[4]-[7], but it didn't quite work out how I imagined it would. Also, if I use quad, when it comes to stating the four corners, would it be the four corners of the tilemap or of the individual tile?
Title: Re: Setting a tilemap into a vertex array
Post by: Laurent on December 20, 2013, 07:17:14 pm
Nothing needs to be changed (except the "2"). The quads represent the final tiles, the number of tiles in the tilemap only change the texture coordinates of the vertices.