Mail Archives: djgpp/1998/04/17/01:17:19
I made a few changes and compiled and ran it just fine. Double check
everything! Let me know if this doesn't work either.
Jeremy
TackMast wrote in message
<1998041420115800 DOT QAA26920 AT ladder01 DOT news DOT aol DOT com>...
>the datafiles still won't work for me in allegro. it seems to not be able
to
>find the datafile, even though there seems to be nothing wrong with my
code.
>somebody please help, i just can't figure out why this won't work. could it
be
>an improper djgpp or allegro installation? or might it be because i have
>windows 95? heres the code:
>
>#include <stdio.h>
>#include <stdlib.h>
>
>#include "allegro.h"
>
>#include "game.h"
^^^^^----------------------I commented this line out, since I don't have the
orginal
>
>main()
>{
>DATAFILE *data;
>
>allegro_init();
>install_keyboard();
>install_timer();
>
>data = load_datafile("game.dat");
>if(!data){
> allegro_exit();
> printf("datafile not loaded properly\n");
> return -1;
>}
>
>set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0);
>
>blit(data[MAIN_BMP].dat, screen, 0, 0, 0, 0, 320, 200);
^^^
I deleted 'MAIN_BMP' and put 0 (zero) in it's place. That way I didn't
need the game.h
>
>readkey();
^^^^---------- I removed this line and make it:
while( !keypressed() );
>
>return 0;
>}
Should work now!
Here is what I compiled:
--------------------------------
#include <stdio.h>
#include <stdlib.h>
#include "allegro.h"
//#include "game.h"
main()
{
DATAFILE *data;
allegro_init();
install_keyboard();
install_timer();
data = load_datafile("game.dat");
if(!data){
allegro_exit();
printf("datafile not loaded properly\n");
return -1;
}
set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0);
blit(data[0].dat, screen, 0, 0, 0, 0, 320, 200);
while( !keypressed() );
return 0;
}
- Raw text -