mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-26 22:43:01 +00:00
implement macro speed/delay
This commit is contained in:
parent
a3e7dbed7a
commit
3b6fa212b8
3 changed files with 40 additions and 3 deletions
|
@ -32,6 +32,18 @@ void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released, bool tic
|
|||
had=false;
|
||||
return;
|
||||
}
|
||||
if (delay>0) {
|
||||
delay--;
|
||||
return;
|
||||
}
|
||||
if (began && source.delay>0) {
|
||||
delay=source.delay;
|
||||
} else {
|
||||
delay=source.speed-1;
|
||||
}
|
||||
if (began) {
|
||||
began=false;
|
||||
}
|
||||
if (finished) {
|
||||
finished=false;
|
||||
}
|
||||
|
|
|
@ -25,21 +25,24 @@
|
|||
class DivEngine;
|
||||
|
||||
struct DivMacroStruct {
|
||||
int pos, lastPos;
|
||||
int pos, lastPos, delay;
|
||||
int val;
|
||||
bool has, had, actualHad, finished, will, linger;
|
||||
bool has, had, actualHad, finished, will, linger, began;
|
||||
unsigned int mode;
|
||||
void doMacro(DivInstrumentMacro& source, bool released, bool tick);
|
||||
void init() {
|
||||
pos=lastPos=mode=0;
|
||||
pos=lastPos=mode=delay=0;
|
||||
has=had=actualHad=will=false;
|
||||
linger=false;
|
||||
began=true;
|
||||
// TODO: test whether this breaks anything?
|
||||
val=0;
|
||||
}
|
||||
void prepare(DivInstrumentMacro& source, DivEngine* e);
|
||||
DivMacroStruct():
|
||||
pos(0),
|
||||
lastPos(0),
|
||||
delay(0),
|
||||
val(0),
|
||||
has(false),
|
||||
had(false),
|
||||
|
@ -47,6 +50,7 @@ struct DivMacroStruct {
|
|||
finished(false),
|
||||
will(false),
|
||||
linger(false),
|
||||
began(false),
|
||||
mode(0) {}
|
||||
};
|
||||
|
||||
|
|
|
@ -1245,6 +1245,27 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
|
|||
if (macroLen>255) macroLen=255;
|
||||
i.macro->len=macroLen;
|
||||
}
|
||||
if (ImGui::Button(ICON_FA_BAR_CHART "##IMacroType")) {
|
||||
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Coming soon!");
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::Button(ICON_FA_ELLIPSIS_H "##IMacroSet");
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("Delay/Step Length");
|
||||
}
|
||||
if (ImGui::BeginPopupContextItem("IMacroSetP",ImGuiPopupFlags_MouseButtonLeft)) {
|
||||
if (ImGui::InputScalar("Step Length (ticks)##IMacroSpeed",ImGuiDataType_U8,&i.macro->speed,&_ONE,&_THREE)) {
|
||||
if (i.macro->speed<1) i.macro->speed=1;
|
||||
MARK_MODIFIED;
|
||||
}
|
||||
if (ImGui::InputScalar("Delay##IMacroDelay",ImGuiDataType_U8,&i.macro->delay,&_ONE,&_THREE)) {
|
||||
MARK_MODIFIED;
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
// do not change this!
|
||||
// anything other than a checkbox will look ugly!
|
||||
// if you really need more than two macro modes please tell me.
|
||||
|
|
Loading…
Reference in a new issue