Skip to content

Commit

Permalink
Make size/position types generic over pixel type (#1277)
Browse files Browse the repository at this point in the history
* Begin implementing DPI generics

* Fix multithreaded example

* Format

* Fix serde test

* hopefully fix most of the errors

* Fix dpi module errors

* More error fixings

* Format

* fix macos errors

* Another error pass

* Replace bad type signatures

* more fixins
  • Loading branch information
Osspial committed Jan 4, 2020
1 parent abb238b commit f9a3d10
Show file tree
Hide file tree
Showing 40 changed files with 379 additions and 327 deletions.
13 changes: 5 additions & 8 deletions examples/multithreaded.rs
Expand Up @@ -12,7 +12,7 @@ fn main() {
};

const WINDOW_COUNT: usize = 3;
const WINDOW_SIZE: PhysicalSize = PhysicalSize::new(600, 400);
const WINDOW_SIZE: PhysicalSize<u32> = PhysicalSize::new(600, 400);

env_logger::init();
let event_loop = EventLoop::new();
Expand Down Expand Up @@ -108,9 +108,9 @@ fn main() {
M => window.set_maximized(state),
P => window.set_outer_position({
let mut position = window.outer_position().unwrap();
let sign = if state { 1.0 } else { -1.0 };
position.x += 10.0 * sign;
position.y += 10.0 * sign;
let sign = if state { 1 } else { -1 };
position.x += 10 * sign;
position.y += 10 * sign;
position
}),
Q => window.request_redraw(),
Expand All @@ -126,10 +126,7 @@ fn main() {
if let Size::Physical(size) = WINDOW_SIZE.into() {
window
.set_cursor_position(Position::Physical(
PhysicalPosition::new(
size.width as f64 / 2.0,
size.height as f64 / 2.0,
),
PhysicalPosition::new(size.width / 2, size.height / 2),
))
.unwrap()
}
Expand Down

0 comments on commit f9a3d10

Please sign in to comment.