![]() |
|
Program with al_set_target_bitmap does not run. |
A. van Patmos
Member #15,349
October 2013
|
Hi all, I've been trying to use the al_set_target_bitmap functionality in the following ways (they all compile but do not run): 1ALLEGRO_BITMAP *bgimage, *vul = NULL;
2
3al_init_primitives_addon();
4al_install_keyboard();
5
6vul = al_load_bitmap("bg.bmp");
7
8bgimage = al_create_bitmap(width, height);
9
10al_set_target_bitmap(bgimage);
11al_draw_bitmap(vul, 0, 0, 0);
12al_draw_filled_triangle(440, 460, 530, 280, 620, 460, al_map_rgb(255, 0, 0));
13al_set_target_bitmap(al_get_backbuffer(display));
Here I thought I needed two pointers, one for creating the bitmap and one for filling it. 2ALLEGRO_BITMAP *bgimage = NULL;
3
4al_init_primitives_addon();
5al_install_keyboard();
6
7bgimage = al_load_bitmap("bg.bmp");
8
9//bgimage = al_create_bitmap(width, height);
10
11al_set_target_bitmap(bgimage);
12//al_draw_bitmap(vul, 0, 0, 0);
13al_draw_filled_triangle(440, 460, 530, 280, 620, 460, al_map_rgb(255, 0, 0));
14al_set_target_bitmap(al_get_backbuffer(display));
Here I load the bg.bmp directly in bgimage which will also be the target_bitmap. 3ALLEGRO_BITMAP *bgimage = NULL;
4
5al_init_primitives_addon();
6al_install_keyboard();
7
8//bgimage = al_load_bitmap("bg.bmp");
9
10//bgimage = al_create_bitmap(width, height);
11
12al_set_target_bitmap(bgimage);
13bgimage = al_load_bitmap("bg.bmp");
14//al_draw_bitmap(vul, 0, 0, 0);
15al_draw_filled_triangle(440, 460, 530, 280, 620, 460, al_map_rgb(255, 0, 0));
16al_set_target_bitmap(al_get_backbuffer(display));
And here I execute al_load_bitmap after al_set_target_bitmap. All of these give "test.exe has encountered a problem and needs to close etc..." Is it my code or is something else wrong, please? |
Paragon
Member #15,335
October 2013
|
You code doesn't show you calling al_init() If you are having trouble loading the bitmap try: http://wiki.allegro.cc/index.php?title=Loading_Resources_(Troubleshooting) |
A. van Patmos
Member #15,349
October 2013
|
Yes I lost my al_init_image_addon() at some point. al_init() and al_draw_bitmap() were there, Thanks. |
|