2 // to use this, you FIRST call configureSliderVisuals, then multiple times addValue, then configureTextSlider
4 CLASS(TextSlider) EXTENDS(Slider)
5 METHOD(TextSlider, valueToText, string(entity, float))
6 METHOD(TextSlider, valueToIdentifier, string(entity, float))
7 METHOD(TextSlider, setValueFromIdentifier, void(entity, string))
8 METHOD(TextSlider, getIdentifier, string(entity))
9 METHOD(TextSlider, addValue, void(entity, string, string))
10 METHOD(TextSlider, configureTextSliderValues, void(entity, string))
11 ATTRIBARRAY(TextSlider, valueStrings, string, 256)
12 ATTRIBARRAY(TextSlider, valueIdentifiers, string, 256)
13 ATTRIB(TextSlider, nValues, float, 0)
18 string valueToIdentifierTextSlider(entity me, float val)
24 return me.(valueIdentifiers[val]);
26 string valueToTextTextSlider(entity me, float val)
32 return me.(valueStrings[val]);
34 void setValueFromIdentifierTextSlider(entity me, string id)
37 for(i = 0; i < me.nValues; ++i)
38 if(me.valueToIdentifier(me, i) == id)
40 setValueSlider( me, i );
43 setValueSlider( me, -1 );
45 string getIdentifierTextSlider(entity me)
47 return me.valueToIdentifier(me, me.value);
49 void addValueTextSlider(entity me, string theString, string theIdentifier)
51 me.(valueStrings[me.nValues]) = theString;
52 me.(valueIdentifiers[me.nValues]) = theIdentifier;
55 void configureTextSliderValuesTextSlider(entity me, string theDefault)
57 me.configureSliderValues(me, 0, 0, me.nValues - 1, 1, 1, 1);
58 me.setValueFromIdentifier(me, theDefault);