From 21cadbda581b4fdbf83c985f704bfe319cc24a07 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 7 Mar 2023 01:21:07 -0500 Subject: [PATCH] GUI: add function to highlight window - DO NOT USE --- src/gui/gui.h | 2 ++ src/gui/tutorial.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index 167e8236d..fd2828e74 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1923,6 +1923,8 @@ class FurnaceGUI { void pushToggleColors(bool status); void popToggleColors(); + void highlightWindow(const char* winName); + FurnaceGUIImage* getImage(FurnaceGUIImages image); SDL_Texture* getTexture(FurnaceGUIImages image, SDL_BlendMode blendMode=SDL_BLENDMODE_BLEND); void drawImage(ImDrawList* dl, FurnaceGUIImages image, const ImVec2& pos, const ImVec2& scale, double rotate, const ImVec2& uvMin, const ImVec2& uvMax, const ImVec4& imgColor); diff --git a/src/gui/tutorial.cpp b/src/gui/tutorial.cpp index 6741399e6..e60c0f433 100644 --- a/src/gui/tutorial.cpp +++ b/src/gui/tutorial.cpp @@ -20,6 +20,7 @@ #include "gui.h" #include "../ta-log.h" #include "IconsFontAwesome4.h" +#include "imgui_internal.h" #define TS FurnaceGUITutorialStep @@ -42,7 +43,12 @@ void FurnaceGUI::initTutorial() { "the order in which these patterns appear is determined by an order list which also scrolls down as the playhead moves between patterns." ), TS( - "this is the Pattern window. it displays a pattern (which contains the notes and stuff)." + "this is the Pattern window. it displays a pattern (which contains the notes and stuff).", + -1, + [this]() { + nextWindow=GUI_WINDOW_PATTERN; + highlightWindow("Pattern"); + } ), TS( "this is the Orders window. it displays which patterns are going to play." @@ -190,7 +196,7 @@ void FurnaceGUI::commitTutorial() { } void FurnaceGUI::activateTutorial(FurnaceGUITutorials which) { - if (tutorial.welcome && !tutorial.taken[which] && !ImGui::IsPopupOpen(NULL,ImGuiPopupFlags_AnyPopupId|ImGuiPopupFlags_AnyPopupLevel) && curTutorial==-1 && introPos>=10.0) { + if (tutorial.welcome && !tutorial.taken[which] && !ImGui::IsPopupOpen((const char*)NULL,ImGuiPopupFlags_AnyPopupId|ImGuiPopupFlags_AnyPopupLevel) && curTutorial==-1 && introPos>=10.0) { logV("activating tutorial %d.",which); curTutorial=which; curTutorialStep=0; @@ -247,6 +253,7 @@ void FurnaceGUI::drawTutorial() { if (curTutorial>=0 && curTutorialPos; + ImVec2 end=ImVec2( + start.x+win->Size.x, + start.y+win->Size.y + ); + + dl->AddRectFilled( + ImVec2(0,0), + ImVec2(start.x,canvasH), + col + ); + dl->AddRectFilled( + ImVec2(start.x,0), + ImVec2(canvasW,start.y), + col + ); + dl->AddRectFilled( + ImVec2(end.x,start.y), + ImVec2(canvasW,canvasH), + col + ); + dl->AddRectFilled( + ImVec2(start.x,end.y), + ImVec2(end.x,canvasH), + col + ); + + dl->AddRect(start,end,ImGui::GetColorU32(uiColors[GUI_COLOR_TEXT]),0,0,3.0f*dpiScale); + } else { + dl->AddRectFilled( + ImVec2(0,0), + ImVec2(canvasW,canvasH), + col + ); + } +} + FurnaceGUITutorialDef::FurnaceGUITutorialDef(const char* n, std::initializer_list step): name(n) { steps=step;