Mail Archives: djgpp/2000/08/22/23:33:43
Heres my first program. Tell me what you think, if there are any
structure errors or whatever. I dont think there are, but then again.
Im just a newbie...
P.S.> Sorry about the Word wrap. :(
-------- USING DJGGP/ALLEGRO FOR DOS --------
// Program by Twisted Matrix - My first graphical c program...
// Uses ALLEGRO and the DJGPP compiler
#include <stdlib.h> // Which of these i acually use in this program
#include <stdio.h> // is beyond me. Heh heh. I know i use Allegro.h.
:)
#include <allegro.h>
main()
{
int x=0; /* Lets define some local variables */
int col=0; /* Everyone loves integers! :) */
/* Initiate the Allegro library for use in this program */
allegro_init();
install_keyboard();
set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);
/* Lets draw the 256 color palette shall we... */
for (x=0; x<639; x++)
{ col++; if (col>255) { col=0; }
vline(screen, x, 0, 479, col); }
/* Now lets write a message on the screen and wait for a key press.
*/
textout_centre(screen, font, "My first c program using
DJGPP/ALLEGRO", 320, 230, 15);
textout_centre(screen, font, "By: Twisted Matrix
(Homie_dont_play_dat AT Yahoo DOT com)", 320, 240, 15);
readkey();
return 0; // Can anyone tell me whats so special about 0? Why 0?
// I mean, whats so special about it? Is is an exit code of
// some kind? Can i use any number I want or none at all?
// How about return 69; or return; ? Would those work?
}
=====
~ Twisted Matrix (Founder of ULTRATECH)
URL: http://www.stas.net/ultratech
Yahoo ID: Homie_dont_play_dat, ICQ: 74628745
AOL im: TwistedMatrix
__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/
- Raw text -