Allegro Help

This is a discussion on Allegro Help within the Game Programming forums, part of the General Programming Boards category; This compiles fine but won't work and I have no I dea why the screen just flashes twice and goes ...

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    208

    Allegro Help

    This compiles fine but won't work and I have no I dea why the screen just flashes twice and goes away. Heres the code.

    Code:
    #include <allegro.h>
    
    volatile long speed_counter = 0;
    
    void increment_speed()
    { speed_counter++;
    }
    END_OF_FUNCTION(increment_speed);
    
    
    
    int main(int argc, char *argv[])
    {
    
    //Initialize Allegro
     
      allegro_init();
      install_keyboard();
      install_timer();
      install_int_ex(increment_speed, BPS_TO_TIMER(60));
      set_color_depth(24);
      set_gfx_mode(GFX_SAFE, 640, 480, 0, 0);
      LOCK_VARIABLE(speed_counter);
      LOCK_FUNCTION(increment_speed_counter);
    // BITMAPS 
    
    BITMAP *fwd1=load_bitmap("fwd1.bmp",NULL);
    BITMAP *fwd2=load_bitmap("fwd2.bmp",NULL);
    BITMAP *idle=load_bitmap("idle.bmp",NULL);
    BITMAP *buffer=create_bitmap(640,480);
    
    //Main Loop 
    
    draw_sprite(buffer, fwd1, 0, 0);
    draw_sprite(buffer, fwd2, 200, 0);
    draw_sprite(buffer, fwd1, 200, 200);
    
    // Clean Up/Exit 
    
    destroy_bitmap(fwd1);
    destroy_bitmap(fwd2);
    destroy_bitmap(idle);
    return 0;
    }
    END_OF_MAIN();

    By the way does anyone know of any allegro specific message boards that are anygood I went looking for one to post this question but never found one. So anyway any help would be greatly appreciated.


    --Kas2002--

  2. #2
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    Code:
    //Main Loop
    You didn't actually include a loop.

    do this to get a loop

    Code:
    while(key![KEY_ESC])
     {
       //code here (i.e. your draw_sprite() )
     }
    Follow the link in my signature and it will take you to my site, which has a bunch of links and a couple of tutorials regarding Allegro.

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    208

    ok I see

    what you mean now...............
    except I have a bigger problem........I have Dev C++ 5 and Dev C++ 4 (because 5 has some bugs in it) and in 5 I keep gettin tons of linker errors when I am sure I linked it and in Dev C++4 when I compile my source that compiles fine it won't even run at all it just does absolutly nothing.......I am very frustrated
    Jeff Paddon
    Undergraduate Research Assistant
    Physics Department
    St. Francis Xavier University

  4. #4
    Registered User Bieh's Avatar
    Join Date
    Sep 2002
    Posts
    83

    Re: Allegro Help

    Originally posted by kas2002
    ...does anyone know of any allegro specific message boards that are anygood...
    Try the Allegro.cc forums, there's lots of good info on there.
    "It always takes longer than you think, even when you take Hofstadter's Law into account."
    -Hofstadter's Law

    Bored? Try my game SpaceWars , made in Allegro and VC++
    or see my new game Redoubt , made in OpenGL and VC++

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Allegro in C for a newb
    By Ideius in forum C Programming
    Replies: 5
    Last Post: 12-29-2005, 04:36 PM
  2. Game Programming FAQ
    By TechWins in forum Game Programming
    Replies: 5
    Last Post: 09-29-2004, 03:00 AM
  3. double buffering for allegro
    By Leeman_s in forum C++ Programming
    Replies: 6
    Last Post: 09-12-2002, 03:45 PM
  4. Special Allegro Information
    By TechWins in forum Game Programming
    Replies: 12
    Last Post: 08-21-2002, 12:35 AM
  5. Allegro programming in a window
    By Person Man in forum Windows Programming
    Replies: 0
    Last Post: 11-16-2001, 03:23 PM

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