Warning: A non-numeric value encountered in /home/fixbyp5/public_html/wp-content/themes/Divi/functions.php on line 5752

This post is a portion of Part 2 in my on going series about 2D Game Development using the Allegro 5 library. These posts are in course order. You can see all of the posts in this course by clicking the “2D Game Development” button at the top of this site.

This is the final entry into part 2. In this video we look at many of the graphical primitives available to us in Allegro 5. Since there are quite a few primitives, and only one video to cover them in, much of the stuff is covered quickly. Feel free to message me or leave a comment with any questions you may have.

Update:

Thank you Krisztian for pointing out an error in my videos:

There is a slight error in the explanation about screen size. It is incorrect that the screen width of 640 is 0 – 639. The declaration of the screen width as

int width = 640;

actually creates a screen that is 641 pixels wide. 0 – 640. The Allegro reference manual does not note how Allegro handles this internally, so you can be off by 1 pixel. The traditional array construct that is used when arrays are offset is useful, if you want to specify the absolute width.

int width = 640 – 1;

You can see this with the following code if width = 640.

al_draw_line(640, 0, 640, 480, al_map_rgb(255, 255, 255), 1); //edited by MG

 In the above comment, the line of code (modified by me) will draw a line down the right side of the screen on the 640th pixel, which by original explanation should not be visible.

 

Source Codes: