METHOD(Slider, configureSliderValues, void(entity, float, float, float, float, float, float))
METHOD(Slider, draw, void(entity))
METHOD(Slider, keyDown, float(entity, float, float, float))
+ METHOD(Slider, keyUp, float(entity, float, float, float))
METHOD(Slider, mousePress, float(entity, vector))
METHOD(Slider, mouseDrag, float(entity, vector))
METHOD(Slider, mouseRelease, float(entity, vector))
me.setValue(me, me.valueMax);
return 1;
}
- // TODO more keys
+ // TODO more keys (NOTE also add them to Slider_keyUp)
+ return 0;
+}
+float Slider_keyUp(entity me, float key, float ascii, float shift)
+{
+ if(me.disabled)
+ return 0;
+ switch(key)
+ {
+ case K_LEFTARROW:
+ case K_KP_LEFTARROW:
+ case K_RIGHTARROW:
+ case K_KP_RIGHTARROW:
+ case K_PGUP:
+ case K_KP_PGUP:
+ case K_PGDN:
+ case K_KP_PGDN:
+ case K_HOME:
+ case K_KP_HOME:
+ case K_END:
+ case K_KP_END:
+ m_play_click_sound(MENU_SOUND_SLIDE);
+ }
return 0;
}
float Slider_mouseDrag(entity me, vector pos)
me.pressed = 0;
if(me.disabled)
return 0;
- if(cvar("menu_sounds"))
- localsound("sound/misc/menu2.wav");
+ m_play_click_sound(MENU_SOUND_SLIDE);
return 1;
}
void Slider_showNotify(entity me)
const string MENU_SOUND_EXECUTE = "sound/menu/execute.wav";
const string MENU_SOUND_SELECT = "sound/menu/select.wav";
+const string MENU_SOUND_SLIDE = "sound/menu/slide.wav";
void m_play_focus_sound();
void m_play_click_sound(string soundfile);