il2cpp_bridge_rs/structs/components/rendering/
screen.rs1use crate::api::cache;
3
4pub struct Screen;
5
6impl Screen {
7 pub fn get_width() -> Result<i32, String> {
12 let class = cache::coremodule()
13 .class("UnityEngine.Screen")
14 .ok_or("Class 'UnityEngine.Screen' not found")?;
15
16 unsafe {
17 let method = class
18 .method("get_width")
19 .ok_or("Method 'get_width' not found")?;
20 method.call::<i32>(&[])
21 }
22 }
23
24 pub fn get_height() -> Result<i32, String> {
29 let class = cache::coremodule()
30 .class("UnityEngine.Screen")
31 .ok_or("Class 'UnityEngine.Screen' not found")?;
32
33 unsafe {
34 let method = class
35 .method("get_height")
36 .ok_or("Method 'get_height' not found")?;
37 method.call::<i32>(&[])
38 }
39 }
40}