From: terencehill Date: Thu, 31 Mar 2022 14:58:43 +0000 (+0200) Subject: Allow closing the Welcome dialog by clicking anywhere outside of it X-Git-Tag: xonotic-v0.8.5~120 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1f954241673ffc468c069247a6cf1967388dd132;p=xonotic%2Fxonotic-data.pk3dir.git Allow closing the Welcome dialog by clicking anywhere outside of it --- diff --git a/qcsrc/menu/xonotic/dialog_welcome.qc b/qcsrc/menu/xonotic/dialog_welcome.qc index fc7abd168..787393158 100644 --- a/qcsrc/menu/xonotic/dialog_welcome.qc +++ b/qcsrc/menu/xonotic/dialog_welcome.qc @@ -27,6 +27,18 @@ float XonoticWelcomeDialog_keyDown(entity me, float key, float ascii, float shif } } +// the same implentation in mousePress apparently works, but for some reason if you try to open +// the dialog again it doesn't show up and requires opening it a seconds time to show up +bool XonoticWelcomeDialog_mouseRelease(entity me, vector pos) +{ + if (pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) + { + return SUPER(XonoticWelcomeDialog).mouseRelease(me, pos); + } + me.close(me); + return true; +} + void XonoticWelcomeDialog_destroy(entity me) { cvar_set("_menu_welcome_dialog_available", "0"); diff --git a/qcsrc/menu/xonotic/dialog_welcome.qh b/qcsrc/menu/xonotic/dialog_welcome.qh index 9417f55ac..4a6394285 100644 --- a/qcsrc/menu/xonotic/dialog_welcome.qh +++ b/qcsrc/menu/xonotic/dialog_welcome.qh @@ -10,6 +10,7 @@ CLASS(XonoticWelcomeDialog, XonoticRootDialog) ATTRIB(XonoticWelcomeDialog, columns, float, 4); ATTRIB(XonoticWelcomeDialog, name, string, "Welcome"); + METHOD(XonoticWelcomeDialog, mouseRelease, bool(entity, vector)); METHOD(XonoticWelcomeDialog, keyDown, float(entity, float, float, float)); METHOD(XonoticWelcomeDialog, destroy, void(entity)); METHOD(XonoticWelcomeDialog, readInputArgs, void(entity, int));