Animations that are missing from the animation map now auto-generate after animations have been defined.

This commit is contained in:
sigonasr2 2023-09-16 07:22:44 -05:00
parent 465fb0b6c2
commit 14564d814d
3 changed files with 20 additions and 1 deletions

View File

@ -208,6 +208,16 @@ void sig::Animation::InitializeAnimations(){
CreateStillAnimation("charged_shot_arrow.png",{48,48});
CreateStillAnimation("laser.png",{5,1});
CreateStillAnimation("range_indicator.png",{24,24});
for(auto&dat:GFX){
std::string imgFile=dat.first;
if(!ANIMATION_DATA.count(imgFile)){
std::cout<<"WARNING! Animation data for "<<imgFile<<" not found! Auto-generating..."<<std::endl;
CreateStillAnimation(imgFile,GFX[imgFile].Sprite()->Size());
std::map<int,int>test;
test.begin();
}
}
}
void sig::Animation::SetupPlayerAnimations(){

View File

@ -2,7 +2,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 0
#define VERSION_BUILD 1318
#define VERSION_BUILD 1324
#define stringify(a) stringify_(a)
#define stringify_(a) #a

View File

@ -14,6 +14,9 @@ public:
}
return map[key];
}
size_t count(T key){
return map.count(key);
}
void SetInitialized(){
initialized=true;
}
@ -25,4 +28,10 @@ public:
initialized=false;
map.clear();
}
auto begin()const{
return map.begin();
}
auto end()const{
return map.end();
}
};