allegro and window
a b

I want to make board game - I wrote use library allegro to displaying board . But what to do to display in a window, because now it is display without window so I must push ESC to close this programm ? What should I do ?
PS. I want write this game in C ++, but code library allegro is very different from c++ :/

1#include <allegro.h>
2#include<iostream>
3#include<ctime>
4#include<cstring>
5using namespace std;
6 
7 
8 
9 
10int main()
11{
12BITMAP *rysunek = NULL;
13 
14allegro_init();
15install_keyboard();
16set_color_depth(16);
17set_gfx_mode(GFX_AUTODETECT,1024,768,0,0);
18clear_to_color(screen,15);
19 
20rysunek = load_bitmap("cos.bmp",default_palette);
21blit(rysunek,screen,0,0,0,0,rysunek->w,rysunek->h);
22 
23 
24readkey();
25allegro_exit();
26return 0;
27}
28END_OF_MAIN()

mscava

Try
set_gfx_mode(GFX_AUTODETECT_WINDOWED,1024,768,0,0);
Make sure the resolution is smaller than desktop's. But still I'm not sure wheter you will be able to close it with X button.

Evert
Quote:

But still I'm not sure wheter you will be able to close it with X button.

You need to install a callback for the close button. See the manual for more details.

a b

install callback ??? could you give me a link ?

And why allegro is so different from c++ ??

Durnus

Allegro is not any different than C++ because allegro is a library for C++ (Or C, depending on how you program.)

I am interested in the close button as well.

kazzmir
Quote:

install callback ??? could you give me a link ?

set_close_button_callback( my_close_function );

The forum parser isnt recognizing that function so heres the link to the manual


http://alleg.sourceforge.net/stabledocs/en/alleg000.html#set_close_button_callback

BAF
Quote:

And why allegro is so different from c++ ??

Allegro is very different from C++. Allegro is a library, C++ is a language.

Thread #589000. Printed from Allegro.cc