//-------------------------------------------------------------- void testApp::update() { Tweenzor::update( ofGetElapsedTimeMillis() ); int index = 0 ; vector<TileContent*>::iterator t ; for ( t = contents.begin() ; t != contents.end() ; t++ ) { //Update (*t)->update( ) ; //If our input is within the bounds if ( (*t)->hitTest( mouseX , mouseY ) == true ) { cout << "hitTesting over : " << index << endl ; //If this index is NOT already selected index if ( activeTileIndex != index ) { setNewTileActive( index ) ; return ; } else { //Still over but not triggering the initial event return ; } } index++ ; } //If not within over all the contents transition out active if ( activeTileIndex > -1 ) { resetTiles( ) ; } }
mainWidget::mainWidget(QDialog* parent) : QDialog(parent) { setupUi(this); scene = new QGraphicsScene; // if the initial screen is bigger (shows white zones) increase // this scene rect, could be done dynamically... scene->setSceneRect(QRectF(-400,-400,800,800)); graphicsView->setScene(scene); tileBox = new TileBox(scene); graphicsView->centerOn(QPoint(0,0)); settings = new QSettings("libnoise-view", "qknight"); frequency = settings->value("frequency", 0.002).toDouble();; octave = settings->value("octave", 4).toInt(); colorstate = settings->value("drawcoloredOrBlackWhite", true).toBool(); tileBox->colorstate=colorstate; tileBox->octave=octave; tileBox->frequency=frequency; if (colorstate) r1->setChecked(true); else r2->setChecked(true); frequencyleft->setValue(frequency); octavesleft->setValue(octave); connect(octavesleft,SIGNAL(valueChanged ( int )), this, SLOT(octave_changed(int))); connect(frequencyleft,SIGNAL(valueChanged ( double )), this, SLOT(frequency_changed(double))); connect(r1, SIGNAL( toggled ( bool )), this, SLOT( colorstate_changed(bool))); connect(graphicsView, SIGNAL(absoluteViewMoveSignal(QRectF)), tileBox, SLOT(moveTileBox(QRectF))); connect(this, SIGNAL(resetTilesSignal(QRectF)), tileBox, SLOT(resetTiles(QRectF))); connect(tileBox, SIGNAL(sceneItemCountSignal(int)), this, SLOT(updateSceneItemLabel(int))); emit resetTilesSignal(graphicsView->sceneRect()); }
void Waveform::setWindowPosition(qint64 position) { WAVEFORM_DEBUG << "Waveform::setWindowPosition" << "old" << m_windowPosition << "new" << position << "tileArrayStart" << m_tileArrayStart; const qint64 oldPosition = m_windowPosition; m_windowPosition = position; if ((m_windowPosition >= oldPosition) && (m_windowPosition - m_tileArrayStart < (m_tiles.count() * m_tileLength))) { // Work out how many tiles need to be shuffled const qint64 offset = m_windowPosition - m_tileArrayStart; const int nTiles = offset / m_tileLength; shuffleTiles(nTiles); } else { resetTiles(m_windowPosition); } if (!paintTiles() && m_windowPosition != oldPosition) update(); }