SFML community forums

Help => Graphics => Topic started by: axtyax on July 21, 2015, 07:31:00 am

Title: sfml sprite being obscured through pointer
Post by: axtyax on July 21, 2015, 07:31:00 am
Ok so I have a class called Render, a class called RenderMap, and another one called Collider.

This is my issue:

void Render::drawMap() {

mapRender.DrawMap (map.getWindow()); //mapRender is an object of type RenderMap

}

//passes the window into the function

void RenderMap::DrawMap (sf::RenderWindow *map) {


test.draw (map); // test is an object of type Collider
//test.draw(map);

}

//takes the window and passes it into another function

void Collider::draw (sf::RenderWindow* map) {

map -> draw (tile); //tile is an sf::Sprite
}

//finally the last function draws a grass tile to the window

 

Obviously this isnt nearly all of the code in my program, but this is where the issue is coming from.

The sprite draws to the screen , but it draws as a rectangle that looks like a squashed version of my sprite.

Can anyone help me?

I have a feeling this is some issue with sfml 2.3...

EDIT: i also tried showing a sprite in int main() and it worked perfectly, and i tried resizing the window to something with an  x to y ratio of 1. Ex. 500x500
Title: Re: sfml sprite being obscured through pointer
Post by: Nexus on July 21, 2015, 01:13:46 pm
I have a feeling this is some issue with sfml 2.3...
Don't feel. Know.

Please provide a minimal complete example (http://en.sfml-dev.org/forums/index.php?topic=5559.msg36368#msg36368).
Title: Re: sfml sprite being obscured through pointer
Post by: Hapax on July 21, 2015, 02:58:11 pm
Are you using views?

but mostly what Nexus said...
Title: Re: sfml sprite being obscured through pointer
Post by: axtyax on July 21, 2015, 04:06:31 pm
Sorry this is my first time on the forum. :P.
But if I show all my code I'll go way over those guidelines.

Anyway the issue was with views, thanks!
Title: Re: sfml sprite being obscured through pointer
Post by: Jesper Juhl on July 21, 2015, 04:23:27 pm
But if I show all my code I'll go way over those guidelines.
The point is not to show your original code.
The point is to create a new and minimal program that contains just enough to display the problem and nothing more.

See also http://sscce.org/