[AD] driver selection in config file |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2008-09-01, trentg@xxxxxxxxxx <trentg@xxxxxxxxxx> wrote:
> Revision: 10647
> http://alleg.svn.sourceforge.net/alleg/?rev=10647&view=rev
> Author: trentg
> Date: 2008-09-01 22:21:01 +0000 (Mon, 01 Sep 2008)
>
> Log Message:
> -----------
> Better defaults in allegro.cfg. Added config option to set display driver.
>
> Modified Paths:
> Modified: allegro/branches/4.9/src/win/wnewsys.c
> ===================================================================
> --- allegro/branches/4.9/src/win/wnewsys.c 2008-09-01 22:07:26 UTC (rev 10646)
> +++ allegro/branches/4.9/src/win/wnewsys.c 2008-09-01 22:21:01 UTC (rev 10647)
> @@ -180,7 +180,19 @@
> static ALLEGRO_DISPLAY_INTERFACE *win_get_display_driver(void)
> {
> int flags = al_get_new_display_flags();
> + ALLEGRO_SYSTEM *sys = al_system_driver();
> + AL_CONST char *s;
>
> + if (sys->config) {
> + s = al_config_get_value(sys->config, "gfx", "driver");
> + if (s) {
> + if (strstr(s, "opengl"))
> + return _al_display_wgl_driver();
> + else if (strstr(s, "direct3d"))
> + return _al_display_d3d_driver();
> + }
> + }
> +
> if (flags & ALLEGRO_OPENGL) {
> #if defined ALLEGRO_CFG_OPENGL
> return _al_display_wgl_driver();
I think, if the program specifies ALLEGRO_OPENGL or ALLEGRO_DIRECT3D
then that's exactly what they should get, regardless of the config file.
And if the program specifies ALLEGRO_OPENGL but OpenGL support wasn't
compiled in, it should just return NULL instead of falling back to
something else as it will do now.
Peter