mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2025-01-10 02:51:32 +11:00
Started to add set_position
This commit is contained in:
parent
1cd69660d8
commit
b576ab3139
|
@ -20,6 +20,8 @@ fn main() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.set_position(10, 10);
|
||||||
|
|
||||||
while window.is_open() && !window.is_key_down(Key::Escape) {
|
while window.is_open() && !window.is_key_down(Key::Escape) {
|
||||||
for i in buffer.iter_mut() {
|
for i in buffer.iter_mut() {
|
||||||
noise = seed;
|
noise = seed;
|
||||||
|
|
17
src/lib.rs
17
src/lib.rs
|
@ -249,6 +249,23 @@ impl Window {
|
||||||
self.0.is_open()
|
self.0.is_open()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Sets the position of the window. This is useful if you have
|
||||||
|
/// more than one window and want to align them up on the screen
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// // Moves the window to pixel postion 20, 20 on the screen
|
||||||
|
/// window.set_position(20, 20);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
#[inline]
|
||||||
|
pub fn set_position(&mut self, x: isize, y: isize) {
|
||||||
|
self.0.set_position(x, y)
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Get the current keys that are down.
|
/// Get the current keys that are down.
|
||||||
///
|
///
|
||||||
|
|
|
@ -201,6 +201,10 @@ impl Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn set_position(&mut self, _: isize, _: isize) {
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_keys(&self) -> Option<Vec<Key>> {
|
pub fn get_keys(&self) -> Option<Vec<Key>> {
|
||||||
self.key_handler.get_keys()
|
self.key_handler.get_keys()
|
||||||
|
|
|
@ -175,6 +175,10 @@ impl Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn set_position(&mut self, _: isize, _: isize) {
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_keys(&self) -> Option<Vec<Key>> {
|
pub fn get_keys(&self) -> Option<Vec<Key>> {
|
||||||
self.key_handler.get_keys()
|
self.key_handler.get_keys()
|
||||||
|
|
|
@ -342,6 +342,14 @@ impl Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn set_position(&mut self, x: isize, y: isize) {
|
||||||
|
unsafe {
|
||||||
|
user32::SetWindowPos(self.window.unwrap(), ptr::null_mut(), x as i32, y as i32,
|
||||||
|
0, 0, winapi::SWP_SHOWWINDOW | winapi::SWP_NOSIZE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_keys(&self) -> Option<Vec<Key>> {
|
pub fn get_keys(&self) -> Option<Vec<Key>> {
|
||||||
self.key_handler.get_keys()
|
self.key_handler.get_keys()
|
||||||
|
|
Loading…
Reference in a new issue