Exemplo n.º 1
0
void Level1_PreloadBitmaps(struct Game *game, void (*progress)(struct Game*, float)) {
	PROGRESS_INIT(Level1_PreloadSteps());
	game->level.level1.owl = LoadScaledBitmap("levels/1/owl.png", game->viewportWidth*0.08, game->viewportWidth*0.08);
	PROGRESS;
	game->level.letter_font = al_load_ttf_font(GetDataFilePath("fonts/DejaVuSans.ttf"),game->viewportHeight*0.0225,0 );
	PROGRESS;
	game->level.letter = LoadScaledBitmap("levels/1/letter.png", game->viewportHeight*1.3, game->viewportHeight*1.2);
	al_set_target_bitmap(game->level.letter);
	float y = 0.20;
	float x = 0.19;
	void draw_text(char* text) {
		al_draw_text(game->level.letter_font, al_map_rgb(0,0,0), al_get_bitmap_width(game->level.letter)*x, game->viewportHeight*y, ALLEGRO_ALIGN_LEFT, text);
		y+=0.028;
	}
Exemplo n.º 2
0
void Loading_Load(struct Game *game) {
	al_clear_to_color(al_map_rgb(0,0,0));

	game->loading.loading_bitmap = al_create_bitmap(game->viewportWidth, game->viewportHeight);

	game->loading.image1 = LoadScaledBitmap("loading1.png", game->viewportWidth, game->viewportHeight);

	draw(game,game->loading.image1);
	al_draw_bitmap(game->loading.loading_bitmap,0,0,0);

	game->loading.image2 = LoadScaledBitmap("loading2.png", game->viewportWidth, game->viewportHeight);
	game->loading.image3 = LoadScaledBitmap("loading3.png", game->viewportWidth, game->viewportHeight);
	game->loading.image4 = LoadScaledBitmap("loading4.png", game->viewportWidth, game->viewportHeight);
}
Exemplo n.º 3
0
wxBitmap LoadScaledThemeBitmap(const std::string& name, const wxWindow* context,
                               const wxSize& output_size, const wxRect& usable_rect, LSIFlags flags,
                               const wxColour& fill_color)
{
  std::string path = File::GetThemeDir(SConfig::GetInstance().theme_name) + name + ".png";
  return LoadScaledBitmap(path, context, output_size, usable_rect, flags, fill_color);
}
Exemplo n.º 4
0
wxBitmap LoadScaledResourceBitmap(const std::string& name, const wxWindow* context,
                                  const wxSize& output_size, const wxRect& usable_rect,
                                  LSIFlags flags, const wxColour& fill_color)
{
  std::string path = File::GetSysDirectory() + RESOURCES_DIR DIR_SEP + name + ".png";
  return LoadScaledBitmap(path, context, output_size, usable_rect, flags, fill_color);
}
Exemplo n.º 5
0
wxBitmap PoeditArtProvider::CreateBitmap(const wxArtID& id,
                                         const wxArtClient& client,
                                         const wxSize& size)
{
    // Silence warning about unused parameter in some of the builds
    (void)client;
    (void)size;

    // Note: On Unix, this code is only called as last resolt, if standard
    //       theme provider (that uses current icon theme and files from
    //       /usr/share/icons/<theme>) didn't find any matching icon.

    wxLogTrace("poedit.icons", "getting icon '%s'", id.c_str());

#ifdef __WXGTK20__
    // try legacy GNOME icons from standard theme:
    wxString gnomeId = GetGnomeStockId(id);
    if ( !gnomeId.empty() )
    {
        wxLogTrace("poedit.icons", "-> legacy '%s'", gnomeId.c_str());
        wxBitmap gbmp(wxArtProvider::GetBitmap(gnomeId, client, size));
        if ( gbmp.Ok() )
            return gbmp;
    }
#endif // __WXGTK20__

    wxString iconsdir =
#if defined(__WXMSW__)
        wxStandardPaths::Get().GetResourcesDir() + "\\Resources";
#else
        wxStandardPaths::Get().GetInstallPrefix() + "/share/poedit/icons";
#endif
    if ( !wxDirExists(iconsdir) )
    {
        wxLogTrace("poedit.icons",
                   "icons dir %s not found", iconsdir.c_str());
        return wxNullBitmap;
    }

    wxString icon;
    icon.Printf("%s/%s", iconsdir.c_str(), id.c_str());
    wxLogTrace("poedit.icons", "loading from %s", icon.c_str());
    return LoadScaledBitmap(icon);
}
Exemplo n.º 6
0
void Menu_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
	PROGRESS_INIT(16);

	game->menu.options.fullscreen = game->fullscreen;
	game->menu.options.fps = game->fps;
	game->menu.options.width = game->width;
	game->menu.options.height = game->height;
	game->menu.loaded = true;
	game->menu.image = LoadScaledBitmap( "menu/menu.png", game->viewportWidth, game->viewportWidth*(1240.0/3910.0));
	PROGRESS;
	game->menu.mountain = LoadScaledBitmap( "menu/mountain.png", game->viewportHeight*1.6*0.055, game->viewportHeight/9 );
	PROGRESS;
	game->menu.cloud = LoadScaledBitmap( "menu/cloud.png", game->viewportHeight*1.6*0.5, game->viewportHeight*0.25 );
	PROGRESS;
	game->menu.cloud2 = LoadScaledBitmap( "menu/cloud2.png", game->viewportHeight*1.6*0.2, game->viewportHeight*0.1 );
	PROGRESS;
	game->menu.logo = LoadScaledBitmap( "menu/logo.png", game->viewportHeight*1.6*0.3, game->viewportHeight*0.35 );
	game->menu.blurbg = al_create_bitmap(game->viewportHeight*1.6*0.3, game->viewportHeight*0.35);
	game->menu.blurbg2 = al_create_bitmap(game->viewportHeight*1.6*0.3, game->viewportHeight*0.35);
	PROGRESS;
	game->menu.logoblur = al_create_bitmap(game->viewportHeight*1.6*0.3+4, game->viewportHeight*0.35+4);
	al_set_target_bitmap(game->menu.logoblur);
	al_clear_to_color(al_map_rgba(0,0,0,0));
	float alpha = (1.0/40.0);
	ALLEGRO_COLOR color = al_map_rgba_f(alpha, alpha, alpha, alpha);
	int by, bx;
	for (by = -2; by <= 2; by++) {
		for (bx = -2; bx <= 2; bx++) {
			if (sqrt(bx*bx+by*by) <= 2)
				al_draw_tinted_bitmap(game->menu.logo, color, bx, by, 0);
		}
	}
	al_set_target_bitmap(al_get_backbuffer(game->display));
	PROGRESS;
	game->menu.glass = LoadScaledBitmap( "menu/glass.png", game->viewportHeight*1.6*0.3, game->viewportHeight*0.35 );
	PROGRESS;
	//game->menu.pinkcloud = LoadScaledBitmap( "menu/pinkcloud.png", game->viewportWidth*0.33125, game->viewportHeight*0.8122);
	game->menu.pinkcloud = LoadScaledBitmap( "menu/pinkcloud.png", game->viewportHeight*0.8122*(1171.0/2218.0), game->viewportHeight*0.8122);
	PROGRESS;
	al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP);
	game->menu.rain = al_load_bitmap( GetDataFilePath("menu/rain.png") );
	PROGRESS;
	game->menu.pie = al_load_bitmap( GetDataFilePath("menu/pie.png") );
	al_set_new_bitmap_flags(ALLEGRO_MAG_LINEAR | ALLEGRO_MIN_LINEAR);
	PROGRESS;

	game->menu.sample = al_load_sample( GetDataFilePath("menu/menu.flac") );
	PROGRESS;
	game->menu.rain_sample = al_load_sample( GetDataFilePath("menu/rain.flac") );
	PROGRESS;
	game->menu.click_sample = al_load_sample( GetDataFilePath("menu/click.flac") );
	PROGRESS;
	game->menu.mountain_position = game->viewportWidth*0.7;

	game->menu.music = al_create_sample_instance(game->menu.sample);
	al_attach_sample_instance_to_mixer(game->menu.music, game->audio.music);
	al_set_sample_instance_playmode(game->menu.music, ALLEGRO_PLAYMODE_LOOP);

	game->menu.rain_sound = al_create_sample_instance(game->menu.rain_sample);
	al_attach_sample_instance_to_mixer(game->menu.rain_sound, game->audio.fx);
	al_set_sample_instance_playmode(game->menu.rain_sound, ALLEGRO_PLAYMODE_LOOP);

	game->menu.click = al_create_sample_instance(game->menu.click_sample);
	al_attach_sample_instance_to_mixer(game->menu.click, game->audio.fx);
	al_set_sample_instance_playmode(game->menu.click, ALLEGRO_PLAYMODE_ONCE);

	game->menu.font_title = al_load_ttf_font(GetDataFilePath("fonts/ShadowsIntoLight.ttf"),game->viewportHeight*0.16,0 );
	game->menu.font_subtitle = al_load_ttf_font(GetDataFilePath("fonts/ShadowsIntoLight.ttf"),game->viewportHeight*0.08,0 );
	game->menu.font = al_load_ttf_font(GetDataFilePath("fonts/ShadowsIntoLight.ttf"),game->viewportHeight*0.05,0 );
	game->menu.font_selected = al_load_ttf_font(GetDataFilePath("fonts/ShadowsIntoLight.ttf"),game->viewportHeight*0.065,0 );
	PROGRESS;

	if (!game->menu.sample){
		fprintf(stderr, "Audio clip sample not loaded!\n" );
		exit(-1);
	}

	if (!game->menu.rain_sample){
		fprintf(stderr, "Audio clip sample#2 not loaded!\n" );
		exit(-1);
	}

	if (!game->menu.click_sample){
		fprintf(stderr, "Audio clip sample#3 not loaded!\n" );
		exit(-1);
	}

	game->menu.pinkcloud_bitmap = al_create_bitmap(game->viewportHeight*0.8122*(1171.0/2218.0), game->viewportHeight);

	game->menu.pie_bitmap = al_create_bitmap(game->viewportHeight*0.8, game->viewportHeight);
	al_set_target_bitmap(game->menu.pie_bitmap);
	al_clear_to_color(al_map_rgba(0,0,0,0));
	al_draw_scaled_bitmap(game->menu.pie, 0, 0, al_get_bitmap_width(game->menu.pie), al_get_bitmap_height(game->menu.pie), al_get_bitmap_width(game->menu.pie_bitmap)*0.5, 0, game->viewportHeight*1.6*0.11875, game->viewportHeight*0.0825, 0);
	al_draw_scaled_bitmap(game->menu.pie, 0, 0, al_get_bitmap_width(game->menu.pie), al_get_bitmap_height(game->menu.pie), al_get_bitmap_width(game->menu.pie_bitmap)*0.1, al_get_bitmap_height(game->menu.pie_bitmap)*0.3, game->viewportHeight*1.6*0.09, game->viewportHeight*0.06, ALLEGRO_FLIP_HORIZONTAL);
	al_draw_scaled_bitmap(game->menu.pie, 0, 0, al_get_bitmap_width(game->menu.pie), al_get_bitmap_height(game->menu.pie), al_get_bitmap_width(game->menu.pie_bitmap)*0.3, al_get_bitmap_height(game->menu.pie_bitmap)*0.6, game->viewportHeight*1.6*0.13, game->viewportHeight*0.1, 0);
	al_destroy_bitmap(game->menu.pie);
	PROGRESS;

	al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP);
	game->menu.rain_bitmap = al_create_bitmap(al_get_bitmap_width(game->menu.pinkcloud_bitmap)*0.5, al_get_bitmap_height(game->menu.pinkcloud_bitmap)*0.1);
	al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR);
	al_set_target_bitmap(game->menu.rain_bitmap);
	al_clear_to_color(al_map_rgba(0,0,0,0));
	al_draw_scaled_bitmap(game->menu.rain,0, 0, al_get_bitmap_width(game->menu.rain), al_get_bitmap_height(game->menu.rain), 0, 0, al_get_bitmap_width(game->menu.rain_bitmap), al_get_bitmap_height(game->menu.rain_bitmap),0);
	al_destroy_bitmap(game->menu.rain);
	PROGRESS;
}
Exemplo n.º 7
0
wxBitmap PoeditArtProvider::CreateBitmap(const wxArtID& id_,
                                         const wxArtClient& client,
                                         const wxSize& size)
{
    wxLogTrace("poedit.icons", "getting icon '%s'", id_.c_str());

    wxArtID id(id_);
    #define CHECK_FOR_VARIANT(name)                         \
        const bool name##Variant = id.Contains("@" #name);  \
        if (name##Variant)                                  \
            id.Replace("@" #name, "")
    CHECK_FOR_VARIANT(disabled);
    CHECK_FOR_VARIANT(opaque);
    CHECK_FOR_VARIANT(inverted);

    // Silence warning about unused parameter in some of the builds
    (void)client;
    (void)size;

    // Note: On Unix, this code is only called as last resort, if standard
    //       theme provider (that uses current icon theme and files from
    //       /usr/share/icons/<theme>) didn't find any matching icon.

#ifdef __WXGTK20__
    // try legacy GNOME icons from standard theme:
    wxString gnomeId = GetGnomeStockId(id);
    if ( !gnomeId.empty() )
    {
        wxLogTrace("poedit.icons", "-> legacy '%s'", gnomeId.c_str());
        wxBitmap gbmp(wxArtProvider::GetBitmap(gnomeId, client, size));
        if ( gbmp.Ok() )
            return gbmp;
    }
#endif // __WXGTK20__

    auto iconsdir = GetIconsDir();
    if ( !wxDirExists(iconsdir) )
    {
        wxLogTrace("poedit.icons",
                   "icons dir %s not found", iconsdir.c_str());
        return wxNullBitmap;
    }

    wxString icon;
    icon.Printf("%s/%s", iconsdir, id);
    wxLogTrace("poedit.icons", "loading from %s", icon);
    wxImage img;
    if (ColorScheme::GetAppMode() == ColorScheme::Dark)
        img = LoadScaledBitmap(icon + "Dark");
    if (!img.IsOk())
        img = LoadScaledBitmap(icon);

    if (!img.IsOk())
    {
        wxLogTrace("poedit.icons", "failed to load icon '%s'", id);
        return wxNullBitmap;
    }

    if (id.EndsWith("Template"))
        ProcessTemplateImage(img, opaqueVariant, invertedVariant);

    if (disabledVariant)
        img = img.ConvertToDisabled();

    if (wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft && ShouldBeMirorredInRTL(id, client))
    {
        img = img.Mirror();
    }

#ifdef __WXMSW__
    if (client == wxART_TOOLBAR && IsWindows10OrGreater())
    {
        const int padding = PX(1);
        auto sz = img.GetSize();
        sz.IncBy(padding * 2);
        img.Resize(sz, wxPoint(padding, padding));
    }
#endif // __WXMSW__

    return wxBitmap(img);
}