diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 9f5a0d606..6d04d3821 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -5182,6 +5182,7 @@ bool FurnaceGUI::loop() { } if (!tutorial.introPlayed) { + initialScreenWipe=0; drawIntro(); } @@ -5233,6 +5234,20 @@ bool FurnaceGUI::loop() { ImGui::Render(); renderTimeEnd=SDL_GetPerformanceCounter(); ImGui_ImplSDLRenderer_RenderDrawData(ImGui::GetDrawData()); + if (mustClear) { + SDL_RenderClear(sdlRend); + mustClear--; + } else { + if (initialScreenWipe>0.0f) { + WAKE_UP; + initialScreenWipe-=ImGui::GetIO().DeltaTime*5.0f; + if (initialScreenWipe>0.0f) { + SDL_SetRenderDrawBlendMode(sdlRend,SDL_BLENDMODE_BLEND); + SDL_SetRenderDrawColor(sdlRend,0,0,0,255*initialScreenWipe); + SDL_RenderFillRect(sdlRend,NULL); + } + } + } SDL_RenderPresent(sdlRend); layoutTimeDelta=layoutTimeEnd-layoutTimeBegin; @@ -6222,7 +6237,9 @@ FurnaceGUI::FurnaceGUI(): waveGenSmooth(1), waveGenAmplify(1.0f), waveGenFM(false), - introPos(0.0) { + introPos(0.0), + mustClear(2), + initialScreenWipe(1.0f) { // value keys valueKeys[SDLK_0]=0; valueKeys[SDLK_1]=1; diff --git a/src/gui/gui.h b/src/gui/gui.h index 514c32ca3..c1f267b1e 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1495,7 +1495,7 @@ class FurnaceGUI { bool taken[GUI_TUTORIAL_MAX]; Tutorial(): userComesFrom(0), - introPlayed(false) { + introPlayed(true) { memset(taken,0,GUI_TUTORIAL_MAX*sizeof(bool)); } } tutorial; @@ -1829,6 +1829,8 @@ class FurnaceGUI { // intro double introPos; + int mustClear; + float initialScreenWipe; void drawSSGEnv(unsigned char type, const ImVec2& size); void drawWaveform(unsigned char type, bool opz, const ImVec2& size); diff --git a/src/gui/intro.cpp b/src/gui/intro.cpp index 51b1ca745..abde9fd82 100644 --- a/src/gui/intro.cpp +++ b/src/gui/intro.cpp @@ -33,26 +33,21 @@ void FurnaceGUI::drawImage(ImDrawList* dl, FurnaceGUIImages image, const ImVec2& -rectMin.y ); - ImVec2 posAbs=ImVec2( - pos.x*canvasW, - pos.y*canvasH - ); - ImVec2 quad0=ImVec2( - posAbs.x+rectMin.x*cos(rotate)-rectMin.y*sin(rotate), - posAbs.y+rectMin.x*sin(rotate)+rectMin.y*cos(rotate) + pos.x+rectMin.x*cos(rotate)-rectMin.y*sin(rotate), + pos.y+rectMin.x*sin(rotate)+rectMin.y*cos(rotate) ); ImVec2 quad1=ImVec2( - posAbs.x+rectMax.x*cos(rotate)-rectMin.y*sin(rotate), - posAbs.y+rectMax.x*sin(rotate)+rectMin.y*cos(rotate) + pos.x+rectMax.x*cos(rotate)-rectMin.y*sin(rotate), + pos.y+rectMax.x*sin(rotate)+rectMin.y*cos(rotate) ); ImVec2 quad2=ImVec2( - posAbs.x+rectMax.x*cos(rotate)-rectMax.y*sin(rotate), - posAbs.y+rectMax.x*sin(rotate)+rectMax.y*cos(rotate) + pos.x+rectMax.x*cos(rotate)-rectMax.y*sin(rotate), + pos.y+rectMax.x*sin(rotate)+rectMax.y*cos(rotate) ); ImVec2 quad3=ImVec2( - posAbs.x+rectMin.x*cos(rotate)-rectMax.y*sin(rotate), - posAbs.y+rectMin.x*sin(rotate)+rectMax.y*cos(rotate) + pos.x+rectMin.x*cos(rotate)-rectMax.y*sin(rotate), + pos.y+rectMin.x*sin(rotate)+rectMax.y*cos(rotate) ); ImVec2 uv0=ImVec2(uvMin.x,uvMin.y); @@ -69,7 +64,6 @@ void FurnaceGUI::drawIntro() { if (introPos<7.0) { WAKE_UP; nextWindow=GUI_WINDOW_NOTHING; - introPos+=ImGui::GetIO().DeltaTime; ImGui::SetNextWindowPos(ImVec2(0,0)); ImGui::SetNextWindowSize(ImVec2(canvasW,canvasH)); if (ImGui::Begin("Intro",NULL,ImGuiWindowFlags_Modal)) { @@ -82,8 +76,12 @@ void FurnaceGUI::drawIntro() { dl->AddRectFilled(top,bottom,bgColor); dl->AddText(top,0xffffffff,"Furnace intro - work in progress"); - drawImage(dl,GUI_IMAGE_TALOGO,ImVec2(0.5,0.5),ImVec2(1.0,1.0),introPos,ImVec2(0.0,0.0),ImVec2(1.0,1.0),ImVec4(1.0,1.0,1.0,1.0)); + drawImage(dl,GUI_IMAGE_TALOGO,ImVec2(0.5*canvasW,0.5*canvasH),ImVec2(1.0,1.0),0.0f,ImVec2(0.0,0.0),ImVec2(1.0,1.0),ImVec4(1.0,1.0,1.0,pow(MIN(1.0,introPos*2.0),0.8))); } ImGui::End(); + + if (mustClear<=0) { + introPos+=ImGui::GetIO().DeltaTime; + } } }