LAnimationWindow::AnimateEvent

#include "ltwrappr.h"

virtual L_VOID LAnimationWindow::AnimateEvent(nEvent, nFrameNumber)

L_INT nEvent;

/* the animation event */

L_INT nFrameNumber;

/* the current frame number */

Informs you of Animation events.

Parameter

Description

nEvent

The animation event. Possible values are:

 

Value

Meaning

 

EVENT_MOVE_FIRST

LAnimationWindow::MoveFirstFrame was called.

 

EVENT_MOVE_LAST

LAnimationWindow::MoveLastFrame was called.

 

EVENT_MOVE_NEXT

LAnimationWindow::MoveNextFrame was called.

 

EVENT_MOVE_PREV

LAnimationWindow::MovePreviousFrame was called.

 

EVENT_MOVE_TO

LAnimationWindow::MoveToFrame was called.

 

EVENT_PLAYSTATE_START

LAnimationWindow::PlayAnimation was called and the playback was started.

 

EVENT_PLAYSTATE_STOP

LAnimationWindow::StopAnimation was called or the playback reached the end.

 

EVENT_PLAYSTATE_PRECLEAR

The initial state of the playback (index = -1). The target bitmap will be cleared to the Bitmap background color on the next call.

 

EVENT_PLAYSTATE_POSTCLEAR

The target bitmap has been cleared.

 

EVENT_PLAYSTATE_PRERENDER

The current image will be rendered to the target bitmap.

 

EVENT_PLAYSTATE_RENDER

An image has been rendered to the target bitmap.

 

EVENT_PLAYSTATE_POSTRENDER

An image is in the midst of being rendered to the target bitmap.

 

EVENT_PLAYSTATE_WAITINPUT

The playback engine is waiting for user input before moving on to PLAYSTATE_PREDISPOSE.

 

EVENT_PLAYSTATE_WAITDELAY

The playback engine is waiting for a delayed time before moving on to PLAYSTATE_PREDISPOSE.

 

EVENT_PLAYSTATE_WAITINPUTDELAY

The playback engine is waiting for user input and a delayed time before moving on to PLAYSTATE_PREDISPOSE.

 

EVENT_PLAYSTATE_PREDISPOSE

The current image will be disposed of.

 

EVENT_PLAYSTATE_POSTDISPOSE

The current image has been disposed of. The index is incremented after processing this state.

 

EVENT_PLAYSTATE_LOOP

Animation playback has looped back to the first frame.

nFrameNumber

The current frame number being displayed.

Returns

None

Comments

This function is called to indicate that an animation event has occurred, or that one of the LAnimationWindow::MoveXXX functions has been called.

You must enable the animation events using LAnimationWindow::EnableAnimateEvent before this function will be called.

Override this function in order to be notified of the events.

The events from EVENT_PLAYSTATE_START to EVENT_POSTDISPOSE are generated by LAnimationWindow::PlayAnimation.

Required DLLs and Libraries

LTDIS
LTDLG
LTEFX
LTFIL
LTIMG
LTISI
LTSCR
LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LAnimationWindow::LAnimationWindow, LAnimationWindow::IsPlaying, , LAnimationWindow::EnableAnimateEvent, Class Members

Topics:

Implementing Animation

Example

#include < ltlck.h> //Unlock support

class MyClass : public LAnimationWindow
{
   public :
      virtual L_VOID AnimateEvent(L_INT nEvent,L_INT nFrameNumber)
      {
         L_TCHAR szStr[255];
         wsprintf(szStr,TEXT("Event number : %d\nFrameNumber : %d"),nEvent, nFrameNumber);
         MessageBox(m_hWnd, szStr, TEXT("Example"), MB_OK|MB_ICONINFORMATION);
         //call base class
         LAnimationWindow::AnimateEvent(nEvent, nFrameNumber);
      }
};

L_VOID TestFunction(HWND hWndParent)
{
   LBase::LoadLibraries(LT_ALL_LEADLIB); //make sure all libraries are loaded
   WRPUNLOCKSUPPORT(); //unlock GIF support

   MyClass MyAnimation;

   MyAnimation.SetFileName(TEXT("eye.gif"));
   if (MyAnimation.Load()==SUCCESS)
   {
      MyAnimation.CreateWnd(hWndParent,0, WS_VISIBLE|WS_CHILD|WS_BORDER,0,0,300,300);
      MyAnimation.EnableAnimateEvent();
      MyAnimation.PlayAnimation();
      while (MyAnimation.IsPlaying())
      {
         if (MyAnimation.DoEvents())
         break;
      }
   }
}