mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-17 22:10:12 +00:00
GUI: randomize in macros under the right click
This commit is contained in:
parent
aa38292ca4
commit
587e066d43
3 changed files with 25 additions and 0 deletions
|
@ -5216,6 +5216,8 @@ FurnaceGUI::FurnaceGUI():
|
|||
macroOffY(0),
|
||||
macroScaleX(100.0f),
|
||||
macroScaleY(100.0f),
|
||||
macroRandMin(0),
|
||||
macroRandMax(0),
|
||||
macroLoopDragStart(0,0),
|
||||
macroLoopDragAreaSize(0,0),
|
||||
macroLoopDragTarget(NULL),
|
||||
|
|
|
@ -1446,6 +1446,7 @@ class FurnaceGUI {
|
|||
FurnaceGUIMacroDesc lastMacroDesc;
|
||||
int macroOffX, macroOffY;
|
||||
float macroScaleX, macroScaleY;
|
||||
int macroRandMin, macroRandMax;
|
||||
|
||||
ImVec2 macroLoopDragStart;
|
||||
ImVec2 macroLoopDragAreaSize;
|
||||
|
|
|
@ -4556,6 +4556,28 @@ void FurnaceGUI::drawInsEdit() {
|
|||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::BeginMenu("randomize...")) {
|
||||
if (macroRandMin<lastMacroDesc.min) macroRandMin=lastMacroDesc.min;
|
||||
if (macroRandMin>lastMacroDesc.max) macroRandMin=lastMacroDesc.max;
|
||||
if (macroRandMax<lastMacroDesc.min) macroRandMax=lastMacroDesc.min;
|
||||
if (macroRandMax>lastMacroDesc.max) macroRandMax=lastMacroDesc.max;
|
||||
ImGui::InputInt("Min",¯oRandMin,1,10);
|
||||
ImGui::InputInt("Max",¯oRandMax,1,10);
|
||||
if (ImGui::Button("randomize")) {
|
||||
for (int i=0; i<lastMacroDesc.macro->len; i++) {
|
||||
int val=0;
|
||||
if (macroRandMax<=macroRandMin) {
|
||||
val=macroRandMin;
|
||||
} else {
|
||||
val=macroRandMin+(rand()%(macroRandMax-macroRandMin+1));
|
||||
}
|
||||
lastMacroDesc.macro->val[i]=val;
|
||||
}
|
||||
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue