From: terencehill Date: Thu, 10 Mar 2022 23:25:40 +0000 (+0100) Subject: Allow closing the Welcome dialog with Enter and Space X-Git-Tag: xonotic-v0.8.5~81^2~23 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=651ed474adc28a66c8fd85502714655a6c879ac0;p=xonotic%2Fxonotic-data.pk3dir.git Allow closing the Welcome dialog with Enter and Space --- diff --git a/qcsrc/menu/xonotic/dialog_welcome.qc b/qcsrc/menu/xonotic/dialog_welcome.qc index bf2a71163..4c3166649 100644 --- a/qcsrc/menu/xonotic/dialog_welcome.qc +++ b/qcsrc/menu/xonotic/dialog_welcome.qc @@ -17,6 +17,19 @@ void welcomeDialog_resetStrings(entity me) strunzone(me.serverinfo_MOTD); me.serverinfo_MOTD = strzone(_("")); } +float XonoticWelcomeDialog_keyDown(entity me, float key, float ascii, float shift) +{ + switch(key) + { + case K_KP_ENTER: + case K_ENTER: + case K_SPACE: + XonoticWelcomeDialog_close(me); + return true; + default: + return SUPER(XonoticWelcomeDialog).keyDown(me, key, ascii, shift); + } +} void XonoticWelcomeDialog_close(entity me) { SUPER(XonoticWelcomeDialog).close(me); diff --git a/qcsrc/menu/xonotic/dialog_welcome.qh b/qcsrc/menu/xonotic/dialog_welcome.qh index 5b4881bcf..a1666ed02 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, keyDown, float(entity, float, float, float)); METHOD(XonoticWelcomeDialog, close, void(entity)); METHOD(XonoticWelcomeDialog, configureDialog, void(entity)); METHOD(XonoticWelcomeDialog, readInputArgs, void(entity, float));