Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [A5] Possible to make alerts?

This thread is locked; no one can reply to it. rss feed Print
[A5] Possible to make alerts?
tariel36
Member #14,214
April 2012

Hello, I wonder if it is possible to make windows-like error alerts in Allegro. I've found al_set_errno(); and al_get_errno(); functions in manula but I'm not sure how to use it. (Till now I used to report errors in console, but now I wanted to get rid of it).

Arthur Kalliokoski
Second in Command
February 2005
avatar

For most errors, just putting a string into a dialog box will suffice, e.g.

#SelectExpand
1 if(!al_init()) 2 { 3 al_show_native_message_box(0, "Error", "Failed to initialize Allegro", "", NULL, 0); 4 return 1; 5 } 6 . 7 . 8 . 9 display = al_create_display(display_width, display_height); 10 if (!display) 11 { 12 al_show_native_message_box(0, "Error", "Couldn't create display", "", NULL, 0); 13 return 1; 14 } 15 . 16 . 17 . 18 faceimg = al_load_bitmap("face.tga"); 19 if(!faceimg) 20 { 21 al_show_native_message_box(display, "Error", "Unable to load \"face.tga\"", "", NULL, 0); 22 return 1; 23 }

If you want to get specific strings such as EWOULDBLOCK etc., you'd have to reference those strings manually.

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

― Robert A. Heinlein

tariel36
Member #14,214
April 2012

Thanks for fast reply! It should do the job :)

Go to: