protected void setFrameIndex ( int frameIdx , boolean forceUpdate ) { // make sure we're displaying a valid frame frameIdx = ( frameIdx % _frames . getFrameCount ( ) ) ; // if this is the same frame we're already displaying and we're // not being forced to update, we can stop now if ( frameIdx == _frameIdx && ! forceUpdate ) { return ; } else { _frameIdx = frameIdx ; } // start with our old bounds Rectangle dirty = new Rectangle ( _bounds ) ; // determine our drawing offsets and rendered rectangle size accomodateFrame ( _frameIdx , _frames . getWidth ( _frameIdx ) , _frames . getHeight ( _frameIdx ) ) ; // add our new bounds dirty . add ( _bounds ) ; // give the dirty rectangle to the region manager if ( _mgr != null ) { _mgr . getRegionManager ( ) . addDirtyRegion ( dirty ) ; } }
Instructs the sprite to display the specified frame index .