1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

[HTML5] Detect screen scale and DPI.

`OS.get_screen_scale` will now return the `window.devicePixelRatio`
value, `OS.get_screen_dpi` uses CSS media queries to find approximate
DPI value for the current display.
`OS.get_screen_size` also return the actual screen size (not the CSS
pixel size).
This commit is contained in:
Fabio Alessandrelli
2021-02-05 19:56:56 +01:00
parent e71510097d
commit b3f78687de
4 changed files with 44 additions and 1 deletions

View File

@@ -134,6 +134,9 @@ public:
virtual void set_window_fullscreen(bool p_enabled);
virtual bool is_window_fullscreen() const;
virtual Size2 get_screen_size(int p_screen = -1) const;
virtual int get_screen_dpi(int p_screen = -1) const;
virtual float get_screen_scale(int p_screen = -1) const;
virtual float get_screen_max_scale() const;
virtual Point2 get_mouse_position() const;
virtual int get_mouse_button_state() const;