Re: [AD] modernizing the examples

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


On 7/26/07, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> On 2007-07-26, Matthew Leverton <meffer@xxxxxxxxxx> wrote:
> > (And if people object to that,
> > a GFX_DESKTOP magic driver could be made that gives precedence to
> > windowed drivers.)
>
> Good idea.  I'd like for it to be named GFX_AUTODETECT_something,
> e.g. GFX_AUTODETECT_PREFER_WINDOWED, although it's slightly long.
>
>

Attached is a patch that adds GFX_AUTODETECT_DESKTOP. I'm not married
to the name, but I'd rather it not get any longer...

Backward compatible behavior should remain the same. If
GFX_AUTODETECT_DESKTOP is selected, then the following occurs:

1) Check graphics.gfx_cardw
2) Check graphics.gfx_card
3) Check windowed drivers
4) Check fullscreen drivers

I think that is a fair method. One might argue that gfx_card should be
ignored if gfx_cardw is not set, but I think if someone takes the time
to modify allegro.cfg, then they ought to be responsible for setting
them both if that's what they want.

Technical details:

The current Allegro auto detection of graphics drivers is kind of
optimistic in that it sets flags as if there will be a plethora of
them, when in fact there are only two (windowed / fullscreen) and they
don't really actually solve the only real problem very well... But the
patch does nothing to dampen the spirits, and instead just kind of
works around it in as trivial of a manner as possible.

graphics.c is where all the fun stuff is at:

A) I slightly changed the meaning of the GFX_DRIVER_FULLSCREEN /
WINDOWED_FLAGs. At least one of them must be set when doing an
AUTODETECT. If set, it means that mode is allowed. If it is not set,
it means it is not allowed. I think that is more intuitive than the
current method.

B) I added GFX_DRIVER_PREFER_WINDOW_FLAG. It's only used in the
_set_gfx_mode function. The gfx_driver_is_valid function still doesn't
care about preference.

C) _set_gfx_mode sets the flags accordingly, and then fills "int
mode_priority[2]" with the fullscreen / windowed flags in the proper
order. mode_priority[1] is empty if the user specifically requested
only one of the two modes.

--
Matthew Leverton

Attachment: auto_desktop.diff
Description: Binary data



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