implement macro speed/delay
This commit is contained in:
parent
a3e7dbed7a
commit
3b6fa212b8
|
@ -32,6 +32,18 @@ void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released, bool tic
|
||||||
had=false;
|
had=false;
|
||||||
return;
|
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) {
|
if (finished) {
|
||||||
finished=false;
|
finished=false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,21 +25,24 @@
|
||||||
class DivEngine;
|
class DivEngine;
|
||||||
|
|
||||||
struct DivMacroStruct {
|
struct DivMacroStruct {
|
||||||
int pos, lastPos;
|
int pos, lastPos, delay;
|
||||||
int val;
|
int val;
|
||||||
bool has, had, actualHad, finished, will, linger;
|
bool has, had, actualHad, finished, will, linger, began;
|
||||||
unsigned int mode;
|
unsigned int mode;
|
||||||
void doMacro(DivInstrumentMacro& source, bool released, bool tick);
|
void doMacro(DivInstrumentMacro& source, bool released, bool tick);
|
||||||
void init() {
|
void init() {
|
||||||
pos=lastPos=mode=0;
|
pos=lastPos=mode=delay=0;
|
||||||
has=had=actualHad=will=false;
|
has=had=actualHad=will=false;
|
||||||
linger=false;
|
linger=false;
|
||||||
|
began=true;
|
||||||
// TODO: test whether this breaks anything?
|
// TODO: test whether this breaks anything?
|
||||||
val=0;
|
val=0;
|
||||||
}
|
}
|
||||||
void prepare(DivInstrumentMacro& source, DivEngine* e);
|
void prepare(DivInstrumentMacro& source, DivEngine* e);
|
||||||
DivMacroStruct():
|
DivMacroStruct():
|
||||||
pos(0),
|
pos(0),
|
||||||
|
lastPos(0),
|
||||||
|
delay(0),
|
||||||
val(0),
|
val(0),
|
||||||
has(false),
|
has(false),
|
||||||
had(false),
|
had(false),
|
||||||
|
@ -47,6 +50,7 @@ struct DivMacroStruct {
|
||||||
finished(false),
|
finished(false),
|
||||||
will(false),
|
will(false),
|
||||||
linger(false),
|
linger(false),
|
||||||
|
began(false),
|
||||||
mode(0) {}
|
mode(0) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1245,6 +1245,27 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
|
||||||
if (macroLen>255) macroLen=255;
|
if (macroLen>255) macroLen=255;
|
||||||
i.macro->len=macroLen;
|
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!
|
// do not change this!
|
||||||
// anything other than a checkbox will look ugly!
|
// anything other than a checkbox will look ugly!
|
||||||
// if you really need more than two macro modes please tell me.
|
// if you really need more than two macro modes please tell me.
|
||||||
|
|
Loading…
Reference in a new issue