New version page

FIU EEL 2880 - Building and using the Allegro Graphics & Gaming Library

Documents in this Course
Load more

This preview shows page 1-2-3-4 out of 12 pages.

View Full Document
View Full Document

End of preview. Want to read all 12 pages?

Upload your study docs or become a GradeBuddy member to access this document.

View Full Document
Unformatted text preview:

EEL 2880 Exercise #1 Page 1Building and using the Allegro Graphics & Gaming LibraryTable of ContentsDownload and install CodeBlocks with MinGW compiler.......................................................................2Set Environment Variables.........................................................................................................................3Installing The Allegro Library ..................................................................................................................4Download and install Allegro 4.2.2 Source...........................................................................................4Download and install directX sources...................................................................................................5Confirm that the paths and environment variables are correct..................................................................6Build Sources and install Allegro library...................................................................................................7Create project “Hello World” example......................................................................................................9Compile, build, and run the HelloWorld project...................................................................................9Add liballeg.a to linker settings.............................................................................................................9Create a new Hello World project with following source...................................................................10Final Screen output..............................................................................................................................11Running the Demo program................................................................................................................12EEL 2880 Exercise #1 Page 2Download and install CodeBlocks with MinGW compilerDownload and install CodeBlocks with MinGW compiler. Click on link, save to a working directory and then run codeblocks-8.02mingw-setup.exe.Install supplies both CodeBlocks and the MinGW gcc compiler in one package. Illustration 1: Class web site selectionIllustration 2: InstallationEEL 2880 Exercise #1 Page 3Information: The MinGW compiler is located in C:\Program Files\CodeBlocks\MinGW\bin.Set Environment VariablesThe final part of the installation involves environment variables. XP: Click on start, then control panel, then the system icon. Click on the advanced tab and then on the environment variables button.Vista:Click start, right click Computer, select properties. On the left side of the new window select "advanced system settings". Then on the newest window press Environment Variables. Two variables will need to be added: 1) MINGDIR set to the path value to (Illustration 4) C:\Progra~1\CodeBlocks\MinGW 2) PATH will add the value C:\Progra~1\CodeBlocks\MinGW\bin. Note that Path already exists and will then need to be edited/modified. The new path is added after a semicolon. (Illustration 3).C:\Program Files\CodeBlocks\MinGW\bin is the location of the compiler, but path values cannot have spaces included so non-8dot3 notation is used as shown. This notation is used to specify the Program Files directory without spaces.Note: Any changes to environment variables will not affect currently opened console windows. You will need to restart the console for the changes to take effect.EEL 2880 Exercise #1 Page 4Illustration 3: Modify Path environment variableIllustration 4: Add MINGDIR envirnment variableEEL 2880 Exercise #1 Page 5Installing The Allegro Library Download and install Allegro 4.2.2 SourceDownload file “all422.zip” from class web site and save in a directory. (Illustration 5)Unzip all422.zip and allowing it to expand to its own folder Start and follow wizard to unpack into folder.Download and install directX sourcesDownload file “dx70_mgw.zip” (Illustration 5) from class web site and save in a directory .The Windows version of allegro uses this version of directX (the standard Windows way of interfacing graphics). Allegro won't compile without it. NOTE: As shown in Illustration 7, extract the contents to C:\Program Files\CodeBlocks\MinGW overwriting all files. Illustration 6: Unzip all422.zip to folderIllustration 5: Class web site sourceEEL 2880 Exercise #1 Page 6Confirm that the paths and environment variables are correctStart a command window with Start->RunIllustration 7: Extracting directX sources to MinGW directoryEEL 2880 Exercise #1 Page 7Confirm the gcc compiler is available and working. Type “gcc -v” and observe a correct response:Build Sources and install Allegro libraryThen inside the command window, change directory to the unzipped allegro directory.On my computer this is the following:cd C:\Documents and Settings\Owner.herman\My Documents\DownLoads\all422\allegro>Now allegro can be compiled. Note that compilation will take some time. Start by typing in the command line: • FIX mingw• MINGW32-MAKE• MINGW32-MAKE installSee Illustration 9 and Illustration 10 below for successful Allegro compile and install results.Illustration 8: Confirm gcc is workingEEL 2880 Exercise #1 Page 8Illustration 9: Successful Allegro compile (end screen)Illustration 10: Successful Allegro installEEL 2880 Exercise #1 Page 9Create project “Hello World” exampleCompile, build, and run the HelloWorld project.Change line 51 in the source and insert your name. Run example and print screen to turn in as the endpoint of the assignment. Note also that the liballeg.a library has to be specified for the Linker as shown in the illustration following the example program.Turn in a screen capture of the output screen.Add liballeg.a to linker settingsNOTE! In CodeBlocks, a reference to the allegro library has to be placed in the Build instructions. Go to Project->Build Options->Linker Settings, and add liballeg.a as shown below by pressing the Add button.EEL 2880 Exercise #1 Page 10Create a new Hello World project with following source.1 /*2 * Example program for the Allegro library, by Shawn Hargreaves.3 *4 * This is a very simple program showing how to get into graphics5 * mode and draw text onto the screen.6 */78 #include <allegro.h>910 int main(void)11 {1213 int height;1415 /* you should always do this at the start of Allegro programs */16 if (allegro_init() != 0)17 return 1;1819 /* set


View Full Document
Loading Unlocking...
Login

Join to view Building and using the Allegro Graphics & Gaming Library and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Building and using the Allegro Graphics & Gaming Library and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?