Example #1
0
//! Connects to mouseDown, mouseDrag, mouseWheel and resize signals of \a window, with optional priority \a signalPriority
void CameraUi::connect( const app::WindowRef &window, int signalPriority )
{
	mWindow = window;
	mSignalPriority = signalPriority;
	if( window ) {
		mMouseDownConnection = window->getSignalMouseDown().connect( signalPriority,
			[this]( app::MouseEvent &event ) { mouseDown( event ); } );
		mMouseUpConnection = window->getSignalMouseUp().connect( signalPriority,
			[this]( app::MouseEvent &event ) { mouseUp( event ); } );
		mMouseDragConnection = window->getSignalMouseDrag().connect( signalPriority,
			[this]( app::MouseEvent &event ) { mouseDrag( event ); } );
		mMouseWheelConnection = window->getSignalMouseWheel().connect( signalPriority,
			[this]( app::MouseEvent &event ) { mouseWheel( event ); } );
		mWindowResizeConnection = window->getSignalResize().connect( signalPriority,
			[this]() {
				setWindowSize( mWindow->getSize() );
				if( mCamera )
					mCamera->setAspectRatio( mWindow->getAspectRatio() );
			}
		);
	}
	else
		disconnect();
		
	mLastAction = ACTION_NONE;
}
Example #2
0
void TreentTest::connect( app::WindowRef window )
{
  storeConnection( window->getSignalMouseDown().connect( [this]( const MouseEvent &e )
    { mouseDown( e ); } ) );
  storeConnection( window->getSignalMouseDrag().connect( [this]( const MouseEvent &e )
                                                        { mouseDrag( e ); } ) );
  storeConnection( window->getSignalMouseUp().connect( [this]( const MouseEvent &e )
                                                        { mouseUp( e ); } ) );
}
Example #3
0
void Narcotic::initializeWindows()
{
	guiWindow = app::getWindow();
	projectionWindow = createWindow(Window::Format().size(400, 400));

// FIX THIS 
	guiWindow->getSignalPostDraw().connect([this]{drawGui(); });

	projectionWindow->setTitle("Narcotic Visuals Projection");
	projectionWindow->setAlwaysOnTop(true);
	

	Vec2f projectionPos;
	projectionPos.x = guiWindow->getPos().x + guiWindow->getSize().x;
	projectionPos.y = 50;
	projectionWindow->setPos(projectionPos);
	guiWindow->getSignalClose().connect([=]{isQuit = true; });
	guiWindow->setTitle("Narcotic visuals GUI");

	guiWindow->setPos(10, 50);

	int uniqueId = getNumWindows();
	/*newWindow->getSignalClose().connect(
		[uniqueId, this] { this->console() << "You closed window #" << uniqueId << std::endl; }
		);*/
	ImGui::setWindow(guiWindow);
	//connect close to other windows.
	// download midi
}
Example #4
0
void Scene::show( app::WindowRef window, bool useWindowBounds )
{
    mDisplayConnection.disconnect();
    mDisplayConnection.store( window->getSignalDraw().connect( 1, [this]() {
        draw();
    } ) );
    if( useWindowBounds ) {
        setBounds( window->getBounds() );
    }
    appear();
}
Example #5
0
SquareListener::SquareListener( app::WindowRef window )
	: mWindow( window )
{
	mRect = Rectf( Vec2f( -40, -40 ), Vec2f( 40, 40 ) );
	mRect.offset( window->getCenter() );
	mSelected = false;
	
	mCbMouseDown = mWindow->getSignalMouseDown().connect( std::bind( &SquareListener::mouseDown, this, std::_1 ) );
	mCbMouseDrag = mWindow->getSignalMouseDrag().connect( std::bind( &SquareListener::mouseDrag, this, std::_1 ) );	
}
Example #6
0
void Narcotic::draw()
{
	
	gl::clear();
	fboProjection.bindFramebuffer();
	gl::clear(Color::gray(0.25));
	v1.draw();
	fboProjection.unbindFramebuffer();
	gl::draw(fboProjection.getTexture(), Rectf(projectionWindow->getBounds()));
	//fboProjection.unbindTexture();
}