int key_hook(int keycode, t_fractal *p) { if (keycode) { if (keycode == ECHAP) exit_free(); if (keycode == SPACE) init_point(p); if (keycode == DOWN) p->offset.y += 10; if (keycode == UP) p->offset.y -= 10; if (keycode == LEFT) p->offset.x += 10; if (keycode == RIGHT) p->offset.x -= 10; if (keycode == PLUS) p->zoom += 10; if (keycode == MOIN) p->zoom -= 10; alpha_num_operateur(keycode, p); p->refresh = 1; } return (1); }
int main(int ac, char **av) { t_data *d; if (init_start(&d, ac, av) < 0 || render_init(d) < 0) { exit_free(); return (error("main:: Initialization error")); } run_the_game(d); return (0); }
int press_key_hook(int keycode, t_mega *all) { if (keycode == ECHAP) exit_free(all); if (keycode == KEY_W) all->hook.up = 1; else if (keycode == KEY_S) all->hook.down = 1; else if (keycode == KEY_A) all->hook.strafe_left = 1; else if (keycode == KEY_D) all->hook.strafe_right = 1; else if (keycode == RIGHT) all->hook.right = 1; else if (keycode == LEFT) all->hook.left = 1; else if (keycode == SPACE) all->hook.shoot = 1; else if (keycode == TAB) all->hook.minimap_enable = 1; else if (keycode == KEY_F) all->hook.action = 1; return (1); }