Xonotic
textslider.qc
Go to the documentation of this file.
1 #include "textslider.qh"
2 
3  string TextSlider_valueToIdentifier(entity me, int val)
4  {
5  if (val >= me.nValues) return "custom";
6  if (val < 0) return "custom";
7  return me.(valueIdentifiers[val]);
8  }
9  string TextSlider_valueToText(entity me, int val)
10  {
11  if (val >= me.nValues) return _("Custom");
12  if (val < 0) return _("Custom");
13  return me.(valueStrings[val]);
14  }
15  void TextSlider_setValueFromIdentifier_allowAnim(entity me, string id, bool allowAnim)
16  {
17  int i;
18  for (i = 0; i < me.nValues; ++i)
19  if (me.valueToIdentifier(me, i) == id)
20  {
21  SUPER(TextSlider).setValue_allowAnim(me, i, allowAnim);
22  return;
23  }
24  SUPER(TextSlider).setValue_allowAnim(me, -1, allowAnim);
25  }
27  {
29  }
31  {
33  }
35  {
36  return me.valueToIdentifier(me, me.value);
37  }
39  {
40  me.nValues = 0;
41  }
42  void TextSlider_addValue(entity me, string theString, string theIdentifier)
43  {
44  me.(valueStrings[me.nValues]) = theString;
45  me.(valueIdentifiers[me.nValues]) = theIdentifier;
46  me.nValues += 1;
47  }
48  void TextSlider_insertValue(entity me, int pos, string theString, string theIdentifier)
49  {
50  int i;
51  for (i = me.nValues; i > pos; --i)
52  {
53  me.(valueStrings[i]) = me.(valueStrings[i - 1]);
54  me.(valueIdentifiers[i]) = me.(valueIdentifiers[i - 1]);
55  }
56  me.(valueStrings[pos]) = theString;
57  me.(valueIdentifiers[pos]) = theIdentifier;
58  me.nValues += 1;
59  }
60  void TextSlider_configureTextSliderValues(entity me, string theDefault)
61  {
62  me.configureSliderValues(me, 0, 0, me.nValues - 1, 1, 1, 1);
63  me.setValueFromIdentifier_noAnim(me, theDefault);
64  }
void TextSlider_setValueFromIdentifier_allowAnim(entity me, string id, bool allowAnim)
Definition: textslider.qc:15
string TextSlider_valueToIdentifier(entity me, int val)
Definition: textslider.qc:3
string TextSlider_getIdentifier(entity me)
Definition: textslider.qc:34
entity() spawn
void TextSlider_configureTextSliderValues(entity me, string theDefault)
Definition: textslider.qc:60
void TextSlider_insertValue(entity me, int pos, string theString, string theIdentifier)
Definition: textslider.qc:48
#define SUPER(cname)
Definition: oo.qh:219
void TextSlider_addValue(entity me, string theString, string theIdentifier)
Definition: textslider.qc:42
void TextSlider_clearValues(entity me)
Definition: textslider.qc:38
void TextSlider_setValueFromIdentifier(entity me, string id)
Definition: textslider.qc:30
void TextSlider_setValueFromIdentifier_noAnim(entity me, string id)
Definition: textslider.qc:26
string TextSlider_valueToText(entity me, int val)
Definition: textslider.qc:9