Skip to content

Commit 79cb0db

Browse files
authored
gg: add a working implementation for screen_size() on windows (#13237)
1 parent 6c8e7f5 commit 79cb0db

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

vlib/gg/gg.c.v

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import sokol.sgl
1212
import sokol.gfx
1313
import math
1414

15+
$if windows {
16+
#flag -lgdi32
17+
#include "windows.h"
18+
}
19+
1520
pub type TouchPoint = C.sapp_touchpoint
1621

1722
pub struct Event {
@@ -300,11 +305,20 @@ pub fn high_dpi() bool {
300305
return C.sapp_high_dpi()
301306
}
302307

308+
// call Windows API to get screen size
309+
fn C.GetSystemMetrics(int) int
310+
303311
pub fn screen_size() Size {
304312
$if macos {
305313
return C.gg_get_screen_size()
306314
}
307-
// TODO windows, linux, etc
315+
$if windows {
316+
return Size{
317+
width: int(C.GetSystemMetrics(C.SM_CXSCREEN))
318+
height: int(C.GetSystemMetrics(C.SM_CYSCREEN))
319+
}
320+
}
321+
// TODO linux, etc
308322
return Size{}
309323
}
310324

0 commit comments

Comments
 (0)