-
Allegro
Anyone know why this won't compile
Code:
#include <allegro.h>
int main()
{
allegro_init();
install_keyboard();
set_gfx_mode(GFX_VGA,320,200,0,0);
textout_centre(screen,font,"Ready. Beep.",160,100,255);
readkey();
return 0;
}
i get the following errors
Code:
7 main.cpp
`GFX_VGA' undeclared (first use this function)
7 main.cpp
(Each undeclared identifier is reported only once
7 main.cpp
for each function it appears in.)
and the linker errors of
Code:
g++: c:\my documents\jeff\tutorial\main.o: No such file or directory
g++: file path prefix `C:\DEV-C_~1\BIN\' never used
thanx for your help??
by the way I am using dev c++ IDE
-
well first of all need
     END_OF_MAIN();
after the closing braket of your main loop. And make sure you are including your liballeg.a file in your linker options.
-
Those linker errors basically mean nothing. Also, you have to use GFX_AUTODETECT, GFX_AUTODETECTWINDOWED, or GFX_AUTODETECTFULLSCREEN. The VGA flag won't work. Another thing, Dev-C++ uses
Code:
int main(int argc, char *argv[])
not int main(). So you'll have to fix that
-
I use Allegro and Dev-C++ and I don't have to use the main with argument handling.
And a better way to do your colors is
makecol(R,G,B)
where R is your R value, G is your G value, so on.
And since you tried in GFX_VGA I am assuming you are using DOS. Dev-C++ is a windows compiler, take advantage of it. Windows games in Allegro run smoother, because they use DirectX for everything. Plus it's 32bit code instead of 16bit code. And the beauty of Allegro is, you won't have to change one line of code, except for maybe changing GFX_AUTODETECT to GFX_DIRECTX if you want it to always use hardware acceleration (another reason to use windows)
-
also, if you want to use AllegroGL you HAVE to use Windows or Linux, because it uses OpenGL.
And while we are on the topic of Allegro.
A dude on the Allegro forums says he got Allegro to compile on PS2 using the Linux kit. That would be cool to see. They are thinking of making an add-on for Allegro 5 (when it comes out) for taking advantage of the Emotion Engine of PS2, and it will include some PS2 assembly language code for blitting and stuff. I would get the add-on, except I need the Linux kit to do it.
-
thanx
thanx for the input. The reason I am using dos is because I am newto programing and I am not that comfortable with windows programing yet.
-
It doesn't really matter when you use Allegro w/ windows or dos.
-
can anyone
give a exapmle of what you are talking about cause I don't understand 100%
just the same code as mine with the things I am missig???
-
No, coding-wise the syntax is a little different from the DJPP compiler and Dev-C++ compiler, but they all function the same, so there really is no better-than || worse features between the two besides the fact the Windows can use Direct X for hardware rendering.
-
there are a FEW Windows specifics, as well as DOS specifics.
And as I said earlier, the same code will work in DOS as Windows. I was making a RPG a while back in Allegro using DJGPP, then I transferred it to Windows. The ONLY line I had to change was set_gfx_mode(), I changed it from GFX_AUTODETECT to GFX_DIRECTX, although AUTODETECT works in Windows too, I just wanted hardware to be required.
But the main reason I would convert to Windows, is speed, DirectX (unless you use AllegroGL, then you are using OpenGL), and support. With Win 2k and XP being more and more widespread, DOS is hard to support, since it's just emulated in those platforms.