Code and Algorithms


Download the zip files below. They may contain either source code or algorithm files. The Type column on the table at the bottom of this page either sais C, C++, or Alg. Alg stands for Algorithm (an algorithm is a program written in plain English -- basically, an algorithm tells you how your program will be put together and how it will work). If you downloaded an algorithm file, you do not need to read the rest of this document.

Just extract the files into a sub-folder in your DJGPP folder or a folder that you use for programs and run the executable file. You can view the source in a viewer such as Notepad or Wordpad. In fact, any text viewer will work. You can also alter the source and recompile it in DJGPP.

If you are compiling the source file from the prompt, type 'gcc name_of_source.c -o name_of_executable.exe -lalleg' The -lalleg parameter includes the necessary Allegro library files. Where I have written name_of_source you will need to insert the name of the source file (duh). For the first file (refer to table at the bottom of this page), for example, you would type colors16.c instead of name_of_source.c The name_of_executable can be anything that you want.

The first zip file, colors.zip, after extraction, will contain two files, colors16.c and colors16.exe You can run the colors16.exe file to see what the program does. If you feel brave, edit the colors16.c source code file and either compile it in your Rhide interface or at the prompt. If you wish to do the latter, you need to type: 'gcc colors16.c -o colors16.exe -lalleg' (omit the '') That's it. Good luck.


File Type Description
colors.zip C Simply displays the 16 primary colors of VGA.
pallete.zip C Cycles one color of the pallete to produce a waxing and waning effect.
circles.zip C Prompts user to choose between several graphic modes and the number of circles. Initializes chosen mode and moves the specified number of circles around the screen. Weeeee!
starfield.zip C Uses hardware scrolling to create a 2D star field simulation.
bumps.zip C Bump-mapping using Allegro. I have yet to understand what the heck that is. :)
collide.zip C Shows how to do bounding box collisions with sprites.
pcollide.zip C After you perform bounding box collision checking on your sprite, you could do a more accurate collision check using pixel-perfect collision checking.
particles.zip C Particle explosions. Explosions could be done using sprites or particles. Particles are basically pixels or other primitive shapes.
plasma.zip C A funky plasma demo that makes your screen look like a pudle of color-changing plasma.

More later, of course.

Hosting by WebRing.