// // MARK: - RootNode // void RootNode::connect( ci::app::WindowRef window ) { storeConnection( window->getSignalTouchesBegan().connect( [this]( app::TouchEvent &event ) { deepTouchesBegan( event ); } ) ); storeConnection( window->getSignalTouchesMoved().connect( [this]( app::TouchEvent &event ) { deepTouchesMoved( event ); } ) ); storeConnection( window->getSignalTouchesEnded().connect( [this]( app::TouchEvent &event ) { deepTouchesEnded( event ); } ) ); storeConnection( window->getSignalMouseDown().connect( [this]( app::MouseEvent &event ) { deepMouseDown( event ); } ) ); storeConnection( window->getSignalMouseDrag().connect( [this]( app::MouseEvent &event ) { deepMouseDrag( event ); } ) ); storeConnection( window->getSignalMouseUp().connect( [this]( app::MouseEvent &event ) { deepMouseUp( event ); } ) ); }
void connectWindow( ci::app::WindowRef window ) { sWindowConnections = { window->getSignalMouseDown().connect( mouseDown ), window->getSignalMouseUp().connect( mouseUp ), window->getSignalMouseDrag().connect( mouseDrag ), window->getSignalMouseMove().connect( mouseMove ), window->getSignalMouseWheel().connect( mouseWheel ), window->getSignalKeyDown().connect( keyDown ), window->getSignalKeyUp().connect( keyUp ), window->getSignalResize().connect( resize ), }; }
void PretzelRoot::connectSignals(ci::app::WindowRef window) { if( !mMouseBeganCallback.isConnected() ){ // uses default priority 0 mMouseBeganCallback = window->getSignalMouseDown().connect(std::bind(&PretzelRoot::onMouseDown, this, std::placeholders::_1)); mMouseDragCallback = window->getSignalMouseDrag().connect(std::bind(&PretzelRoot::onMouseDragged, this, std::placeholders::_1)); mMouseEndCallback = window->getSignalMouseUp().connect(std::bind(&PretzelRoot::onMouseUp, this, std::placeholders::_1)); mMouseMovedCallback = window->getSignalMouseMove().connect(std::bind(&PretzelRoot::onMouseMoved, this, std::placeholders::_1)); mKeyDownCallback = window->getSignalKeyDown().connect(std::bind(&PretzelRoot::onKeyDown, this, std::placeholders::_1)); mMouseWheelCallback = window->getSignalMouseWheel().connect(std::bind(&PretzelRoot::onMouseWheel, this, std::placeholders::_1)); mUpdateCallback = ci::app::App::get()->getSignalUpdate().connect(std::bind(&PretzelRoot::update, this)); } }