Remove Ads

Share on Facebook Share on Twitter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Intro to 2D Graphics: Installing Allegro
#1
That's one big title, but it is what this is about. I've decided to do some 2D graphics tutorials for this section.

This will be about installing Allegro. Allegro is a very fun 2D graphics library.

Taken from their website.
Quote:Allegro.cc is the most comprehensive website on the Internet pertaining to the Allegro Gaming Library. The Allegro library provides C/C++ programmers low level routines commonly needed in game programing, such as input, graphics, midi, sound effects, and timing. It is cross platform and works with many different compilers. Originally developed by Shawn Hargreaves, it is now a group project with contributions from all over the world! Some of its key features include:

Ease of Use - comes with comprehensive documentation and examples
Extensibility - if the built-in functionality isn't enough, there are many add-ons available
Cross Platform - without changing a single line of code, you can create versions for Windows, OS X, Linux, DOS, and others! Works with many compilers, including DJGPP and VC++
Open Source - anyone can contribute, including you!
Free - it won't cost you a dime, and there are no restrictions on its usage

You can see why it's a useful library.

Download the Allegro file here.

Put all the contents in the approporiate folders. You should also put any dlls in the system 32 folder to run your applications statically.

[Image: http://i992.photobucket.com/albums/af47/...nstall.gif]

Once that is installed you can make an empty project. All you need to do include is liballeg.a to make the programs work.

To test if you installed it correctly run this example.
[code]
#include <allegro.h>//only header needed

int main()
{
allegro_init();//initalize allegro
install_keyboard();//allows use of the keyboard
set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);//This scrren resolution is 640 480 in this example

readkey();//equivilent of cin.get()

return 0;
}
END_OF_MAIN();//Define this to prevent errors
[/code]

If this compiles fine then you have successfully installed allegro.
Next I will post about creating objects and moving them with the arrow keys.
Reply
#2
Hmmm I might have to look into this. I've wanted to make a 2D sidescroller.
Reply
#3
I'm actually working on a similar project right now. I've got the sprite, background, and physics.
I'm just working on an efficient way to scroll the background without lag. I figured out a way to last night fortunately.
Reply
#4
I know in a book I used previously it took about 5 chapters covering making a sprite, animating the sprite, getting the scroll, and all the other stuff you need. If I find it I'll be happy to share it with you.
Reply
#5
It's fine. I've got everything working right now.
Reply
#6
Interesting, finally I'll learn something about these things.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)