gg: screen_size()
parent
b37550c279
commit
e160f6e7d2
|
@ -581,6 +581,15 @@ pub fn (ctx &Context) draw_empty_rounded_rect(x f32, y f32, w f32, h f32, radius
|
|||
sgl.end()
|
||||
}
|
||||
|
||||
|
||||
pub fn screen_size() Size {
|
||||
$if macos {
|
||||
return C.gg_get_screen_size()
|
||||
}
|
||||
// TODO windows, linux, etc
|
||||
return Size{}
|
||||
}
|
||||
|
||||
fn C.WaitMessage()
|
||||
|
||||
/*
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
module gg
|
||||
|
||||
#include "@VROOT/vlib/gg/gg_darwin.m"
|
||||
fn C.gg_get_screen_size() Size
|
|
@ -0,0 +1,14 @@
|
|||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
gg__Size gg_get_screen_size() {
|
||||
NSScreen *screen = [NSScreen mainScreen];
|
||||
NSDictionary *description = [screen deviceDescription];
|
||||
NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue];
|
||||
CGSize displayPhysicalSize = CGDisplayScreenSize(
|
||||
[[description objectForKey:@"NSScreenNumber"] unsignedIntValue]);
|
||||
gg__Size res;
|
||||
res.width = displayPixelSize.width;
|
||||
res.height = displayPixelSize.height;
|
||||
return res;
|
||||
}
|
||||
|
Loading…
Reference in New Issue