METHOD(Image, toString, string(entity))
METHOD(Image, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(Image, updateAspect, void(entity))
+ METHOD(Image, initZoom, void(entity))
METHOD(Image, setZoom, void(entity, float, float))
METHOD(Image, drag_setStartPos, float(entity, vector))
METHOD(Image, drag, float(entity, vector))
void Image_configureImage(entity me, string path)
{
me.src = path;
+}
+void Image_initZoom(entity me)
+{
me.zoomOffset = '0.5 0.5 0';
me.zoomFactor = 1;
if (me.forcedAspect == -2)
if (me.zoomLimitedByTheBox)
me.zoomMax = -1; // calculate zoomMax at the first updateAspect call
}
+
void Image_draw(entity me)
{
if(me.imgSize_x > 1 || me.imgSize_y > 1)
if (me.currentScrPath)
strunzone(me.currentScrPath);
me.currentScrPath = strzone(scrImage);
- me.screenshotImage.configureXonoticScreenshotImage(me.screenshotImage, me.currentScrPath);
+ me.screenshotImage.load(me.screenshotImage, me.currentScrPath);
me.frame.setText(me.frame, me.screenshotImage.screenshotTitle);
}
void prevScreenshot_Click(entity btn, entity me)
#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))
{
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);
+}
+
+void XonoticScreenshotImage_load(entity me, string theImage)
{
- me.configureImage(me, theImage);
- me.forcedAspect = -2;
//me.zoomLimitedByTheBox = 1;
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)