Re: How to install animation



I would first look into gtk_timeout_add() in gtkmain.h.

Basically you would do this:

1.) create an array of xpm images for the animation
You should also make a variable (just use a global one in a simple test
program)
to hold the current frame of animation.

2.) make a function to handle updating the current frame of animation (and
draw the frame)
This is simple to do.. example:
  current_frame++;
  if (current_frame > MAX_FRAMES)
    current_frame = 0;
  draw_xpm(xpm_array[current_frame]);

3.) call gtk_timeout_add() with the function that handles updating animation
frames
What this does is add a timeout to the function, and once the timeout's
interval is reached
it calls the function, which updates the animation.

Simple as that.

Stopping animation is even easier:

  gtk_timeout_remove(tag_returned_by_gtk_timeout_add);

When you want it to start back up, just use gtk_timeout_add() and it will
start
where it left off.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]