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

Author Topic: I have two questions  (Read 1738 times)

0 Members and 1 Guest are viewing this topic.

deathsangel

  • Newbie
  • *
  • Posts: 2
    • View Profile
I have two questions
« on: May 02, 2009, 05:06:08 am »
First is how do I pass the RenderWindow to a function.

For example I want to have a render function in my layer class

void render(Sprite& s, RenderWindow& rw)
{
rw.Draw(s);
}

how would I go about making that :?:
-----------------------------------------------------------------------------
The second question is how come when I change the image of the sprite, when I draw it, it appears white ?!?!??!

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
I have two questions
« Reply #1 on: May 02, 2009, 09:46:37 am »
1) You mean calling the function ?
Code: [Select]
sf::RenderWindow w(...);
sf::Sprite s(...);

render(s, w); // Reference conversion is implicit.


But this function is only a test, isn't it ?

2) Some other thread speak about that error. I let you find them.
But long story short : your Image instance is deleted before that the sprite is drawn.
SFML / OS X developer

 

anything