Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
screenshotimage.qc
Go to the documentation of this file.
1#include "screenshotimage.qh"
2
4{
6 me.configureXonoticScreenshotImage(me);
7 return me;
8}
9
11{
12 me.configureXonoticImage(me, string_null, -2);
13 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)
14 me.zoomSnapToTheBox = false; // disabled: it's cooler
15}
16
17void XonoticScreenshotImage_load(entity me, string theImage)
18{
19 me.screenshotTime = time;
20 me.src = theImage;
21 strcpy(me.screenshotTitle, substring(me.src, 13, strlen(theImage) - 13)); //strip "/screenshots/"
22
23 me.initZoom(me); // this image may have a different size
24 me.setZoom(me, 0, 0);
25}
26
28{
29 return this.drag_setStartPos(this, pos);
30}
31
33{
34 return me.drag(me, coords);
35}
36
38{
39 return me.drag_setStartPos(me, coords);
40}
41
43{
44 if (me.src != "")
45 {
46 float theAlpha;
48 if (me.showTitle && time < me.screenshotTime + 4) // 3 seconds at full alpha, 1 second fading out
49 {
50 theAlpha = (4 - (time - me.screenshotTime));
51 draw_CenterText('0.5 0 0', me.screenshotTitle, me.realFontSize, '1 1 1', theAlpha, false);
52 }
53 if (time < me.zoomTime + 2) // 1 seconds at full alpha, 1 second fading out
54 {
55 float myzoom = me.zoomFactor;
56 string zoomString = ftos_decimals_percentage(myzoom, (myzoom == floor(myzoom) ? 0 : 2));
57 theAlpha = (2 - (time - me.zoomTime));
58 draw_Text('0.05 0.95 0', zoomString, me.realFontSize, '1 1 1', theAlpha, false);
59 }
60 }
61}
62
63void XonoticScreenshotImage_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
64{
65 SUPER(XonoticScreenshotImage).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
66 me.realFontSize_y = me.fontSize / absSize.y;
67 me.realFontSize_x = me.fontSize / absSize.x;
68}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
virtual void drag_setStartPos()
float time
#define strlen
void draw_Text(vector theOrigin, string theText, vector theSize, vector theColor, float theAlpha, float ICanHasKallerz)
Definition draw.qc:282
void draw_CenterText(vector theOrigin, string theText, vector theSize, vector theColor, float theAlpha, float ICanHasKallerz)
Definition draw.qc:298
string substring(string s, float start, float length)
float floor(float f)
string string_null
Definition nil.qh:9
#define NEW(cname,...)
Definition oo.qh:117
#define SUPER(cname)
Definition oo.qh:231
#define METHOD(cname, name, prototype)
Definition oo.qh:269
void XonoticScreenshotImage_draw(entity me)
float XonoticScreenshotImage_mouseDrag(entity me, vector coords)
void XonoticScreenshotImage_configureXonoticScreenshotImage(entity me)
void XonoticScreenshotImage_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
entity makeXonoticScreenshotImage()
float XonoticScreenshotImage_mouseMove(entity me, vector coords)
void XonoticScreenshotImage_load(entity me, string theImage)
vector
Definition self.qh:92
#define strcpy(this, s)
Definition string.qh:52
ERASEABLE string ftos_decimals_percentage(float number, int decimals)
converts a percentage to a string with the indicated number of decimals
Definition string.qh:480