Re: [AD] About al_get_current_display and al_show_native_message_box

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Mon, Nov 22, 2010 at 6:52 AM, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> On 2010-11-18, Peter Wang <novalazy@xxxxxxxxxx> wrote:
>> On 2010-11-17, David Capello <davidcapello@xxxxxxxxxx> wrote:
>> > Hello,
>> >
>> > One question, can we use "al_get_current_display" before calling "al_init"
>> > or even if "al_init" fails? If we can, the following patch could be applied to
>> > "examples/common.c" to avoid problems showing a message box
>> > behinds the current display (e.g. in "ex_joystick_events.c" when we
>> > don't have a joystick).
>>
>> I don't think it's officially supported, yet.  It may initialise some
>> thread-local state, which could be somewhat complicated.
>> We could make tls_get() return NULL if Allegro hasn't yet been
>> initialised, then all of the al_get_* functions for thread-local state
>> will return default values.
>
> Another alternative is to add al_is_system_installed.
> This could be useful for other cases and arguably should be added
> anyway for consistency.

Yes, that's a good idea. Indeed, I think it should be added
for A5.0 so "al_get_current_display" can use it.

Anyway, could be "al_is_system_installed" implemented as follow?
bool al_is_system_installed(void)
{
   return al_get_system_driver() != NULL;
}




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/