The code below won’t work; it produces a blank screen. But if I change the filled rectangle line toward the bottom line to:
al_draw_filled_rectangle(100, 100, 100+15, 100+15, al_map_rgb(155, 255, 155));
It produces a square at the correct coordinates. What’s up?
#define ALLEGRO_STATICLINK
#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
int main(int argc, char **argv)
{
ALLEGRO_DISPLAY *display;
if(!al_init())
{
return -1;
}
display = al_create_display(640, 480);
if(!display)
{
return -1;
}
if(!al_init_primitives_addon())
{
return -1;
}
al_draw_filled_rectangle(73, 493, 73+15, 493+15, al_map_rgb(155, 255, 155));
al_flip_display();
al_rest(10);
return 0;
}
You are trying to draw at a Y coordinate greater than the screen height…
Draws at 493 to 493+15
493 > 480 and 493+15 > 480
This set 480 as your screen height so drawing above that number will result in nothing being shown.
When you use
You are now actually on the screen so it works.