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

Go to the source code of this file.

Functions

entity makeXonoticSlider (float theValueMin, float theValueMax, float theValueStep, string theCvar)
entity makeXonoticSlider_T (float theValueMin, float theValueMax, float theValueStep, string theCvar, string theTooltip)
void XonoticSlider_configureXonoticSlider (entity me, float theValueMin, float theValueMax, float theValueStep, string theCvar, string theTooltip)
void XonoticSlider_loadCvars (entity me)
void XonoticSlider_saveCvars (entity me)
void XonoticSlider_setValue (entity me, float val, bool allowAnim)
void XonoticSlider_setValueSpace (entity me, float val)

Function Documentation

◆ makeXonoticSlider()

◆ makeXonoticSlider_T()

entity makeXonoticSlider_T ( float theValueMin,
float theValueMax,
float theValueStep,
string theCvar,
string theTooltip )

Definition at line 3 of file slider.qc.

4{
6 me.configureXonoticSlider(me, theValueMin, theValueMax, theValueStep, theCvar, theTooltip);
7 return me;
8}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define NEW(cname,...)
Definition oo.qh:117

References entity(), and NEW.

Referenced by makeXonoticSlider(), XonoticEffectsSettingsTab_fill(), XonoticGameHUDSettingsTab_fill(), XonoticGameViewSettingsTab_fill(), XonoticInputSettingsTab_fill(), XonoticMiscSettingsTab_fill(), XonoticMutatorsDialog_fill(), XonoticServerCreateTab_fill(), and XonoticVideoSettingsTab_fill().

◆ XonoticSlider_configureXonoticSlider()

void XonoticSlider_configureXonoticSlider ( entity me,
float theValueMin,
float theValueMax,
float theValueStep,
string theCvar,
string theTooltip )

Definition at line 13 of file slider.qc.

14{
15 float vp = theValueStep * 10;
16 while(fabs(vp) < fabs(theValueMax - theValueMin) / 40)
17 vp *= 10;
18
19 me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
20
21 me.controlledCvar = (theCvar) ? theCvar : string_null;
22 if(theCvar)
23 // Prevent flickering of the slider button by initialising the
24 // slider out of bounds to hide the button before loading the cvar
25 me.configureSliderValues(me, theValueMin, theValueMin-theValueStep, theValueMax, theValueStep, theValueStep, vp);
26 else
27 me.configureSliderValues(me, theValueMin, theValueMin, theValueMax, theValueStep, theValueStep, vp);
28 me.loadCvars(me);
29 setZonedTooltip(me, theTooltip, theCvar);
30}
void setZonedTooltip(entity e, string theTooltip, string theCvar)
Definition util.qc:257
float fabs(float f)

References entity(), fabs(), setZonedTooltip(), and string_null.

◆ XonoticSlider_loadCvars()

void XonoticSlider_loadCvars ( entity me)

Definition at line 47 of file slider.qc.

48{
49 if (!me.controlledCvar)
50 return;
51
52 SUPER(XonoticSlider).setValue(me, cvar(me.controlledCvar), false);
53}
float cvar(string name)
#define SUPER(cname)
Definition oo.qh:231

References cvar(), entity(), and SUPER.

◆ XonoticSlider_saveCvars()

void XonoticSlider_saveCvars ( entity me)

Definition at line 54 of file slider.qc.

55{
56 if (!me.controlledCvar)
57 return;
58
59 cvar_set(me.controlledCvar, ftos_mindecimals(me.value));
60
61 CheckSendCvars(me, me.controlledCvar);
62}
void CheckSendCvars(entity me, string cvarnamestring)
Definition util.qc:825
void cvar_set(string name, string value)
ERASEABLE string ftos_mindecimals(float number)
Converts a number to a string with the minimum number of decimals It assumes that an extreme accuracy...
Definition string.qh:497

References CheckSendCvars(), cvar_set(), entity(), and ftos_mindecimals().

◆ XonoticSlider_setValue()

void XonoticSlider_setValue ( entity me,
float val,
bool allowAnim )

Definition at line 31 of file slider.qc.

32{
33 if(val != me.value)
34 {
35 SUPER(XonoticSlider).setValue(me, val, allowAnim);
36 me.saveCvars(me);
37
38 if(me.onChange)
39 me.onChange(me, me.onChangeEntity);
40 }
41}

References entity(), and SUPER.

◆ XonoticSlider_setValueSpace()

void XonoticSlider_setValueSpace ( entity me,
float val )

Definition at line 42 of file slider.qc.

43{
44 me.valueSpace = val;
45 me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
46}

References entity().