Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
screenshotimage.qc File Reference
#include "screenshotimage.qh"
Include dependency graph for screenshotimage.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

entity makeXonoticScreenshotImage ()
void XonoticScreenshotImage_configureXonoticScreenshotImage (entity me)
void XonoticScreenshotImage_draw (entity me)
void XonoticScreenshotImage_load (entity me, string theImage)
float XonoticScreenshotImage_mouseDrag (entity me, vector coords)
float XonoticScreenshotImage_mouseMove (entity me, vector coords)
void XonoticScreenshotImage_resizeNotify (entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)

Function Documentation

◆ makeXonoticScreenshotImage()

entity makeXonoticScreenshotImage ( )

Definition at line 3 of file screenshotimage.qc.

4{
5 entity me;
7 me.configureXonoticScreenshotImage(me);
8 return me;
9}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define NEW(cname,...)
Definition oo.qh:117

References entity(), and NEW.

Referenced by XonoticScreenshotImage::ATTRIB(), and XonoticScreenshotViewerDialog_fill().

◆ XonoticScreenshotImage_configureXonoticScreenshotImage()

void XonoticScreenshotImage_configureXonoticScreenshotImage ( entity me)

Definition at line 11 of file screenshotimage.qc.

12{
13 me.configureXonoticImage(me, string_null, -2);
14 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)
15 me.zoomSnapToTheBox = false; // disabled: it's cooler
16}
string string_null
Definition nil.qh:9

References entity(), and string_null.

◆ XonoticScreenshotImage_draw()

void XonoticScreenshotImage_draw ( entity me)

Definition at line 43 of file screenshotimage.qc.

44{
45 if (me.src != "")
46 {
47 float theAlpha;
49 if (me.showTitle && time < me.screenshotTime + 4) // 3 seconds at full alpha, 1 second fading out
50 {
51 theAlpha = (4 - (time - me.screenshotTime));
52 draw_CenterText('0.5 0 0', me.screenshotTitle, me.realFontSize, '1 1 1', theAlpha, false);
53 }
54 if (time < me.zoomTime + 2) // 1 seconds at full alpha, 1 second fading out
55 {
56 float myzoom = me.zoomFactor;
57 string zoomString = ftos_decimals_percentage(myzoom, (myzoom == floor(myzoom) ? 0 : 2));
58 theAlpha = (2 - (time - me.zoomTime));
59 draw_Text('0.05 0.95 0', zoomString, me.realFontSize, '1 1 1', theAlpha, false);
60 }
61 }
62}
float time
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
float floor(float f)
#define SUPER(cname)
Definition oo.qh:231
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

References draw_CenterText(), draw_Text(), entity(), floor(), ftos_decimals_percentage(), SUPER, and time.

◆ XonoticScreenshotImage_load()

void XonoticScreenshotImage_load ( entity me,
string theImage )

Definition at line 18 of file screenshotimage.qc.

19{
20 me.screenshotTime = time;
21 me.src = theImage;
22 strcpy(me.screenshotTitle, substring(me.src, 13, strlen(theImage) - 13)); //strip "/screenshots/"
23
24 me.initZoom(me); // this image may have a different size
25 me.setZoom(me, 0, 0);
26}
#define strlen
string substring(string s, float start, float length)
#define strcpy(this, s)
Definition string.qh:52

References entity(), strcpy, strlen, substring(), and time.

◆ XonoticScreenshotImage_mouseDrag()

float XonoticScreenshotImage_mouseDrag ( entity me,
vector coords )

Definition at line 33 of file screenshotimage.qc.

34{
35 return me.drag(me, coords);
36}

References entity(), and vector.

◆ XonoticScreenshotImage_mouseMove()

float XonoticScreenshotImage_mouseMove ( entity me,
vector coords )

Definition at line 38 of file screenshotimage.qc.

39{
40 return me.drag_setStartPos(me, coords);
41}

References entity(), and vector.

◆ XonoticScreenshotImage_resizeNotify()

void XonoticScreenshotImage_resizeNotify ( entity me,
vector relOrigin,
vector relSize,
vector absOrigin,
vector absSize )

Definition at line 64 of file screenshotimage.qc.

65{
66 SUPER(XonoticScreenshotImage).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
67 me.realFontSize_y = me.fontSize / absSize.y;
68 me.realFontSize_x = me.fontSize / absSize.x;
69}

References entity(), SUPER, and vector.