diff options
| author | Petr Mrázek | 2011-08-07 06:13:07 +0000 |
|---|---|---|
| committer | Petr Mrázek | 2011-08-07 06:13:07 +0000 |
| commit | 6762c6d4a73291e949607fceb274e6e1a4aa2045 (patch) | |
| tree | 6b3f0e23e5f4b3b139c5641ea89ed3147ad2062c /GUI.cpp | |
| parent | 21c0ebbe4768413b97c15114a125828e674c3742 (diff) | |
| download | stonesense-6762c6d4a73291e949607fceb274e6e1a4aa2045.tar.gz stonesense-6762c6d4a73291e949607fceb274e6e1a4aa2045.tar.bz2 stonesense-6762c6d4a73291e949607fceb274e6e1a4aa2045.tar.xz | |
reuse the allegro path while loading the basic sprites
Diffstat (limited to 'GUI.cpp')
| -rw-r--r-- | GUI.cpp | 38 |
1 files changed, 3 insertions, 35 deletions
@@ -812,19 +812,17 @@ void paintboard(){ void loadGraphicsFromDisk()
{
- auto globulate = [](const char * filename, ALLEGRO_BITMAP *& imgd ) -> bool
+ ALLEGRO_PATH * p = al_create_path_for_directory("stonesense");
+ auto globulate = [&](const char * filename, ALLEGRO_BITMAP *& imgd ) -> bool
{
int index;
- ALLEGRO_PATH * p = al_create_path_for_directory("stonesense");
al_set_path_filename(p,filename);
index = loadImgFile(al_path_cstr(p,ALLEGRO_NATIVE_PATH_SEP));
if(index == -1)
{
- al_destroy_path(p);
return false;
}
imgd = al_create_sub_bitmap(IMGFilelist[index], 0, 0, al_get_bitmap_width(IMGFilelist[index]), al_get_bitmap_height(IMGFilelist[index]));
- al_destroy_path(p);
return true;
};
if(!globulate("objects.png", IMGObjectSheet)) return;
@@ -835,37 +833,7 @@ void loadGraphicsFromDisk() if(!globulate("engravings_floor.png", IMGEngFloorSheet)) return;
if(!globulate("engravings_left.png", IMGEngLeftSheet)) return;
if(!globulate("engravings_right.png", IMGEngRightSheet)) return;
-/*
- al_set_path_filename(p,"creatures.png");
- index = loadImgFile(al_path_cstr(p,ALLEGRO_NATIVE_PATH_SEP));
- if(index == -1) return;
- IMGCreatureSheet = al_create_sub_bitmap(IMGFilelist[index], 0, 0, al_get_bitmap_width(IMGFilelist[index]), al_get_bitmap_height(IMGFilelist[index]));
-
- al_set_path_filename(p,"ramps.png");
- index = loadImgFile(al_path_cstr(p,ALLEGRO_NATIVE_PATH_SEP));
- if(index == -1) return;
- IMGRampSheet = al_create_sub_bitmap(IMGFilelist[index], 0, 0, al_get_bitmap_width(IMGFilelist[index]), al_get_bitmap_height(IMGFilelist[index]));
-
- index = loadImgFile("SSStatusIcons.png");
- if(index == -1) return;
- IMGStatusSheet = al_create_sub_bitmap(IMGFilelist[index], 0, 0, al_get_bitmap_width(IMGFilelist[index]), al_get_bitmap_height(IMGFilelist[index]));
-
- index = loadImgFile("gibs.png");
- if(index == -1) return;
- IMGBloodSheet = al_create_sub_bitmap(IMGFilelist[index], 0, 0, al_get_bitmap_width(IMGFilelist[index]), al_get_bitmap_height(IMGFilelist[index]));
-
- index = loadImgFile("engravings_floor.png");
- if(index == -1) return;
- IMGEngFloorSheet = al_create_sub_bitmap(IMGFilelist[index], 0, 0, al_get_bitmap_width(IMGFilelist[index]), al_get_bitmap_height(IMGFilelist[index]));
-
- index = loadImgFile("engravings_left.png");
- if(index == -1) return;
- IMGEngLeftSheet = al_create_sub_bitmap(IMGFilelist[index], 0, 0, al_get_bitmap_width(IMGFilelist[index]), al_get_bitmap_height(IMGFilelist[index]));
-
- index = loadImgFile("engravings_right.png");
- if(index == -1) return;
- IMGEngRightSheet = al_create_sub_bitmap(IMGFilelist[index], 0, 0, al_get_bitmap_width(IMGFilelist[index]), al_get_bitmap_height(IMGFilelist[index]));
- */
+ al_destroy_path(p);
createEffectSprites();
}
|
