allegro question

This is a discussion on allegro question within the C++ Programming forums, part of the General Programming Boards category; I have this simulation result from matlab; and my computer is so slow it's painful to make a movie to ...

  1. #1
    -bleh-
    Join Date
    Aug 2010
    Location
    somewhere in this universe
    Posts
    452

    allegro question

    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.
    "All that we see or seem
    Is but a dream within a dream." - Poe

  2. #2
    Registered User bobknows's Avatar
    Join Date
    Jan 2011
    Location
    SD
    Posts
    87
    to see each frame individually you could use
    Code:
    system("PAUSE");
    but i have no idea how to set the fps. maybe you should try using <ctime> and having it wait for 1/24 of a second after it displays one frame.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Allegro Programming Question
    By xmltorrent in forum Game Programming
    Replies: 2
    Last Post: 08-24-2006, 02:45 PM
  2. Exam Question - Possible Mistake?
    By Richie T in forum C++ Programming
    Replies: 15
    Last Post: 05-08-2006, 03:44 PM
  3. Very simple question, problem in my Code.
    By Vber in forum C Programming
    Replies: 7
    Last Post: 11-16-2002, 02:57 PM
  4. ALLEGRO Question
    By Unregistered in forum Game Programming
    Replies: 10
    Last Post: 10-22-2001, 01:27 PM
  5. ALLEGRO Question
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 09-14-2001, 11:06 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21