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

Author Topic: Setting window view from a class derived from drawable  (Read 1109 times)

0 Members and 1 Guest are viewing this topic.

tylradm5

  • Newbie
  • *
  • Posts: 2
    • View Profile
Setting window view from a class derived from drawable
« 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 :)
« Last Edit: May 12, 2015, 03:51:04 am by tylradm5 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Setting window view from a class derived from drawable
« Reply #1 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.
Laurent Gomila - SFML developer

tylradm5

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Setting window view from a class derived from drawable
« Reply #2 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.