Remove global context

This commit is contained in:
meehl committed 2025-10-27 23:10:11 +01:00
1 parent f3d2f73925
commit d8e52218f8
25 files changed
+1607 -1036

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
use crate::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))
}
pub fn get_screen_scale(l: &Lua, _: ()) -> LuaResult<f32> {
let socket = l.app_data_ref::<&'static ContextSocket>().unwrap();
Ok(socket.window().scale_factor)
}
pub fn set_window_title(l: &Lua, title: String) -> LuaResult<()> {
let socket = l.app_data_ref::<&'static ContextSocket>().unwrap();
socket.window().set_window_title(&title);
Ok(())
}