Exemple #1
0
// Update the frame and return the new position in the animation
sf::IntRect Animation::update(sf::Time dt)
{
	mElapsedTime += dt;
	if (mElapsedTime >= mFrameDuration)
	{
		mElapsedTime -= mFrameDuration;

		if (mReverse)
		{
			// Loop the animation, or stop if repeating is disabled
			if (mCurrentFrame + mStartingFrame - 1 < 0 + mStartingFrame)
			{
				if (mRepeat)
					mCurrentFrame = mStartingFrame;
				mComplete = 1;
			}
			else
			{
				mCurrentFrame--;			
				mComplete = 0;
			}
		}
		else
		{
			// Loop the animation, or stop if repeating is disabled
			if (mCurrentFrame - mStartingFrame + 1 > mNumFrames)
			{
				if (mRepeat)
					mCurrentFrame = mStartingFrame;
				mComplete = 1;
			}
			else
			{
				mCurrentFrame++;			
				mComplete = 0;
			}
		}
	}
	return getFrameWindow();
}
Exemple #2
0
static void
x_event_window(PceWindow sw, XEvent *event)
{ EventObj ev;
  FrameObj fr = getFrameWindow(sw, OFF);
  FrameObj bfr;
  Any receiver = sw;

#ifdef O_XDND
  if ( event->xany.type == MapNotify )
  { if ( hasSendMethodObject(sw, NAME_dropFiles) )
      setDndAwareFrame(fr);
  }
#endif /*O_XDND*/

  if ( fr && (bfr=blockedByModalFrame(fr)) )
  { switch( event->xany.type )
    { case KeyPress:
      { receiver = bfr;
	break;
      }
      case ButtonRelease:
	send(fr, NAME_bell, EAV);
      case ButtonPress:
	send(bfr, NAME_expose, EAV);
      default:
	return;
    }
  }

  if ( (ev = CtoEvent(sw, event)) )
  { addCodeReference(ev);
    postNamedEvent(ev, receiver, DEFAULT, NAME_postEvent);
    delCodeReference(ev);
    freeableObj(ev);

    RedrawDisplayManager(TheDisplayManager()); /* optional? */
  }
}