SFML community forums

Help => Graphics => Topic started by: EClaesson on February 26, 2011, 01:14:33 pm

Title: 640x480 in 800x600 window
Post by: EClaesson on February 26, 2011, 01:14:33 pm
Hi. I want to show a 640x480 screen in a larger window. The window can be 800x600 or larger. I know that sf::View is good for this.

But how should i do it (for a 800x600 window)?
Code: [Select]
sf::View view;
view.setCenter(400, 300);
view.setHalfSize(400, 300);
view.Zoom(2.0f);


or

Code: [Select]
sf::View view;
view.setCenter(400, 300);
view.setHalfSize(320, 240);

or something else?

Thanks in advance.
Title: 640x480 in 800x600 window
Post by: Laurent on February 26, 2011, 01:56:17 pm
The view shouldn't know anything about the window it will be displayed in. Just setup with the size that want to view (640x480). Same for the center, this is the center of the world area that you want to display, this has nothing to do with the size of the target window.
Title: 640x480 in 800x600 window
Post by: EClaesson on February 26, 2011, 02:00:15 pm
Quote from: "Laurent"
The view shouldn't know anything about the window it will be displayed in. Just setup with the size that want to view (640x480). Same for the center, this is the center of the world area that you want to display, this has nothing to do with the size of the target window.


Thanks a lot Laurent! I really appreciate that you're taking time to help us.
That's worth a Flattr ;)