From 7a05f902ea2061440ef60a7676218389422e0770 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 15 Feb 2022 18:52:12 -0500 Subject: [PATCH] i need to go --- src/gui/gui.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++++- src/gui/gui.h | 19 +++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index a2a28987..c929fc21 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -169,6 +169,18 @@ const char* pitchLabel[11]={ String getHomeDir(); +ImU32 partTest[256]; + +bool Particle::update() { + pos.x+=speed.x; + pos.y+=speed.y; + speed.x*=friction; + speed.y*=friction; + speed.y+=gravity; + life-=lifeSpeed; + return (life>0); +} + void FurnaceGUI::bindEngine(DivEngine* eng) { e=eng; } @@ -3511,9 +3523,24 @@ void FurnaceGUI::drawPattern() { DivChannelState* ch=e->getChanState(i); if (ch->portaSpeed>0) { ImVec4 col=uiColors[GUI_COLOR_PATTERN_EFFECT_PITCH]; - col.w*=0.3; + col.w*=0.2; float width=patChanX[i+1]-patChanX[i]; + if (e->isPlaying()) { + particles.push_back(Particle( + partTest, + (ch->portaNote<=ch->note)?ICON_FA_CHEVRON_DOWN:ICON_FA_CHEVRON_UP, + off.x+patChanX[i]+fmod(rand(),width), + off.y+fmod(rand(),MAX(1,ImGui::GetWindowHeight())), + 0.0f, + (7.0f+(rand()%5)+ch->portaSpeed)*((ch->portaNote<=ch->note)?1:-1), + 0.0f, + 1.0f, + 255.0f, + 18.0f + )); + } + for (float j=-patChanSlideY[i]; jAddText( + part.pos, + part.colors[(int)part.life], + part.type + ); + } else { + particles.erase(particles.begin()+i); + i--; + } + } } ImGui::PopStyleColor(3); @@ -8425,6 +8467,10 @@ void FurnaceGUI::applyUISettings() { ImGui::GetStyle()=sty; + for (int i=0; i<256; i++) { + partTest[i]=ImGui::GetColorU32(ImVec4(1.0f,1.0f,1.0f,(float)i/255.0f)); + } + // set to 800 for now due to problems with unifont static const ImWchar loadEverything[]={0x20,0x800,0}; diff --git a/src/gui/gui.h b/src/gui/gui.h index 487d0fc4..f7c9c23c 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -365,6 +365,23 @@ struct UndoStep { std::vector pat; }; +struct Particle { + ImU32* colors; + const char* type; + ImVec2 pos, speed; + float gravity, friction, life, lifeSpeed; + bool update(); + Particle(ImU32* color, const char* ty, float x, float y, float sX, float sY, float g, float fr, float l, float lS): + colors(color), + type(ty), + pos(x,y), + speed(sX,sY), + gravity(g), + friction(fr), + life(l), + lifeSpeed(lS) {} +}; + class FurnaceGUI { DivEngine* e; @@ -515,6 +532,8 @@ class FurnaceGUI { }; std::vector activeNotes; + std::vector particles; + bool wavePreviewOn; SDL_Scancode wavePreviewKey; int wavePreviewNote;