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

Author Topic: sf::View not working in latest SFML 2 revision?  (Read 1706 times)

0 Members and 1 Guest are viewing this topic.

gardnerj

  • Newbie
  • *
  • Posts: 4
    • View Profile
sf::View not working in latest SFML 2 revision?
« on: April 19, 2010, 03:26:13 am »
sf::View isn't working right for me since the latest revision(1509) (I assume due to the sf::Rect definition change).  For example, in the code below I would expect that I am defining a view starting at x,y = 1,1 with width,height = 2,2 so that that the square starting at 1,1 with width,height = 2,2 should fill the screen. Instead it fills the bottom right part only.  SetViewport has similar problems.


Code: [Select]

#include <SFML/Graphics.hpp>

int main(){
  sf::RenderWindow app;
  app.Create(sf::VideoMode(500, 500, 32), "");

  sf::View view(sf::FloatRect(1, 1, 2, 2));
  app.SetView(view);

  sf::Shape rect = sf::Shape::Rectangle(1, 1, 2, 2, sf::Color(250,0,0));

  while (app.IsOpened()){
    sf::Event event;
    while (app.GetEvent(event)){
      if (event.Type == sf::Event::Closed) app.Close();
    }

    app.Clear();
    app.Draw(rect);
    app.Display();
  }

  return EXIT_SUCCESS;
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::View not working in latest SFML 2 revision?
« Reply #1 on: April 19, 2010, 12:38:04 pm »
It's fixed, it was a stupid error :)

Thanks for your feedback.
Laurent Gomila - SFML developer

gardnerj

  • Newbie
  • *
  • Posts: 4
    • View Profile
sf::View not working in latest SFML 2 revision?
« Reply #2 on: April 19, 2010, 04:21:54 pm »
Excellent!  That solved all the problems in my code.

 

anything