Re: [AD] desktop resolution (2) |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> I think it should explicitly set the values to 0 (unless it does, I
> haven't looked at the patch).
No, it doesn't at present.
> That would avoid the type of error where the user would do:
> int x, y;
> get_desktop_rez(&x, &y);
But the user should never do that ! As stated in the docs, he must check the
return value.
I think get_desktop_resolution() can serve to detect windowed OSes:
if (get_desktop_resolution(&desk_w, &desk_h) > 0) {
/* ok, we can run in a window */
color_depth = desktop_color_depth();
set_color_depth(color_depth);
/* get the best matching window size */
(...)
if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, x, y, 0, 0) < 0) {
if (color_depth == 16) {
color_depth = 15;
set_color_depth(color_depth);
if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, x, y, 0, 0) < 0)
goto Error;
}
}
else {
/* only fullscreen modes are availables */
if (set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, x, y, 0, 0) < 0)
goto Error;
}
--
Eric Botcazou
ebotcazou@xxxxxxxxxx