这篇教程C++ startAnimation函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中startAnimation函数的典型用法代码示例。如果您正苦于以下问题:C++ startAnimation函数的具体用法?C++ startAnimation怎么用?C++ startAnimation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了startAnimation函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: startAnimationvoid WarningWidget::showAnimated() { startAnimation(false); show(); setFocus();}
开发者ID:telegramdesktop,项目名称:tdesktop,代码行数:5,
示例2: mainint main(int argc, char *argv[]){ int detFd = open(DETDEVICE, O_RDONLY|O_NDELAY, 0); if (detFd < 0) { perror(DETDEVICE); return 1; } detect_device_t detectData[26]; if (read(detFd, detectData, 104) < 104) { perror(DETDEVICE); return 1; } if (detectData[BOOTSRC_DETECT].status != OMEGABOOT_CHG) { // Boot not triggered by charger insertion // Continue normal boot return 0; } else if (detectData[CHARGER_DETECT].status != DEV_ON) { // Boot triggered by charger, but has since been removed // Power off system("/sbin/poweroff"); return 0; } int kbdFd = open(KBDDEVICE, O_RDONLY, 0); if (kbdFd < 0) { perror(KBDDEVICE); return 1; } startAnimation(CHARGE_ANIMATION); struct termios origTermData; struct termios termData; tcgetattr(kbdFd, &origTermData); tcgetattr(kbdFd, &termData); ioctl(kbdFd, KDSKBMODE, K_RAW); termData.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); termData.c_oflag = 0; termData.c_cflag = CREAD | CS8; termData.c_lflag = 0; termData.c_cc[VTIME]=0; termData.c_cc[VMIN]=1; cfsetispeed(&termData, 9600); cfsetospeed(&termData, 9600); tcsetattr(kbdFd, TCSANOW, &termData); unsigned char code = 0; while (1) { fd_set set; FD_ZERO(&set); FD_SET(kbdFd, &set); FD_SET(detFd, &set); // check if user has pressed any key int ret = select(FD_SETSIZE, &set, NULL, NULL, NULL); if ( ret < 0 ) // continue boot if error break; if (FD_ISSET(kbdFd, &set)) { read(kbdFd, &code, 1); int boot = 0; switch (code & 0x7f) { // Keypad case 0x2e: //Qt::Key_0 case 0x02: //Qt::Key_1 case 0x03: //Qt::Key_2 case 0x04: //Qt::Key_3 case 0x05: //Qt::Key_4 case 0x06: //Qt::Key_5 case 0x08: //Qt::Key_6 case 0x09: //Qt::Key_7 case 0x0a: //Qt::Key_8 case 0x0b: //Qt::Key_9 case 0x1e: //Qt::Key_Asterisk; case 0x20: //Qt::Key_NumberSign; // Navigation+ case 0x32: //Qt::Key_Call case 0x16: //Qt::Key_Hangup case 0x19: //Qt::Key_Context1 case 0x26: //Qt::Key_Back case 0x12: //Qt::Key_Up case 0x24: //Qt::Key_Down case 0x21: //Qt::Key_Left case 0x17: //Qt::Key_Right case 0x22: //Qt::Key_Select // stop animation now boot = 1; stopAnimation(1);//.........这里部分代码省略.........
开发者ID:GodFox,项目名称:qtopia-ezx,代码行数:101,
示例3: startAnimationvoid BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& destRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator compositeOp){ startAnimation(); RetainPtr<CGImageRef> image = frameAtIndex(m_currentFrame); if (!image) // If it's too early we won't have an image yet. return; if (mayFillWithSolidColor()) { fillWithSolidColor(ctxt, destRect, solidColor(), styleColorSpace, compositeOp); return; } float currHeight = CGImageGetHeight(image.get()); if (currHeight <= srcRect.y()) return; CGContextRef context = ctxt->platformContext(); ctxt->save(); bool shouldUseSubimage = false; // If the source rect is a subportion of the image, then we compute an inflated destination rect that will hold the entire image // and then set a clip to the portion that we want to display. FloatRect adjustedDestRect = destRect; FloatSize selfSize = currentFrameSize(); if (srcRect.size() != selfSize) { CGInterpolationQuality interpolationQuality = CGContextGetInterpolationQuality(context); // When the image is scaled using high-quality interpolation, we create a temporary CGImage // containing only the portion we want to display. We need to do this because high-quality // interpolation smoothes sharp edges, causing pixels from outside the source rect to bleed // into the destination rect. See <rdar://problem/6112909>. shouldUseSubimage = (interpolationQuality == kCGInterpolationHigh || interpolationQuality == kCGInterpolationDefault) && (srcRect.size() != destRect.size() || !ctxt->getCTM().isIdentityOrTranslationOrFlipped()); float xScale = srcRect.width() / destRect.width(); float yScale = srcRect.height() / destRect.height(); if (shouldUseSubimage) { FloatRect subimageRect = srcRect; float leftPadding = srcRect.x() - floorf(srcRect.x()); float topPadding = srcRect.y() - floorf(srcRect.y()); subimageRect.move(-leftPadding, -topPadding); adjustedDestRect.move(-leftPadding / xScale, -topPadding / yScale); subimageRect.setWidth(ceilf(subimageRect.width() + leftPadding)); adjustedDestRect.setWidth(subimageRect.width() / xScale); subimageRect.setHeight(ceilf(subimageRect.height() + topPadding)); adjustedDestRect.setHeight(subimageRect.height() / yScale); image.adoptCF(CGImageCreateWithImageInRect(image.get(), subimageRect)); if (currHeight < srcRect.bottom()) { ASSERT(CGImageGetHeight(image.get()) == currHeight - CGRectIntegral(srcRect).origin.y); adjustedDestRect.setHeight(CGImageGetHeight(image.get()) / yScale); } } else { adjustedDestRect.setLocation(FloatPoint(destRect.x() - srcRect.x() / xScale, destRect.y() - srcRect.y() / yScale)); adjustedDestRect.setSize(FloatSize(selfSize.width() / xScale, selfSize.height() / yScale)); } CGContextClipToRect(context, destRect); } // If the image is only partially loaded, then shrink the destination rect that we're drawing into accordingly. if (!shouldUseSubimage && currHeight < selfSize.height()) adjustedDestRect.setHeight(adjustedDestRect.height() * currHeight / selfSize.height()); ctxt->setCompositeOperation(compositeOp); // Flip the coords. CGContextScaleCTM(context, 1, -1); adjustedDestRect.setY(-adjustedDestRect.bottom()); // Adjust the color space. image = imageWithColorSpace(image.get(), styleColorSpace); // Draw the image. CGContextDrawImage(context, adjustedDestRect, image.get()); ctxt->restore(); if (imageObserver()) imageObserver()->didDraw(this);}
开发者ID:dslab-epfl,项目名称:warr,代码行数:83,
示例4: l_currentAnimCloudvoid SWViewerWorker::startLoop(){ bool l_bDoLoop; m_oLoopMutex.lockForRead(); l_bDoLoop = m_bDoLoop; m_oLoopMutex.unlock(); QTime l_oStartTime; l_oStartTime.start(); int l_numLine = 0; QVector<bool> l_currentAnimCloud(m_vCloudsAnimation.size(),true); QVector<bool> l_currentAnimMesh(m_vMeshesAnimation.size(),true); clock_t l_oProgramTime = clock(); while(l_bDoLoop) { //control the time of the loop while(l_oStartTime.elapsed() < m_i32LoopPeriod) { QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents, m_i32LoopPeriod - l_oStartTime.elapsed()); } l_oStartTime.restart(); bool l_cloudAnimStillRunning = false; for(int ii = 0; ii < l_currentAnimCloud.size(); ++ii) { if(l_currentAnimCloud[ii] == true) { l_cloudAnimStillRunning = true; break; } } bool l_meshAnimStillRunning = false; for(int ii = 0; ii < l_currentAnimMesh.size(); ++ii) { if(l_currentAnimMesh[ii] == true) { l_meshAnimStillRunning = true; break; } } if(!l_cloudAnimStillRunning && !l_meshAnimStillRunning) { l_bDoLoop = false; break; } // ... for(int ii = 0; ii < m_vCloudsAnimation.size(); ++ii) { if(!l_currentAnimCloud[ii]) { continue; } SWAnimationSendDataPtr dataToSend = SWAnimationSendDataPtr(new SWAnimationSendData()); dataToSend->m_index = ii; dataToSend->m_isCloud = true; if(!m_vCloudsAnimation[ii].retrieveTransfosToApply(l_numLine, dataToSend->m_animationOffsetsX, dataToSend->m_animationOffsetsY,dataToSend->m_animationOffsetsZ,dataToSend->m_animationRigidMotion)) { l_currentAnimCloud[ii] = false; } else { if(l_numLine == 0) { emit startAnimation(true, ii); } emit sendOffsetAnimation(dataToSend); } } for(int ii = 0; ii < m_vMeshesAnimation.size(); ++ii) { if(!l_currentAnimMesh[ii]) { continue; } SWAnimationSendDataPtr dataToSend = SWAnimationSendDataPtr(new SWAnimationSendData()); dataToSend->m_index = ii; dataToSend->m_isCloud = false; if(!m_vMeshesAnimation[ii].retrieveTransfosToApply(l_numLine, dataToSend->m_animationOffsetsX, dataToSend->m_animationOffsetsY,dataToSend->m_animationOffsetsZ,dataToSend->m_animationRigidMotion)) { l_currentAnimMesh[ii] = false; } else { if(l_numLine == 0) { emit startAnimation(false, ii); }//.........这里部分代码省略.........
开发者ID:GuillaumeGibert,项目名称:swooz,代码行数:101,
示例5: startAnimationvoid KCMailSendingStatus::showStatus(){ destinationTop=0; startAnimation();}
开发者ID:Kreogist,项目名称:Cuties,代码行数:5,
示例6: startAnimationvoid ToolBoxGraphicsItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* event){ startAnimation(QAbstractAnimation::Backward); QGraphicsItemGroup::hoverLeaveEvent(event);}
开发者ID:An-dy,项目名称:qTox,代码行数:5,
示例7: startAnimationvoid AsScene1308LightWallSymbols::stFadeIn() { startAnimation(0x80180A10, 0, -1); setVisible(true); _newStickFrameIndex = STICK_LAST_FRAME;}
开发者ID:jaeyeonkim,项目名称:scummvm-kor,代码行数:5,
示例8: setElement//.........这里部分代码省略......... else SoXipCursor::setCursor( "SEL_ZOOM" ); } action->setHandled(); } } else if( mode.getValue() == PANZOOM ) { if( mPan ) { // The user starts dragging in the center of the image // Apply a translation to the view matrix // SbVec3f pos1 = mPlaneProj.project( mousePos ); SbVec3f pos2 = mPlaneProj.project( mLastMousePosition ); getCamera()->position.setValue( getCamera()->position.getValue() - pos1 + pos2 ); mLastMousePosition = mousePos; SoXipCursor::setCursor( "SEL_PAN" ); } else { // The user starts dragging from the view border // Apply a zoom factor to the image // getCamera()->scaleHeight( 1.f + ( mLastMousePosition[1] - mousePos[1] ) ); mLastMousePosition = mousePos; SoXipCursor::setCursor( "SEL_ZOOM" ); } action->setHandled(); } else if( mode.getValue() == SHIFT || mode.getValue() == SCROLL || mode.getValue() == SHIFTSCROLL ) { float hStep = 0; float vStep = 0; if( mode.getValue() == SHIFT || mode.getValue() == SHIFTSCROLL ) { vStep = ( mousePos[1] - mLastMousePosition[1] ) * (float) mViewport.getViewportSizePixels()[1] / 60.; } if( mode.getValue() == SCROLL || mode.getValue() == SHIFTSCROLL ) { hStep = ( mousePos[0] - mLastMousePosition[0] ) * (float) mViewport.getViewportSizePixels()[0] / 60.; } // Change in direction: stop if( mAnimateVStep < 0 && vStep > 0 || mAnimateVStep > 0 && vStep < 0 || mAnimateHStep < 0 && hStep > 0 || mAnimateHStep > 0 && hStep < 0 ) { // Change in direction: stop stopAnimation(); mAnimateChange = 10; } else { if( mAnimateVStep == 0 && mAnimateHStep == 0 ) { if( mAnimateChange <= 0 ) { // Start new shift startAnimation( hStep, vStep ); } else -- mAnimateChange; } else { // Speed up a little mAnimateHStep += hStep; mAnimateVStep += vStep; } } mLastMousePosition = mousePos; action->setHandled(); if( mode.getValue() == SHIFT ) SoXipCursor::setCursor( "SHIFT" ); else if( mode.getValue() == SCROLL ) SoXipCursor::setCursor( "SCROLL" ); else if( mode.getValue() == SHIFTSCROLL ) SoXipCursor::setCursor( "SHIFTSCROLL" ); } } else if( SO_MOUSE_RELEASE_EVENT( event, BUTTON1 ) && action->getGrabber() == this ) { stopAnimation(); action->releaseGrabber(); action->setHandled(); }}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:101,
示例9: startAnimationvoid DockItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* event){ startAnimation();}
开发者ID:ViktorNova,项目名称:qtpanel,代码行数:4,
示例10: startAnimationvoid InnerDropdown::onHideStart() { if (_hiding) return; _hiding = true; startAnimation();}
开发者ID:2asoft,项目名称:tdesktop,代码行数:6,
示例11: sendMessagevoid AsScene1302Bridge::cbLowerBridgeEvent() { sendMessage(_parentScene, 0x2032, 0); startAnimation(0x88148150, -1, -1); _newStickFrameIndex = STICK_LAST_FRAME;}
开发者ID:jaeyeonkim,项目名称:scummvm-kor,代码行数:5,
示例12: CReverseAnimationbool CDefenceAnimation::init(){ if(attacker == nullptr && owner->battleEffects.size() > 0) return false; ui32 lowestMoveID = owner->animIDhelper + 5; for(auto & elem : owner->pendingAnims) { CDefenceAnimation * defAnim = dynamic_cast<CDefenceAnimation *>(elem.first); if(defAnim && defAnim->stack->ID != stack->ID) continue; CAttackAnimation * attAnim = dynamic_cast<CAttackAnimation *>(elem.first); if(attAnim && attAnim->stack->ID != stack->ID) continue; CSpellEffectAnimation * sen = dynamic_cast<CSpellEffectAnimation *>(elem.first); if (sen) continue; CReverseAnimation * animAsRev = dynamic_cast<CReverseAnimation *>(elem.first); if(animAsRev) return false; if(elem.first) vstd::amin(lowestMoveID, elem.first->ID); } if(ID > lowestMoveID) return false; //reverse unit if necessary if (attacker && owner->getCurrentPlayerInterface()->cb->isToReverse(stack->position, attacker->position, owner->creDir[stack->ID], attacker->doubleWide(), owner->creDir[attacker->ID])) { owner->addNewAnim(new CReverseAnimation(owner, stack, stack->position, true)); return false; } //unit reversed if(rangedAttack) //delay hit animation { for(std::list<ProjectileInfo>::const_iterator it = owner->projectiles.begin(); it != owner->projectiles.end(); ++it) { if(it->creID == attacker->getCreature()->idNumber) { return false; } } } // synchronize animation with attacker, unless defending or attacked by shooter: // wait for 1/2 of attack animation if (!rangedAttack && getMyAnimType() != CCreatureAnim::DEFENCE) { float frameLength = AnimationControls::getCreatureAnimationSpeed( stack->getCreature(), owner->creAnims[stack->ID], getMyAnimType()); timeToWait = myAnim->framesInGroup(getMyAnimType()) * frameLength / 2; myAnim->setType(CCreatureAnim::HOLDING); } else { timeToWait = 0; startAnimation(); } return true; //initialized successfuly}
开发者ID:andrew889,项目名称:vcmi,代码行数:72,
示例13: startAnimationvoid AsScene3009VerticalIndicator::show() { startAnimation(0xC2463913, 0, -1); setVisible(true); updatePosition(); _enabled = true;}
开发者ID:SinSiXX,项目名称:scummvm,代码行数:6,
示例14: setAnimationPeriodvoid PointCloudViewer::init(){ setAnimationPeriod(30); startAnimation();}
开发者ID:tomgeb,项目名称:lsd_slam,代码行数:5,
示例15: setVisiblevoid Spinner::start(){ setVisible(true); startAnimation();}
开发者ID:johnbolia,项目名称:schat,代码行数:5,
示例16: switch//.........这里部分代码省略......... loadBackground(); fade(_palette1); break; case 1: // First half of square, circle, and triangle arranging themselves _objects[0].setVisage(16, 1); _objects[0]._frame = 1; _objects[0]._position = Common::Point(169, 107); _objects[0]._numFrames = 7; _objects[0].setAnimMode(true); break; case 2: // Keep waiting until first animation ends if (!_objects[0].isAnimEnded()) { --_counter; } else { // Start second half of the shapes animation _objects[0].setVisage(16, 2); _objects[0]._frame = 1; _objects[0]._numFrames = 11; _objects[0].setAnimMode(true); } break; case 3: // Keep waiting until second animation of shapes ordering themselves ends if (!_objects[0].isAnimEnded()) { --_counter; } else { // Fade out the background but keep the shapes visible fade(_palette2); screen._backBuffer1.clear(); } waitFrames(10); break; case 4: // Load the new palette byte palette[PALETTE_SIZE]; Common::copy(&_palette2[0], &_palette2[PALETTE_SIZE], &palette[0]); _lib.getPalette(palette, 12); screen.clear(); screen.setPalette(palette); // Morph into the EA logo _objects[0].setVisage(12, 1); _objects[0]._frame = 1; _objects[0]._numFrames = 7; _objects[0].setAnimMode(true); _objects[0]._position = Common::Point(170, 142); _objects[0].setDestination(Common::Point(158, 71)); break; case 5: // Wait until the logo has expanded upwards to form EA logo if (_objects[0].isMoving()) --_counter; break; case 6: fade(_palette3, 40); break; case 7: // Show the 'Electronic Arts' company name _objects[1].setVisage(14, 1); _objects[1]._frame = 1; _objects[1]._position = Common::Point(152, 98); waitFrames(120); break; case 8: // Start sequence of positioning and size hand cursor in an arc _objects[2].setVisage(18, 1); startAnimation(2, 5, &handFrames[0]); break; case 9: // Show a highlighting of the company name _objects[1].remove(); _objects[2].erase(); _objects[2].remove(); _objects[3].setVisage(19, 1); startAnimation(3, 8, &companyFrames[0]); break; case 10: waitFrames(180); break; case 11: _finished = true; break; default: break; }}
开发者ID:86400,项目名称:scummvm,代码行数:101,
示例17: startAnimationvoid TaskEditor::discardChanges() { startAnimation(fullSize, false);}
开发者ID:hanschen,项目名称:Remember-The-Milk-Simple,代码行数:3,
示例18: monotonicallyIncreasingTimevoid BitmapImage::startAnimation(bool catchUpIfNecessary){ if (m_frameTimer || !shouldAnimate() || frameCount() <= 1) return; // If we aren't already animating, set now as the animation start time. const double time = monotonicallyIncreasingTime(); if (!m_desiredFrameStartTime) m_desiredFrameStartTime = time; // Don't advance the animation to an incomplete frame. size_t nextFrame = (m_currentFrame + 1) % frameCount(); if (!m_allDataReceived && !frameIsCompleteAtIndex(nextFrame)) return; // Don't advance past the last frame if we haven't decoded the whole image // yet and our repetition count is potentially unset. The repetition count // in a GIF can potentially come after all the rest of the image data, so // wait on it. if (!m_allDataReceived && repetitionCount(false) == cAnimationLoopOnce && m_currentFrame >= (frameCount() - 1)) return; // Determine time for next frame to start. By ignoring paint and timer lag // in this calculation, we make the animation appear to run at its desired // rate regardless of how fast it's being repainted. const double currentDuration = frameDurationAtIndex(m_currentFrame); m_desiredFrameStartTime += currentDuration; // When an animated image is more than five minutes out of date, the // user probably doesn't care about resyncing and we could burn a lot of // time looping through frames below. Just reset the timings. const double cAnimationResyncCutoff = 5 * 60; if ((time - m_desiredFrameStartTime) > cAnimationResyncCutoff) m_desiredFrameStartTime = time + currentDuration; // The image may load more slowly than it's supposed to animate, so that by // the time we reach the end of the first repetition, we're well behind. // Clamp the desired frame start time in this case, so that we don't skip // frames (or whole iterations) trying to "catch up". This is a tradeoff: // It guarantees users see the whole animation the second time through and // don't miss any repetitions, and is closer to what other browsers do; on // the other hand, it makes animations "less accurate" for pages that try to // sync an image and some other resource (e.g. audio), especially if users // switch tabs (and thus stop drawing the animation, which will pause it) // during that initial loop, then switch back later. if (nextFrame == 0 && m_repetitionsComplete == 0 && m_desiredFrameStartTime < time) m_desiredFrameStartTime = time; if (!catchUpIfNecessary || time < m_desiredFrameStartTime) { // Haven't yet reached time for next frame to start; delay until then. m_frameTimer = new Timer<BitmapImage>(this, &BitmapImage::advanceAnimation); m_frameTimer->startOneShot(std::max(m_desiredFrameStartTime - time, 0.)); } else { // We've already reached or passed the time for the next frame to start. // See if we've also passed the time for frames after that to start, in // case we need to skip some frames entirely. Remember not to advance // to an incomplete frame. for (size_t frameAfterNext = (nextFrame + 1) % frameCount(); frameIsCompleteAtIndex(frameAfterNext); frameAfterNext = (nextFrame + 1) % frameCount()) { // Should we skip the next frame? double frameAfterNextStartTime = m_desiredFrameStartTime + frameDurationAtIndex(nextFrame); if (time < frameAfterNextStartTime) break; // Yes; skip over it without notifying our observers. if (!internalAdvanceAnimation(true)) return; m_desiredFrameStartTime = frameAfterNextStartTime; nextFrame = frameAfterNext; } // Draw the next frame immediately. Note that m_desiredFrameStartTime // may be in the past, meaning the next time through this function we'll // kick off the next advancement sooner than this frame's duration would // suggest. if (internalAdvanceAnimation(false)) { // The image region has been marked dirty, but once we return to our // caller, draw() will clear it, and nothing will cause the // animation to advance again. We need to start the timer for the // next frame running, or the animation can hang. (Compare this // with when advanceAnimation() is called, and the region is dirtied // while draw() is not in the callstack, meaning draw() gets called // to update the region and thus startAnimation() is reached again.) // NOTE: For large images with slow or heavily-loaded systems, // throwing away data as we go (see destroyDecodedData()) means we // can spend so much time re-decoding data above that by the time we // reach here we're behind again. If we let startAnimation() run // the catch-up code again, we can get long delays without painting // as we race the timer, or even infinite recursion. In this // situation the best we can do is to simply change frames as fast // as possible, so force startAnimation() to set a zero-delay timer // and bail out if we're not caught up. startAnimation(false); } }}
开发者ID:webOS-ports,项目名称:webkit,代码行数:95,
示例19: setGlobalVarvoid AsScene2402TV::stJokeFinished() { setGlobalVar(V_TV_JOKE_TOLD, 1); startAnimation(0x050A0103, 0, -1); _newStickFrameIndex = 0; SetUpdateHandler(&AsScene2402TV::upFocusKlaymen);}
开发者ID:jaeyeonkim,项目名称:scummvm-kor,代码行数:6,
注:本文中的startAnimation函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ startCommand函数代码示例 C++ start函数代码示例 |