1. generates an 800x800 initial black window
2. Fills an outermost square of size 800x800 400 using the color green... (0, 255, 0)
3. Now put a loop around this box drawer. Each time through the loop, fill a box with sides of 4 pixels less than the prior box drawn AND which is a color 2 shades less of green and 2 shades more of red. Make sure every box is centered at coordinate (400,400) which is the center of the window.
4. When the loop reaches a box of side-size 0, stop and pause (so I can see the beautiful square-gradient you made, till I press a key).
5. Blank the whole window white.
Then draw concentric triangles, the outermost on has 3 points: <0,0>, <800,0>, and <400,800>. Now loop, going in 4 pixels each time for all 3 corners and shading with the scheme above. Make sure the lines look parallel. Stop and pause when you reach the single point in the middle.
square is same size as window? Then just clear screen. What does the 400 mean?
yes is square as windows i assume. they aren't any other square.
#include <allegro.h>
int main()
{
allegro_init();
set_gfx_mode(GFX_AUTODETECT_WINDOWED,800,800,0,0);
rectfill(screen,0,800,0,800, makecol(0,255,0));
return 0;
}
END_OF_MAIN();
the program closing itself. how can i fix it?
This will stop the program from closing. Pressing Esc will make it exit. I also fixed up the co-ordinates of the rectfill function for you.
By the way, unless you have a very good reason (eg. targeting older hardware), you'd be better learning Allegro 5 than Allegro 4, which is no longer actively developed.
krabby, did you find out about Allegro recently? Where you found it, did it suggest to use Allegro 4?
please. please. stop using allegro 4.
It was designed *for DOS*. (with roots going back to the *Amiga*)
Allegro 5, is still C based, and a thousand times better.
It was designed for DOS. (with roots going back to the Amiga)
I believe it was actually the Atari ST, not the Amiga.
Clearly this is homework, and his professor is assigning allegro 4.
{"name":"5239042.jpg","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/f\/df99f7688267bbefaa703ab1d991dba4.jpg","w":375,"h":240,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/f\/df99f7688267bbefaa703ab1d991dba4"}