mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-07 16:12:31 +00:00
GUI: mobile portrait order bar
This commit is contained in:
parent
2fdce8512a
commit
884588e46b
7 changed files with 56 additions and 12 deletions
|
@ -212,7 +212,7 @@ void FurnaceGUI::drawMobileControls() {
|
|||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("Song info here...");
|
||||
drawSongInfo(true);
|
||||
break;
|
||||
}
|
||||
case GUI_SCENE_CHANNELS:
|
||||
|
|
|
@ -3774,6 +3774,7 @@ bool FurnaceGUI::loop() {
|
|||
curWindow=GUI_WINDOW_PATTERN;
|
||||
drawPattern();
|
||||
drawPiano();
|
||||
drawMobileOrderSel();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1730,8 +1730,9 @@ class FurnaceGUI {
|
|||
void popToggleColors();
|
||||
|
||||
void drawMobileControls();
|
||||
void drawMobileOrderSel();
|
||||
void drawEditControls();
|
||||
void drawSongInfo();
|
||||
void drawSongInfo(bool asChild=false);
|
||||
void drawOrders();
|
||||
void drawPattern();
|
||||
void drawInsList(bool asChild=false);
|
||||
|
|
|
@ -18,8 +18,45 @@
|
|||
*/
|
||||
|
||||
#include "gui.h"
|
||||
#include <fmt/printf.h>
|
||||
#include "IconsFontAwesome4.h"
|
||||
#include <imgui.h>
|
||||
#include "imgui_internal.h"
|
||||
|
||||
void FurnaceGUI::drawMobileOrderSel() {
|
||||
if (!portrait) return;
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(0.0f,mobileMenuPos*-0.65*canvasH));
|
||||
ImGui::SetNextWindowSize(ImVec2(canvasW,0.12*canvasW));
|
||||
if (ImGui::Begin("OrderSel",NULL,globalWinFlags)) {
|
||||
ImDrawList* dl=ImGui::GetWindowDrawList();
|
||||
ImGuiWindow* window=ImGui::GetCurrentWindow();
|
||||
ImGuiStyle& style=ImGui::GetStyle();
|
||||
|
||||
ImVec2 size=ImGui::GetContentRegionAvail();
|
||||
|
||||
ImVec2 minArea=window->DC.CursorPos;
|
||||
ImVec2 maxArea=ImVec2(
|
||||
minArea.x+size.x,
|
||||
minArea.y+size.y
|
||||
);
|
||||
ImRect rect=ImRect(minArea,maxArea);
|
||||
ImGui::ItemSize(size,style.FramePadding.y);
|
||||
ImU32 col=ImGui::GetColorU32(ImGuiCol_Text);
|
||||
if (ImGui::ItemAdd(rect,ImGui::GetID("OrderSelW"))) {
|
||||
String text=fmt::sprintf("%.2X",curOrder);
|
||||
|
||||
ImVec2 pos=ImLerp(minArea,maxArea,ImVec2(0.5,0.0));
|
||||
ImGui::PushFont(bigFont);
|
||||
ImVec2 textSize=ImGui::CalcTextSize(text.c_str());
|
||||
ImGui::PopFont();
|
||||
|
||||
pos.x-=textSize.x*0.5*(size.y/textSize.y);
|
||||
|
||||
dl->AddText(bigFont,size.y,pos,col,text.c_str());
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void FurnaceGUI::drawOrders() {
|
||||
static char selID[4096];
|
||||
|
|
|
@ -376,8 +376,8 @@ void FurnaceGUI::drawPattern() {
|
|||
}
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0.0f,0.0f));
|
||||
if (mobileUI) {
|
||||
patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*canvasH)):ImVec2((0.16*canvasH)+0.5*canvasW*mobileMenuPos,0.0f));
|
||||
patWindowSize=(portrait?ImVec2(canvasW,canvasH-(0.16*canvasW)-(pianoOpen?(0.4*canvasW):0.0f)):ImVec2(canvasW-(0.16*canvasH),canvasH-(pianoOpen?(0.3*canvasH):0.0f)));
|
||||
patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*canvasH)+(0.12*canvasW)):ImVec2((0.16*canvasH)+0.5*canvasW*mobileMenuPos,0.0f));
|
||||
patWindowSize=(portrait?ImVec2(canvasW,canvasH-(0.16*canvasW)-(0.12*canvasW)-(pianoOpen?(0.4*canvasW):0.0f)):ImVec2(canvasW-(0.16*canvasH),canvasH-(pianoOpen?(0.3*canvasH):0.0f)));
|
||||
ImGui::SetNextWindowPos(patWindowPos);
|
||||
ImGui::SetNextWindowSize(patWindowSize);
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ void FurnaceGUI::drawPiano() {
|
|||
}
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
if (pianoInputPadMode==1 && cursor.xFine>0) {
|
||||
if (pianoInputPadMode==1 && cursor.xFine>0 && curWindow==GUI_WINDOW_PATTERN) {
|
||||
ImVec2 buttonSize=ImGui::GetContentRegionAvail();
|
||||
if (ImGui::BeginTable("InputPadP",8,ImGuiTableFlags_SizingFixedSame)) {
|
||||
ImGui::TableNextRow();
|
||||
|
@ -430,7 +430,7 @@ void FurnaceGUI::drawPiano() {
|
|||
ImGui::End();
|
||||
|
||||
// draw input pad if necessary
|
||||
if ((pianoInputPadMode==2 && cursor.xFine>0) || pianoInputPadMode==3) {
|
||||
if (curWindow==GUI_WINDOW_PATTERN && ((pianoInputPadMode==2 && cursor.xFine>0) || pianoInputPadMode==3)) {
|
||||
if (ImGui::Begin("Input Pad",NULL,ImGuiWindowFlags_NoTitleBar)) {
|
||||
ImGui::BeginDisabled(cursor.xFine==0);
|
||||
if (ImGui::BeginTable("InputPad",3,ImGuiTableFlags_Borders)) {
|
||||
|
|
|
@ -22,14 +22,15 @@
|
|||
#include "misc/cpp/imgui_stdlib.h"
|
||||
#include "intConst.h"
|
||||
|
||||
void FurnaceGUI::drawSongInfo() {
|
||||
void FurnaceGUI::drawSongInfo(bool asChild) {
|
||||
if (nextWindow==GUI_WINDOW_SONG_INFO) {
|
||||
songInfoOpen=true;
|
||||
ImGui::SetNextWindowFocus();
|
||||
nextWindow=GUI_WINDOW_NOTHING;
|
||||
}
|
||||
if (!songInfoOpen) return;
|
||||
if (ImGui::Begin("Song Information",&songInfoOpen,globalWinFlags)) {
|
||||
if (!songInfoOpen && !asChild) return;
|
||||
bool began=asChild?ImGui::BeginChild("Song Information"):ImGui::Begin("Song Information",&songInfoOpen,globalWinFlags);
|
||||
if (began) {
|
||||
if (ImGui::BeginTable("NameAuthor",2,ImGuiTableFlags_SizingStretchProp)) {
|
||||
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthFixed,0.0);
|
||||
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch,0.0);
|
||||
|
@ -240,6 +241,10 @@ void FurnaceGUI::drawSongInfo() {
|
|||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_SONG_INFO;
|
||||
ImGui::End();
|
||||
if (!asChild && ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_SONG_INFO;
|
||||
if (asChild) {
|
||||
ImGui::EndChild();
|
||||
} else {
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue