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{
6 me.configureXonoticRadioButton(me, theGroup, theCvar, theValue, theText, 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 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 13 of file radiobutton.qc.

14{
15 me.controlledCvar = (theCvar) ? theCvar : string_null;
16 me.cvarValue = theValue;
17 me.loadCvars(me);
18 setZonedTooltip(me, theTooltip, theCvar);
19 me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
20}
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 57 of file radiobutton.qc.

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

References entity(), and SUPER.

◆ XonoticRadioButton_loadCvars()

void XonoticRadioButton_loadCvars ( entity me)

Definition at line 29 of file radiobutton.qc.

30{
31 if(me.cvarValue)
32 {
33 if(me.controlledCvar)
34 {
35 if(me.cvarValueIsAnotherCvar)
36 me.checked = (cvar_string(me.controlledCvar) == cvar_string(me.cvarValue));
37 else
38 me.checked = (cvar_string(me.controlledCvar) == me.cvarValue);
39 }
40 }
41 else
42 {
43 if(me.controlledCvar)
44 {
45 me.checked = boolean(cvar(me.controlledCvar));
46 }
47 else
48 {
49 // this is difficult
50 // this is the "generic" selection... but at this time, not
51 // everything is constructed yet.
52 // we need to set this later in draw()
53 me.checked = false;
54 }
55 }
56}
#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 75 of file radiobutton.qc.

76{
77 if(me.cvarValue)
78 {
79 if(me.controlledCvar)
80 {
81 if(me.checked)
82 {
83 if(me.cvarValueIsAnotherCvar)
84 cvar_set(me.controlledCvar, cvar_string(me.cvarValue));
85 else
86 cvar_set(me.controlledCvar, me.cvarValue);
87 }
88 else if(me.cvarOffValue)
89 cvar_set(me.controlledCvar, me.cvarOffValue);
90 }
91 }
92 else
93 {
94 if(me.controlledCvar)
95 {
96 cvar_set(me.controlledCvar, ftos(me.checked));
97 }
98 }
99}
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 21 of file radiobutton.qc.

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

References entity().