In my opinion you should let the user choose the resolution, and use the best available by default. Isn't that possible in your game?
I was thinking of something a little more automated. Letting the user choose a resolution also doesn't solve the ratio mismatch. I'm trying to write a function that will set the resolution and just make due with whatever SFML gave you, giving you a scene of the same dimensions and ratio every time.
Here's how I fix windowed mode. (Also, having to keep the view instance around is very annoying, I only
guessed that was the problem and got lucky.)
void CorrectWindowedRatio(sf::RenderWindow& App, int width, int height) {
static sf::View view;
App.SetSize(App.GetWidth(),
App.GetWidth() * ((float)height / (float)width));
view = sf::View(sf::FloatRect(0, 0, App.GetWidth(), App.GetHeight()));
App.SetView(view);
}
So I can then do something like this.
sf::RenderWindow App(sf::VideoMode(1280, 720), "Window");
// Oops, SFML gave me a window 1024 pixels wide (desktop screen res)
CorrectWindowedRatio(App, 1280, 720);