cschreib / lxgui

Portable, real time, modular and data-driven GUI C++ library.
https://cschreib.github.io/lxgui
MIT License
73 stars 20 forks source link

Add support for Hi-DPI displays (interface scale factor) #62

Closed cschreib closed 3 years ago

cschreib commented 3 years ago

The whole GUI uses pixels as a base unit. This is fine for "normal" resolution displays, but a given interface will render very tiny on Hi-DPI displays. This can be fixed by applying a global scaling factor to pixel coordinates / dimensions.

Other approaches would include knowing the actual DPI of the display, and automatically adjusting the interface accordingly. This will be less portable, but more user friendly?

cschreib commented 3 years ago

Work for this started in the branch https://github.com/cschreib/lxgui/tree/vbo. The current implementation exposes a global scaling factor that can be tuned (from C++ and Lua). This factor is multiplied to a "hint" provided by the input source (only supported with SDL input), which is effectively the recommended scaling factor value from the operating system.

This means

cschreib commented 3 years ago

Merged in master.