Beispiel #1
0
void showNunchukData( WiiNunchuk &wiiClassy )
{

		displayAt(0,0,"x: ");
		showHex(wiiClassy.x());

		displayAt(1,0,"y: ");
		showHex(wiiClassy.y());

		displayAt(0,6,"Xa:");
		showHex(wiiClassy.xacc());

		displayAt(0,11,",Ya:");
		showHex(wiiClassy.yacc());

		displayAt(1,6,"Za:");
		showHex(wiiClassy.zacc());

		setPosition(1,12);
		showHex(wiiClassy.z());

		setPosition(1,15);
		showHex(wiiClassy.c());
}
Beispiel #2
0
bool TguitarView::mapTouchEvent(QTouchEvent* te) {
#if defined (Q_OS_ANDROID)
  if (isPreview()) { // PREVIEW MODE
      if (!TtouchParams::i()->guitarWasTouched) { // display hint how to use fret preview
          tMessage->setMessage(TtouchProxy::touchGuitarHelp(), 0);
          TtouchParams::i()->guitarWasTouched = true;
      }
      switch (te->type()) {
        case QEvent::TouchBegin: {
          if (proxy()->isVisible()) // already displayed - can be scrolled or selected
            m_couldBeTouch = true;
          break;
        }
        case QEvent::TouchUpdate: {
          if (isVisible() && m_touchStartedHere &&
              QLineF(te->touchPoints().first().pos(), te->touchPoints().first().startPos()).length() > Tmtr::fingerPixels() / 2)
          { // scrolling - so not selected
              horizontalScrollBar()->setValue(horizontalScrollBar()->value() +
                                              (te->touchPoints()[0].pos().x() - te->touchPoints()[0].lastPos().x()));
              quint8 currFret = m_guitar->pointToFinger(QPoint(horizontalScrollBar()->value() / transform().m11(),
                                                               m_guitar->height() / 2)).fret();
              if ((m_fret == 1 && currFret > 1) || (m_fret != 1 && currFret != m_fret)) {
                m_fret = currFret;
                updateMarkPosition();
                proxy()->setPos(m_fret ? m_guitar->fretPositionX(m_fret) + 9.0 :
                                         m_parent->width() - width(), m_parent->height() - height() - 4);
              }
              m_couldBeTouch = false;
          }
          break;
        }
        case QEvent::TouchEnd: {
          if (isVisible()) {
            if (m_touchStartedHere) { // preview was touched so it might be scrolled or touched
              if (m_couldBeTouch) { // it was touched - fake press the guitar
                if (m_parent->itemAt(te->touchPoints().first().startPos().toPoint()) == proxy()) {
                  QPointF mtgv = proxy()->mapFromScene(te->touchPoints().first().pos()); // mapped from global scene to guitar view
                  m_guitar->fakePress(QPointF((mtgv.x() + horizontalScrollBar()->value()) / transform().m11(),
                                              mtgv.y() / transform().m11()).toPoint());
                }
              } else // touched but scrolled - update displayed fret
                  updateContextPosition();
            } else // guitar (parent widget) was touched, so hide the preview
                hide();
          } else // not visible -display it at touch position
              displayAt(te->touchPoints().first().pos());
          m_touchStartedHere = false;
          m_couldBeTouch = false;
          break;
        }
        default:
          break;
      }
  } else
#endif
  { // NO PREVIEW - only convert touch in guitar into mouse press
      if (te->type() == QEvent::TouchEnd)
          m_guitar->fakePress(QPoint(te->touchPoints().first().pos().x() - m_guitar->x(),
                                     te->touchPoints().first().pos().y() - m_guitar->y()));
  }
  return true;
}