1
Window / window.SetView() Problem
« on: December 18, 2011, 11:08:21 pm »
Im using SFML 1.6 and whenever I call the set view function the window only displays a blank screen, drawing none of my objects.
Im using this when the window is resized so the view matches the dimensions of the window. My code looks like this:
even when I set the view to the current view the screen is drawn blank:
The only way I have managed to resize my view is by directly referencing the default view (it wont let my directly reference the current view).
Any ideas? Its probably something obvious Im over looking, and I appreciate the help.
Edit:
In my first code example I had declared my view initialization wrong. Regardless I still cant figure out whats wrong.
Im using this when the window is resized so the view matches the dimensions of the window. My code looks like this:
Code: [Select]
if(events.Type == sf::Event::Resized)
{
sf::View v(sf::FloatRect(0, 0, events.Size.Width, events.Size.Height));
window.SetView(v);
}
even when I set the view to the current view the screen is drawn blank:
Code: [Select]
if(events.Type == sf::Event::Resized)
{
sf::View v = window.GetView();
window.SetView(v);
}
The only way I have managed to resize my view is by directly referencing the default view (it wont let my directly reference the current view).
Code: [Select]
if(events.Type == sf::Event::Resized)
{
sf::View &v = window.GetDefaultView();
v.SetFromRect(sf::FloatRect(0, 0, events.Size.Width, events.Size.Height);
}
Any ideas? Its probably something obvious Im over looking, and I appreciate the help.
Edit:
In my first code example I had declared my view initialization wrong. Regardless I still cant figure out whats wrong.