|
@@ -32,10 +32,34 @@ fn main() {
|
|
|
Ok(texture) => {
|
|
Ok(texture) => {
|
|
|
window.set_lazy(true);
|
|
window.set_lazy(true);
|
|
|
while let Some(e) = window.next() {
|
|
while let Some(e) = window.next() {
|
|
|
- window.draw_2d(&e, |c, g, _| {
|
|
|
|
|
- clear([1.0; 4], g);
|
|
|
|
|
- image(&texture, c.transform, g);
|
|
|
|
|
|
|
+ let mut offset = (0.0, 0.0);
|
|
|
|
|
+
|
|
|
|
|
+ e.mouse_cursor(|d| {
|
|
|
|
|
+ offset.0 = d[0];
|
|
|
|
|
+ offset.1 = d[1];
|
|
|
|
|
+ // image(&texture, transform, gfx);
|
|
|
|
|
+ // println!("Relative mouse moved '{} {}'", d[0], d[1])
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ // offset = (100.0, 0.0);
|
|
|
|
|
+
|
|
|
|
|
+ println!("Offset '{} {}'", offset.0, offset.1);
|
|
|
|
|
+
|
|
|
|
|
+ window.draw_2d(&e, |c, gfx, _| {
|
|
|
|
|
+ clear([0.3; 4], gfx);
|
|
|
|
|
+ // c.trans(111.0,1.0);
|
|
|
|
|
+ let transform = c.transform.trans(offset.0, offset.1);
|
|
|
|
|
+
|
|
|
|
|
+ image(&texture, transform, gfx);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ if let Some(Button::Mouse(button)) = e.press_args() {
|
|
|
|
|
+ println!("Pressed mouse button '{:?}'", button);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
Err(e) => println!("Could not create texture. {}", e),
|
|
Err(e) => println!("Could not create texture. {}", e),
|