void manage_straff(int x, int y, t_env *e) { if (x >= 200 && x <= 236 && y >= 5 * e->height / 6 \ && y <= (5 * e->height / 6) + 12 && e->set->straff == 1) { e->set->straff = 0; expose_hook(e); } else if (x >= 200 && x <= 236 && y >= 5 * e->height / 6 \ && y <= (5 * e->height / 6) + 12 && e->set->straff == 0) { e->set->straff = 1; expose_hook(e); } }
void manage_color(int x, int y, t_env *e) { if (x >= 200 && x <= 236 && y >= e->height / 6 \ && y <= e->height / 6 + 12 && e->set->color == 1) { e->set->color = 0; expose_hook(e); } else if (x >= 200 && x <= 236 && y >= e->height / 6 \ && y <= e->height / 6 + 12 && e->set->color == 0) { e->set->color = 1; expose_hook(e); } }
static int idle_hook(t_env *env) { debug_stdout("INIT", FILE_LINE_FUN); expose_hook(env); test_opengl_error("ERROR", FILE_LINE_FUN); return (EXIT_SUCCESS); }
int mouse_hook(int button, int x, int y, t_env *env) { double x_calc; double y_calc; if (button == 1) { env->zoom += 1 * env->ratio; x_calc = (double)(SCREEN_X / 2 - x) / 12.5; y_calc = (double)(SCREEN_Y / 2 - y) / 25; env->move_x += (double)-(x_calc / env->zoom / 10); env->move_y += (double)-(y_calc / env->zoom / 10); } else if (button == 3) { env->zoom -= 1 * env->ratio; if (env->zoom <= 0) env->zoom = 1; x_calc = (double)(SCREEN_X / 2 - x) / 12.5; y_calc = (double)(SCREEN_Y / 2 - y) / 25; env->move_x += (double)-(x_calc / env->zoom / 10); env->move_y += (double)-(y_calc / env->zoom / 10); } else mouse_hook_bis(button, x, y, env); expose_hook(env); return (0); }
int key_hook(int keycode, t_env *env) { if (keycode == T_ESC) exit (0); if (keycode == T_UP) ft_move_forward(env); if (keycode == T_DOWN) ft_move_backward(env); if (keycode == T_RIGHT) ft_rotate_right(env); if (keycode == T_LEFT) ft_rotate_left(env); if (keycode == T_SEVEN) env->view = 1.2; if (keycode == T_FOUR) env->view = 2; if (keycode == T_ONE) env->view = 10; if (keycode == T_C) ft_move_left(env); if (keycode == T_Z) ft_move_right(env); else key_hook_bis(keycode, env); expose_hook(env); return (0); }
int key_hook(int keycode, t_env *env) { if (keycode == 65307) exit (0); if (keycode == T_MUL) env->ratio *= 10; if (keycode == T_DIV) env->ratio /= 10; if (keycode == 65453) { env->it_max -= 10; if (env->it_max <= 0) env->it_max = 1; } if (keycode == 65451) env->it_max += 10; if (keycode == 65362) env->move_y += 0.1 / env->zoom; if (keycode == 65364) env->move_y -= 0.1 / env->zoom; if (keycode == 65361) env->move_x += 0.1 / env->zoom; if (keycode == 65363) env->move_x -= 0.1 / env->zoom; key_hook_bis(keycode, env); expose_hook(env); return (0); }
int loop_hook(t_mlxdata *data) { mlx_destroy_image(data->env.mlx, data->img.ptr); data->img = mlx_create_image(data, WIDTH, HEIGHT, 32); which_fractal(data); expose_hook(data); return (1); }
int loop_hook(t_w3d *w3d) { if (w3d->change == 1) { expose_hook(w3d); w3d->change = 0; } return (0); }
int handle_spike(int keycode, t_env *env) { if (keycode == STAR) { env->spike = env->spike + 0.1; if (env->spike == 10) env->spike = 10; expose_hook(env); } else if (keycode == SLASH) { env->spike = env->spike - 0.1; if (env->spike == 0) env->spike = 0.1; expose_hook(env); } return (0); }
int loop_hook(t_env *env) { if (env->renderer == 1) { expose_hook(env); env->renderer = 0; } return (0); }
void check_keycode2(int keycode, t_env *e) { if (keycode == 53 || keycode == 123 || keycode == 124 || keycode == 125 || keycode == 126 || keycode == 12 || keycode == 13 || keycode == 0 || keycode == 1 || keycode == 78 || keycode == 69 || keycode == 6 || keycode == 7 || keycode == 8 || keycode == 9 || keycode == 18 || keycode == 19 || keycode == 20) expose_hook(e); }
static void inter(int keycode, t_env *e) { if (keycode == 69 && e->iteration + 20 < 2147483647) { e->iteration += 20; expose_hook(e); } if (keycode == 78 && e->iteration - 20 > 0) { e->iteration -= 20; expose_hook(e); } if (keycode == 49) { if (e->it == 1) e->it = 0; else e->it = 1; } }
int handle_size(int keycode, t_env *env) { if (keycode == MINUS) { env->size = env->size / 2; env->pos_x = env->pos_x - 25; if (env->size < 1) env->size = 1; expose_hook(env); } else if (keycode == PLUS) { env->size = env->size * 2; env->pos_x = env->pos_x + 25; if (env->size > 100) env->size = 100; expose_hook(env); } return (0); }
void manage_cursor_light(int x, int y, t_env *e) { double l; if (x >= 200 && x <= 400 && y >= 3 * e->height / 6 \ && y <= 3 * e->height / 6 + 12) { l = (((float)x - 200) / 200) * 10; l = (l - floor(l) <= 0.5) ? floor(l) : ceil(l); e->set->light = l; expose_hook(e); } }
int key_hook(int kc, t_env *e) { if (kc == 65362 || kc == 65364 || kc == 65363 || kc == 65361) move_init(e, kc); if (kc == 65507) e->p.speed = -0.15; if (kc == 101) e->p.speed = 0.8; if (kc == 65307) exit(1); expose_hook(e); return (0); }
void move_back(t_env *e, int keycode, double movespeed) { if (keycode == S) { if (e->wl_map[(int)(e->data.player.x - e->data.direction.x * movespeed)][(int)(e->data.player.y)] == 0) e->data.player.x -= e->data.direction.x * movespeed; if (e->wl_map[(int)(e->data.player.x)][(int)(e->data.player.y - e->data.direction.y * movespeed)] == 0) e->data.player.y -= e->data.direction.y * movespeed; new_image(e); expose_hook(e); } }
int key_hook(int keycode, t_env *e) { int tmpx; int tmpy; ft_bzero(e->addr, (e->sizel2 * e->mapdim + e->bpp * e->mapdim)); ft_keyhook1(e, keycode, tmpx, tmpy); ft_keyhook2(e, keycode, tmpx, tmpy); ft_keyrot(e, keycode); if (keycode == 65307 || keycode == 53) exit(EXIT_SUCCESS);// faire un exit propre expose_hook(e); return(0); }
void w_detect_settings(int button, int x, int y, t_env *e) { if (button == 1 && e->game == 2) { manage_color(x, y, e); manage_straff(x, y, e); manage_cursor_light(x, y, e); if (x >= 5 && x <= 45 && y >= 5 && y <= 45) { mlx_clear_window(e->mlx, e->win); e->game = e->prev_game; expose_hook(e); } } }
int handle_pos(int keycode, t_env *env) { if (keycode == LEFT) { env->pos_x = env->pos_x - 10; expose_hook(env); } else if (keycode == RIGHT) { env->pos_x = env->pos_x + 10; expose_hook(env); } else if (keycode == UP) { env->pos_y = env->pos_y - 10; expose_hook(env); } else if (keycode == DOWN) { env->pos_y = env->pos_y + 10; expose_hook(env); } return (0); }
int julia_key_events(int key, t_env *e) { if (key == ESC) exit(0); if (key == KEY_C) handle_color(e); if (key == UP || key == DOWN || key == LEFT || key == RIGHT) handle_pos(key, e->j); if (key == KEY_R) init_julia(e->j, e); if (key == KEY_H) e->help = !e->help ? 1 : 0; expose_hook(e); return (1); }
int mouse_hook(int button, int x, int y, t_env *env) { if (button == 1) ft_destroy_block(env, x, y); if (button == 3) { ft_init_dda(x, env); ft_side_ray_dist(env); ft_dist_wallx4(env); ft_start_end_line(env); ft_add_block(env, y); } expose_hook(env); return (0); }
int event_mouse(int x, int y, t_env *e) { if (e->stop == 0) { if (x < 400) e->v.c_r -= 0.0006; if (x >= 400) e->v.c_r += 0.0006; if (y < 400) e->v.c_i -= 0.0006; if (y >= 400) e->v.c_i += 0.0006; } expose_hook(e); return (0); }
int mouse_hook(int button, int x, int y, t_env *e) { e->xm += (x - e->width / 2) * e->zoom; e->ym += (y - e->height / 2) * e->zoom; if (button == 5) { e->zoom *= 2; } if (button == 4) { if (e->zoom > fabs(x) * 1e-16 && e->zoom > fabs(y) * 1e-16) e->zoom /= 2; } expose_hook(e); return (button); }
int key_hook(int keycode, t_env *e) { if (keycode == 99) choose_color(e); if (keycode == 32) { e->mouse_x = 0; e->mouse_y = 0; e->zoom = 1; expose_hook(e); } if (keycode == 65307) exit (0); if (keycode == 102) e->move = (e->move + 1) % 2; return (0); }
int key_hook(int keycode, t_env *e) { if (keycode == ESC) { free(e); exit(0); } move(e, keycode); rotate(e, keycode); if (keycode == RETURN) { init_player(e); new_image(e); expose_hook(e); } return (0); }
void rotate_left(t_env *e, int keycode, double rotspeed, t_info old) { if (keycode == A) { old.direction.x = e->data.direction.x; e->data.direction.x = e->data.direction.x * cos(rotspeed) - e->data.direction.y * sin(rotspeed); e->data.direction.y = old.direction.x * sin(rotspeed) + e->data.direction.y * cos(rotspeed); old.plane.x = e->data.plane.x; e->data.plane.x = e->data.plane.x * cos(rotspeed) - e->data.plane.y * sin(rotspeed); e->data.plane.y = old.plane.x * sin(rotspeed) + e->data.plane.y * cos(rotspeed); new_image(e); expose_hook(e); } }
int motion_hook(int x, int y, t_env *env) { if (env->stop == 0) { if (env->old_x - x != 0 && env->old_y - y != 0) { env->old_x = x; env->old_y = y; } if (!env->bol && env->motion) { env->bol = 1; ft_seak(x, y, env); expose_hook(env); } } return (0); }
int ft_key_hook(int keycode, t_env *env) { if (keycode == ESC) exit_program(keycode, 0); else if (keycode == MINUS || keycode == PLUS) handle_size(keycode, env); else if (keycode == LEFT || keycode == RIGHT || keycode == UP || keycode == DOWN) handle_pos(keycode, env); else if (keycode == SLASH || keycode == STAR) handle_spike(keycode, env); else if (keycode == KEY_C) { env->ui = !env->ui ? 1 : 0; expose_hook(env); } return (0); }
int key_hook(int key, t_env *e) { ft_putnbr(key); (key == 53) ? exit(0) : 0; (key == 42) ? e->rot_col = 0 : 0; (key == 35) ? e->rot_col = 1000 : 0; (key == 6) ? e->maxi += 1 : 0; (key == 7) ? e->maxi -= 1 : 0; (key == 14) ? e->mouse = -e->mouse : 0; (key == 0) ? (e->cre += 0.01) : 0; (key == 2) ? (e->cre -= 0.01) : 0; (key == 13) ? (e->cim += 0.01) : 0; (key == 1) ? (e->cim -= 0.01) : 0; (key == 30) ? (e->rot_col += 1) : 0; (key == 33) ? (e->rot_col -= 1) : 0; mlx_clear_window(e->mlx, e->win); expose_hook(e); return (0); }
void move(t_env *e, int keycode) { double movespeed; movespeed = 1; if (keycode == W) { if (e->wl_map[(int)(e->data.player.x + e->data.direction.x * movespeed)][(int)(e->data.player.y)] == 0) e->data.player.x += e->data.direction.x * movespeed; if (e->wl_map[(int)(e->data.player.x)][(int)(e->data.player.y + e->data.direction.y * movespeed)] == 0) e->data.player.y += e->data.direction.y * movespeed; mlx_destroy_image(e->mlx, e->img_ptr); new_image(e); expose_hook(e); } move_back(e, keycode, movespeed); }