This function gets the width (in pixels) of the GUI as used in the Draw GUI Event.
NOTE When your application_surface is larger than the display's size (roughly), and you call this function before the current room's initialisation has finished, e.g. in a global script, a room's Creation Code or an instance's Create event, the value returned may not be accurate. For accurate results in such cases, call this in a Draw event.
display_get_gui_width();
Draw GUI Event
var _width = display_get_gui_width();
var _halign = draw_get_halign();
draw_set_halign(fa_right);
draw_text(_width - 5, 5, "This text is drawn in the top-right corner of the GUI");
draw_set_halign(_halign);
The above code draws a text in the GUI: it first gets the GUI width using display_get_gui_width and then sets the horizontal text alignment to fa_right, then draws a line of text using draw_text and finally resets the horizontal text alignment to its previous value.