SFML community forums

Help => Graphics => Topic started by: Andidy on November 14, 2018, 06:55:47 pm

Title: Rotating Quads within Tile Map [Solved]
Post by: Andidy on November 14, 2018, 06:55:47 pm
EDIT: [SOLVED] I'm a dumby and forgot how switch statements work lmao

Hello, I am trying to modify the example tilemap presented in the 2.5.1 tutorials. I have added another array called "pose" which stores an int 0-3, I then made a function to set the orientation of the texcoords of the quads as the are being produced in the Load function. However when the vertex array is drawn to my program, all of the tiles have the same pose (3) even though each tile should have its own pose.

I think it might be I am passing the pointer to my quad in wrong but I am not sure.

Title: Re: Rotating Quads within Tile Map
Post by: NGM88 on November 14, 2018, 09:21:55 pm
Sounds like you're not passing the correct element from your pose array (or the correct index of the element, however you wanna call it). Would be more helpful if you post all the relevant parts of the code.
Title: Re: Rotating Quads within Tile Map
Post by: Andidy on November 14, 2018, 09:42:37 pm
Sounds like you're not passing the correct element from your pose array (or the correct index of the element, however you wanna call it). Would be more helpful if you post all the relevant parts of the code.

I don't use forums like this often and it seems my image attachments aren't displaying :/

Here is a link to my output, you'll notice that all the tiles of the same part of the tileset have the same rotation. https://imgur.com/JhBUlVe

But heres some snippets
(click to show/hide)
Title: Re: Rotating Quads within Tile Map [Solved]
Post by: Laurent on November 15, 2018, 07:55:00 am
For those who only read new posts: problem is solved (see EDIT in first post).
Title: Re: Rotating Quads within Tile Map [Solved]
Post by: FRex on November 15, 2018, 03:41:56 pm
For anyone not seeing it: there were no breaks in the switch cases which meant that for case 0 the code for 0, 1, 2 and 3 ran, for case 1 code for 1, 2 and 3 ran, etc.