mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-15 17:25:06 +00:00
i need to go
This commit is contained in:
parent
e5d9aed669
commit
7a05f902ea
2 changed files with 66 additions and 1 deletions
|
@ -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]; j<ImGui::GetWindowHeight(); j+=width*0.7) {
|
||||
ImVec2 tMin=ImVec2(off.x+patChanX[i],off.y+j);
|
||||
ImVec2 tMax=ImVec2(off.x+patChanX[i+1],off.y+j+width*0.6);
|
||||
|
@ -3547,6 +3574,21 @@ void FurnaceGUI::drawPattern() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// particle simulation
|
||||
for (size_t i=0; i<particles.size(); i++) {
|
||||
Particle& part=particles[i];
|
||||
if (part.update()) {
|
||||
dl->AddText(
|
||||
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};
|
||||
|
||||
|
|
|
@ -365,6 +365,23 @@ struct UndoStep {
|
|||
std::vector<UndoPatternData> 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<ActiveNote> activeNotes;
|
||||
|
||||
std::vector<Particle> particles;
|
||||
|
||||
bool wavePreviewOn;
|
||||
SDL_Scancode wavePreviewKey;
|
||||
int wavePreviewNote;
|
||||
|
|
Loading…
Reference in a new issue