[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
I don't mind access to the global pointers. IMO, using functions like
get_key_array are rather inefficient for low-level programming. The
key array, the screen bitmap, etc, are designed to hold real-time
data.. showing the state of the device at any given moment in time.
Polling goes counter-intuitive to this, and IMHO, should be avoided
unless there's no other choice. Allegro has been, and should continue
to be, designed to give the programmer low-level access.. as low-level
as possible given the OS, anyway.
(playing devil's advocate here) Under modern OSes at the lowest level
you find events driven systems, needing polling... Allegro has always
worked around this to bring the user a realtime API, with status vars
updated in realtime (see the key array or the mouse_* vars), often
using a background thread to poll the system events. The only system
actually not doing the polling nowadays is... DOS.
When I said to break with the DOS centric development, I meant this. So
far we've made other OSes emulate the DOS way of doing things, and this
is an example.
That said, I really appreciate the current way Allegro works, without
needing to poll. But this is not that lowlevel...
IMO we should do the other way around: internally Allegro should use an
events system, emulating an events pump under platforms that do not
support polling (only DOS AFAIK). Then provide both access to this
lowlevel events system and to an alternative API system which
automatically polls and gives the users the possibility to get changes
in realtime without needing to poll themselves. Some switch in
al_init() would do the job. Think "al_init(0) versus
al_init(AL_AUTO_POLLING)".
Having an events based input system underneath also could greatly
simplify the code, as many hacks would not be needed anymore...
If the programmer wants to implement a polling scheme on top of this,
then great. But it shouldn't be Allegro's job to do it.
Then the programs implementing such a polling scheme by themselves
would internally be redundant, going from polled to realtime and back
to polled on most systems...
--
Angelo Mottola
a.mottola@xxxxxxxxxx
http://www.ecplusplus.com