Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » al_get_display_mode on Windows and Linux

This thread is locked; no one can reply to it. rss feed Print
al_get_display_mode on Windows and Linux
AMCerasoli
Member #11,955
May 2010
avatar

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
Second in Command
February 2005
avatar

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

They all watch too much MSNBC... they get ideas.

Thomas Fjellstrom
Member #476
June 2000
avatar

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

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Matthew Leverton
Supreme Loser
January 1999
avatar

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

Go to: