Is a function to retrieve the native desktop resolution planned to be included in Allegro 5?
I'm asking this because the most reliable way to get a display going is to use the native fullscreen mode of the computer.
Also, will there be a way to get a list of the supported resolutions in A5 the way there was with Allegro 4?
I believe the first mode given from the mode enumeration stuff is usually the current one, but theres also al_get_monitor_info. You can get the width and height of each monitor via that.
Also, if you're always just going to set the desktop mode, forget a normal ALLEGRO_FULLSCREEN window, use ALLEGRO_FULLSCREEN_WINDOW instead. That will always create a window the size of the screen regardless of what you passed to al_create_display, and will skip any mode set.
Also, will there be a way to get a list of the supported resolutions in A5 the way there was with Allegro 4?
Yes. al_get_display_mode.
I looked at the manual, but I must be blind since I missed both those functions.
Okay, so I would use something like this to set a desktop sized fullscreen display and to enumerate the modes available, right? :
Also, if you're always just going to set the desktop mode, forget a normal ALLEGRO_FULLSCREEN window, use ALLEGRO_FULLSCREEN_WINDOW instead.
About your suggestion to use ALLEGRO_FULLSCREEN_WINDOW instead of ALLEGRO_FULLSCREEN - does using that mode preserve the contents of video memory when the user switches away from the program using Alt-Tab?
Okay, so I would use something like this to set a desktop sized fullscreen display and to enumerate the modes available, right?
I suppose you could use something like that.
About your suggestion to use ALLEGRO_FULLSCREEN_WINDOW instead of ALLEGRO_FULLSCREEN - does using that mode preserve the contents of video memory when the user switches away from the program using Alt-Tab?
I believe so. And even if it doesn't, just make sure you handle the ALLEGRO_EVENT_DISPLAY_LOST and ALLEGRO_EVENT_DISPLAY_FOUND events, and redraw when you get the latter event.
void get_desktop_resolution(int adapter, int *w, int *h) { ALLEGRO_MONITOR_INFO info; al_get_monitor_info(adapter, &info); *w = info.x2 - info.x1; *h = info.y2 - info.y1; }
Side note: maybe al_get_monitor_info() and similar void functions should instead return false if the adapter is out of range.
Maybe we should have al_get_desktop_resolution(monitor, *w, *h) and al_get_desktop_position(monitor, *x, *y) instead of al_get_monitor_info, since this question seems to come up repeatedly And I agree about the return value - right now you're more or less required to call al_get_num_video_adapters before calling al_get_monitor_info.
Side note: maybe al_get_monitor_info() and similar void functions should instead return false if the adapter is out of range.
I agree, if that happens to matter.
The manual entry for ALLEGRO_MONITOR_INFO doesn't specify whether x2 and y2 are inclusive or exclusive. Are they the bottom right pixel or one past it? It makes a difference when calculating the width and height of the monitor, so I thought I'd ask.
Are they the bottom right pixel or one past it?
It's "one past." So you don't need to add 1 to get the correct sizes.
Maybe we should have al_get_desktop_resolution(monitor, *w, *h) and al_get_desktop_position(monitor, *x, *y) instead of al_get_monitor_info
I prefer the A5 functions. Seems less hacky than using multiple integer pointers.