diff --git a/include/window.hpp b/include/window.hpp index d6d20a35..4a58d70c 100644 --- a/include/window.hpp +++ b/include/window.hpp @@ -99,7 +99,7 @@ struct Window { ~Window(); void run(); /** Takes a screenshot of each module */ - void screenshot(); + void screenshot(float zoom); void close(); void cursorLock(); void cursorUnlock(); diff --git a/src/main.cpp b/src/main.cpp index 44acd81a..46270cfa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -58,11 +58,12 @@ int main(int argc, char *argv[]) { std::string patchPath; bool screenshot = false; + float screenshotZoom = 1.f; // Parse command line arguments int c; opterr = 0; - while ((c = getopt(argc, argv, "dhps:u:")) != -1) { + while ((c = getopt(argc, argv, "dhp:s:u:")) != -1) { switch (c) { case 'd': { settings::devMode = true; @@ -72,6 +73,7 @@ int main(int argc, char *argv[]) { } break; case 'p': { screenshot = true; + sscanf(optarg, "%f", &screenshotZoom); } break; case 's': { asset::systemDir = optarg; @@ -163,7 +165,7 @@ int main(int argc, char *argv[]) { std::this_thread::sleep_for(std::chrono::seconds(2)); } else if (screenshot) { - APP->window->screenshot(); + APP->window->screenshot(screenshotZoom); } else { INFO("Running window"); diff --git a/src/window.cpp b/src/window.cpp index a1262550..57bd5374 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -403,7 +403,7 @@ void Window::run() { } } -void Window::screenshot() { +void Window::screenshot(float zoom) { // Iterate plugins and create directories std::string screenshotsDir = asset::user("screenshots"); system::createDirectory(screenshotsDir); @@ -421,7 +421,6 @@ void Window::screenshot() { app::ModuleWidget *mw = model->createModuleWidgetNull(); widget::FramebufferWidget *fb = new widget::FramebufferWidget; fb->addChild(mw); - float zoom = 2.f; fb->scale = math::Vec(zoom, zoom); // Draw to framebuffer