예제 #1
0
void	Menu::arena() {
    print_surface(this->str_2players, this->str_2players_selected, 400, 400, MENU_ARENA_2P);
    print_surface(this->str_3players, this->str_3players_selected, 400, 500, MENU_ARENA_3P);
    print_surface(this->str_4players, this->str_4players_selected, 400, 600, MENU_ARENA_4P);
    print_surface(this->str_5players, this->str_5players_selected, 400, 700, MENU_ARENA_5P);
    print_surface(this->str_return, this->str_return_selected, 400, 800, MENU_ARENA_RETURN);
}
예제 #2
0
void    Menu::config_video() {
    if (true == main_event->full_screen)
        print_surface(this->str_config_video_fullscreen, this->str_config_video_fullscreen_selected, 400, 500, MENU_CONFIG_VIDEO_MODE);
    else
        print_surface(this->str_config_video_window, this->str_config_video_window_selected, 400, 500, MENU_CONFIG_VIDEO_MODE);

    if (false == main_event->full_screen) {
        if (RESOLUTION_800 == main_event->actual_resolution)
            print_surface(this->str_config_video_800_600, this->str_config_video_800_600_selected, 400, 600, MENU_CONFIG_VIDEO_RESOLUTION);
        else if (RESOLUTION_1280 == main_event->actual_resolution)
            print_surface(this->str_config_video_1280_720, this->str_config_video_1280_720_selected, 400, 600, MENU_CONFIG_VIDEO_RESOLUTION);
        else if (RESOLUTION_1600 == main_event->actual_resolution)
            print_surface(this->str_config_video_1600_900, this->str_config_video_1600_900_selected, 400, 600, MENU_CONFIG_VIDEO_RESOLUTION);
        else if (RESOLUTION_1920 == main_event->actual_resolution)
            print_surface(this->str_config_video_1920_1080, this->str_config_video_1920_1080_selected, 400, 600, MENU_CONFIG_VIDEO_RESOLUTION);
        else if (RESOLUTION_2560 == main_event->actual_resolution)
            print_surface(this->str_config_video_2560_1440, this->str_config_video_2560_1440_selected, 400, 600, MENU_CONFIG_VIDEO_RESOLUTION);
        else
            print_surface(this->str_config_video_not_set, this->str_config_video_not_set_selected, 400, 600, MENU_CONFIG_VIDEO_RESOLUTION);
    }
    else {
        print_surface(this->str_config_video_not_set, this->str_config_video_not_set_disable, 400, 600, MENU_CONFIG_VIDEO_RESOLUTION);
    }
    print_surface(this->str_return, this->str_return_selected, 400, 700, MENU_CONFIG_VIDEO_RETURN);
}
예제 #3
0
void	Menu::winner_multi() {
	if (false == this->musicIsPlaying) {
		this->musicIsPlaying = true;
		main_event->soundrender->stopSounds();
		main_event->soundrender->stopMusic();
		main_event->soundrender->playMusic("victory_multiplayer");
	}
    print_surface(this->winner[main_event->draw_winner_multi - 1], this->winner[main_event->draw_winner_multi - 1], 400, 400, 0);
    print_surface(this->winner_push_to_retry_previous, this->winner_push_to_retry_previous, 200, 550, 0);
	print_surface(this->winner_push_to_go_menu, this->winner_push_to_go_menu, 300, 700, 0);
}
예제 #4
0
inline void print_data_to_files(double *phi, double *density, double *residual, int tl) {
    double x0 = get_center_x() + tl*TAU * func_u(tl*TAU, get_center_x(), get_center_y());
    double y0 = get_center_y() + tl*TAU* func_v(tl*TAU, get_center_x(), get_center_y());
    print_surface("phi", NX, NY, HX, HY, tl, A, C, x0, y0, TAU, U, V, phi);
    print_surface("rho", NX, NY, HX, HY, tl, A, C, x0, y0, TAU, U, V, density);
//    print_surface("res", NX, NY, HX, HY, tl, A, C, get_center_x_2(), get_center_y_2(), TAU,
//                  U, V, residual);
    double *err_lock = calc_error_2(HX, HY, tl * TAU, density);
    print_surface("err-l", NX, NY, HX, HY, tl, A, C, x0, y0, TAU, U, V, err_lock);
    delete[] err_lock;
}
예제 #5
0
void	Menu::lose_campaign() {
	if (false == this->musicIsPlaying) {
		this->musicIsPlaying = true;
		main_event->soundrender->stopSounds();
		main_event->soundrender->stopMusic();
		main_event->soundrender->playSound("lose");
	}
	print_surface(this->lose_campaign_txt, this->lose_campaign_txt, 500, 400, 0);
    print_surface(this->winner_push_to_go_menu, this->winner_push_to_go_menu, 300, 700, 0);
    if (main_event->multi >= 2 || main_event->arena >= 2) {
        print_surface(this->winner_push_to_retry_previous, this->winner_push_to_retry_previous, 200, 550, 0);
    }
}
예제 #6
0
void	Menu::end_campaign() {
	if (false == this->musicIsPlaying) {
		this->musicIsPlaying = true;
		main_event->soundrender->stopSounds();
		main_event->soundrender->stopMusic();
		main_event->soundrender->playMusic("victory_final");
	}
	print_surface(this->winner_game_txt, this->winner_game_txt, 400, 400, 0);
}
예제 #7
0
void	Menu::multiplayer() {
    print_surface(this->str_2players, this->str_2players_selected, 400, 400, MENU_MULTI_2P);
    print_surface(this->str_3players, this->str_3players_selected, 400, 500, MENU_MULTI_3P);
    print_surface(this->str_4players, this->str_4players_selected, 400, 600, MENU_MULTI_4P);
		print_surface(this->str_5players, this->str_5players_selected, 400, 700, MENU_MULTI_5P);
    print_surface(this->str_10players, this->str_10players_selected, 400, 800, MENU_MULTI_10P);
    print_surface(this->str_return, this->str_return_selected, 400, 900, MENU_MULTI_RETURN);
}
예제 #8
0
void  Menu::big_menu() {
    if (false == this->musicIsPlaying) {
        this->musicIsPlaying = true;
        main_event->soundrender->stopSounds();
        main_event->soundrender->stopMusic();
    }

    if (true == main_event->game_playing) {// Si partie en cours
        print_surface(this->str_resume_game, this->str_resume_game_selected, 400, 300, RESUME_GAME);
    }
    print_surface(this->str_campaign, this->str_campaign_selected, 400, 390, MENU_CAMPAIGN);
    print_surface(this->str_arena, this->str_arena_selected, 400, 480, MENU_ARENA);
    print_surface(this->str_multiplayer, this->str_multiplayer_selected, 400, 570, MENU_MULTIPLAYER);
    print_surface(this->str_config, str_config_selected, 400, 660, MENU_CONFIG);
    print_surface(this->str_config_sound, str_config_sound_selected, 400, 750, MENU_CONFIG_SOUND);
    print_surface(this->str_config_video, str_config_video_selected, 400, 840, MENU_CONFIG_VIDEO);
    if (true == main_event->option_arcade)
        print_surface(this->str_arcade, this->str_arcade_selected, 400, 930, MENU_EXIT);
    else
        print_surface(this->str_exit, this->str_exit_selected, 400, 930, MENU_EXIT);
}
예제 #9
0
void    Menu::config_sound() {
    if (VOLUME_OFF != main_event->soundrender->getMusicVolume()) {
        print_surface(this->str_config_sound_global_activated, this->str_config_sound_global_activated_selected, 400, 500, MENU_CONFIG_SOUND_GLOBAL_SOUND);
    }
    else {
        print_surface(this->str_config_sound_global_desactivated, this->str_config_sound_global_desactivated_selected, 400, 500, MENU_CONFIG_SOUND_GLOBAL_SOUND);
    }

    if (VOLUME_OFF == main_event->soundrender->getMusicVolume())
        print_surface(this->str_config_sound_volume_off, this->str_config_sound_volume_off_selected, 400, 600, MENU_CONFIG_SOUND_SOUND_VOLUME);
    else if (VOLUME_LOW == main_event->soundrender->getMusicVolume())
        print_surface(this->str_config_sound_colume_low, this->str_config_sound_colume_low_selected, 400, 600, MENU_CONFIG_SOUND_SOUND_VOLUME);
    else if (VOLUME_MEDIUM == main_event->soundrender->getMusicVolume())
        print_surface(this->str_config_sound_colume_medium, this->str_config_sound_colume_medium_selected, 400, 600, MENU_CONFIG_SOUND_SOUND_VOLUME);
    else if (VOLUME_HIGH == main_event->soundrender->getMusicVolume())
        print_surface(this->str_config_sound_colume_hight, this->str_config_sound_colume_hight_selected, 400, 600, MENU_CONFIG_SOUND_SOUND_VOLUME);

    print_surface(this->str_return, this->str_return_selected, 400, 700, MENU_CONFIG_SOUND_RETURN);
}
예제 #10
0
void	Menu::campaign() {
    print_surface(this->str_campaign_new, this->str_campaign_new_selected, 400, 400, MENU_CAMPAIGN_NEW);
    print_surface(this->str_campaign_continue, this->str_campaign_continue_selected, 400, 500, MENU_CAMPAIGN_CONTINUE);
    print_surface(this->str_campaign_coop, this->str_campaign_coop_selected, 400, 600, MENU_CAMPAIGN_COOP);
    print_surface(this->str_return, this->str_return_selected, 400, 700, MENU_CAMPAIGN_RETURN);
}
예제 #11
0
void	Menu::exit_game() {
	print_surface(this->str_exit_confirm, this->str_exit_confirm_selected, 400, 400, MENU_EXIT_CONFIRM);
	print_surface(this->str_return, this->str_return_selected, 400, 500, MENU_EXIT_RETURN);
}
예제 #12
0
void	Menu::config() {
	print_surface(this->str_config_1, this->str_config_1_selected, 200, 400, MENU_CONFIG_PLAYER1);
	if (main_event->joystick->config[0] == 0)
		print_surface(this->str_player_controller_selected, this->str_player_controller_selected, 600, 400, MENU_CONFIG_PLAYER1);
	else
		print_surface(this->str_player_keyboard_selected, this->str_player_keyboard_selected, 600, 400, MENU_CONFIG_PLAYER1);

	print_surface(this->str_config_2, this->str_config_2_selected, 200, 500, MENU_CONFIG_PLAYER2);
	if (main_event->joystick->config[1] == 0)
		print_surface(this->str_player_controller_selected, this->str_player_controller_selected, 600, 500, MENU_CONFIG_PLAYER2);
	else
		print_surface(this->str_player_keyboard_selected, this->str_player_keyboard_selected, 600, 500, MENU_CONFIG_PLAYER2);

	print_surface(this->str_config_3, this->str_config_3_selected, 200, 600, MENU_CONFIG_PLAYER3);
	if (main_event->joystick->config[2] == 0)
		print_surface(this->str_player_controller_selected, this->str_player_controller_selected, 600, 600, MENU_CONFIG_PLAYER3);
	else
		print_surface(this->str_player_keyboard_selected, this->str_player_keyboard_selected, 600, 600, MENU_CONFIG_PLAYER3);

	print_surface(this->str_config_4, this->str_config_4_selected, 200, 700, MENU_CONFIG_PLAYER4);
	if (main_event->joystick->config[3] == 0)
		print_surface(this->str_player_controller_selected, this->str_player_controller_selected, 600, 700, MENU_CONFIG_PLAYER4);
	else
		print_surface(this->str_player_keyboard_selected, this->str_player_keyboard_selected, 600, 700, MENU_CONFIG_PLAYER4);

	print_surface(this->str_config_5, this->str_config_5_selected, 200, 800, MENU_CONFIG_PLAYER5);
	if (main_event->joystick->config[4] == 0)
		print_surface(this->str_player_controller_selected, this->str_player_controller_selected, 600, 800, MENU_CONFIG_PLAYER5);
	else
		print_surface(this->str_player_keyboard_selected, this->str_player_keyboard_selected, 600, 800, MENU_CONFIG_PLAYER5);

	print_surface(this->str_return, this->str_return_selected, 400, 900, MENU_CONFIG_RETURN);
}
예제 #13
0
static cairo_test_status_t
preamble (cairo_test_context_t *ctx)
{
    const char *filename = "png.out.png";
    cairo_surface_t *surface0, *surface1;
    cairo_status_t status;
    uint32_t argb32 = 0xdeadbede;

    surface0 = cairo_image_surface_create_for_data ((unsigned char *) &argb32,
						    CAIRO_FORMAT_ARGB32,
						    1, 1, 4);
    status = cairo_surface_write_to_png (surface0, filename);
    if (status) {
	cairo_test_log (ctx, "Error writing '%s': %s\n",
			filename, cairo_status_to_string (status));

	cairo_surface_destroy (surface0);
	return cairo_test_status_from_status (ctx, status);
    }
    surface1 = cairo_image_surface_create_from_png (filename);
    status = cairo_surface_status (surface1);
    if (status) {
	cairo_test_log (ctx, "Error reading '%s': %s\n",
			filename, cairo_status_to_string (status));

	cairo_surface_destroy (surface1);
	cairo_surface_destroy (surface0);
	return cairo_test_status_from_status (ctx, status);
    }

    if (! image_surface_equals (surface0, surface1)) {
	cairo_test_log (ctx, "Error surface mismatch.\n");
	cairo_test_log (ctx, "to png: "); print_surface (ctx, surface0);
	cairo_test_log (ctx, "from png: "); print_surface (ctx, surface1);

	cairo_surface_destroy (surface0);
	cairo_surface_destroy (surface1);
	return CAIRO_TEST_FAILURE;
    }
    assert (*(uint32_t *) cairo_image_surface_get_data (surface1) == argb32);

    cairo_surface_destroy (surface0);
    cairo_surface_destroy (surface1);

    surface0 = cairo_image_surface_create_for_data ((unsigned char *) &argb32,
						    CAIRO_FORMAT_RGB24,
						    1, 1, 4);
    status = cairo_surface_write_to_png (surface0, filename);
    if (status) {
	cairo_test_log (ctx, "Error writing '%s': %s\n",
			filename, cairo_status_to_string (status));
	cairo_surface_destroy (surface0);
	return cairo_test_status_from_status (ctx, status);
    }
    surface1 = cairo_image_surface_create_from_png (filename);
    status = cairo_surface_status (surface1);
    if (status) {
	cairo_test_log (ctx, "Error reading '%s': %s\n",
			filename, cairo_status_to_string (status));

	cairo_surface_destroy (surface1);
	cairo_surface_destroy (surface0);
	return cairo_test_status_from_status (ctx, status);
    }

    if (! image_surface_equals (surface0, surface1)) {
	cairo_test_log (ctx, "Error surface mismatch.\n");
	cairo_test_log (ctx, "to png: "); print_surface (ctx, surface0);
	cairo_test_log (ctx, "from png: "); print_surface (ctx, surface1);

	cairo_surface_destroy (surface0);
	cairo_surface_destroy (surface1);
	return CAIRO_TEST_FAILURE;
    }
    assert ((*(uint32_t *) cairo_image_surface_get_data (surface1) & RGB_MASK)
	    == (argb32 & RGB_MASK));

    cairo_surface_destroy (surface0);
    cairo_surface_destroy (surface1);

    return CAIRO_TEST_SUCCESS;
}
예제 #14
0
파일: main.c 프로젝트: dahlem/heat
int main(int argc, char *argv[])
{
    matrix A;
    vector u, v, x_bar;
    int status;
    double square_pnts[2][2];

#ifdef HAVE_MPI
    setup(&argc, &argv);
#endif /* HAVE_MPI */

    /* parse the command-line arguments */
    if ((status = process_cl(argc, argv)) != 0) {
#ifdef HAVE_MPI
        finalise();
#endif /* HAVE_MPI */
        fprintf(stderr, "ERROR: Received command-line parsing status %d\n", status);
        fflush(stderr);

        return EXIT_FAILURE;
    }

#ifdef HAVE_LIBGSL
    /* read GSL_IEEE_MODE */
    gsl_ieee_env_setup();
#else
    fesetround(FE_UPWARD);
#endif /* HAVE_LIBGSL */

    /* specify the domain */
    square_pnts[0][0] = globalArgs.x0;
    square_pnts[0][1] = globalArgs.x1;
    square_pnts[1][0] = globalArgs.y0;
    square_pnts[1][1] = globalArgs.y1;

    print_settings();

    /* set up the poisson matrix and vectors */
    setup_poiss_2d(&A, &u, &v, &x_bar, globalArgs.s, globalArgs.d,
                   square_pnts, *src_dens, *bound_cond);

#ifdef NDEBUG
    /* print the matrix and vectors */
# ifdef HAVE_MPI
    fprintf(stdout, "Partial matrix %d:\n", mpiArgs.rank);
# else
    printf("Matrix:\n");
# endif /* HAVE_MPI */
    matrix_print(&A);
#endif /* NDEBUG */

    /* solve with conjugate gradient */
    if (status == 0) {
        status = conjugate(&A, &v, &u, &x_bar, globalArgs.e);
    } else {
        fprintf(stderr, "ERROR: Received conjugate method status %d\n", status);
        fflush(stderr);
    }

    /* print the vector into a gnuplot format */
    if (status == 0) {
        status = print_surface(&x_bar, globalArgs.s - 2, *bound_cond);
    }

    matrix_free(&A);
    vector_free(&u);
    vector_free(&v);
    vector_free(&x_bar);

#ifdef HAVE_MPI
    finalise();
#endif /* HAVE_MPI */

    return status;
}