void taku_wo_miseru(Taku *taku) { cursur_position(0, 0); erase_display(ENTIRE); print_taku(taku); key_break(); }
static void quit(void) { restore(); restore_input(&org); erase_display(); pthread_mutex_destroy(&mut); pthread_cond_destroy(&cond); printf("\n"); exit(0); }
int main() { struct sigaction sa; memset(&sa, 0, sizeof(struct sigaction)); sa.sa_handler = sigint; sigaction(SIGINT, &sa, NULL); atexit(quit); prepare_input(&org); erase_display(); srand(time(NULL)); game_init(); draw(); pthread_mutex_init(&mut, NULL); pthread_cond_init(&cond, NULL); pthread_t tid; pthread_create(&tid, NULL, trd_timer, NULL); pthread_detach(tid); pthread_create(&tid, NULL, trd_draw, NULL); pthread_detach(tid); int c; while(EOF != (c=getchar())) { if(c == 'j') { move_down(); } else if(c == 'k') { rotate(); } else if(c == 'h') { move_left(); } else if(c == 'l') { move_right(); } else if(c == 32) { drop_down(); } else if(c == 'q') { quit(); } else { continue; } } return 0; }