Fixed fElapsedTime bug going negative seemingly randomly. Thank std::chrono::library::that::is::way::too::annoying::to::use::and::apparently::is::not::ultra::accurate
This commit is contained in:
+5
-5
@@ -96,7 +96,7 @@ bool Crawler::OnUserCreate(){
|
||||
}
|
||||
|
||||
bool Crawler::OnUserUpdate(float fElapsedTime){
|
||||
fElapsedTime=std::min(1/60.f,fElapsedTime);
|
||||
fElapsedTime=std::clamp(fElapsedTime,0.f,1/60.f);
|
||||
HandleUserInput(fElapsedTime);
|
||||
UpdateEffects(fElapsedTime);
|
||||
player->Update(fElapsedTime);
|
||||
@@ -727,16 +727,16 @@ void Crawler::RenderHud(){
|
||||
player->GetAbility3(),
|
||||
player->GetAbility4(),
|
||||
};
|
||||
std::vector<Ability>activeCooldowns;
|
||||
std::copy_if(cooldowns.begin(),cooldowns.end(),std::back_inserter(activeCooldowns),[](Ability a){
|
||||
std::vector<Ability>activeCooldowns{};
|
||||
std::copy_if(cooldowns.begin(),cooldowns.end(),std::back_inserter(activeCooldowns),[](Ability&a){
|
||||
return a.cooldown>0;
|
||||
});
|
||||
std::sort(activeCooldowns.begin(),activeCooldowns.end(),[](Ability&a1,Ability&a2){
|
||||
std::sort(activeCooldowns.begin(),activeCooldowns.end(),[&](Ability&a1,Ability&a2){
|
||||
return a1.cooldown<a2.cooldown;
|
||||
});
|
||||
int offset=6*activeCooldowns.size();
|
||||
for(Ability&a:activeCooldowns){
|
||||
if(a.cooldown>0){
|
||||
if(a.cooldown>0.1){
|
||||
FillRectDecal(vf2d{10,ScreenHeight()-22.f}-vf2d{0,float(offset)},{64,6},BLACK);
|
||||
FillRectDecal(vf2d{11,ScreenHeight()-21.f}-vf2d{0,float(offset)},{62,4},DARK_GREY);
|
||||
GradientFillRectDecal(vf2d{10,ScreenHeight()-22.f}-vf2d{0,float(offset)},{(a.cooldown/a.COOLDOWN_TIME)*64,6},a.barColor1,a.barColor1,a.barColor2,a.barColor2);
|
||||
|
||||
Reference in New Issue
Block a user