1
Window / Re: Getting screen boundaries
« on: February 22, 2013, 09:19:49 pm »
I've been using this function to keep aspect ratio when changing resolution.
window.create(sf::VideoMode(resX,resY),"asdasda",sf::Style::Fullscreen);
int newH = (width*resY)/resX;
int displace = (newH - height)/(-2);
v1 = sf::View(sf::FloatRect(0,displace,width,newH));
v1.setCenter(width/2,height/2);
window.setView(v1);
height = resY;
width = resX;
int newH = (width*resY)/resX;
int displace = (newH - height)/(-2);
v1 = sf::View(sf::FloatRect(0,displace,width,newH));
v1.setCenter(width/2,height/2);
window.setView(v1);
height = resY;
width = resX;