diff --git a/src/gui/gui.h b/src/gui/gui.h index fd2828e74..e852e8d4d 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1005,12 +1005,14 @@ struct FurnaceGUITutorialStep { const char* text; int waitForTrigger; TutorialFunc run; + TutorialFunc runBefore; TutorialFunc runAfter; - FurnaceGUITutorialStep(const char* t, int trigger=-1, TutorialFunc activeFunc=NULL, TutorialFunc endFunc=NULL): + FurnaceGUITutorialStep(const char* t, int trigger=-1, TutorialFunc activeFunc=NULL, TutorialFunc beginFunc=NULL, TutorialFunc endFunc=NULL): text(t), waitForTrigger(trigger), run(activeFunc), + runBefore(beginFunc), runAfter(endFunc) {} }; diff --git a/src/gui/tutorial.cpp b/src/gui/tutorial.cpp index e60c0f433..9d06ec5bc 100644 --- a/src/gui/tutorial.cpp +++ b/src/gui/tutorial.cpp @@ -46,25 +46,62 @@ void FurnaceGUI::initTutorial() { "this is the Pattern window. it displays a pattern (which contains the notes and stuff).", -1, [this]() { - nextWindow=GUI_WINDOW_PATTERN; highlightWindow("Pattern"); + }, + [this]() { + nextWindow=GUI_WINDOW_PATTERN; } ), TS( - "this is the Orders window. it displays which patterns are going to play." + "this is the Orders window. it displays which patterns are going to play.", + -1, + [this]() { + highlightWindow("Orders"); + }, + [this]() { + nextWindow=GUI_WINDOW_ORDERS; + } ), TS( - "this is the Instruments window. it shows a list of instruments (sounds) in the song." + "this is the Instruments window. it shows a list of instruments (sounds) in the song.", + -1, + [this]() { + highlightWindow("Instruments"); + }, + [this]() { + nextWindow=GUI_WINDOW_INS_LIST; + } ), TS( - "this is the Song Information window, which allows you to change some song properties." + "this is the Song Information window, which allows you to change some song properties.", + -1, + [this]() { + highlightWindow("Song Info"); + }, + [this]() { + nextWindow=GUI_WINDOW_SONG_INFO; + } ), TS( - "this is the Speed window, which contains speed parameters." + "this is the Speed window, which contains speed parameters.", + -1, + [this]() { + highlightWindow("Speed"); + }, + [this]() { + nextWindow=GUI_WINDOW_SPEED; + } ), TS( "and here are the Play Controls. you can use these to play the song and do some other things.\n" - "now that I am done explaining the interface, let's make a song!" + "now that I am done explaining the interface, let's make a song!", + -1, + [this]() { + highlightWindow("Play Controls"); + }, + [this]() { + nextWindow=GUI_WINDOW_EDIT_CONTROLS; + } ), TS( "we'll start by creating an instrument.\n" @@ -251,23 +288,27 @@ void FurnaceGUI::drawTutorial() { // tutorial if (curTutorial>=0 && curTutorial=(int)tutorials[curTutorial].steps.size()) { - tutorial.taken[curTutorial]=true; - curTutorial=-1; - curTutorialStep=0; + if (ImGui::Button(ICON_FA_CHEVRON_RIGHT)) { + curTutorialStep++; + if (step.runAfter!=NULL) step.runAfter(); + if (curTutorialStep>=(int)tutorials[curTutorial].steps.size()) { + tutorial.taken[curTutorial]=true; + curTutorial=-1; + curTutorialStep=0; + } else { + if (tutorials[curTutorial].steps[curTutorialStep].runBefore) tutorials[curTutorial].steps[curTutorialStep].runBefore(); + } } } + ImGui::End(); } - ImGui::End(); } }