38 lines
703 B
Rust
38 lines
703 B
Rust
//! C++ functions.
|
|
|
|
use maraiah::ffi;
|
|
|
|
mod static_ffi {
|
|
use maraiah::ffi;
|
|
|
|
pub type QPainter = ffi::c_void;
|
|
|
|
extern "C" {
|
|
pub fn critical_msg(title: ffi::NT, msg: ffi::NT);
|
|
pub fn paint_point(paint: *mut QPainter, x: ffi::c_int, y: ffi::c_int);
|
|
}
|
|
}
|
|
|
|
pub use static_ffi::QPainter;
|
|
|
|
pub fn paint_point(paint: *mut QPainter, x: i32, y: i32)
|
|
{
|
|
unsafe {
|
|
static_ffi::paint_point(paint, x.into(), y.into());
|
|
}
|
|
}
|
|
|
|
pub fn critical_msg<T, U>(title: T, msg: U)
|
|
where T: ToString,
|
|
U: ToString
|
|
{
|
|
let title = ffi::CString::new(title.to_string()).unwrap();
|
|
let msg = ffi::CString::new(msg.to_string()).unwrap();
|
|
|
|
unsafe {
|
|
static_ffi::critical_msg(title.as_ptr(), msg.as_ptr());
|
|
}
|
|
}
|
|
|
|
// EOF
|