|
How do you change the screen resolution? |
japheth
Member #9,327
December 2007
|
I've been trying to change the screen resolution for a game I'm making and the relevant code is below. If I use 1680x1050 (my current and native resolution), I get a black window that fills the whole screen. If I use any other resolution (such as 1280x800), allegro does make a window (display isn't NULL), but it's not filled with black. I haven't found any allegro function that looks like it changes the screen resolution (other than al_create_display). Can anyone tell me if there is a way to change the monitor resolution and if there is a anything I can do in an allegro fullscreen game other than using the resolution the player currently has? int width = 1680; int height = 1050; al_set_new_display_flags(ALLEGRO_FULLSCREEN); ALLEGRO_DISPLAY* display = al_create_display(width , height); if (!display) { cout << "Failed to create display" << endl; } else { al_set_target_bitmap(al_get_backbuffer(display)); al_draw_filled_rectangle(0, 0, 1280, 800, al_map_rgb(0, 255, 0)); }
|
l j
Member #10,584
January 2009
|
Which resolutions are supported in full screen mode depends on the monitor and graphics card that the user uses. al_resize_display can be used for resizing. Also, you must call al_flip_display after drawing, for actually printing to the screen. I don't know if you're already doing this.
|
japheth
Member #9,327
December 2007
|
I figured out what my problem was. I couldn't change to some resolutions because because I wasn't changing the existing refresh rate. I looked at the output of al_get_display_mode to determine possible refresh rates for a given resolution and then I was able to set the resolutions I wanted. |
|