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

pull/28/head
sigonasr2 1 year ago
parent 465fb0b6c2
commit 14564d814d
  1. 10
      Crawler/Animation.cpp
  2. 2
      Crawler/Version.h
  3. 9
      Crawler/safemap.h

@ -208,6 +208,16 @@ void sig::Animation::InitializeAnimations(){
CreateStillAnimation("charged_shot_arrow.png",{48,48}); CreateStillAnimation("charged_shot_arrow.png",{48,48});
CreateStillAnimation("laser.png",{5,1}); CreateStillAnimation("laser.png",{5,1});
CreateStillAnimation("range_indicator.png",{24,24}); 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(){ void sig::Animation::SetupPlayerAnimations(){

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

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