File tree Expand file tree Collapse file tree 4 files changed +33
-8
lines changed
Expand file tree Collapse file tree 4 files changed +33
-8
lines changed Original file line number Diff line number Diff line change 66/* By: anleclab <marvin@42.fr> +#+ +:+ +#+ */
77/* +#+#+#+#+#+ +#+ */
88/* Created: 2019/02/15 15:25:34 by anleclab #+# #+# */
9- /* Updated: 2019/02/18 17:13:01 by anleclab ### ########.fr */
9+ /* Updated: 2019/02/18 17:24:23 by anleclab ### ########.fr */
1010/* */
1111/* ************************************************************************** */
1212
Original file line number Diff line number Diff line change 66/* By: anleclab <marvin@42.fr> +#+ +:+ +#+ */
77/* +#+#+#+#+#+ +#+ */
88/* Created: 2019/01/27 17:23:18 by anleclab #+# #+# */
9- /* Updated: 2019/02/18 13:59:43 by anleclab ### ########.fr */
9+ /* Updated: 2019/02/18 17:35:06 by anleclab ### ########.fr */
1010/* */
1111/* ************************************************************************** */
1212
2020
2121# define C 8
2222
23+ # define SPACE 49
24+
25+ # define DOWN_ARROW 125
26+ # define UP_ARROW 126
27+ # define RIGHT_ARROW 124
28+ # define LEFT_ARROW 123
29+
2330/*# define PAD_1 83
2431# define PAD_2 84
2532# define PAD_3 85
3845# define Z 6
3946# define X 7
4047
41- # define DOWN_ARROW 125
42- # define UP_ARROW 126
43- # define SPACE 49
48+
4449
4550# define PLUS 24
4651# define PAD_PLUS 69
Original file line number Diff line number Diff line change 66/* By: anleclab <marvin@42.fr> +#+ +:+ +#+ */
77/* +#+#+#+#+#+ +#+ */
88/* Created: 2019/02/18 12:13:25 by anleclab #+# #+# */
9- /* Updated: 2019/02/18 17:20:23 by anleclab ### ########.fr */
9+ /* Updated: 2019/02/18 17:24:55 by anleclab ### ########.fr */
1010/* */
1111/* ************************************************************************** */
1212
Original file line number Diff line number Diff line change 66/* By: anleclab <marvin@42.fr> +#+ +:+ +#+ */
77/* +#+#+#+#+#+ +#+ */
88/* Created: 2019/02/15 16:31:46 by anleclab #+# #+# */
9- /* Updated: 2019/02/18 15:44:57 by anleclab ### ########.fr */
9+ /* Updated: 2019/02/18 17:39:22 by anleclab ### ########.fr */
1010/* */
1111/* ************************************************************************** */
1212
1313#include "fractol.h"
1414
1515int mouse_event (int button , int x , int y , t_fract * fract )
1616{
17+ if (button != MOUSE_SCROLL_UP && button != MOUSE_SCROLL_DOWN )
18+ return (0 );
1719 (void )x ;
1820 (void )y ;
1921 if (button == MOUSE_SCROLL_UP )
@@ -47,7 +49,25 @@ int key_release(int key, t_fract *fract)
4749{
4850 if (key == ESC )
4951 end (fract , EXIT_OK );
50- if (key == C )
52+ else if (key == C )
5153 fract -> mode = (fract -> mode + 1 ) % 2 ;
54+ else if (key == SPACE || (fract -> name == JULIA && (key == DOWN_ARROW
55+ || key == UP_ARROW || key == RIGHT_ARROW
56+ || key == LEFT_ARROW )))
57+ {
58+ if (key == SPACE )
59+ fract -> color = (fract -> color + 1 ) % NB_COLOR_SCHEMES ;
60+ if (key == DOWN_ARROW )
61+ fract -> julia .y *= 0.9 ;
62+ if (key == UP_ARROW )
63+ fract -> julia .y *= 1.1 ;
64+ if (key == LEFT_ARROW )
65+ fract -> julia .x *= 0.9 ;
66+ if (key == RIGHT_ARROW )
67+ fract -> julia .x *= 1.1 ;
68+ draw_fractal (fract );
69+ mlx_put_image_to_window (fract -> mlx_ptr , fract -> win_ptr , fract -> img_ptr ,
70+ 0 , 0 );
71+ }
5272 return (0 );
5373}
You can’t perform that action at this time.
0 commit comments