al_get_display_mode on Windows and Linux
AMCerasoli

Aloha!

It's me or al_get_display_mode() doesn't work the same in Windows as in Linux?

I was running the example that's on the Wiki:

#SelectExpand
1#include <iostream> 2 3#include "allegro5/allegro.h" 4#include "allegro5/allegro_image.h" 5#include "allegro5/allegro_primitives.h" 6 7using namespace std; 8 9int main(int argc, char **argv){ 10 11 ALLEGRO_DISPLAY *display = NULL; 12 ALLEGRO_DISPLAY_MODE disp_data; 13 14 al_init(); // I'm not checking the return value for simplicity. 15 al_init_image_addon(); 16 al_init_primitives_addon(); 17 18 al_get_display_mode(al_get_num_display_modes()-1, &disp_data); //Gets the biggest resolution supported. 19 20 al_set_new_display_flags(ALLEGRO_FULLSCREEN); 21 display = al_create_display(disp_data.width, disp_data.height); 22 23 cout<<"width: "<<disp_data.width<<endl<<"Height: "<<disp_data.height; 24 25 al_rest(3); 26 al_destroy_display(display); 27 28 return 0; 29}

And I'm getting the opposite of what the line number 18 says. I think that article is wrong or something... When I made that article I was on Windows and I think that was right, but now I'm not so sure...

Arthur Kalliokoski

You're depending on the highest resolution to be last? That seems dodgy to me, no matter what OS you're running.

Thomas Fjellstrom

I don't think the order of the modes is defined anywhere. If you want the largest mode, you need to look for it.

Matthew Leverton

Where is that wiki article? It'd be nice if Allegro sorted the results, but it doesn't currently guarantee it.

What do you expect?

  • height, then width

  • width, then height

  • height * width, then height

  • height * width, then width

Thread #612859. Printed from Allegro.cc