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

Author Topic: Have trouble with my 4k resolution.  (Read 2222 times)

0 Members and 1 Guest are viewing this topic.

LedLoaf

  • Guest
Have trouble with my 4k resolution.
« 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.
« Last Edit: August 13, 2017, 03:12:19 am by LedLoaf »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Have trouble with my 4k resolution.
« Reply #1 on: August 13, 2017, 08:37:35 am »
Read the official tutorial on sf::View. That way you can scale your 1080p to 4K.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

LedLoaf

  • Guest
Re: Have trouble with my 4k resolution.
« Reply #2 on: August 13, 2017, 10:25:52 pm »
Yeah thank you. The next chapter went a whole new way of using view the next chapter so it worked out great.

Milerius

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Have trouble with my 4k resolution.
« Reply #3 on: December 17, 2017, 08:10:17 pm »
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.

 

anything