void CWindowMover::checkLaunchArea() { CCoeControl* control =(viewer->winId()); int y=control->Position().iY; int x=control->Position().iX; float verSense=settings->value("settings/versense",0.5).toFloat(); int height=control->Size().iHeight; if (x==0&&abs(y-prevY)<40&&y>(-height*verSense)&&y<-40) { qDebug()<<"will show launch area"; emit showLaunchArea(); startAnim(EYAxis,0); } prevY=y; }
void HCCWindow::show() { if(m_tips) { //UIPanel* _panel = (UIPanel*)m_tips; //_panel->setBackGroundColorOpacity(0); m_layer->addWidget(m_tips); m_tips->setZOrder(HWindowsManager::S()->getTopZOrder()); setZOrder(m_tips->getZOrder()); UIWidget* m_bg = m_tips->getChildByName("bg"); if (m_autoCenter) { m_bg->setPosition(_pCenter); } if (m_bg) { m_widgetHelper = new HUIWidgetHelper(m_bg); } } HWindowsManager::S()->pushWindow(this); startAnim(); }
void HWindow::showWindow(){ if(m_tips){ // Layout* _panel = (Layout*)m_tips; // _panel->setSize(Size(_pScreenSize.width, _pScreenSize.height)); // _panel->setBackGroundColorOpacity(128); m_node->addChild(m_tips); m_tips->setZOrder(HWindowsManager::S()->getTopZOrder()); setZOrder(m_tips->getZOrder()); Node* m_bg = m_tips->getChildByName("bg"); if (m_autoCenter) { m_bg->setPosition(Point(_pCenterX,_pCenterY)); } if (m_bg) { m_windowsHelper = new HWindowsHelper(m_bg); } } HWindowsManager::S()->pushWindow(this); setTocuhEnable(false); startAnim(); }
void CWindowMover::HandlePointerEventL(const TPointerEvent& aPointerEvent) { CCoeControl* control =(viewer->winId()); if (aPointerEvent.iType == TPointerEvent::EButton1Down) { iPointerPoint1=aPointerEvent.iPosition; iPointerPoint2=aPointerEvent.iPosition; MovingChanged(true); QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress); pressEvent.setScenePos(QPointF(iPointerPoint1.iX-control->Position().iX, iPointerPoint1.iY-control->Position().iY)); qDebug()<<pressEvent.scenePos().x()<<pressEvent.scenePos().y(); pressEvent.setButton(Qt::LeftButton); pressEvent.setButtons(Qt::LeftButton); QApplication::sendEvent(viewer->scene(), &pressEvent); } else if (aPointerEvent.iType == TPointerEvent::EDrag) { iDragged=ETrue; TInt dx=aPointerEvent.iPosition.iX-iPointerPoint1.iX; TInt dy=aPointerEvent.iPosition.iY-iPointerPoint1.iY; if (!axisSet) { if (abs(dy)>abs(dx)) {axisX=0; axisY=1;} else {axisX=1;axisY=0;} axisSet=true; } RWindow rWindow=(control->Window()); control->SetPosition(TPoint(dx*axisX,dy*axisY)); control->DrawBackground(TRect(control->Position(),control->Size())); } else if (aPointerEvent.iType==TPointerEvent::EButton1Up) { iPointerPoint2=aPointerEvent.iPosition; //MakeVisible(EFalse); int gest=settings->value("settings/gesture").toInt(); if (gest==0) axisSet=false; float horSense=settings->value("settings/horsense",0.5).toFloat(); float verSense=settings->value("settings/versense",0.5).toFloat(); int width=control->Size().iWidth; int height=control->Size().iHeight; int x=control->Position().iX; int y=control->Position().iY; qDebug()<<"("<<x<<","<<y<<")"<<horSense<<verSense; if (x>(horSense)*width) {startAnim(EXAxis,width);} else if (x<(-horSense)*width) {startAnim(EXAxis,-width);} else if (x!=0) {startAnim(EXAxis,0);} if (y>(verSense)*height) {startAnim(EYAxis,height);} else if (y<(-verSense)*height) {startAnim(EYAxis,-height);} else if (y!=0) {startAnim(EYAxis,0);} if (abs(iPointerPoint1.iX-iPointerPoint2.iX)<20&&abs(iPointerPoint1.iY-iPointerPoint2.iY)<20) { QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease); releaseEvent.setScenePos(QPointF(iPointerPoint1.iX-control->Position().iX, iPointerPoint1.iY-control->Position().iY)); releaseEvent.setButton(Qt::LeftButton); releaseEvent.setButtons(Qt::LeftButton); QApplication::sendEvent(viewer->scene(), &releaseEvent); } else { QGraphicsSceneMouseEvent moveEvent(QEvent::GraphicsSceneMouseMove); moveEvent.setScenePos(QPointF(iPointerPoint1.iX-control->Position().iX-10,iPointerPoint1.iY-control->Position().iY-10)); moveEvent.setButton(Qt::LeftButton); moveEvent.setButtons(Qt::LeftButton); QApplication::sendEvent(viewer->scene(), &moveEvent); QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease); releaseEvent.setScenePos(QPointF(0,0)); releaseEvent.setButton(Qt::LeftButton); releaseEvent.setButtons(Qt::LeftButton); QApplication::sendEvent(viewer->scene(), &releaseEvent); } MovingChanged(false); } CCoeControl::HandlePointerEventL(aPointerEvent); }
void CGO_Player::setAniDirState (Uint8 state, Uint8 direction) { bool directionChanged = false; // direction is different if (this->direction != direction) { // set the new direction if (direction < ANONE) { this->direction = direction; directionChanged = true; } // if direction is NONE, set the previous direction if (direction == ANONE) { direction = this->direction; } } if (this->ani != NULL && this->stateAni == state && !directionChanged) { // nothing } else { setAnimLoop(true); switch (state) { case SSTAND: stopAnim(); this->stateAni = SSTAND; ani = &(a_stand[direction]); /////////////// render.PushRedrawEvent(); break; case SWALK: this->stateAni = SWALK; stopAnim(); ani = &(a_walk[direction]); startAnim(); break; case SCORNERHEAD: this->stateAni = SCORNERHEAD; srand(SDL_GetTicks() + state + direction + getX() + getY() ); stopAnim(); ani = &(a_cornerhead[rand() % CCORNERHEAD]); startAnim(); break; case SDIE: this->stateAni = SDIE; setAnimLoop(false); // die and freeze srand(SDL_GetTicks() + state + direction + getX() + getY() ); stopAnim(); ani = &(a_die[rand() % CDIES]); startAnim(); break; case SPUNCH: this->stateAni = SPUNCH; stopAnim(); ani = &(a_punch[direction]); startAnim(); break; case SKICK: this->stateAni = SKICK; stopAnim(); ani = &(a_kick[direction]); startAnim(); break; case SPICKUP: this->stateAni = SPICKUP; stopAnim(); ani = &(a_pickup[direction]); startAnim(); break; case SSPIN: this->stateAni = SSPIN; stopAnim(); ani = &(a_spin); startAnim(); break; } // cout << "direction: " << (int)direction << ", stateAni: " << (int)state << endl; } }