0

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...

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by firstPerson
0

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?

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.