forked from duarteroso/glfw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvidmode.v
More file actions
34 lines (28 loc) · 914 Bytes
/
Copy pathvidmode.v
File metadata and controls
34 lines (28 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module vglfw
// Forward declaration
@[typedef]
struct C.GLFWvidmode {
}
// Helper methods to handle GLFWvidmode
fn C.glfwGetVidModeSizeHelper(vidmode &C.GLFWvidmode, width &int, height &int)
fn C.glfwGetVidModeRGBBitsHelper(vidmode &C.GLFWvidmode, r &int, g &int, b &int)
fn C.glfwGetVidModeRefreshRateHelper(vidmode &C.GLFWvidmode, rate &int)
// VideoMode represents the video mode of a monitor
pub struct VideoMode {
pub:
width int
height int
red_bits int
green_bits int
blue_bits int
refresh_rate int
}
// create_vidmode creates a VideoMode instance
pub fn create_vidmode(data voidptr) VideoMode {
raw_data := unsafe { &C.GLFWvidmode(data) }
v := VideoMode{}
C.glfwGetVidModeSizeHelper(raw_data, &v.width, &v.height)
C.glfwGetVidModeRGBBitsHelper(raw_data, &v.red_bits, &v.green_bits, &v.blue_bits)
C.glfwGetVidModeRefreshRateHelper(raw_data, &v.refresh_rate)
return v
}