diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d544ad7f..0a743e74c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -604,6 +604,7 @@ src/gui/findReplace.cpp src/gui/gradient.cpp src/gui/grooves.cpp src/gui/insEdit.cpp +src/gui/intro.cpp src/gui/log.cpp src/gui/mixer.cpp src/gui/midiMap.cpp @@ -645,7 +646,7 @@ if (APPLE) list(APPEND GUI_SOURCES extern/nfd-modified/src/nfd_cocoa.mm) endif() -if (NOT WIN32 AND NOT APPLE) +if (NOT APPLE) list(APPEND GUI_SOURCES src/gui/icon.c) CHECK_INCLUDE_FILE(sys/io.h SYS_IO_FOUND) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 0fc1b54a2..597cd6908 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -5182,6 +5182,10 @@ bool FurnaceGUI::loop() { ImGui::EndPopup(); } + if (!tutorial.introPlayed) { + drawIntro(); + } + layoutTimeEnd=SDL_GetPerformanceCounter(); // backup trigger @@ -6214,7 +6218,8 @@ FurnaceGUI::FurnaceGUI(): waveGenOffsetY(0), waveGenSmooth(1), waveGenAmplify(1.0f), - waveGenFM(false) { + waveGenFM(false), + introPos(0.0) { // value keys valueKeys[SDLK_0]=0; valueKeys[SDLK_1]=1; diff --git a/src/gui/gui.h b/src/gui/gui.h index 6c22361f4..3c6f8c9e8 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1473,7 +1473,7 @@ class FurnaceGUI { bool taken[GUI_TUTORIAL_MAX]; Tutorial(): userComesFrom(0), - introPlayed(0) { + introPlayed(false) { memset(taken,0,GUI_TUTORIAL_MAX*sizeof(bool)); } } tutorial; @@ -1803,6 +1803,9 @@ class FurnaceGUI { bool waveGenFMCon4[5]; bool waveGenFM; + // intro + double introPos; + void drawSSGEnv(unsigned char type, const ImVec2& size); void drawWaveform(unsigned char type, bool opz, const ImVec2& size); void drawAlgorithm(unsigned char alg, FurnaceGUIFMAlgs algType, const ImVec2& size); @@ -1879,6 +1882,7 @@ class FurnaceGUI { void drawSysManager(); void drawRegView(); void drawAbout(); + void drawIntro(); void drawSettings(); void drawDebug(); void drawNewSong(); diff --git a/src/gui/intro.cpp b/src/gui/intro.cpp new file mode 100644 index 000000000..864e4f12f --- /dev/null +++ b/src/gui/intro.cpp @@ -0,0 +1,42 @@ +/** + * Furnace Tracker - multi-system chiptune tracker + * Copyright (C) 2021-2023 tildearrow and contributors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "gui.h" +#include "imgui_internal.h" + +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)) { + ImDrawList* dl=ImGui::GetForegroundDrawList(); + ImVec2 top=ImVec2(0.0f,0.0f); + ImVec2 bottom=ImVec2(canvasW,canvasH); + + ImU32 bgColor=ImGui::GetColorU32(ImVec4(0.0f,0.0f,0.0f,1.0f)); + + dl->AddRectFilled(top,bottom,bgColor); + dl->AddText(top,0xffffffff,"Furnace intro"); + } + ImGui::End(); + } +}