[gtkmm] Animating with Fixed.put()



Greetings:

I am working on a simple poker card game and wants to show
the the card as moving from one spot to another. I did this
by continuously calling the member method "put(Widget &w,
int x, int y)" of the "Fixed" container with new coordinates
as the following code snippet shows:

 while (x[i]!=toX || y[i]!=toY)
 {
  if (x[i]<toX) x[i]++;
  if (x[i]>toX) x[i]--;
  if (y[i]<toY) y[i]++;
  if (y[i]>toY) y[i]--;
  playArea->move(cards[i], x[i], y[i]);
 }

However, I found that it is too fast, I didn't see the
animation and it is already finished. When I added a
delay() function at the end of the while loop, the
program simply freezes until seemingly all the move
calls have finished.

Why is it like that? Is there anyway of forcing the
move() function to repaint the widget (which is an
Image) at the new location without it buffering. (i.e.
I want to achieve the effect of "zooming" a card
from one spot to another in the window).

Regards,

Shuo Xiang



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