-
Notifications
You must be signed in to change notification settings - Fork 3
/
vsdl.v
53 lines (38 loc) · 857 Bytes
/
vsdl.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
module vsdl
#flag -I @VROOT/headers
#flag -L .
#flag -lSDL2
#include "SDL.h"
#include "SDL_vulkan.h"
fn C.SDL_Init(u32)
fn C.SDL_InitSubSystem(u32)
fn C.SDL_Delay(u32)
fn C.SDL_GetError() charptr
fn C.SDL_GetTicks() u32
fn C.SDL_Quit()
fn C.SDL_GetVersion(voidptr)
fn init() {
C.SDL_Init(0)
}
// delay waits the specified amount of milliseconds before returning
pub fn delay(ms u32) {
C.SDL_Delay(ms)
}
// get_ticks returns the number of milliseconds since VSDL was initialized
pub fn get_ticks() u32 {
return C.SDL_GetTicks()
}
// quit shuts down all SDL subsystems
pub fn quit() {
C.SDL_Quit()
}
// version returns the SDL library version
pub fn version() Version {
mut version := Version{}
C.SDL_GetVersion(&version)
return version
}
fn serror(text string) string {
msg := unsafe { tos3(C.SDL_GetError()) }
return '$text: $msg'
}