]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow closing the Welcome dialog by clicking anywhere outside of it
authorterencehill <piuntn@gmail.com>
Thu, 31 Mar 2022 14:58:43 +0000 (16:58 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 31 Mar 2022 14:58:43 +0000 (16:58 +0200)
qcsrc/menu/xonotic/dialog_welcome.qc
qcsrc/menu/xonotic/dialog_welcome.qh

index fc7abd168a150d5d5dafb488409d572efbc3f3f6..7873931589cafd5406a252590e8ae4a30c957936 100644 (file)
@@ -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");
index 9417f55ac3f56a04686d7fa474167d87617f1599..4a63942859aff16ae224efbab468e3ff90e16f95 100644 (file)
@@ -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));