I am using dev-c++ with allegro
here is the code:

#include <allegro.h>

int SCREEN_WIDTH;
int SCREEN_HEIGHT;
BITMAP *buffer;
int main(int argc, char *argv[]){
     allegro_init();
     install_mouse();
     SCREEN_WIDTH = 620;
     SCREEN_HEIGHT = 240;
     set_color_depth(16);
     set_gfx_mode( GFX_AUTODETECT_WINDOWED, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
     show_mouse(screen);
     buffer = create_bitmap(SCREEN_WIDTH, SCREEN_HEIGHT); 
     putpixel(buffer,300,300,4);
     blit(buffer,screen,0,0,0,0,SCREEN_WIDTH,SCREEN_HEIGHT);
     while(!key[KEY_ESC]){
          //do stuff
          clear_keybuf();
     }
     destroy_bitmap(buffer); 
}
END_OF_MAIN()

I want it to end the loop when the escape key is pressed, but it doesn't respond. Also, there are two screens instead of just one; the first is text only and the second is where the pixels are drawn. Lastly, I tell the computer to put the pixel on the buffer at 300,300 but when buffer is drawn to the screen, it is at about 10,0, with multiple pixels along the x axis (about 10, in all different colors). Does anyone have any idea about what is wrong?
Thanks for any help...

All problems are fixed except the two windows. Is this normal for the system to do that? Or is there some code to delete the text-only window?

Yes its normal. The first window is from your compiler, and the
second is where you render you objects.

It will be useful when you need to debug you application.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.