From 9bbc949c432f6a981fdac5aec4b36edd2f4dcdba Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 4 Mar 2020 11:09:50 +0100 Subject: Linux branch with minilibx_linux(https://framagit.org/ggenois/minilibx_linux) --- src/event.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/event.c') diff --git a/src/event.c b/src/event.c index 668a599..e868ae8 100644 --- a/src/event.c +++ b/src/event.c @@ -69,9 +69,10 @@ int event_keydown(int key, t_state *state) int event_mouse(int button, int x, int y, t_state *state) { - (void)x; - (void)y; + /* (void)x; */ + /* (void)y; */ + /* printf("%d\n", button); */ if (button == MLX_MOUSE_SCROLL_UP) { h_zoom_in(state); @@ -85,6 +86,13 @@ int event_mouse(int button, int x, int y, t_state *state) /* state->center.r -= MOVE_SPEED * (double)(x - WINDOW_WIDTH / 2) / WINDOW_WIDTH; */ /* state->center.i -= MOVE_SPEED * (double)(y - WINDOW_HEIGHT / 2) / WINDOW_HEIGHT; */ } + else if (button == MLX_MOUSE_LEFT) + { + printf("%d %d\n", x, y); + state->center.r = ((double)x / FWINDOW_WIDTH) * state->plane.r - state->plane.r / 2.0; + state->center.i = ((double)y / FWINDOW_HEIGHT) * state->plane.i - state->plane.i / 2.0; + + } else return (0); state->updated = false; -- cgit