]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/screenshotimage.qc
Menu: ScrollPanel component
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / screenshotimage.qc
index a800a849486aceae4d7651f2adbaf41a4c36db40..8e8f3ccf738bd4f32de72be843b87510b558d8d8 100644 (file)
@@ -1,27 +1,9 @@
-#ifdef INTERFACE
-CLASS(XonoticScreenshotImage) EXTENDS(XonoticImage)
-       METHOD(XonoticScreenshotImage, configureXonoticScreenshotImage, void(entity))
-       METHOD(XonoticScreenshotImage, load, void(entity, string))
-       METHOD(XonoticScreenshotImage, draw, void(entity))
-       ATTRIB(XonoticScreenshotImage, focusable, float, 1) // mousePress and mouseDrag work only if focusable is set
-       METHOD(XonoticScreenshotImage, mousePress, float(entity, vector))
-       METHOD(XonoticScreenshotImage, mouseDrag, float(entity, vector))
-       METHOD(XonoticScreenshotImage, mouseMove, float(entity, vector))
-       METHOD(XonoticScreenshotImage, resizeNotify, void(entity, vector, vector, vector, vector))
-       ATTRIB(XonoticScreenshotImage, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticScreenshotImage, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticScreenshotImage, showTitle, float, 1)
-       ATTRIB(XonoticScreenshotImage, screenshotTime, float, 0)
-       ATTRIB(XonoticScreenshotImage, screenshotTitle, string, string_null)
-ENDCLASS(XonoticScreenshotImage)
-entity makeXonoticScreenshotImage();
-#endif
+#include "screenshotimage.qh"
 
-#ifdef IMPLEMENTATION
 entity makeXonoticScreenshotImage()
 {
        entity me;
-       me = spawnXonoticScreenshotImage();
+       me = NEW(XonoticScreenshotImage);
        me.configureXonoticScreenshotImage(me);
        return me;
 }
@@ -45,9 +27,9 @@ void XonoticScreenshotImage_load(entity me, string theImage)
        me.setZoom(me, 0, 0);
 }
 
-float XonoticScreenshotImage_mousePress(entity me, vector coords)
+METHOD(XonoticScreenshotImage, mousePress, bool(XonoticScreenshotImage this, vector pos))
 {
-       return me.drag_setStartPos(me, coords);
+       return this.drag_setStartPos(this, pos);
 }
 
 float XonoticScreenshotImage_mouseDrag(entity me, vector coords)
@@ -74,12 +56,11 @@ void XonoticScreenshotImage_draw(entity me)
                if (time < me.zoomTime + 2) // 1 seconds at full alpha, 1 second fading out
                {
                        string zoomString;
-                       float z;
-                       z = me.zoomFactor * 100;
-                       if (z - floor(z) == 0)
-                               zoomString = sprintf("%d%%", z);
+                       float myzoom = me.zoomFactor * 100;
+                       if (myzoom - floor(myzoom) == 0)
+                               zoomString = sprintf("%d%%", myzoom);
                        else
-                               zoomString = sprintf("%.2f%%", z);
+                               zoomString = sprintf("%.2f%%", myzoom);
                        theAlpha = (2 - (time - me.zoomTime));
                        draw_Text('0.05 0.95 0', zoomString, me.realFontSize, '1 1 1', theAlpha, false);
                }
@@ -92,4 +73,3 @@ void XonoticScreenshotImage_resizeNotify(entity me, vector relOrigin, vector rel
        me.realFontSize_y = me.fontSize / absSize.y;
        me.realFontSize_x = me.fontSize / absSize.x;
 }
-#endif