Browse Source

Command line open patches, Ctrl+N for New Patch, Ctrl+Q for quit

tags/v0.3.2
Andrew Belt 7 years ago
parent
commit
c362112e89
3 changed files with 26 additions and 2 deletions
  1. +1
    -0
      include/app.hpp
  2. +20
    -0
      src/app/RackScene.cpp
  3. +5
    -2
      src/main.cpp

+ 1
- 0
include/app.hpp View File

@@ -305,6 +305,7 @@ struct RackScene : Scene {
RackScene();
void step();
void draw(NVGcontext *vg);
Widget *onHoverKey(Vec pos, int key);
};

////////////////////


+ 20
- 0
src/app/RackScene.cpp View File

@@ -29,5 +29,25 @@ void RackScene::draw(NVGcontext *vg) {
Scene::draw(vg);
}

Widget *RackScene::onHoverKey(Vec pos, int key) {
switch (key) {
case GLFW_KEY_N:
if (guiIsModPressed()) {
gRackWidget->clear();
return this;
}
break;
case GLFW_KEY_Q:
if (guiIsModPressed()) {
glfwSetWindowShouldClose(gWindow, GLFW_TRUE);
return this;
}
break;
}

return Widget::onHoverKey(pos, key);
}



} // namespace rack

+ 5
- 2
src/main.cpp View File

@@ -88,7 +88,7 @@ void fixCwd() {

using namespace rack;

int main() {
int main(int argc, char* argv[]) {
#if ARCH_MAC
fixCwd();
#endif
@@ -98,7 +98,10 @@ int main() {
guiInit();
sceneInit();
settingsLoad("settings.json");
gRackWidget->loadPatch("autosave.json");
if (argc >= 2)
gRackWidget->loadPatch(argv[1]);
else
gRackWidget->loadPatch("autosave.json");

engineStart();
guiRun();


Loading…
Cancel
Save