Browse Source

Added zoom level to Window::screenshot().

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
99783f9095
3 changed files with 6 additions and 5 deletions
  1. +1
    -1
      include/window.hpp
  2. +4
    -2
      src/main.cpp
  3. +1
    -2
      src/window.cpp

+ 1
- 1
include/window.hpp View File

@@ -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();


+ 4
- 2
src/main.cpp View File

@@ -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");


+ 1
- 2
src/window.cpp View File

@@ -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


Loading…
Cancel
Save