void aAnimButton::update( const aAnimation& animData ) { if ( !isShowing() ) return; long color = animData.getColor(); if ( animateBmp ) setColor( color, 0 ); if ( animateText ) data.textColors[state] = color; long xPos = animData.getXDelta(); long yPos = animData.getYDelta(); move( xPos, yPos ); if ( bAnimateChildren ) { for ( int i = 0; i < numberOfChildren(); i++ ) pChildren[i]->setColor( color ); } float fXcaleX = animData.getScaleX(); float fScaleY = animData.getScaleX(); if ( fXcaleX != 1.0 && fScaleY != 1.0 ) { float oldWidth = width(); float oldHeight = height(); float oldLeft = globalX(); float oldTop = globalY(); float scaleX = .5 * fXcaleX * width(); float scaleY = .5 * fScaleY * height(); float midX = globalX() + .5 * width(); float midY = globalY() + .5 * height(); float newLeft = midX - scaleX; float newTop = midY - scaleY; moveToNoRecurse( newLeft, newTop ); resize( width() * scaleX, height() * scaleY ); aButton::render(); resize( oldWidth, oldHeight ); moveToNoRecurse( oldLeft, oldTop ); } else aButton::render(); }
void aAnimObject::render( ) { if ( !isShowing() ) return; long color = animInfo.getColor(); float xNewOffset = animInfo.getXDelta()+.5f; float yNewOffset = animInfo.getYDelta()+.5f; move( xNewOffset, yNewOffset ); setColor( color ); float fScaleX = animInfo.getScaleX(); float fScaleY = animInfo.getScaleY(); if ( fScaleX != 1.0 || fScaleY != 1.0 ) { float oldWidth = width()+.5f; float oldHeight = height()+.5f;; float oldLeft = globalX(); float oldTop = globalY(); float scaleX = .5 * fScaleX * width(); float scaleY = .5 * fScaleY * height(); float midX = globalX() + .5 * width(); float midY = globalY() + .5 * height(); float newLeft = midX - scaleX; float newTop = midY - scaleY; moveToNoRecurse( newLeft, newTop ); resize( fScaleX * width(), fScaleY * height() ); aObject::render(); resize( oldWidth, oldHeight ); moveToNoRecurse( oldLeft, oldTop ); } else aObject::render(); move( -xNewOffset, -yNewOffset ); }