void CircMenu::close() { if( buttons.size() > 0 ) { for(int i=0; i<buttons.size(); i++){ poPoint loc = poPoint( 0, 0, 0); buttons[i]->positionTween .set(loc) .setDelay(closeDelay*i) .setDuration(closeDuration) .setTweenFunction(PO_TWEEN_BACK_IN_FUNC) .setNotification(this, poToString(i)) .start(); buttons[i]->icon->rotationTween .set(0) .setDelay(closeDelay*i) .setDuration(closeDuration) .setTweenFunction(PO_TWEEN_QUAD_INOUT_FUNC) .start(); } } CircButton::icon->rotationTween .set(0) .setDelay(0) .setDuration(closeDuration) .setTweenFunction(PO_TWEEN_QUAD_INOUT_FUNC) .start(); }
void CircMenu::messageHandler(const std::string &msg, const poDictionary& dict) { if(msg == poToString(buttons.size()-1)){ for(int i=0; i<buttons.size(); i++){ buttons[i]->visible = false; } } }
// EVENT HANDLER. Called when events happen. Respond to events here. void OrientationTestApp::eventHandler(poEvent *event) { switch (event->type) { case PO_TOUCH_BEGAN_EVENT: if(bLockOrientation) { poSetAutoRotateOrientations(PO_VERTICAL | PO_HORIZONTAL); bg->fillColor.set255(255,0,0); } else { poSetAutoRotateOrientations(poGetOrientation()); bg->fillColor.set255(155,0,0); } bLockOrientation = !bLockOrientation; break; case PO_ROTATION_EVENT: { bg->reshape(getWindowWidth(), getWindowHeight()); switch (poGetOrientation()) { case PO_HORIZONTAL_LEFT: std::cout << "Left" << std::endl; break; case PO_HORIZONTAL_RIGHT: std::cout << "Right" << std::endl; break; case PO_VERTICAL_UP: std::cout << "Up" << std::endl; break; case PO_VERTICAL_DOWN: std::cout << "Down" << std::endl; break; } centerArrow(); break; } case PO_ACCELEROMETER_EVENT: //Add motion to accelerometer accel += event->motion; //Update Accel info text accelInfo->setText("Accelerometer:\nX: " + poToString(event->motion.x) + "\nY: " + poToString(event->motion.y)); accelInfo->doLayout(); accelInfo->position.set(getWindowWidth()/2 - accelInfo->getWidth()/2, getWindowHeight()-accelInfo->getHeight(), 0.0f); break; } }