Handle dpi awareness api feature flag
This commit is contained in:
1 parent
3ff483ad19
commit
3352152ef6
5 files changed
+27
-7
No files matched your search
+12
-5
@@ -1,12 +1,19 @@
|
||||
use crate::lua::ContextSocket;
|
||||
use crate::{
|
||||
dpi::{LogicalSize, PhysicalSize},
|
||||
lua::ContextSocket,
|
||||
};
|
||||
use mlua::{Lua, Result as LuaResult};
|
||||
|
||||
// NOTE: needs to return physical size if this MR gets merged:
|
||||
// https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2/pull/1420
|
||||
pub fn get_screen_size(l: &Lua, _: ()) -> LuaResult<(u32, u32)> {
|
||||
let socket = l.app_data_ref::<&'static ContextSocket>().unwrap();
|
||||
let size = socket.window().logical_size();
|
||||
Ok((size.width, size.height))
|
||||
let size = if *socket.is_dpi_aware() {
|
||||
let PhysicalSize { width, height, .. } = socket.window().size;
|
||||
(width, height)
|
||||
} else {
|
||||
let LogicalSize { width, height, .. } = socket.window().logical_size();
|
||||
(width, height)
|
||||
};
|
||||
Ok(size)
|
||||
}
|
||||
|
||||
pub fn get_screen_scale(l: &Lua, _: ()) -> LuaResult<f32> {
|
||||
|
||||
Reference in new issue
Block a user