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{
5 entity me;
6 me = NEW(XonoticSlider);
7 me.configureXonoticSlider(me, theValueMin, theValueMax, theValueStep, theCvar, theTooltip);
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 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 14 of file slider.qc.

15{
16 float vp;
17 vp = theValueStep * 10;
18 while(fabs(vp) < fabs(theValueMax - theValueMin) / 40)
19 vp *= 10;
20
21 me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
22
23 me.controlledCvar = (theCvar) ? theCvar : string_null;
24 if(theCvar)
25 // Prevent flickering of the slider button by initialising the
26 // slider out of bounds to hide the button before loading the cvar
27 me.configureSliderValues(me, theValueMin, theValueMin-theValueStep, theValueMax, theValueStep, theValueStep, vp);
28 else
29 me.configureSliderValues(me, theValueMin, theValueMin, theValueMax, theValueStep, theValueStep, vp);
30 me.loadCvars(me);
31 setZonedTooltip(me, theTooltip, theCvar);
32}
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 49 of file slider.qc.

50{
51 if (!me.controlledCvar)
52 return;
53
54 SUPER(XonoticSlider).setValue(me, cvar(me.controlledCvar), false);
55}
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 56 of file slider.qc.

57{
58 if (!me.controlledCvar)
59 return;
60
61 cvar_set(me.controlledCvar, ftos_mindecimals(me.value));
62
63 CheckSendCvars(me, me.controlledCvar);
64}
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 33 of file slider.qc.

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

References entity(), and SUPER.

◆ XonoticSlider_setValueSpace()

void XonoticSlider_setValueSpace ( entity me,
float val )

Definition at line 44 of file slider.qc.

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

References entity().