]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/screenshotimage.c
Merge branch 'master' into TimePath/issue-1170
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / screenshotimage.c
index 1a5561d4cd5102263c4211621bb9fb75bae7fcc3..469f177fc6f7f9e01950e5b3e254473e43db7907 100644 (file)
@@ -1,6 +1,7 @@
 #ifdef INTERFACE
-CLASS(XonoticScreenshotImage) EXTENDS(Image)
-       METHOD(XonoticScreenshotImage, configureXonoticScreenshotImage, void(entity, string))
+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))
@@ -21,19 +22,27 @@ entity makeXonoticScreenshotImage()
 {
        entity me;
        me = spawnXonoticScreenshotImage();
-       me.configureXonoticScreenshotImage(me, string_null);
+       me.configureXonoticScreenshotImage(me);
        return me;
 }
 
-void XonoticScreenshotImage_configureXonoticScreenshotImage(entity me, string theImage)
+void XonoticScreenshotImage_configureXonoticScreenshotImage(entity me)
+{
+       me.configureXonoticImage(me, string_null, -2);
+       me.zoomLimitedByTheBox = FALSE; // enable this to forbid enlarging the image more than the containing box (if making use of draw_SetClip is a too bad thing)
+       me.zoomSnapToTheBox = FALSE; // disabled: it's cooler
+}
+
+void XonoticScreenshotImage_load(entity me, string theImage)
 {
-       me.configureImage(me, theImage);
-       me.forcedAspect = -2;
        me.screenshotTime = time;
-       me.updateAspect(me);
+       me.src = theImage;
        if (me.screenshotTitle)
                strunzone(me.screenshotTitle);
        me.screenshotTitle = strzone(substring(me.src, 13, strlen(theImage) - 13)); //strip "/screenshots/"
+
+       me.initZoom(me); // this image may have a different size
+       me.setZoom(me, 0, 0);
 }
 
 float XonoticScreenshotImage_mousePress(entity me, vector coords)