Ejemplo n.º 1
0
void ofApp::touchUp(ofTouchEventArgs& touch) {

    resetInactivityTime();

    if (appState != APP && appState != BAR && appState != ABOUT_ASCENDING) return; //adding ABOUT_ASCENDING because of swipe on iOS

    int id = touch.id;

    // ofLogNotice() << "touchUp (" << id << ")" ;

    touchesIterator it = touches.find(id);

    if (it == touches.end()) return;

    int x = it->second.getX();
    int y = it->second.getY();
    float increment = it->second.getIncrement();

    touches.erase(it);

    #if defined TARGET_OF_IOS
    if (y > CONSOLE_HEIGHT*ofGetHeight() && y < ofApp::maxParticleY && !swiping) {
        modules[getModuleIdx(x)]->addParticle(increment, x, y);
        ofLogNotice() << "Particle added" ;
        swiping = false;
    }
    #else
    if (y > CONSOLE_HEIGHT*ofGetHeight() && y < ofApp::maxParticleY) {
        modules[getModuleIdx(x)]->addParticle(increment, x, y);
        ofLogNotice() << "Particle added" ;
    }
    #endif

}
Ejemplo n.º 2
0
void ofApp::touchMoved(ofTouchEventArgs& touch) {

    if (appState == APP) updateNewModuleActive(touch.x);

    resetInactivityTime();

    if(appState == ABOUT) {
        crop -= touch.y - pY;

        if(crop > (imgAbout.getHeight() - ofGetHeight())) {
            crop = (imgAbout.getHeight() - ofGetHeight());
        } else if(crop < 0) crop = 0;

        pY = touch.y;

    }

    if (appState != APP && appState != BAR) return;

    int x = touch.x;
    int y = touch.y;
    int id = touch.id;

    // ofLogNotice() << "touchMoved (" << id << ", " << x << ", " << y << ")" ;

    touchesIterator it = touches.find(id);
    if (it == touches.end()) return;

    it->second.setXY(x, y);

}
Ejemplo n.º 3
0
void UtilsExWindow::useResetInactivityTime()
{
    m_timer->setInterval(1000);
    m_timer->start();
    connect(m_timer, SIGNAL(timeout()), m_utils, SLOT(resetInactivityTime()));
}
Ejemplo n.º 4
0
void ofApp::touchDown(ofTouchEventArgs& touch) {

    lastTouchY = touch.y;

    if (appState == APP) updateNewModuleActive(touch.x);

    resetInactivityTime();

    if (appState == SPLASH_SCREEN || appState == SPLASH_FADE) {
        appState = ABOUT;
        return;
    }

    int x = touch.x;
    int y = touch.y;
    int id = touch.id;

    if (appState == ABOUT) {
        ofRectangle arrowDownRect(ofGetWidth()/2 - imgArrowDown.getWidth()/2, arrowDownY, imgArrowDown.getWidth(), imgArrowDown.getHeight());
        // register starting Y to scroll from
        pY = touch.y;
        if (arrowDownRect.inside(x, y)) {
            appState = ABOUT_DESCENDING;
        }

        if (ptLangRect.inside(x,y)) changeLanguage("pt");
        else if (enLangRect.inside(x,y)) changeLanguage("en");

        return;
    }

    if (appState == APP && barRect.inside(x, y)) {
        appState = BAR_ASCENDING;
        return;
    }

    if (appState == BAR && barRect.inside(x, y)) {
        appState = BAR_DESCENDING;
        return;
    }

    if (appState == BAR && y >= ofGetHeight()*(1-LIMIT_PARTICLE)) {
        appState = ABOUT_ASCENDING;
        return;
    }

    if (appState == APP || appState == BAR) {

        // NOTE: dismiss swipe info after first touch
        if (showSwipeInfo) showSwipeInfo = false;

        // ofLogNotice() << "down (" << id << ", " << x << ", " << y << ")" ;

        if (y > CONSOLE_HEIGHT*ofGetHeight() && (appState != BAR || y < aboutY) && modules[getModuleIdx(x)]->isNotFull()) {
            touches.insert(pair<int,Touch> (id, Touch(x, y)));
        }

    }

    #if defined TARGET_OF_IOS
    swiping = false;
    #endif

}
Ejemplo n.º 5
0
void ofApp::mouseMoved(ofMouseEventArgs& mouse) {
    resetInactivityTime();
}