Hi,
I want my view to scale with my window, so that I actually see more of my scene when the window is maximized. My test code looks as follows:
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow App(sf::VideoMode(640, 480), "Resize test");
while (App.IsOpened())
{
sf::Event Event;
while (App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
App.Close();
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
if (Event.Type == sf::Event::Resized)
App.SetView(sf::View(sf::FloatRect(0.f, 0.f,
static_cast<float>(App.GetWidth()),
static_cast<float>(App.GetHeight()))));
}
App.Clear();
App.Draw(sf::Shape::Rectangle(100.f, 100.f, 300.f, 300.f, sf::Color::Blue));
App.Draw(sf::Shape::Rectangle(200.f, 200.f, 400.f, 400.f, sf::Color::Red));
App.Display();
}
return EXIT_SUCCESS;
}
The problem is, that nothing is visible any more (all black) after the window's size is changed.
Is this some strange behaviour of my PC or am I just doing something wrong?
(I am using SFML 1.6 with Visual C++ 2010 express at the moment.)
Regards,
Dobi