I need help with Allegro and DJGPP

Hi everybody,

when I try to draw primitives from Allegro library

(for exam. void line(BITMAP *bmp, int x1, int y1, int x2, int y2, int color);)

DJGPP gives a parse error before BITMAP.

What is wrong?


Razze

rasmus.paivarinta@usa.net




URL:htt://www.crosswinds.net/turku/~rasmus

Comments

  • : Hi everybody,

    : when I try to draw primitives from Allegro library

    : (for exam. void line(BITMAP *bmp, int x1, int y1, int x2, int y2, int color);)

    : DJGPP gives a parse error before BITMAP.

    : What is wrong?


    : Razze

    : rasmus.paivarinta@usa.net




    Did you define a BITMAP variable? YOu need to have one defined before you do anything.


    Here's an example with Double buffering:


    #include stdio.h

    #include allegro.h


    int main ()

    BITMAP *


  • : Hi everybody,

    : when I try to draw primitives from Allegro library

    : (for exam. void line(BITMAP *bmp, int x1, int y1, int x2, int y2, int color);)

    : DJGPP gives a parse error before BITMAP.

    : What is wrong?


    : Razze

    : rasmus.paivarinta@usa.net


    I'd suggest simply copying an example that came with the package and working from that.


    -Xotor-








  • Thanks but...

    There didnt come any examples about drawing primitives. There was things about sprite rotating

    and such a things, but not about how to draw a simple line to the screen.


    Could you please write me a simple code that just

    draws a simple line to the screen.


    Thanks a lot,

    Rasmus

    rasmus.paivarinta@usa.net




  • : Thanks but...

    : There didnt come any examples about drawing primitives. There was things about sprite rotating

    : and such a things, but not about how to draw a simple line to the screen.


    : Could you please write me a simple code that just

    : draws a simple line to the screen.


    : Thanks a lot,

    : Rasmus

    : rasmus.paivarinta@usa.net


    #include stdio.h

    #include allegro.h




    int main()

    {




    allegro_init();

    install_keyboard();

    install_timer();

    if (set_gfx_mode(GFX_AUTODETECT,320,200,0,0)!=0)

    {

    printf("
    640x480x256 not detected, you gotta have it to play.");




    exit(1);

    }


    clear_bitmap(screen); //clears the screen;

    line(screen,12,14,120,340,15);

    // This puts a line onto BITMAP buffer, from (12,14) to (120,340)

    // (x,y) notation, with color 15 (white).

    // Note: you should implement a double buffering system if you

    // plan on doing non-jumpy fast animations.


    readkey(); //pauses


    return 0;

    }


    Try that one out.


    -Xotor-


  • : : Thanks but...

    : : There didnt come any examples about drawing primitives. There was things about sprite rotating

    : : and such a things, but not about how to draw a simple line to the screen.


    : : Could you please write me a simple code that just

    : : draws a simple line to the screen.


    : : Thanks a lot,

    : : Rasmus

    : : rasmus.paivarinta@usa.net


    : #include stdio.h

    : #include allegro.h


    :

    : int main()

    : {


    :

    : allegro_init();

    : install_keyboard();

    : install_timer();

    : if (set_gfx_mode(GFX_AUTODETECT,320,200,0,0)!=0)

    : {

    : printf("
    640x480x256 not detected, you gotta have it to play.");


    :

    : exit(1);

    : }


    : clear_bitmap(screen); //clears the screen;

    : line(screen,12,14,120,340,15);

    : // This puts a line onto BITMAP buffer, from (12,14) to (120,340)

    : // (x,y) notation, with color 15 (white).

    : // Note: you should implement a double buffering system if you

    : // plan on doing non-jumpy fast animations.


    : readkey(); //pauses


    : return 0;

    : }


    : Try that one out.


    : -Xotor-


    change the top part to:


    if (set_gfx_mode(GFX_AUTODETECT,640,480,0,0)!=0)

    {

    printf("
    640x480x256 not detected, you gotta have it to play.");




    exit(1);

    }







Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories