Ahh thanks, just been playing with it but Im having an issue.
Im using this code:
void GlobalSettings::setWidthHeight(unsigned short w, unsigned short h)
{
sf::VideoMode desktopVM = sf::VideoMode::GetDesktopMode();
sf::VideoMode vMode = sf::VideoMode(w,h,desktopVM.BitsPerPixel);
if(vMode.IsValid())
{
GlobalSettings::WindowWidth = w;
GlobalSettings::WindowHeight = h;
return;
}
std::vector<sf::VideoMode> modes = sf::VideoMode::GetFullscreenModes();
for (std::size_t i = 0; i < modes.size(); ++i)
{
sf::VideoMode mode = modes[i];
if(desktopVM.BitsPerPixel == mode.BitsPerPixel)
{
if( (mode.Width/mode.Height) == (4/3) )
{
w = mode.Width;
h = mode.Height;
vMode = sf::VideoMode(w,h,desktopVM.BitsPerPixel);
if(vMode.IsValid())
{
GlobalSettings::WindowWidth = w;
GlobalSettings::WindowHeight = h;
return;
}
}
}
}
}
Which should check if the given width/height are valid for the resolution and make sure that they are 4:3 aspect ratio, but it isnt working it just gives back the highest resolution (which it should do as im passing something like 1600x1200) but it isnt the highest 4:3.
Its giving back 1280x800.
I think its to do with the if( (mode.Width/mode.Height) == (4/3) ) but I wasnt sure