diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-03-04 11:09:50 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-03-04 11:11:24 +0100 |
| commit | 9bbc949c432f6a981fdac5aec4b36edd2f4dcdba (patch) | |
| tree | b5cf3c8591267d3bc1f9fca800c1a048bd5b6004 /src/event.c | |
| parent | dab9efb7b745fe884fb72017591dce95978c19c4 (diff) | |
| download | fractol-9bbc949c432f6a981fdac5aec4b36edd2f4dcdba.tar.gz fractol-9bbc949c432f6a981fdac5aec4b36edd2f4dcdba.tar.bz2 fractol-9bbc949c432f6a981fdac5aec4b36edd2f4dcdba.zip | |
Linux branch with minilibx_linux(https://framagit.org/ggenois/minilibx_linux)linux
Diffstat (limited to 'src/event.c')
| -rw-r--r-- | src/event.c | 12 |
1 files changed, 10 insertions, 2 deletions
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; |
