GUI: prepare for the input pad

This commit is contained in:
tildearrow 2022-05-17 15:48:37 -05:00
parent 63d09c0f54
commit 40a63433c5
3 changed files with 76 additions and 4 deletions

View file

@ -2323,8 +2323,8 @@ void FurnaceGUI::processPoint(SDL_Event& ev) {
} }
TouchPoint newPoint(ev.button.x,ev.button.y); TouchPoint newPoint(ev.button.x,ev.button.y);
#ifdef __APPLE__ #ifdef __APPLE__
newPoint->x*=dpiScale; newPoint.x*=dpiScale;
newPoint->y*=dpiScale; newPoint.y*=dpiScale;
#endif #endif
activePoints.push_back(newPoint); activePoints.push_back(newPoint);
pressedPoints.push_back(newPoint); pressedPoints.push_back(newPoint);
@ -4276,6 +4276,7 @@ FurnaceGUI::FurnaceGUI():
pianoOffset(6), pianoOffset(6),
pianoOffsetEdit(9), pianoOffsetEdit(9),
pianoView(2), pianoView(2),
pianoInputPadMode(2),
#else #else
pianoOctaves(7), pianoOctaves(7),
pianoOctavesEdit(4), pianoOctavesEdit(4),
@ -4284,6 +4285,7 @@ FurnaceGUI::FurnaceGUI():
pianoOffset(6), pianoOffset(6),
pianoOffsetEdit(6), pianoOffsetEdit(6),
pianoView(0), pianoView(0),
pianoInputPadMode(0),
#endif #endif
hasACED(false) { hasACED(false) {
// value keys // value keys

View file

@ -1226,7 +1226,7 @@ class FurnaceGUI {
float pianoKeyHit[180]; float pianoKeyHit[180];
bool pianoKeyPressed[180]; bool pianoKeyPressed[180];
int pianoOffset, pianoOffsetEdit; int pianoOffset, pianoOffsetEdit;
int pianoView; int pianoView, pianoInputPadMode;
// TX81Z // TX81Z
bool hasACED; bool hasACED;

View file

@ -40,7 +40,11 @@ const bool isTopKey[12]={
false, true, false, true, false, false, true, false, true, false, true, false false, true, false, true, false, false, true, false, true, false, true, false
}; };
// TODO: actually implement a piano! #define VALUE_DIGIT(x,label) \
if (ImGui::Selectable(label,false,0,ImVec2(50.0*dpiScale,50.0*dpiScale))) { \
valueInput(x,false); \
}
void FurnaceGUI::drawPiano() { void FurnaceGUI::drawPiano() {
if (nextWindow==GUI_WINDOW_PIANO) { if (nextWindow==GUI_WINDOW_PIANO) {
pianoOpen=true; pianoOpen=true;
@ -86,6 +90,19 @@ void FurnaceGUI::drawPiano() {
if (ImGui::RadioButton("Continuous",pianoView==1)) { if (ImGui::RadioButton("Continuous",pianoView==1)) {
pianoView=1; pianoView=1;
} }
ImGui::Text("Value input pad:");
if (ImGui::RadioButton("Disabled",pianoInputPadMode==0)) {
pianoInputPadMode=0;
}
if (ImGui::RadioButton("On keyboard",pianoInputPadMode==1)) {
pianoInputPadMode=1;
}
if (ImGui::RadioButton("Split (automatic)",pianoInputPadMode==2)) {
pianoInputPadMode=2;
}
if (ImGui::RadioButton("Split (always visible)",pianoInputPadMode==3)) {
pianoInputPadMode=3;
}
ImGui::Checkbox("Share play/edit offset/range",&pianoSharePosition); ImGui::Checkbox("Share play/edit offset/range",&pianoSharePosition);
ImGui::EndPopup(); ImGui::EndPopup();
} }
@ -295,4 +312,57 @@ void FurnaceGUI::drawPiano() {
} }
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_PIANO; if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_PIANO;
ImGui::End(); ImGui::End();
// draw input pad if necessary
if ((pianoInputPadMode==2 && cursor.xFine>0) || pianoInputPadMode==3) {
if (ImGui::Begin("Input Pad",NULL,ImGuiWindowFlags_NoTitleBar)) {
if (ImGui::BeginTable("InputPad",3,ImGuiTableFlags_Borders)) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
VALUE_DIGIT(10,"A");
ImGui::TableNextColumn();
VALUE_DIGIT(11,"B");
ImGui::TableNextColumn();
VALUE_DIGIT(12,"C");
ImGui::TableNextRow();
ImGui::TableNextColumn();
VALUE_DIGIT(13,"D");
ImGui::TableNextColumn();
VALUE_DIGIT(14,"E");
ImGui::TableNextColumn();
VALUE_DIGIT(15,"F");
ImGui::TableNextRow();
ImGui::TableNextColumn();
VALUE_DIGIT(1,"1");
ImGui::TableNextColumn();
VALUE_DIGIT(2,"2");
ImGui::TableNextColumn();
VALUE_DIGIT(3,"3");
ImGui::TableNextRow();
ImGui::TableNextColumn();
VALUE_DIGIT(4,"4");
ImGui::TableNextColumn();
VALUE_DIGIT(5,"5");
ImGui::TableNextColumn();
VALUE_DIGIT(6,"6");
ImGui::TableNextRow();
ImGui::TableNextColumn();
VALUE_DIGIT(7,"7");
ImGui::TableNextColumn();
VALUE_DIGIT(8,"8");
ImGui::TableNextColumn();
VALUE_DIGIT(9,"9");
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TableNextColumn();
VALUE_DIGIT(0,"0");
ImGui::TableNextColumn();
ImGui::EndTable();
}
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_PIANO;
ImGui::End();
}
} }