GUI: new osc renderer, part 29

This commit is contained in:
tildearrow 2024-02-22 12:59:20 -05:00
parent ecd3875a64
commit c5d0203f94
3 changed files with 27 additions and 19 deletions

View file

@ -610,6 +610,9 @@ void FurnaceGUI::drawMobileControls() {
mobileMenuPos=0.0f;
aboutOpen=true;
}
if (ImGui::Button("Shader Editor")) {
shaderEditor=!shaderEditor;
}
if (ImGui::Button("Switch to Desktop Mode")) {
toggleMobileUI(!mobileUI);
}

View file

@ -4423,6 +4423,7 @@ bool FurnaceGUI::loop() {
if (ImGui::MenuItem("effect list",BIND_FOR(GUI_ACTION_WINDOW_EFFECT_LIST),effectListOpen)) effectListOpen=!effectListOpen;
if (ImGui::MenuItem("debug menu",BIND_FOR(GUI_ACTION_WINDOW_DEBUG))) debugOpen=!debugOpen;
if (ImGui::MenuItem("inspector")) inspectorOpen=!inspectorOpen;
if (ImGui::MenuItem("shader editor")) shaderEditor=!shaderEditor;
if (ImGui::MenuItem("panic",BIND_FOR(GUI_ACTION_PANIC))) e->syncReset();
if (ImGui::MenuItem("about...",BIND_FOR(GUI_ACTION_WINDOW_ABOUT))) {
aboutOpen=true;
@ -4678,28 +4679,30 @@ bool FurnaceGUI::loop() {
}
// NEW CODE - REMOVE WHEN DONE
if (ImGui::Begin("Shader Editor 2024",NULL,ImGuiWindowFlags_NoScrollWithMouse|ImGuiWindowFlags_NoScrollbar)) {
ImGui::PushFont(patFont);
ImGui::InputTextMultiline("##SHFragment",&newOscFragment,ImVec2(ImGui::GetContentRegionAvail().x,ImGui::GetContentRegionAvail().y-ImGui::GetFrameHeightWithSpacing()),ImGuiInputTextFlags_UndoRedo);
ImGui::PopFont();
if (ImGui::Button("Save")) {
FILE* f=ps_fopen("/storage/emulated/0/osc.fsh","w");
if (f==NULL) {
showError("Something happened");
} else {
fwrite(newOscFragment.c_str(),1,newOscFragment.size(),f);
fclose(f);
showError("Saved!");
}
}
ImGui::SameLine();
if (ImGui::Button("Apply")) {
if (!rend->regenOscShader(newOscFragment.c_str())) {
showError("Of course you screwed it up, again!");
if (shaderEditor) {
if (ImGui::Begin("Shader Editor 2024",&shaderEditor,ImGuiWindowFlags_NoScrollWithMouse|ImGuiWindowFlags_NoScrollbar)) {
ImGui::PushFont(patFont);
ImGui::InputTextMultiline("##SHFragment",&newOscFragment,ImVec2(ImGui::GetContentRegionAvail().x,ImGui::GetContentRegionAvail().y-ImGui::GetFrameHeightWithSpacing()),ImGuiInputTextFlags_UndoRedo);
ImGui::PopFont();
if (ImGui::Button("Save")) {
FILE* f=ps_fopen("/storage/emulated/0/osc.fsh","w");
if (f==NULL) {
showError("Something happened");
} else {
fwrite(newOscFragment.c_str(),1,newOscFragment.size(),f);
fclose(f);
showError("Saved!");
}
}
ImGui::SameLine();
if (ImGui::Button("Apply")) {
if (!rend->regenOscShader(newOscFragment.c_str())) {
showError("Of course you screwed it up, again!");
}
}
}
ImGui::End();
}
ImGui::End();
// release selection if mouse released
if (ImGui::IsMouseReleased(ImGuiMouseButton_Left) && selecting) {
@ -7329,6 +7332,7 @@ FurnaceGUI::FurnaceGUI():
snesFilterHex(false),
modTableHex(false),
displayEditString(false),
shaderEditor(false),
mobileEdit(false),
killGraphics(false),
safeMode(false),

View file

@ -1505,6 +1505,7 @@ class FurnaceGUI {
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
bool displayNew, displayExport, displayPalette, fullScreen, preserveChanPos, sysDupCloneChannels, sysDupEnd, wantScrollList, noteInputPoly, notifyWaveChange;
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex, modTableHex, displayEditString;
bool shaderEditor;
bool mobileEdit;
bool killGraphics;
bool safeMode;