Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix y inversion on examples #638

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/arkanoid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async fn main() {
// (0., 0) .... (SCR_W, 0.)
// (0., SCR_H) .... (SCR_W, SCR_H)
set_camera(&Camera2D {
zoom: vec2(1. / SCR_W * 2., -1. / SCR_H * 2.),
zoom: vec2(1. / SCR_W * 2., 1. / SCR_H * 2.),
target: vec2(SCR_W / 2., SCR_H / 2.),
..Default::default()
});
Expand Down
1 change: 0 additions & 1 deletion examples/letterbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ async fn main() {
WHITE,
DrawTextureParams {
dest_size: Some(vec2(VIRTUAL_WIDTH * scale, VIRTUAL_HEIGHT * scale)),
flip_y: true, // Must flip y otherwise 'render_target' will be upside down
..Default::default()
},
);
Expand Down
4 changes: 2 additions & 2 deletions src/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Camera2D {

Camera2D {
target,
zoom: vec2(1. / rect.w * 2., -1. / rect.h * 2.),
zoom: vec2(1. / rect.w * 2., 1. / rect.h * 2.),
offset: vec2(0., 0.),
rotation: 0.,

Expand All @@ -74,7 +74,7 @@ impl Default for Camera2D {

impl Camera for Camera2D {
fn matrix(&self) -> Mat4 {
// gleaned from https://github.com/raysan5/raylib/blob/master/src/core.c#L1528
// gleaned from https://github.com/raysan5/raylib/blob/master/src/rcore.c#L2888

// The camera in world-space is set by
// 1. Move it to target
Expand Down
Loading