Re: [AD] END_OF_MAIN removal patch for msvc

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


On Tue, 2008-11-18 at 16:07 -0700, Thomas Fjellstrom wrote:
> On November 18, 2008, Paul Suntsov wrote:
> > If I may butt in, but reducing choice and forcing people into a single (and
> > flawed when it comes to games, in my opinion) paradigm only to remove a
> > single macro is not the right solution.
> 
> Yeah, I'm not sure going whole hog on the event system is the right direction, 
> but neither are hacks like END_OF_MAIN.

The idea is that it is easy to build a polling paradigm on top of an
event system, but it is hard to go the other way round (this is
mentioned in the A4 manual, actually).

If I understand correctly, the main block for END_OF_MAIN is MacOS,
where the event loop must be in the main thread. In this case, why not
have Allegro simply control the main thread? 

int main(void)
{
    al_init();
    [...]
    al_run([callback]);

    return 0;
}

Since all A5 platforms run on event loops internally, this is trivial to
implement (the user's code is called whenever the Allegro event loop
hits idle). The only side-effect to the user is that he'll have to place
his own game code to the callback, not the main function. Everything
else stays the same (polling for input, window size etc).

Would this solve the problem? Is this worth it when compared to the
END_OF_MAIN hack? Any catches?






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