Ejemplo n.º 1
0
int start_new_game(void)
{
    struct thread_data data = { NULL, 0, 0, PTHREAD_MUTEX_INITIALIZER, 0, 0 };

    initialize_game_elements();
    initialize_game_screen();

    /* draw the next block, and the begin game message */
    draw_next_block(next_block, next_block_orientation);
    if (draw_start_game() == FAILURE)
        return SUCCESS;

    draw_level_info(game_options.initial_level);

    /* create the worker thread */
    if (pthread_create(&data.thread_id, NULL, worker_thread_fn, (void *)&data))
        return FAILURE;

    /* the main thread for the core gameplay */
    play_game(&data);
    pthread_join(data.thread_id, NULL);

    if (data.new_highscore)
        draw_highscore(global_highscore);

    return SUCCESS;
}
void highscore_show(int numb) {
    highscore_add("player name",numb);
     while(!keyboard_check(27 /*vk_escape*/)) {
    draw_highscore(20, 0, room_width-20, room_height);

         screen_refresh();
         io_handle();
     }
}