-
Notifications
You must be signed in to change notification settings - Fork 0
/
mouse_bonus.c
40 lines (36 loc) · 1.37 KB
/
mouse_bonus.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* ************************************************************************** */
/* */
/* :::::::: */
/* mouse_bonus.c :+: :+: */
/* +:+ */
/* By: goosterl <[email protected]> +#+ */
/* +#+ */
/* Created: 2020/12/10 10:37:28 by goosterl #+# #+# */
/* Updated: 2021/04/12 16:40:50 by goosterl ######## odam.nl */
/* */
/* ************************************************************************** */
#if IS_BONUS == 1
# include <jump_tables.h>
# include <events.h>
t_bool jump_btn(t_scene *scene, int btn, int *idx)
{
static t_jump_btn jb[] = {
{Mouse1, select_shape},
{Mouse2, sh_deselect},
{Mouse4, dof_adjust_up},
{Mouse5, dof_adjust_dn},
{NOBTN, NULL}
};
if (scene->viewport == brdf)
scene->viewport = flat;
scene->do_update = false;
if (jb[*idx].btn == NOBTN)
{
*idx = -1;
return (true);
}
if (btn == jb[*idx].btn)
return (jb[*idx].press(scene));
return (false);
}
#endif