1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

gg: add a working implementation for screen_size() on windows (#13237)

This commit is contained in:
Charles WANG 2022-01-21 12:43:12 +00:00 committed by GitHub
parent 6c8e7f53b5
commit 79cb0db2ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,11 @@ import sokol.sgl
import sokol.gfx
import math
$if windows {
#flag -lgdi32
#include "windows.h"
}
pub type TouchPoint = C.sapp_touchpoint
pub struct Event {
@ -300,11 +305,20 @@ pub fn high_dpi() bool {
return C.sapp_high_dpi()
}
// call Windows API to get screen size
fn C.GetSystemMetrics(int) int
pub fn screen_size() Size {
$if macos {
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{}
}