X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fmenu%2Fxonotic%2Fscreenshotimage.qc;h=42e168b4b58b2617d5978b7bce289bd8ac4a8131;hb=53911d2ce2724f2da23fb6806e491ce795ae4326;hp=469f177fc6f7f9e01950e5b3e254473e43db7907;hpb=d99a102842ced06e6e1a0c9358c07c3b64523968;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/screenshotimage.qc b/qcsrc/menu/xonotic/screenshotimage.qc index 469f177fc..42e168b4b 100644 --- a/qcsrc/menu/xonotic/screenshotimage.qc +++ b/qcsrc/menu/xonotic/screenshotimage.qc @@ -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; } @@ -29,8 +11,8 @@ entity makeXonoticScreenshotImage() 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 + 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) @@ -69,19 +51,18 @@ void XonoticScreenshotImage_draw(entity me) if (me.showTitle && time < me.screenshotTime + 4) // 3 seconds at full alpha, 1 second fading out { theAlpha = (4 - (time - me.screenshotTime)); - draw_CenterText('0.5 0 0', me.screenshotTitle, me.realFontSize, '1 1 1', theAlpha, FALSE); + draw_CenterText('0.5 0 0', me.screenshotTitle, me.realFontSize, '1 1 1', theAlpha, false); } 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); + draw_Text('0.05 0.95 0', zoomString, me.realFontSize, '1 1 1', theAlpha, false); } } } @@ -89,7 +70,6 @@ void XonoticScreenshotImage_draw(entity me) void XonoticScreenshotImage_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize) { SUPER(XonoticScreenshotImage).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); - me.realFontSize_y = me.fontSize / absSize_y; - me.realFontSize_x = me.fontSize / absSize_x; + me.realFontSize_y = me.fontSize / absSize.y; + me.realFontSize_x = me.fontSize / absSize.x; } -#endif