SFML community forums

Help => Graphics => Topic started by: tylradm5 on May 12, 2015, 03:48:53 am

Title: Setting window view from a class derived from drawable
Post by: tylradm5 on May 12, 2015, 03:48:53 am
I have a class that is derived from Drawble
class UserInterface : public sf::Drawable
And the virtual function draw

Is it possible to change the target view from the draw function like this?
void UserInterface::draw(sf::RenderTarget& target, sf::RenderStates states) const {
  target.setView(newview);
  target.draw(somesprite);
}

This is what I've tried but nothing will successfully draw to newview. :(
I can provide more information if needed.
Thanks for any help :)
Title: Re: Setting window view from a class derived from drawable
Post by: Laurent on May 12, 2015, 07:47:23 am
Yes, you can. If it doesn't work then please provide a complete and minimal code that reproduces the problem.
Title: Re: Setting window view from a class derived from drawable
Post by: tylradm5 on May 12, 2015, 07:49:18 pm
Thanks Laurent,
In the process of creating a complete and minimal code and having that work, I stumbled upon the problem in my original code.