diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index e8b769a47..fd5d5a7d2 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -59,13 +59,13 @@ extern "C" { #define LAYOUT_INI "/layout.ini" #endif -bool Particle::update() { - pos.x+=speed.x; - pos.y+=speed.y; - speed.x*=friction; - speed.y*=friction; - speed.y+=gravity; - life-=lifeSpeed; +bool Particle::update(float frameTime) { + pos.x+=speed.x*frameTime; + pos.y+=speed.y*frameTime; + speed.x*=1.0-((1.0-friction)*frameTime); + speed.y*=1.0-((1.0-friction)*frameTime); + speed.y+=gravity*frameTime; + life-=lifeSpeed*frameTime; return (life>0); } @@ -1437,10 +1437,11 @@ void FurnaceGUI::drawVolMeter() { ImGuiStyle& style=ImGui::GetStyle(); ImGui::ItemSize(ImVec2(4.0f,4.0f),style.FramePadding.y); ImU32 lowColor=ImGui::GetColorU32(uiColors[GUI_COLOR_VOLMETER_LOW]); + float peakDecay=0.05f*60.0f*ImGui::GetIO().DeltaTime; if (ImGui::ItemAdd(rect,ImGui::GetID("volMeter"))) { ImGui::RenderFrame(rect.Min,rect.Max,ImGui::GetColorU32(ImGuiCol_FrameBg),true,style.FrameRounding); for (int i=0; i<2; i++) { - peak[i]*=0.95; + peak[i]*=1.0-peakDecay; if (peak[i]<0.0001) peak[i]=0.0; for (int j=0; joscSize; j++) { if (fabs(e->oscBuf[i][j])>peak[i]) { diff --git a/src/gui/gui.h b/src/gui/gui.h index 8db639ab5..495073a21 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -391,7 +391,7 @@ struct Particle { const char* type; ImVec2 pos, speed; float gravity, friction, life, lifeSpeed; - bool update(); + bool update(float frameTime); Particle(ImU32* color, const char* ty, float x, float y, float sX, float sY, float g, float fr, float l, float lS): colors(color), type(ty), diff --git a/src/gui/pattern.cpp b/src/gui/pattern.cpp index c6c78ba8d..7d9eb43ce 100644 --- a/src/gui/pattern.cpp +++ b/src/gui/pattern.cpp @@ -451,7 +451,7 @@ void FurnaceGUI::drawPattern() { chanHead.x*=0.25+keyHit[i]; chanHead.y*=0.25+keyHit[i]; chanHead.z*=0.25+keyHit[i]; chanHeadActive.x*=0.8; chanHeadActive.y*=0.8; chanHeadActive.z*=0.8; chanHeadHover.x*=0.4+keyHit[i]; chanHeadHover.y*=0.4+keyHit[i]; chanHeadHover.z*=0.4+keyHit[i]; - keyHit[i]-=0.02; + keyHit[i]-=0.02*60.0*ImGui::GetIO().DeltaTime; if (keyHit[i]<0) keyHit[i]=0; ImGui::PushStyleColor(ImGuiCol_Header,chanHead); ImGui::PushStyleColor(ImGuiCol_HeaderActive,chanHeadActive); @@ -717,6 +717,8 @@ void FurnaceGUI::drawPattern() { } } + float frameTime=ImGui::GetIO().DeltaTime*60.0f; + // note slides ImVec2 arrowPoints[7]; if (e->isPlaying()) for (int i=0; iAddPolyline(arrowPoints,7,ImGui::GetColorU32(col),ImDrawFlags_None,5.0f*dpiScale); } } - patChanSlideY[i]+=((ch->portaNote<=ch->note)?-8:8)*dpiScale; + patChanSlideY[i]+=((ch->portaNote<=ch->note)?-8:8)*dpiScale*frameTime; if (width>0) { if (patChanSlideY[i]<0) { patChanSlideY[i]=-fmod(-patChanSlideY[i],width*0.7); @@ -778,7 +780,7 @@ void FurnaceGUI::drawPattern() { ImDrawList* fdl=ImGui::GetForegroundDrawList(); for (size_t i=0; i255) part.life=255; fdl->AddText( iconFont,