-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathmod.rs
46 lines (39 loc) · 1.07 KB
/
mod.rs
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
use std::os::raw::c_int;
extern "C" {
fn js_create_layer(id_ptr: *const u8, id_len: u32, key: c_int);
fn js_clear_screen(layer_id: c_int);
fn js_set_screen_size(width: c_int, height: c_int, quality: c_int);
fn js_set_layer_size(layer_id: c_int, width: c_int, height: c_int, quality: c_int);
fn js_request_tick();
fn js_start_interval_tick(ms: c_int);
}
pub fn create_layer(id: &str, key: i32) {
unsafe {
js_create_layer(id.as_ptr(), id.len() as u32, key);
}
}
pub fn clear_screen(layer: i32) {
unsafe {
js_clear_screen(layer);
}
}
pub fn set_layer_size(layer: i32, width: u32, height: u32, quality: u32) {
unsafe {
js_set_layer_size(layer, width as i32, height as i32, quality as i32);
}
}
pub fn set_screen_size(width: u32, height: u32, quality: u32) {
unsafe {
js_set_screen_size(width as i32, height as i32, quality as i32);
}
}
pub fn request_next_tick() {
unsafe {
js_request_tick();
}
}
pub fn start_interval_tick(ms: i32) {
unsafe {
js_start_interval_tick(ms);
}
}