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
use crate::ffi;
use crate::core::RaylibHandle;
use std::ffi::CStr;
impl RaylibHandle {
#[inline]
pub fn is_file_dropped(&self) -> bool {
unsafe { ffi::IsFileDropped() }
}
pub fn get_dropped_files(&self) -> Vec<String> {
let mut v = Vec::new();
unsafe {
let mut count: i32 = 0;
let dropfiles = ffi::GetDroppedFiles(&mut count);
for i in 0..count {
let filestr = CStr::from_ptr(*dropfiles.offset(i as isize))
.to_str()
.unwrap();
let file = String::from(filestr);
v.push(file);
}
}
v
}
#[inline]
pub fn clear_dropped_files(&mut self) {
unsafe {
ffi::ClearDroppedFiles();
}
}
}