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

Author Topic: Game window is smaller in my laptop...  (Read 1515 times)

0 Members and 1 Guest are viewing this topic.

Grime

  • Newbie
  • *
  • Posts: 13
    • View Profile
Game window is smaller in my laptop...
« on: August 27, 2019, 04:39:12 pm »
I wrote a game on my computer which is to be presented in my laptop.

I set the dimensions (in pixels) for the game window, on my computer to be as large as I wanted it to be on my laptop.

But when I compile the game in my laptop.. the game window is very tiny!

What do I do now? Everything in the game from mouse events to graphics correspond to coordinates of the tiny window.

Is there anything that would help scale the window up a little? What about mouse events, do I have to rewrite everything?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: Game window is smaller in my laptop...
« Reply #1 on: August 27, 2019, 04:43:24 pm »
Sounds like your notebook has a high resolution display. The window is exactly the amount of pixels you want, but the display DPI is higher, so the window appears smaller, i.e. when you disable DPI scaling, everything will appear tiny.
SFML currently lacks some proper high DPI handling. You can however just scale the view and make the window larger to display everything larger.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Grime

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Game window is smaller in my laptop...
« Reply #2 on: August 27, 2019, 04:53:15 pm »
How do I scale the entire window from the program?

But then I have mouse events that wait for the user to click on certain sprites. If I just scale the window, the mouse event coordinates won't change right. So the program won't work as expected and even when the player clicks the sprites, the program won't register it.

I guess I just have to multiply each mouse event by how much I scale the window?

(edit: oh or I can just divide the sf::event of a mouse click by how much I scaled the window?)
After scaling the window, would the size of the window change only to the operating system but also to the program?

Thanks for replying
« Last Edit: August 27, 2019, 04:56:22 pm by Grime »

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Game window is smaller in my laptop...
« Reply #3 on: August 28, 2019, 12:35:22 am »
Mapping the mouse position using the view will accommodate whatever your window size:
https://www.sfml-dev.org/tutorials/2.5/graphics-view.php#coordinates-conversions

The easiest thing to do would be to set the window to a larger size but keep the view the same. This scales everything within the window.




As an aside for the SFML team, it's worth noting that proper handling of DPI scaling might be more urgent than originally thought, at least for Windows-based systems as Windows 7 is being officially unsupported by Jan next year, leaving only properly handled DPI operating systems (Windows 10). This means that almost everyone (who use Windows) will be using Windows 10 and SFML should be ready for that.
Not complaining. Just not sure if you were aware :)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything