void WarningWidget::showAnimated() {
	startAnimation(false);
	show();
	setFocus();
}
Exemplo n.º 2
0
int 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);

                    break;

                //don't react on volume keys
                //case 0x07: //Qt::Key_VolumeUp
                //case 0x14: //Qt::Key_VolumeDown

                //don't react on right hand side keys of device
                //case 0x31: //Qt::Key_F7   // Key +
                //case 0x30: //Qt::Key_F8   // Key -

                // don't react on Camera
                //case 0x23: //Qt::Key_F4

                // Lock key on top of device
                //case 0x36: //Qt::Key_F29

                // Key on headphones
                //case 0x33: //Qt::Key_F28
                default:
                       break;
            }

            if ( boot ) 
                // continue boot
                break;
        } 
        if (FD_ISSET(detFd, &set)) {
            if (read(detFd, detectData, 104) == 104) {
                // check if charger has been removed
                if (detectData[CHARGER_DETECT].status == DEV_OFF) {
                    // stop animation soon
                    stopAnimation(0);
                    showImage(POWERING_OFF);

                    system("/sbin/poweroff");

                    break;
                }

                // check battery level
                if (detectData[LOWPOWER_DETECT].status == NORMAL_POWER &&
                    detectData[LOWPOWER_DETECT].extra >= 4) {
                    stopAnimation(0);
                    showImage(FULLY_CHARGED);
                } else {
                    if (!animationPid)
                        startAnimation(CHARGE_ANIMATION);
                }
            }
        }
    }


    ioctl(kbdFd, KDSKBMODE, K_XLATE);
    tcsetattr(kbdFd, TCSANOW, &origTermData);
    close(kbdFd);

    close(detFd);

    return 0;
}
Exemplo n.º 3
0
void 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);
}
Exemplo n.º 4
0
void 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);
                    }

                    emit sendOffsetAnimation(dataToSend);
                }
            }

        // check end of the loop
            m_oLoopMutex.lockForRead();
                l_bDoLoop = m_bDoLoop;
            m_oLoopMutex.unlock();

            ++l_numLine;

            emit drawSceneSignal();
    }
}
Exemplo n.º 5
0
void KCMailSendingStatus::showStatus()
{
    destinationTop=0;
    startAnimation();
}
Exemplo n.º 6
0
void ToolBoxGraphicsItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)
{
    startAnimation(QAbstractAnimation::Backward);
    QGraphicsItemGroup::hoverLeaveEvent(event);
}
Exemplo n.º 7
0
void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const FloatRect& src, ColorSpace styleColorSpace, CompositeOperator op)
{
    FloatRect srcRect(src);
    FloatRect dstRect(dst);

    if (dstRect.width() == 0.0f || dstRect.height() == 0.0f ||
        srcRect.width() == 0.0f || srcRect.height() == 0.0f)
        return;

    startAnimation();

    cairo_surface_t* image = frameAtIndex(m_currentFrame);
    if (!image) // If it's too early we won't have an image yet.
        return;

    if (mayFillWithSolidColor()) {
        fillWithSolidColor(context, dstRect, solidColor(), styleColorSpace, op);
        return;
    }

    IntSize selfSize = size();

    cairo_t* cr = context->platformContext();
    context->save();

    // Set the compositing operation.
    if (op == CompositeSourceOver && !frameHasAlphaAtIndex(m_currentFrame))
        context->setCompositeOperation(CompositeCopy);
    else
        context->setCompositeOperation(op);

    // If we're drawing a sub portion of the image or scaling then create
    // a pattern transformation on the image and draw the transformed pattern.
    // Test using example site at http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
    cairo_pattern_t* pattern = cairo_pattern_create_for_surface(image);

    cairo_pattern_set_extend(pattern, CAIRO_EXTEND_PAD);

    float scaleX = srcRect.width() / dstRect.width();
    float scaleY = srcRect.height() / dstRect.height();
    cairo_matrix_t matrix = { scaleX, 0, 0, scaleY, srcRect.x(), srcRect.y() };
    cairo_pattern_set_matrix(pattern, &matrix);

    // Draw the shadow
#if ENABLE(FILTERS)
    FloatSize shadowOffset;
    float shadowBlur;
    Color shadowColor;
    if (context->getShadow(shadowOffset, shadowBlur, shadowColor)) {
        IntSize shadowBufferSize;
        FloatRect shadowRect;
        float radius = 0;
        context->calculateShadowBufferDimensions(shadowBufferSize, shadowRect, radius, dstRect, shadowOffset, shadowBlur);
        shadowColor = colorWithOverrideAlpha(shadowColor.rgb(), (shadowColor.alpha() *  context->getAlpha()) / 255.f);

        //draw shadow into a new ImageBuffer
        OwnPtr<ImageBuffer> shadowBuffer = ImageBuffer::create(shadowBufferSize);
        cairo_t* shadowContext = shadowBuffer->context()->platformContext();
        cairo_set_source(shadowContext, pattern);
        cairo_translate(shadowContext, -dstRect.x(), -dstRect.y());
        cairo_rectangle(shadowContext, 0, 0, dstRect.width(), dstRect.height());
        cairo_fill(shadowContext);

        context->applyPlatformShadow(shadowBuffer.release(), shadowColor, shadowRect, radius);
    }
#endif

    // Draw the image.
    cairo_translate(cr, dstRect.x(), dstRect.y());
    cairo_set_source(cr, pattern);
    cairo_pattern_destroy(pattern);
    cairo_rectangle(cr, 0, 0, dstRect.width(), dstRect.height());
    cairo_clip(cr);
    cairo_paint_with_alpha(cr, context->getAlpha());

    context->restore();

    if (imageObserver())
        imageObserver()->didDraw(this);
}
Exemplo n.º 8
0
void AsScene1308LightWallSymbols::stFadeIn() {
	startAnimation(0x80180A10, 0, -1);
	setVisible(true);
	_newStickFrameIndex = STICK_LAST_FRAME;
}
Exemplo n.º 9
0
void AsScene1308LightWallSymbols::stFadeOut() {
	startAnimation(0x80180A10, -1, -1);
	_playBackwards = true;
	NextState(&AsScene1308LightWallSymbols::stFadeOutDone);
}
Exemplo n.º 10
0
void AsScene1308JaggyDoor::stOpenDoor() {
	startAnimation(0xBA0AE050, 0, -1);
	setVisible(true);
	playSound(0, calcHash("fxDoorOpen38"));
	NextState(&AsScene1308JaggyDoor::stOpenDoorDone);
}
Exemplo n.º 11
0
void AsScene1308KeyboardDoor::stFallingKeys() {
	startAnimation(0x6238B191, 0, -1);
	_x = 580;
	_y = 383;
	NextState(&AsScene1308KeyboardDoor::stFallingKeysDone);
}
Exemplo n.º 12
0
void AsScene1307Key::stInsert() {
	const uint32 *fileHashes = kAsScene1307KeyResourceLists[_keyIndex];
	startAnimation(fileHashes[2], 0, -1);
	_newStickFrameIndex = STICK_LAST_FRAME;
}
Exemplo n.º 13
0
void AsScene1303Balloon::stPopBalloon() {
	startAnimation(0xAC004CD0, 0, -1);
	SetMessageHandler(&AsScene1303Balloon::hmBalloonPopped);
}
void WarningWidget::hideAnimated() {
	startAnimation(true);
}
Exemplo n.º 15
0
void SoXipDicomExaminer::handleEvent( SoHandleEventAction* action )
{
	// Set the Dicom Element
	setElement( action );

	// Call base class first
	SoXipKit::handleEvent( action );
	if( action->isHandled() )
		return ;

	// Save the view information (so we can have access to it
	// while the event is grabbed)
	saveViewInformation( action );

	const SoEvent* event = action->getEvent();
	if( !event )
		return ;
	
	if( mode.getValue() == NONE )
		return ;

	if( SO_MOUSE_PRESS_EVENT( event, BUTTON1 ) )
	{
		// Stop the animation as soon as we get a mouse down event
		stopAnimation();

		mLastMousePosition = event->getNormalizedPosition( mViewport );

		action->setHandled();
		action->setGrabber( this );

		mPan = SbBox2f(0.2, 0.2, 0.8, 0.8).intersect( mLastMousePosition );
	}
	else if( event->isOfType( SoLocation2Event::getClassTypeId() ) )
	{
		SbVec2f mousePos = event->getNormalizedPosition( mViewport );

		if( action->getGrabber() != this )
		{
			if( mousePos[0] >= 0 && mousePos[0] <= 1.f &&
				mousePos[1] >= 0 && mousePos[1] <= 1.f )
			{
				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( mode.getValue() == PANZOOM )
				{
					SbBox2f panBox( 0.2, 0.2, 0.8, 0.8 );
					if( panBox.intersect( event->getNormalizedPosition( mViewport ) ) )
						SoXipCursor::setCursor( "SEL_PAN" );
					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();
	}
}
Exemplo n.º 16
0
void AsScene1302Bridge::stLowerBridge() {
	startAnimation(0x88148150, 0, -1);
	playSound(1);
	NextState(&AsScene1302Bridge::cbLowerBridgeEvent);
}
Exemplo n.º 17
0
void DockItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)
{
	startAnimation();
}
Exemplo n.º 18
0
void AsScene1302Bridge::stRaiseBridge() {
	startAnimation(0x88148150, 7, -1);
	_playBackwards = true;
	_newStickFrameIndex = 0;
	playSound(0);
}
Exemplo n.º 19
0
void InnerDropdown::onHideStart() {
	if (_hiding) return;

	_hiding = true;
	startAnimation();
}
Exemplo n.º 20
0
void AsScene1302Bridge::cbLowerBridgeEvent() {
	sendMessage(_parentScene, 0x2032, 0);
	startAnimation(0x88148150, -1, -1);
	_newStickFrameIndex = STICK_LAST_FRAME;
}
Exemplo n.º 21
0
bool 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
}
Exemplo n.º 22
0
void AsScene3009VerticalIndicator::show() {
	startAnimation(0xC2463913, 0, -1);
	setVisible(true);
	updatePosition();
	_enabled = true;
}
Exemplo n.º 23
0
void KCMailSendingStatus::hideStatus()
{
    destinationTop=-height()-30;
    startAnimation();
}
Exemplo n.º 24
0
void AsScene3009HorizontalIndicator::show() {
	startAnimation(0xC0C12954, 0, -1);
	setVisible(true);
	updatePosition();
	_enabled = true;
}
Exemplo n.º 25
0
void PointCloudViewer::init()
{
	setAnimationPeriod(30);
	startAnimation();
}
Exemplo n.º 26
0
void Spinner::start()
{
  setVisible(true);
  startAnimation();
}
Exemplo n.º 27
0
void Logo::nextFrame() {
	Screen &screen = *_vm->_screen;

	if (_waitFrames) {
		uint32 currFrame = _frameCounter;
		if (currFrame - _waitStartFrame < _waitFrames) {
			return;
		}
		_waitStartFrame = 0;
		_waitFrames = 0;
	}

	if (_animateFrames) {
		uint32 currFrame = _frameCounter;
		if (currFrame > _animateStartFrame + _animateFrameDelay) {
			AnimationFrame animationFrame = _animateFrames[_animateFrame];
			if (animationFrame.frame) {
				_objects[_animateObject]._frame = animationFrame.frame;
				_objects[_animateObject]._position = Common::Point(animationFrame.x, animationFrame.y);
				_animateStartFrame += _animateFrameDelay;
				_animateFrame++;
			} else {
				_animateObject = 0;
				_animateFrameDelay = 0;
				_animateFrames = NULL;
				_animateStartFrame = 0;
				_animateFrame = 0;
			}
		}
		if (_animateFrames)
			return;
	}

	switch (_counter++) {
	case 0:
		// Load the background and fade it in
		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;
	}
}
void TaskEditor::discardChanges() {
  startAnimation(fullSize, false);
}
Exemplo n.º 29
0
void 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);
        }
    }
}
Exemplo n.º 30
0
void AsScene2402TV::stJokeFinished() {
	setGlobalVar(V_TV_JOKE_TOLD, 1);
	startAnimation(0x050A0103, 0, -1);
	_newStickFrameIndex = 0;
	SetUpdateHandler(&AsScene2402TV::upFocusKlaymen);
}