Our friends at Cymon’s Games recommend MinGW with Code::Blocks for the compiler and IDE and Allegro for the library (things that will help making games). Here are some extract from Cymon’s site, please pay him a visit for the complete article and more! Cymon has also posted a helpful video on You Tube.
Once MinGW and Code::Blocks is install you’re ready to start programming. It is best practice to always use a project so to finish of we’ll start you on your first project.
video where the instructions left off:
If you’ve installed PDCurses chances are you can simply use the allegro wiki and figure out it out. But for those who need a little more help here’s a step-by-step:
cd gcc -vReading specs from c:/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/specs Configured with: ../gcc-3.4.5/configure –with-gcc –with-gnu-ld –with-gnu-as –host=mingw32 –target=mingw32 –prefix=/mingw –enable-threads –disable-nls –enable-languages=c,c++,f77,ada,objc,java –disable-win32-registry –disable-shared –enable-sjlj-exceptions –enable-libgcj –disable-java-awt –without-x –enable-java-gc=boehm –disable-libgcj-debug –enable-interpreter –enable-hash-synchronization –enable-libstdcxx-debug Thread model: win32 gcc version 3.4.5 (mingw-vista special) If not you’ll see: 'gcc' is not recognized as an internal or external command, operable program or batch file. And you’ll need to try setting the path again making sure you’ve got the right directory.cd CodeBlocksMinGWAllegro set MINGDIR=c:CodeBlocksMinGW fix mingw32 mingw32-make (This will be a few minutes) mingw32-make install exit#include <allegro.h>
int main(void) {
/* you should always do this at the start of Allegro programs */
if (allegro_init() != 0) return 1;
install_keyboard(); /* set up the keyboard handler */
/* set a graphics mode sized 320x200 */
if (set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0) != 0) {
if (set_gfx_mode(GFX_SAFE, 320, 200, 0, 0) != 0) {
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("Unable to set any graphic moden%s", allegro_error); return 1;
}
}
set_palette(desktop_palette); /* set the color palette */
clear_to_color(screen, makecol(255, 255, 255)); /* clear the screen to white */
/* you don't need to do this, but on some platforms (eg. Windows) things
* will be drawn more quickly if you always acquire the screen before * trying to draw onto it. */
acquire_screen();
/* write some text to the screen with black letters and transparent background */
textout_centre_ex(screen, font, "Hello, world!", SCREEN_W/2, SCREEN_H/2, makecol(0,0,0), -1);
/* you must always release bitmaps before calling any input functions */
release_screen();
readkey(); /* wait for a keypress */
return 0;
}
END_OF_MAIN()C:CodeBlocksMinGWallegrolibmingw32liballeg.aC:CodeBlocksMinGWallegro and C:CodeBlocksMinGWallegrolib to all three tabs under the Search Directories tab; Compiler, Linker and Resource Compiler.At this point you may become aware that our hello world programs are getting bigger. Get used to it. The cooler they get, the bigger they get.