SFML community forums
Help => General => Topic started by: LedLoaf on August 13, 2017, 02:23:23 am
-
I bought a book called Beginning C++ Game Programming by John Horton. This is the first time I have worked with SFML. I really like how SFML works so far, but I have a problem. The 1st game you produce is a game called Timber. My problem is I just recently purchased a 4K 17.3" monitor size laptop and I can't for the life of me figure out how to get the SFML window full screen and have the graphics scale with it. The graphics are designed for 1920x1080 so I get full screen, but the image is just in the left corner assigned as that resolution.
As of now I have the Style set to default because it makes it perfectly fit with then project. But it's just a small window.
Before I got so far in the book with this game, I had messed with SFML tutorials on scaling graphics to my screen size. Also tried various google examples with what could be a similar problem with no luck. I got it to work that way though with the scaling. It's just that there is so much more added graphically it would be a pain. My question is there a way I can have the graphics automatically scale to the correct size? I did some googling and messing around and I can't remember what it was all about. But basically they made a window using sfml-graphics and the current window is from RenderWindow. The commands for the sfml-graphics window example was different than what the RenderWindow could do. So I didn't bother with that tutorial.
Is the best way to go about this is scale ALL the images manually or is this something I can do with just the window? I am basically done with this game example (last chapter before moving on) and I want to get this part working before moving on.
I appreciate any help! Thanks!
PS: I have trouble with steam games since being at 4k resolution and its always kind of a hassle if they don't have a scaling option.
EDIT: Ok I noticed something. When I have the Style::Default and then Maximize it. The game scales correctly. So maybe I can just find a way to maximize it. But I didn't want a border and such.
-
Read the official tutorial on sf::View. That way you can scale your 1080p to 4K.
-
Yeah thank you. The next chapter went a whole new way of using view the next chapter so it worked out great.
-
Hey, i had the same problem, and i found a really convenient solution, instead of using sf::view, if you are on windows 10, you can simply :
#ifdef USING_WINDOWS
SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
#endif
this solve all the problem about scaling in 4K display.