user7621473
user7621473

Reputation:

Allegro get current window size

In Allegro, I can set the Window to be resizeable by running

al_set_new_display_flags(ALLEGRO_RESIZABLE);

before

display = al_create_display(800, 600);

however, if I resize the window, how will I know how big the window is that I resize?

Upvotes: 0

Views: 1182

Answers (2)

rcorre
rcorre

Reputation: 7218

If you want to respond dynamically as the window is resized, you should listen for ALLEGRO_EVENT_DISPLAY_RESIZE. Note that you'll have to register your display as a source for your event queue first:

al_register_event_source(event_queue, al_get_display_event_source(display));

Upvotes: 2

Bassel Shmali
Bassel Shmali

Reputation: 217

use al_get_window_constraints(ALLEGRO_DISPLAY *display, int *min_w, int *min_h, int *max_w, int *max_h).

Source

Upvotes: 1

Related Questions