Skip to content

Commit

Permalink
WIP: fix camera Y
Browse files Browse the repository at this point in the history
  • Loading branch information
ozkriff committed Mar 26, 2024
1 parent 27dc614 commit 88ae4bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ pub fn aspect_ratio() -> f32 {
pub fn make_and_set_camera(aspect_ratio: f32) -> Camera2D {
let camera = Camera2D::from_display_rect(Rect {
x: -aspect_ratio,
y: -1.0,
y: 1.0,
w: aspect_ratio * 2.0,
h: 2.0,
h: -2.0,
});
set_camera(&camera);
camera
Expand Down
3 changes: 2 additions & 1 deletion zgui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ impl<Message: Clone> Gui<Message> {
}

pub fn draw(&self) {
let ui_coordinates = Rect::new(-self.aspect_ratio, -1.0, self.aspect_ratio * 2.0, 2.0);
// let ui_coordinates = Rect::new(-self.aspect_ratio, -1.0, self.aspect_ratio * 2.0, 2.0);
let ui_coordinates = Rect::new(-self.aspect_ratio, 1.0, self.aspect_ratio * 2.0, -2.0);
set_camera(&Camera2D::from_display_rect(ui_coordinates));
for AnchoredWidget { widget, .. } in &self.anchored_widgets {
widget.borrow().draw();
Expand Down

0 comments on commit 88ae4bb

Please sign in to comment.