I am having problem catching the ALLEGRO_MESSAGEBOX_YES_NO return value.
How am i supposed to get its value, so when the user press yes, the window is resized?
Here is the code i have made.
int resize; resize = al_show_native_message_box(display, "Change display", "Are you sure?", "Do you want to change your display to 600x600?", "Of course|No", ALLEGRO_MESSAGEBOX_YES_NO); if(resize == 1) { al_resize_display(display, 600, 600); }
I tried it but i get this error on visual studio 2012
{"name":"606487","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/4\/0409376e1c55faeb0c7fcd20ac88a3b6.png","w":441,"h":319,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/4\/0409376e1c55faeb0c7fcd20ac88a3b6"}
Your 'display' pointer is bad, but you didn't get this error before because ALLEGRO_MESSAGEBOX_YES_NO isn't equal to 1, so the al_resize_display() was never called.
This is my display pointer. Is it bad?
ALLEGRO_DISPLAY *display = NULL;
Even if i change its parameters to
ALLEGRO_DISPLAY *display(int width = 300, int height = 200);
It will show an error on the first parameter
al_resize_display(display, 600, 600);
This is my display pointer. Is it bad?
ALLEGRO_DISPLAY *display = NULL;
It shouldn't be NULL after you've successfully created a display with it.
[EDIT]
You need to create a display to resize it.
I got it to work, but i get a weird thing in the display
This happens only after the screen is resized. Otherwise if i press no it wont happen.
As the screen shows it, they are the bounders of the smaller display i created it.
Edit: I didnt get this error with your code
{"name":"606488","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/e\/ee68b60bdb4ade90c9d5119dd2d2d1b9.png","w":301,"h":394,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/e\/ee68b60bdb4ade90c9d5119dd2d2d1b9"}
I edited my previous post just when you were posting. Save your code to something else temporarily and try what I posted. It worked OK for me except the window always went to lower right corner of desktop, whether the al_set_new_window_position() was above the resize or not.
Very weird errors indeed. I will try to find what is the problem with the programs.
Also, when executing your code, it shows in the center of my screen, so it works perfect!
Still, i cannot understand why i get that white think
EDIT: i got it to work, but i used 2 times the al_flip_display();
Is that ok, or it is not recommended?
Here is my code
Actually, i was thinking if the user, can specify himself the resolution using a text box, or maybe two. Is it possible?