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

Go to the source code of this file.

Functions

entity makeXonoticRadioButton (float theGroup, string theCvar, string theValue, string theText)
entity makeXonoticRadioButton_T (float theGroup, string theCvar, string theValue, string theText, string theTooltip)
void XonoticRadioButton_configureXonoticRadioButton (entity me, float theGroup, string theCvar, string theValue, string theText, string theTooltip)
void XonoticRadioButton_draw (entity me)
void XonoticRadioButton_loadCvars (entity me)
void XonoticRadioButton_saveCvars (entity me)
void XonoticRadioButton_setChecked (entity me, bool val)

Function Documentation

◆ makeXonoticRadioButton()

◆ makeXonoticRadioButton_T()

entity makeXonoticRadioButton_T ( float theGroup,
string theCvar,
string theValue,
string theText,
string theTooltip )

Definition at line 3 of file radiobutton.qc.

4{
5 entity me;
7 me.configureXonoticRadioButton(me, theGroup, theCvar, theValue, theText, 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 makeXonoticRadioButton(), XonoticAudioSettingsTab_fill(), XonoticGameCrosshairSettingsTab_fill(), XonoticGameWeaponsSettingsTab_fill(), XonoticMutatorsDialog_fill(), and XonoticVideoSettingsTab_fill().

◆ XonoticRadioButton_configureXonoticRadioButton()

void XonoticRadioButton_configureXonoticRadioButton ( entity me,
float theGroup,
string theCvar,
string theValue,
string theText,
string theTooltip )

Definition at line 14 of file radiobutton.qc.

15{
16 me.controlledCvar = (theCvar) ? theCvar : string_null;
17 me.cvarValue = theValue;
18 me.loadCvars(me);
19 setZonedTooltip(me, theTooltip, theCvar);
20 me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
21}
void setZonedTooltip(entity e, string theTooltip, string theCvar)
Definition util.qc:257

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

◆ XonoticRadioButton_draw()

void XonoticRadioButton_draw ( entity me)

Definition at line 58 of file radiobutton.qc.

59{
60 if (!me.cvarValue)
61 if (!me.controlledCvar)
62 {
63 // this is the "other" option
64 // always select this if none other is
65 entity e;
66 bool found = false;
67 for(e = me.parent.firstChild; e; e = e.nextSibling)
68 if(e.group == me.group)
69 if(e.checked)
70 found = true;
71 if(!found)
72 me.setChecked(me, true);
73 }
74 SUPER(XonoticRadioButton).draw(me);
75}
#define SUPER(cname)
Definition oo.qh:231

References entity(), and SUPER.

◆ XonoticRadioButton_loadCvars()

void XonoticRadioButton_loadCvars ( entity me)

Definition at line 30 of file radiobutton.qc.

31{
32 if(me.cvarValue)
33 {
34 if(me.controlledCvar)
35 {
36 if(me.cvarValueIsAnotherCvar)
37 me.checked = (cvar_string(me.controlledCvar) == cvar_string(me.cvarValue));
38 else
39 me.checked = (cvar_string(me.controlledCvar) == me.cvarValue);
40 }
41 }
42 else
43 {
44 if(me.controlledCvar)
45 {
46 me.checked = boolean(cvar(me.controlledCvar));
47 }
48 else
49 {
50 // this is difficult
51 // this is the "generic" selection... but at this time, not
52 // everything is constructed yet.
53 // we need to set this later in draw()
54 me.checked = false;
55 }
56 }
57}
#define boolean(value)
Definition bool.qh:9
float cvar(string name)
const string cvar_string(string name)

References boolean, cvar(), cvar_string(), and entity().

◆ XonoticRadioButton_saveCvars()

void XonoticRadioButton_saveCvars ( entity me)

Definition at line 76 of file radiobutton.qc.

77{
78 if(me.cvarValue)
79 {
80 if(me.controlledCvar)
81 {
82 if(me.checked)
83 {
84 if(me.cvarValueIsAnotherCvar)
85 cvar_set(me.controlledCvar, cvar_string(me.cvarValue));
86 else
87 cvar_set(me.controlledCvar, me.cvarValue);
88 }
89 else if(me.cvarOffValue)
90 cvar_set(me.controlledCvar, me.cvarOffValue);
91 }
92 }
93 else
94 {
95 if(me.controlledCvar)
96 {
97 cvar_set(me.controlledCvar, ftos(me.checked));
98 }
99 }
100}
void cvar_set(string name, string value)
string ftos(float f)

References cvar_set(), cvar_string(), entity(), and ftos().

◆ XonoticRadioButton_setChecked()

void XonoticRadioButton_setChecked ( entity me,
bool val )

Definition at line 22 of file radiobutton.qc.

23{
24 if(val != me.checked)
25 {
26 me.checked = val;
27 me.saveCvars(me);
28 }
29}

References entity().