I have this simulation result from matlab; and my computer is so slow it's painful to make a movie to watch the motion using matlab. So I export the data, and do the animation in allegro instead.
Code:
while( i < pll.size() && !key[KEY_ESC] )
{
x = sin(pll[i][1])*double(SCREEN_W)/2.0 + double(SCREEN_W)/2.0-1;
y = -cos(pll[i][3])*double(SCREEN_H)/2 + double(SCREEN_H)/2.0;
textprintf_ex(screen,font,0,0,15,-1,
"x = %+5.5lf ; y = %+5.5lf",x,y);
circle(screen,x,y,3,makecol(255,0,0) );
++i;
rest(100);
textprintf_ex(screen,font,0,0,0,-1,
"x = %+5.5lf ; y = %+5.5lf",x,y);
circle(screen,x,y,3,0 );
}
As, you see, that's just a beginner's allegro stuff. It works, but there are a few kinks i want to work out, and maybe you can help me.
1. how do I make the animation go slower? The speed it is going is way too fast to watch.
2. In the below snippet, plotting and then using a different color to erase the previously object seems really wasteful. Is there a way do this better?
Code:
circle(screen,x,y,3,makecol(255,0,0) );
ircle(screen,x,y,3,0);
thanks in advance for any input.