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

Author Topic: Is sf::Window support dpi scaling on Windows?  (Read 5239 times)

0 Members and 1 Guest are viewing this topic.

hoozh

  • Newbie
  • *
  • Posts: 4
    • View Profile
Is sf::Window support dpi scaling on Windows?
« on: January 05, 2016, 10:41:07 am »
hi, my application that using sfml is working fine until I need run it on a Windows 10 tablet with 10"(2048x1536) screen.


If  below codes is not called, the main window and child window is scaled to 200%, because the system setting is 200%, but when the sfml::Window is created from the child window's handle, the entire window (include main window and child window) are back to 100%, the controls and text is too small.

my application create a win32 main window and a child window, the child window's handle is m_hWnd.

// create sfml window
sf::ContextSettings settings;
settings.antialiasingLevel = 8;
m_sfWindow.create(m_hWnd, settings);
m_sfWindow.setActive(false);
 

I also tried create a independent window, the problem is still there
m_sfWindow.create(sf::VideoMode(800, 600), "My window");
m_sfWindow.setActive(false);
 



Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Is sf::Window support dpi scaling on Windows?
« Reply #1 on: January 05, 2016, 02:33:10 pm »
Do you get any error messages?

Does the setActive() affect the result? I'm wondering why you included it.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

hoozh

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Is sf::Window support dpi scaling on Windows?
« Reply #2 on: January 06, 2016, 03:07:32 am »
thanks for you reply, hapax

my code draw sprites and vectexarrays at the sf::renderwindow on another thread, so i need deactive the sf::window.

I didn't get any error message, the application is working fine except the win32 window and other controls are very small.

I ran some sfml examples on the tablet, like "opengl","win32",“window”, the window size is also not scaled,  it is real size.  Is that proved sf::window doesn't support dpi scaling? 

I am Wondering why the sf::window cause the win32 window losing dpi scaling effect.

Is this topic is talking about this? I am not good enough at english  :'(
http://en.sfml-dev.org/forums/index.php?topic=17092.0

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Is sf::Window support dpi scaling on Windows?
« Reply #3 on: January 06, 2016, 10:59:13 pm »
Haven't checked, but this most likely happens due to SFML telling Windows that it wants to handle DPI scaling on its own (i.e. to use the correct window size in pixels). Unfortunately, I think this is a per process setting, not per window.

I'm not sure there's any way around it, unless we somehow add a toggle or style flag.

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: Is sf::Window support dpi scaling on Windows?
« Reply #4 on: January 09, 2016, 10:30:34 pm »
SFML doesn't support dpi settings, because it uses call to SetProcessDpiAwareness, so all SFML sizes is fixed to the physical pixel size. In order to support dpi settings you need to read system dpi settings and scale your view according to it (with help of View.Zoom for example).

 

anything