mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2025-01-26 02:36:32 +11:00
Added X11 set_position
This commit is contained in:
parent
001bca8f74
commit
f3bd5ddb29
2 changed files with 12 additions and 0 deletions
|
@ -324,6 +324,16 @@ void mfb_update(void* window_info, void* buffer)
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void mfb_set_position(void* window, int x, int y)
|
||||||
|
{
|
||||||
|
WindowInfo* info = (WindowInfo*)window_info;
|
||||||
|
|
||||||
|
XMoveWindow(s_display, info->window, x, y);
|
||||||
|
XFlush(s_display);
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void mfb_close(void* window_info)
|
void mfb_close(void* window_info)
|
||||||
{
|
{
|
||||||
WindowInfo* info = (WindowInfo*)window_info;
|
WindowInfo* info = (WindowInfo*)window_info;
|
||||||
|
|
|
@ -20,6 +20,7 @@ extern {
|
||||||
fn mfb_open(name: *const c_char, width: u32, height: u32, scale: i32) -> *mut c_void;
|
fn mfb_open(name: *const c_char, width: u32, height: u32, scale: i32) -> *mut c_void;
|
||||||
fn mfb_close(window: *mut c_void);
|
fn mfb_close(window: *mut c_void);
|
||||||
fn mfb_update(window: *mut c_void, buffer: *const c_uchar);
|
fn mfb_update(window: *mut c_void, buffer: *const c_uchar);
|
||||||
|
fn mfb_set_position(window: *mut c_void, x: i32, y: i32);
|
||||||
fn mfb_set_key_callback(window: *mut c_void, target: *mut c_void, cb: unsafe extern fn(*mut c_void, i32, i32));
|
fn mfb_set_key_callback(window: *mut c_void, target: *mut c_void, cb: unsafe extern fn(*mut c_void, i32, i32));
|
||||||
fn mfb_should_close(window: *mut c_void) -> i32;
|
fn mfb_should_close(window: *mut c_void) -> i32;
|
||||||
fn mfb_get_screen_size() -> u32;
|
fn mfb_get_screen_size() -> u32;
|
||||||
|
@ -177,6 +178,7 @@ impl Window {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_position(&mut self, _: isize, _: isize) {
|
pub fn set_position(&mut self, _: isize, _: isize) {
|
||||||
|
unsafe { mfb_set_position(self.window_handle, x as i32, y as i32) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Add table
Reference in a new issue