macroquad icon indicating copy to clipboard operation
macroquad copied to clipboard

`mouse_position_local` has y axis facing upwards, but in camera coordinates y axis faces downards

Open victoria-n-w opened this issue 2 years ago • 4 comments

The following code shows what I mean:

#[macroquad::main("Test")]
async fn main() {
    let camera = Camera2D::default();
    set_camera(&camera);

    loop {
        clear_background(BLACK);

        let mouse_pos = mouse_position_local();

        draw_circle(mouse_pos.x, mouse_pos.y, 0.01, RED);

        next_frame().await
    }
}

Expected: the red dot follows the mouse Actual: the red dot mirrors the mouse's movement, flipped vertically

(unfortunately I was not able to record the screen, to show what I mean)

victoria-n-w avatar Mar 11 '23 21:03 victoria-n-w

Unfortunately this is a known issue - the default camera is flipped upside down :( Fixing it will be too much of a breaking change, there are way too many projects with this zoom: vec2(1, -1) in their camera settings

not-fl3 avatar Mar 12 '23 21:03 not-fl3

Hi! If this is just matter of removing one line of code, it's not so bad.

IohannRabeson avatar Mar 18 '23 02:03 IohannRabeson

I think it might confuse a lot of new people coming to macroquad - I spent 1 hour, trying to figure out why my code doesn't work. Maybe in this case, consistency is more important than backwards compatibility?

victoria-n-w avatar Mar 28 '23 18:03 victoria-n-w

I think we can release 0.4 with just a few changes, sub 1.0 all those breaking changes are totally fine

In other words, go ahead with a PR! :)

not-fl3 avatar Mar 29 '23 16:03 not-fl3