How do you change the screen resolution?

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;

ALLEGRO_DISPLAY* display = al_create_display(width , height);
if (!display) {
   cout << "Failed to create display" << endl;
else {
   al_draw_filled_rectangle(0, 0, 1280, 800, al_map_rgb(0, 255, 0));

l j

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.


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.

Thread #612872. Printed from