change copied timer to deltatime

This commit is contained in:
Eknous-P 2024-09-22 11:55:54 +04:00
parent 8dc8bc285d
commit 07b41e03c8
2 changed files with 6 additions and 6 deletions

View file

@ -2277,7 +2277,7 @@ class FurnaceGUI {
struct Tutorial { struct Tutorial {
bool introPlayed; bool introPlayed;
bool protoWelcome; bool protoWelcome;
unsigned short popupTimer; double popupTimer;
Tutorial(): Tutorial():
#ifdef SUPPORT_XP #ifdef SUPPORT_XP
introPlayed(true), introPlayed(true),
@ -2285,7 +2285,7 @@ class FurnaceGUI {
introPlayed(false), introPlayed(false),
#endif #endif
protoWelcome(false), protoWelcome(false),
popupTimer(65535) { popupTimer(1.0f) {
} }
} tutorial; } tutorial;

View file

@ -716,16 +716,16 @@ void FurnaceGUI::drawTutorial() {
(canvasH-ImGui::GetWindowSize().y)*0.5 (canvasH-ImGui::GetWindowSize().y)*0.5
)); ));
if (tutorial.popupTimer<40) { if (tutorial.popupTimer<0.6f) {
ImDrawList* dl=ImGui::GetForegroundDrawList(); ImDrawList* dl=ImGui::GetForegroundDrawList();
const ImVec2 winPos=ImGui::GetWindowPos(); const ImVec2 winPos=ImGui::GetWindowPos();
const ImVec2 winSize=ImGui::GetWindowSize();
const ImVec2 txtSize=ImGui::CalcTextSize("copied!"); const ImVec2 txtSize=ImGui::CalcTextSize("copied!");
const ImVec2 winSize=ImGui::GetWindowSize();
dl->AddText(ImVec2( dl->AddText(ImVec2(
winPos.x+(winSize.x-txtSize.x)/2, winPos.x+(winSize.x-txtSize.x)/2,
winPos.y+(winSize.y-txtSize.y*2) winPos.y+(winSize.y-txtSize.y*2)
),ImGui::ColorConvertFloat4ToU32(uiColors[GUI_COLOR_ACCENT_SECONDARY]),"copied!"); ),ImGui::ColorConvertFloat4ToU32(uiColors[GUI_COLOR_TOGGLE_ON]),"copied!");
tutorial.popupTimer++; tutorial.popupTimer+=ImGui::GetIO().DeltaTime;
} }
ImGui::EndPopup(); ImGui::EndPopup();
} }