Re: [AD] proposal to acquire_screen() and release_screen()

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


ronaldo hideki yamada <r.yamada@xxxxxxxxxx> wrote:
> the user programs could always make use of acquire_screen() and
> relese_screen() in MAIN drawing routines like?
> void main(...)
> {
>    ...
>    while(!done){
>       handle_input();
>       handle_ai();
>       ...
>       acquire_screen();
>       draw_background(); /* no calls to acquire_screen() */
>       draw_enemys();     /* or relese_screen() */
>       ...
>       draw_player();     /* into theses routines */
>       release_screen();
>       ...
>    }
>    ...
> }

It already works like that.  As a convenience, though, Allegro will
do the acquiring for you if you leave it out (but this will be
slower).

> i sugest the uses this, easy implemetation of doublebuffer, pageflipping,
> triple buffer or windowed modes. the user program could call any new
> function like.
>    ...
>    set_gfx_buffering(ALLEGRO_BEST_MODE);
>    ...
> then allegro could attempt to set better mode avail, like triple_buffer, or
> any other requested, and user program could use allegro routines to draw to
> screen bitmap without know how implement triple_buffer the calls to
> acquire_screen() or release_screen() will make all work.

I think this would also work at a higher level, like the demo game.

> i know about drastic changes which this will make ,but is only an proposal

I suspect it is not necessary.

> PS. how work the windowed drivers, how them handle windows overlaped or area
> not visible or need for system update events?

In BeOS, the system tells you which parts of the window are visible.
It is then up to us to update those parts, and those parts only.
The BeOS windowed driver (bgfxapi.cpp) maintains a double buffer,
and remembers which lines are ``dirty'' using a line array, updated
by the bank switching routines in the driver vtable.  There is a
separate thread which updates the screen contents to the double
buffer periodically.

The SVGAlib (svgalib.c) and X (xwin.c) drivers work similarly, but
do not have a separate thread (they just update the screen during
bank switches).  Neither of these drivers need to care about
overlapping regions, though.

-- 
tjaden@xxxxxxxxxx - http://www.psynet.net/tjaden/
TWINCH (twinch), n.  The movement a dog makes with its head when it hears a
high-pitched noise.  -- Rich Hall, "Sniglets"



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