Allegro Wiki A5 Tutorial error or really odd laptop?
Specter Phoenix

I was reading this tutorial:

I executed the code and it compiled fine. I started goofing around with just the function for getting the resolution and my laptop doesn't seem to line up with what the wiki states.

Per wiki:

al_get_display_mode(al_get_num_display_modes() - 1, &disp_data); // minimum res
al_get_display_mode(0, &disp_data); // to get maximum supported resolution instead

My code:

1#include <iostream> 2 3#include "allegro5/allegro.h" 4 5int main(int argc, char **argv){ 6 ALLEGRO_DISPLAY_MODE disp_data; 7 8 al_init(); // skipped error checking 9 10 al_get_display_mode(al_get_num_display_modes()-1, &disp_data); // wiki states this is minimum 11 std::cout << "Minimum Resolution: " << disp_data.width << " x " << disp_data.height << std::endl; 12 13 al_get_display_mode(0, &disp_data); // wiki states this is maximum 14 std::cout << "Maximum Resolution: " << disp_data.width << " x " << disp_data.height << std::endl; 15 16 return 0; 17}

The output is what made it confusing.

Minimum Resolution: 1366 x 768
Maximum Resolution: 320 x 200

So is this a wiki error, my strange laptop, or am I misreading the code or wiki?

Edgar Reynaldo

It's an ascending sort. Smallest is first. Wiki is wrong I would guess.

Specter Phoenix

Okay. I just wanted to verify it as I was just starting to think maybe I had a weird graphics card [Intel].


I don't think the order is defined. On Linux, 0 yields the largest option for me. The wiki is wrong, yes.

Chris Katko

I had a weird graphics card [Intel].

Don't worry. You do. ;)

Thread #617082. Printed from