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)); } }