AnalogPad::AnalogPad(QWidget *parent) :QWidget(parent), m_Position(0, 0), m_PadPosition(0, 0), m_TouchPosition(0, 0), m_MouseDown(false), m_MouseClick(false), m_LimitReached(false), m_BackgroundColor1(BACKGROUND_COLOR_1), m_BackgroundColor2(BACKGROUND_COLOR_2), m_EffectColor(EFFECT_COLOR) { // Start animation timer m_AnimTimer = new QTimer(this); connect(m_AnimTimer, SIGNAL(timeout()), this, SLOT(animationTick())); m_AnimTimer->start(ANIM_TIMER); // Start signal emit timer m_EmitTimer = new QTimer(this); connect(m_EmitTimer, SIGNAL(timeout()), this, SLOT(emitPadValue())); m_EmitTimer->start(EMIT_TIMER); // Click animation timeline m_ClickTimeLine = new QTimeLine(300, this); m_ClickTimeLine->setFrameRange(0, 20); connect(m_ClickTimeLine, SIGNAL(frameChanged(int)), this, SLOT(clickAnimationFrameChanged(int))); }
//----------------------------------------------------------------------------- void ExchangeViewAnimation::animationFinished (CView* view, IdStringPtr name, bool wasCanceled) { if (wasCanceled) { animationTick (0, 0, 1.f); } if (viewToRemove->getParentView ()) { reinterpret_cast<CViewContainer*> (viewToRemove->getParentView ())->removeView (viewToRemove); } }
int main(void) { static uint8_t oldPosition; static uint8_t divVal, modVal; cli(); wdt_disable(); set_sleep_mode( SLEEP_MODE_IDLE ); initDevice(); DDRD = 0b11111111; DDRB = 0b11111111; initTimer2(); initTimer0(); sei(); startTimer2(); startTimer0(); frame = buf1; buffer = buf2; CLEAR_BUFFER( frame ); CLEAR_BUFFER( buffer ); setAnimationFunction( anim_fillDot, TRUE, TRUE ); animation.loop = TRUE; while ( 1 ) { if( animation.tick ) { animationTick(); clearTick(); } if( currentScanPixel == 0 ) { if( animation.nextFrameReady ) { animationBufferSwap(); } } if( oldPosition != currentScanPixel ) { modVal = currentScanPixel % 8; //we need to change columns only so often if( modVal == 0 ) { divVal = currentScanPixel / 8; COL_PIXEL( divVal ); } if( frame[ divVal ] & _BV( modVal ) ) { ROW_PIXEL( modVal ); } else { ROW_OFF(); } oldPosition = currentScanPixel; } //if( TIME TO SLEEP ) { sleep_mode(); } } }