gg: add a working implementation for screen_size() on windows (#13237)
parent
6c8e7f53b5
commit
79cb0db2ff
|
@ -12,6 +12,11 @@ import sokol.sgl
|
||||||
import sokol.gfx
|
import sokol.gfx
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
$if windows {
|
||||||
|
#flag -lgdi32
|
||||||
|
#include "windows.h"
|
||||||
|
}
|
||||||
|
|
||||||
pub type TouchPoint = C.sapp_touchpoint
|
pub type TouchPoint = C.sapp_touchpoint
|
||||||
|
|
||||||
pub struct Event {
|
pub struct Event {
|
||||||
|
@ -300,11 +305,20 @@ pub fn high_dpi() bool {
|
||||||
return C.sapp_high_dpi()
|
return C.sapp_high_dpi()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// call Windows API to get screen size
|
||||||
|
fn C.GetSystemMetrics(int) int
|
||||||
|
|
||||||
pub fn screen_size() Size {
|
pub fn screen_size() Size {
|
||||||
$if macos {
|
$if macos {
|
||||||
return C.gg_get_screen_size()
|
return C.gg_get_screen_size()
|
||||||
}
|
}
|
||||||
// TODO windows, linux, etc
|
$if windows {
|
||||||
|
return Size{
|
||||||
|
width: int(C.GetSystemMetrics(C.SM_CXSCREEN))
|
||||||
|
height: int(C.GetSystemMetrics(C.SM_CYSCREEN))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO linux, etc
|
||||||
return Size{}
|
return Size{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue