static void glut_keyboard(unsigned char key, int x, int y) { switch(key) { case '2': glutIdleFunc(NULL); break; case '3': glutIdleFunc(idleGL); break; case 'x': move_cam(1, 0, 0); break; case 'y': move_cam(0, 1, 0); break; case 'z': cam_z *= 1.1; //move_cam(0, 0, 1); break; case 'a': cam_z *= 0.9; break; case 'q': exit(0); break; break; default: break; } }
static void ft_func_keys(t_wolf *wolf, int keys[4][4], int color, int mode) { if (wolf->mov & W_UP) { move_cam(wolf->dir[0], wolf->dir[1], wolf); ft_draw_square(wolf, keys[2], color, mode); } if (wolf->mov & W_BACK) { move_cam(-wolf->dir[0], -wolf->dir[1], wolf); ft_draw_square(wolf, keys[3], color, mode); } if (wolf->mov & W_RIGHT && !(wolf->mov & W_LEFT)) { turn_cam(-0.025, wolf->plane[0], wolf->dir[0], wolf); ft_draw_square(wolf, keys[1], color, mode); } if (wolf->mov & W_LEFT && !(wolf->mov & W_RIGHT)) { turn_cam(0.025, wolf->plane[0], wolf->dir[0], wolf); ft_draw_square(wolf, keys[0], color, mode); } }
// 動きを計算する void Camera_Update(Camera *self) { if (Console_is_input(self->console) == 0) { if (self->look_at % 2 == 0) { role_cam(self); //移動スイッチについて move_cam(self); } else { //カメラ操作状態 look_out_over(self); } look_at_switch(self); } }
int event_mlx(int keycode, t_env *e) { static int etat; if (!etat) etat = 0; another_keycode(keycode, e); move_cam(e, keycode); if (keycode == 49) { if (etat == 3) etat = 0; else etat++; ft_putstr("Etat Numero : "); ft_putnbr(etat); print_obj(etat); } movable(keycode, e, etat); ray_tracer(e); return (1); }