-
Notifications
You must be signed in to change notification settings - Fork 5
/
window.v
138 lines (110 loc) · 3.24 KB
/
window.v
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
module vraylib
// Window-Related Functions
// Initialize window and OpenGL context
[inline] pub fn init_window(w, h int, title string) {
C.InitWindow(w, h, title.str)
}
// Check if KEY_ESCAPE pressed or Close icon pressed
[inline] pub fn window_should_close() bool {
return C.WindowShouldClose()
}
// Close window and unload OpenGL context
[inline] pub fn close_window() {
C.CloseWindow()
}
// Check if window has been initialized successfully
[inline] pub fn is_window_ready() bool {
return C.IsWindowReady()
}
// Check if window has been minimized (or lost focus)
[inline] pub fn is_window_minimized() bool {
return C.IsWindowMinimized()
}
// Check if window has been resized
[inline] pub fn is_window_resized() bool {
return C.IsWindowResized()
}
// Check if window is currently hidden
[inline] pub fn is_window_hidden() bool {
return C.IsWindowHidden()
}
// Toggle fullscreen mode (only PLATFORM_DESKTOP)
[inline] pub fn toggle_fullscreen() {
C.ToggleFullscreen()
}
// Show the window
[inline] pub fn unhide_window() {
C.UnhideWindow()
}
// Hide the window
[inline] pub fn hide_window() {
C.HideWindow()
}
// Set icon for window (only PLATFORM_DESKTOP)
[inline] pub fn set_window_icon(image Image) {
C.SetWindowIcon(image)
}
// Set title for window (only PLATFORM_DESKTOP)
[inline] pub fn set_window_title(title string) {
C.SetWindowTitle(title.str)
}
// Set window position on screen (only PLATFORM_DESKTOP)
[inline] pub fn set_window_position(x, y int) {
C.SetWindowPosition(x, y)
}
// Set monitor for the current window (fullscreen mode)
[inline] pub fn set_window_monitor(monitor int) {
C.SetWindowMonitor(monitor)
}
// Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
[inline] pub fn set_window_min_size(width, height int) {
C.SetWindowMinSize(width, height)
}
// Set window dimensions
[inline] pub fn set_window_size(width, height int) {
C.SetWindowSize(width, height)
}
// Get native window handle
[inline] pub fn get_window_hanlde() voidptr {
return C.GetWindowHandle()
}
// Get current screen width
[inline] pub fn get_screen_width() int {
return C.GetScreenWidth()
}
// Get current screen height
[inline] pub fn get_screen_height() int {
return C.GetScreenHeight()
}
// Get number of connected monitors
[inline] pub fn get_monitor_count() int {
return C.GetMonitorCount()
}
// Get primary monitor width
[inline] pub fn get_monitor_width(monitor int) int {
return C.GetMonitorWidth(monitor)
}
// Get primary monitor height
[inline] pub fn get_monitor_height(monitor int) int {
return C.GetMonitorHeight(monitor)
}
// Get primary monitor physical width in millimetres
[inline] pub fn get_monitor_physical_width(monitor int) int {
return C.GetMonitorPhysicalWidth(monitor)
}
// Get primary monitor physical height in millimetres
[inline] pub fn get_monitor_physical_height(monitor int) int {
return C.GetMonitorPhysicalHeight(monitor)
}
// Get the human-readable, UTF-8 encoded name of the primary monitor
[inline] pub fn get_monitor_name(monitor int) string {
return string(byteptr(C.GetMonitorName(monitor)))
}
// Get clipboard text content
[inline] pub fn get_clipboard_text() string {
return string(byteptr(C.GetClipboardText()))
}
// Set clipboard text content
[inline] pub fn set_clipboard_text(text string) {
C.SetClipboardText(text.str)
}