Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
TwoWinParams.cpp
#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
#include "cinder/params/Params.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class TwoWinParams : public App
{
public:
void setup() override;
void keyDown( KeyEvent event ) override;
private:
WindowRef mWin0;
WindowRef mWin1;
void draw0();
void draw1();
params::InterfaceGlRef mParams0;
params::InterfaceGlRef mParams1;
};
void TwoWinParams::setup()
{
mWin0 = getWindow();
mWin1 = createWindow();
mWin0->getSignalDraw().connect( std::bind( &TwoWinParams::draw0, this ) );
mWin1->getSignalDraw().connect( std::bind( &TwoWinParams::draw1, this ) );
mParams0 = params::InterfaceGl::create( mWin0, "Settings0", ivec2( 200, 300 ) );
mParams1 = params::InterfaceGl::create( mWin1, "Settings1", ivec2( 200, 300 ) );
}
void TwoWinParams::draw0()
{
gl::viewport( getWindowSize() );
gl::setMatricesWindow( getWindowSize() );
gl::clear();
mParams0->draw();
}
void TwoWinParams::draw1()
{
gl::viewport( getWindowSize() );
gl::setMatricesWindow( getWindowSize() );
gl::clear();
mParams1->draw();
}
void TwoWinParams::keyDown( KeyEvent event )
{
switch ( event.getCode() )
{
case KeyEvent::KEY_0:
mParams0->show( ! mParams0->isVisible() );
break;
case KeyEvent::KEY_1:
mParams1->show( ! mParams1->isVisible() );
break;
case KeyEvent::KEY_ESCAPE:
quit();
break;
default:
break;
}
}
CINDER_APP( TwoWinParams, RendererGl )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment