I've got a problem here...
I get these errors when i want to make a console programs, using Allegro for an if(KeyDown) statement later. http://p18.img-up.net/Unavngivetq0jl.png
What i see is errors in the Allegro files. Not in my script. I use version 1.4.4 i think.
Do i have to make graphics with Allegro? If so, can i make the graphics transparent, so i can see my Command prompt?
- Anders4000
Allegro is a 2d graphics library... what exactly are you trying to accomplish in the console?Without even looking into the allegro.h, you cannot utilize allegro until you initialize its subsystems with a call to allegro_init()();. You also will not be able to read in keys until you "install" the keyboard with a call to install_keyboard();
In addition if you need something from windows.h you must include the Windows-specific header file winalleg.h after the Allegro header. This should resolve your BITMAP redeclaration It must be placed before any Win32 API header file. winalleg.h includes the main Win32 C API header file windows.h. What do you need from windows.h??
Also... I recommend using SDL or SFML for 2d instead of Allegro.
After installing the keyboard and Allegro init, what should i do with the 2 Bitmap errors?
I'm going into Allegro, because i'm only gonna use it for this if(KeyDown) statement.
I'm gonna use it for Command Prompt games. And yes, i do know that these games are, maybe not hard, but takes very long to make. I think it's cool and that's why i'll make them (:
- Anders4000
But Allegro will not allow me to use the console now (:
That's because Allegro is not a console API. It handles managing the window. You're trying to mix a 2d graphics library with the console and it's just not going to work well, if at all. Note that winalleg.h already includes windows.h, so either way you should be able to remove windows.h.
Not sure how Allegro will react to this but, with SDL you can keep the console up in the background and continue to write to it, but you must first have an active managed window open. The game will continue to run until an exit function (user closed the window) is clicked or something occurs. There are certain things you can and cannot do with the console. There might be a way to check for key strokes with the ncurses library so I would start there. I know nothing of this library as I'm mainly into 3d programming... I know there are some on the forum that do though.
A note on 2d in directx, if you are purely planning to learn it for 2d programming and NOT 3d, you'll find it ridiculously easier to use SDL or SFML. Just something to think about.
Thank you so much (:
I will never be making games in the console again. Since i now know that i can't "include" a 2D lib for a KeyDown statement xD
Gonna try SDL. (Might have it installed allready. Tried to install it once b4, but it didn't work out. Now i installed Allegro correctly, so i should be able to do it with SDL too.)
- Anders4000