Xonotic
checkbox_slider_invalid.qc File Reference
#include "checkbox_slider_invalid.qh"
#include "slider.qh"
+ Include dependency graph for checkbox_slider_invalid.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

entity makeXonoticSliderCheckBox (float theOffValue, float isInverted, entity theControlledSlider, string theText)
 
void XonoticSliderCheckBox_configureXonoticSliderCheckBox (entity me, float theOffValue, float isInverted, entity theControlledSlider, string theText)
 
void XonoticSliderCheckBox_draw (entity me)
 
void XonoticSliderCheckBox_setChecked (entity me, float val)
 

Function Documentation

◆ makeXonoticSliderCheckBox()

entity makeXonoticSliderCheckBox ( float  theOffValue,
float  isInverted,
entity  theControlledSlider,
string  theText 
)

Definition at line 5 of file checkbox_slider_invalid.qc.

References entity(), and NEW.

6 {
7  entity me;
9  me.configureXonoticSliderCheckBox(me, theOffValue, isInverted, theControlledSlider, theText);
10  return me;
11 }
#define NEW(cname,...)
Definition: oo.qh:105
entity() spawn
+ Here is the call graph for this function:

◆ XonoticSliderCheckBox_configureXonoticSliderCheckBox()

void XonoticSliderCheckBox_configureXonoticSliderCheckBox ( entity  me,
float  theOffValue,
float  isInverted,
entity  theControlledSlider,
string  theText 
)

Definition at line 12 of file checkbox_slider_invalid.qc.

References median().

13 {
14  me.offValue = theOffValue;
15  me.inverted = isInverted;
16  me.checked = (theControlledSlider.value == theOffValue);
17  if(theControlledSlider.value == median(theControlledSlider.valueMin, theControlledSlider.value, theControlledSlider.valueMax))
18  me.savedValue = theControlledSlider.value;
19  else
20  me.savedValue = theControlledSlider.valueMin;
21  me.controlledSlider = theControlledSlider;
22  me.configureCheckBox(me, theText, me.fontSize, me.image);
23  me.controlledCvar = theControlledSlider.controlledCvar; // in case we want to display the cvar in the tooltip
24  me.tooltip = theControlledSlider.tooltip;
25 }
ERASEABLE float median(float a, float b, float c)
Definition: math.qh:216
+ Here is the call graph for this function:

◆ XonoticSliderCheckBox_draw()

void XonoticSliderCheckBox_draw ( entity  me)

Definition at line 26 of file checkbox_slider_invalid.qc.

References median(), and SUPER.

27 {
28  me.checked = ((me.controlledSlider.value == me.offValue) != me.inverted);
29  if(me.controlledSlider.value == median(me.controlledSlider.valueMin, me.controlledSlider.value, me.controlledSlider.valueMax))
30  me.savedValue = me.controlledSlider.value;
31  SUPER(XonoticSliderCheckBox).draw(me);
32 }
ERASEABLE float median(float a, float b, float c)
Definition: math.qh:216
#define SUPER(cname)
Definition: oo.qh:219
+ Here is the call graph for this function:

◆ XonoticSliderCheckBox_setChecked()

void XonoticSliderCheckBox_setChecked ( entity  me,
float  val 
)

Definition at line 33 of file checkbox_slider_invalid.qc.

References median().

34 {
35  if(me.checked == val)
36  return;
37  me.checked = val;
38  if(val == me.inverted)
39  me.controlledSlider.setValue(me.controlledSlider, median(me.controlledSlider.valueMin, me.savedValue, me.controlledSlider.valueMax));
40  else
41  me.controlledSlider.setValue(me.controlledSlider, me.offValue);
42 }
ERASEABLE float median(float a, float b, float c)
Definition: math.qh:216
+ Here is the call graph for this function: