]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/item/button.qc
Merge branch 'master' into TimePath/unified_weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / item / button.qc
index 796ce40a3365374b2e870e2fc630a84f250a6fd6..934e8cd3426e0579ff5066fea55349e2c3760dd8 100644 (file)
@@ -2,15 +2,15 @@
 #define ITEM_BUTTON_H
 #include "label.qc"
 CLASS(Button, Label)
-       METHOD(Button, configureButton, void(entity, string, float, string))
-       METHOD(Button, draw, void(entity))
-       METHOD(Button, showNotify, void(entity))
-       METHOD(Button, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(Button, keyDown, float(entity, float, float, float))
-       METHOD(Button, mousePress, float(entity, vector))
-       METHOD(Button, mouseDrag, float(entity, vector))
-       METHOD(Button, mouseRelease, float(entity, vector))
-       METHOD(Button, playClickSound, void(entity))
+       METHOD(Button, configureButton, void(entity, string, float, string));
+       METHOD(Button, draw, void(entity));
+       METHOD(Button, showNotify, void(entity));
+       METHOD(Button, resizeNotify, void(entity, vector, vector, vector, vector));
+       METHOD(Button, keyDown, float(entity, float, float, float));
+       METHOD(Button, mousePress, float(entity, vector));
+       METHOD(Button, mouseDrag, float(entity, vector));
+       METHOD(Button, mouseRelease, float(entity, vector));
+       METHOD(Button, playClickSound, void(entity));
        ATTRIB(Button, onClick, void(entity, entity), func_null)
        ATTRIB(Button, onClickEntity, entity, NULL)
        ATTRIB(Button, src, string, string_null)
@@ -44,7 +44,7 @@ void Button_resizeNotify(entity me, vector relOrigin, vector relSize, vector abs
        if(me.srcMulti)
                me.keepspaceLeft = 0;
        else
-               me.keepspaceLeft = min(0.8, absSize.y / absSize.x);
+               me.keepspaceLeft = min(0.8, absSize.x == 0 ? 0 : (absSize.y / absSize.x));
        SUPER(Button).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
 }
 void Button_configureButton(entity me, string txt, float sz, string gfx)