Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sfml sprite being obscured through pointer  (Read 1434 times)

0 Members and 1 Guest are viewing this topic.

axtyax

  • Newbie
  • *
  • Posts: 2
    • View Profile
sfml sprite being obscured through pointer
« 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

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: sfml sprite being obscured through pointer
« Reply #1 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.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: sfml sprite being obscured through pointer
« Reply #2 on: July 21, 2015, 02:58:11 pm »
Are you using views?

but mostly what Nexus said...
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

axtyax

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: sfml sprite being obscured through pointer
« Reply #3 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!

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: sfml sprite being obscured through pointer
« Reply #4 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/