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

Author Topic: Manually adjust view sizing ?  (Read 1821 times)

0 Members and 1 Guest are viewing this topic.

alext94

  • Newbie
  • *
  • Posts: 16
    • View Profile
Manually adjust view sizing ?
« on: April 12, 2015, 11:44:32 pm »
So i have created a view:

m_view (sf::Vector2f(1920 * 0.5f, 1080 * 0.5f),sf::Vector2f(1920.f, 1080.f))
m_nativeVideoMode = sf::VideoMode::getDesktopMode();   
m_window.create(m_nativeVideoMode, "Neon",sf::Style::None,settings);
m_window.setView(m_view);
 

The screen the game is running on has the resolution of 1280 X 800. When something is drawn it isn't modified properly to fit the screen. I submitted a screen shot the white part I highlighted to show the screen size. As you can see it doesn't take advantage of the full space. Is there any way i can over ride this and make it fit properly ?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Manually adjust view sizing ?
« Reply #1 on: April 12, 2015, 11:48:40 pm »
You just need to handle the resized event of the window and adjust your view size accordingly.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

alext94

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Manually adjust view sizing ?
« Reply #2 on: April 13, 2015, 12:22:29 am »
I don't resize the window. The window stays the same i just want it to display the 1920 x 1080p properly the size of the window is always 1280 x 800. I just want to shrink the image properly to fit the 1280 x 800 screen. I added this :
m_view.setViewport(sf::FloatRect(0,0,1,1));
But i still get the same results.

alext94

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Manually adjust view sizing ?
« Reply #3 on: April 13, 2015, 12:30:51 am »
I fixed it with this.

m_view.setViewport(sf::FloatRect(0,0,1920.f / mNativeVideoMode.width, 1080.f / mNativeVideoMode.height));

Not sure if this is bad or not, but it worked.