void set_dialog_default_position() { int w, h; XPLMGetScreenSize(&w, &h); set_dialog_position(get_dialog_default_x(), get_dialog_default_y()); debug("moved dialog to default position"); }
static void safe_window_defaults(void) { int screen_w, screen_h; XPLMGetScreenSize(&screen_w, &screen_h); // Make sure the coords are on screen fit_interval(0, screen_w, &win_pos_x1, &win_pos_y1, 300); fit_interval(0, screen_h, &win_pos_y2, &win_pos_x2, 200); }
int dialog_is_on_screen() { int w, h; XPLMGetScreenSize(&w, &h); int x = get_dialog_x(); int y = get_dialog_y(); if (x < 0 || x > (w - (ui_dialog_w / 2))) return 0; if (y < 0 || y > (h - ui_dialog_h)) return 0; return 1; }
int get_dialog_default_y() { int w, h; XPLMGetScreenSize(&w, &h); return h - ((h - ui_dialog_h) / 4); }
int get_dialog_default_x() { int w, h; XPLMGetScreenSize(&w, &h); return (w - ui_dialog_w) / 2; }