SFML community forums

Help => Graphics => Topic started by: evil_twinkie on January 26, 2011, 11:38:07 pm

Title: Static sprite size on resize event
Post by: evil_twinkie on January 26, 2011, 11:38:07 pm
On Event::Resized (when someone clicks and drags the corner of the App window to be smaller/larger) all of my sprites and shapes get smaller/larger respectively.  Is there a way that I can disable this from happening?  I'm running an OpenGL visualization with sprites that make up my menu.

My code is a bit intricate to post right now, but later I can put together an example to better illustrate my question.  Thanks for the help.
Title: Static sprite size on resize event
Post by: Groogy on January 26, 2011, 11:59:26 pm
you could change the window view to the new size.
Title: Static sprite size on resize event
Post by: evil_twinkie on January 27, 2011, 12:11:41 am
Nice, that did the trick!  Thank you.

Here's the code I added:

Code: [Select]

static sf::View view;
sf::FloatRect rect(0, 0, newWidth, newHeight);
view.SetFromRect(rect);
App.SetView(view);