# HG changeset patch # User Fiore Martin # Date 1468501711 -7200 # Node ID 4c0e82b725d9da7319cbb77cfcace36174ada282 # Parent 75b744078d66f2acad1bfbe2822718941362cd72 added command line arguments for window size diff -r 75b744078d66 -r 4c0e82b725d9 CollidoscopeApp/src/CollidoscopeApp.cpp --- a/CollidoscopeApp/src/CollidoscopeApp.cpp Wed Jul 13 16:06:46 2016 +0200 +++ b/CollidoscopeApp/src/CollidoscopeApp.cpp Thu Jul 14 15:08:31 2016 +0200 @@ -19,10 +19,12 @@ along with this program. If not, see . */ + #include "cinder/app/App.h" #include "cinder/app/RendererGl.h" #include "cinder/gl/gl.h" #include "cinder/Exception.h" +#include #include "Config.h" @@ -46,7 +48,10 @@ void setup() override; void setupGraphics(); + /** Receives MIDI command messages from MIDI thread */ void receiveCommands(); + /** Prints command line usage */ + void usage(); void keyDown( KeyEvent event ) override; void update() override; @@ -122,10 +127,10 @@ switch (c){ case 'r' : mAudioEngine.record( 0 ); - mAudioEngine.record( 1 ); break; case 'w': { + mWaves[0]->getSelection().setSize(mWaves[0]->getSelection().getSize() + 1); size_t numSelectionChunks = mWaves[0]->getSelection().getSize(); @@ -467,9 +472,33 @@ } } + CINDER_APP( CollidoscopeApp, RendererGl, [] ( App::Settings *settings) { - settings->setWindowSize( 1920, 1080 ); - settings->setMultiTouchEnabled( false ); - settings->disableFrameRate(); + + const std::vector< string > args = settings->getCommandLineArgs(); + + int width = 0; + int height = 0; + + try { + if( args.size() != 3 ) + throw std::invalid_argument(""); + + width = std::stoi( args[1] ); + height = std::stoi( args[2] ); + + } + catch( std::invalid_argument & e ){ + console() << "Error: invalid arguments" << std::endl; + console() << "Usage: ./Collidoscope window_width window_height" << std::endl; + console() << "For example: ./Collidoscope 1024 768 " << std::endl; + + settings->setShouldQuit( true ); + return; + } + + settings->setWindowSize( width, height ); + settings->setMultiTouchEnabled( false ); + settings->disableFrameRate(); } )