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 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.
> If we cannot, I think "al_get_current_display" should support calls
> before "al_init". So the examples (and any game) can use
> "al_show_native_message_box" with "al_get_current_display"
> without worrying about if "al_init" has failed or not.
>
> As in "common.c" is said the other option is to remove the display
> parameter from "al_show_native_message_box". But I think it is
> just a bad idea.
>
> Another detail: I think "native_dialog.txt" should say that those
> functions can be called even if "al_init" was failed or was not
> called yet (e.g. "examples" use "al_show_native_message_box"
> to show an error when "al_init" fails).
Ok.
Peter