I´m starting to use allegro 4.4.2 on Visual Studio 2013. I installed both allegro 4.4.2 and 5.0.10 on VS and started testing some examples of allegro 4.4.2
This is my code:
#include <allegro.h>
#define ANCHO 640
#define ALTO 480
int soltado = 1;
int accion = 4;
BITMAP *buffer;
BITMAP *dibujo;
BITMAP *botones;
bool Sobre_boton(){
return (mouse_x >0 && mouse_x < 64 &&
mouse_y >0 && mouse_y < 64);
};
void cambiaccion(){};
void realizaccion(){};
void Boton_izquierdo(){
if (Sobre_boton()){
cambiaccion();
}
else{
realizaccion();
}
};
void Pinta_cursor(){
circle(buffer, mouse_x, mouse_y, 2, 0x000000);
putpixel(buffer, mouse_x, mouse_y, 0x000000);
};
void Pinta_botones(){
blit(botones, buffer, 0, 0, 0, 0, 64, 64);
};
int main()
{
allegro_init();
install_keyboard();
install_mouse();
set_color_depth(32);
set_gfx_mode(GFX_AUTODETECT_WINDOWED, ANCHO, ALTO, 0, 0);
buffer = create_bitmap(ANCHO, ALTO);
dibujo = create_bitmap(ANCHO, ALTO);
botones = load_bmp("bton.bmp", NULL);
clear_to_color(buffer, 0xFFFFFF);
clear_to_color(dibujo, 0xFFFFFF);
while (!key[KEY_ESC]){
blit(dibujo, buffer, 0, 0, 0, 0, ANCHO, ALTO);
Pinta_botones();
//pulsa boton izquierdo
if (mouse_b & 1){
Boton_izquierdo();
}
else{
soltado = 1;
}
Pinta_cursor();
blit(buffer, screen, 0, 0, 0, 0, ANCHO, ALTO);
}
destroy_bitmap(botones);
destroy_bitmap(dibujo);
destroy_bitmap(buffer);
return 0;
}
END_OF_MAIN();
When I run the project, VS starts lagging horribly, to the point I have to wait like 7 seconds to see my mouse cursor move. I have to terminate the process of VS in order to get my pc to work normally again. Here´s a screenshot of the exception:

Can anyone tell what I´m doing wrong?
Thank you
In this part
botones = load_bmp("bton.bmp", NULL);you should add something after, like:To validate whether it was loaded properly or not, as
load_bmpwill return aNULLpointer if it fails to correctly load the file. WhenPinta_botonesis called, the functionblitis called, whose functionality is to copy a rectangular area of the source bitmap to the destination bitmap.The source bitmap, in this case
botonesappears to be aNULLpointer in the screenshot whenblitis called, which will cause problems when trying to access aNULLreference.