METHOD(Item, destroy, void(entity))
ATTRIB(Item, focused, float, 0)
ATTRIB(Item, focusable, float, 0)
+ ATTRIB(Item, allowFocusSound, float, 0)
ATTRIB(Item, parent, entity, NULL)
ATTRIB(Item, preferredFocusPriority, float, 0)
ATTRIB(Item, origin, vector, '0 0 0')
void Item_focusEnter(entity me)
{
+ if(me.allowFocusSound)
+ m_play_focus_sound();
}
void Item_focusLeave(entity me)
METHOD(Button, mousePress, float(entity, vector))
METHOD(Button, mouseDrag, float(entity, vector))
METHOD(Button, mouseRelease, float(entity, vector))
- METHOD(Button, focusEnter, void(entity))
ATTRIB(Button, onClick, void(entity, entity), func_null)
ATTRIB(Button, onClickEntity, entity, NULL)
ATTRIB(Button, src, string, string_null)
ATTRIB(Button, srcMulti, float, 1) // 0: button square left, text right; 1: button stretched, text over it
ATTRIB(Button, buttonLeftOfText, float, 0)
ATTRIB(Button, focusable, float, 1)
+ ATTRIB(Button, allowFocusSound, float, 1)
ATTRIB(Button, pressed, float, 0)
ATTRIB(Button, clickTime, float, 0)
ATTRIB(Button, disabled, float, 0)
{
me.focusable = !me.disabled;
}
-void Button_focusEnter(entity me)
-{
- if(cvar("menu_sounds") > 1)
- localsound("sound/misc/menu1.wav");
- SUPER(Button).focusEnter(me);
-}
void Button_draw(entity me)
{
vector bOrigin, bSize;
ATTRIB(InputBox, scrollPos, float, 0) // widths
ATTRIB(InputBox, focusable, float, 1)
+ ATTRIB(InputBox, allowFocusSound, float, 1)
ATTRIB(InputBox, disabled, float, 0)
ATTRIB(InputBox, lastChangeTime, float, 0)
ATTRIB(InputBox, dragScrollTimer, float, 0)
METHOD(ListBox, mouseRelease, float(entity, vector))
METHOD(ListBox, focusLeave, void(entity))
ATTRIB(ListBox, focusable, float, 1)
+ ATTRIB(ListBox, allowFocusSound, float, 1)
ATTRIB(ListBox, selectedItem, float, 0)
ATTRIB(ListBox, size, vector, '0 0 0')
ATTRIB(ListBox, origin, vector, '0 0 0')
METHOD(Slider, mousePress, float(entity, vector))
METHOD(Slider, mouseDrag, float(entity, vector))
METHOD(Slider, mouseRelease, float(entity, vector))
- METHOD(Slider, focusEnter, void(entity))
METHOD(Slider, valueToText, string(entity, float))
METHOD(Slider, toString, string(entity))
METHOD(Slider, setValue, void(entity, float))
METHOD(Slider, showNotify, void(entity))
ATTRIB(Slider, src, string, string_null)
ATTRIB(Slider, focusable, float, 1)
+ ATTRIB(Slider, allowFocusSound, float, 1)
ATTRIB(Slider, value, float, 0)
ATTRIB(Slider, animated, float, 1)
ATTRIB(Slider, sliderValue, float, 0)
{
me.focusable = !me.disabled;
}
-void Slider_focusEnter(entity me)
-{
- if(cvar("menu_sounds") > 1)
- localsound("sound/misc/menu1.wav");
- SUPER(Slider).focusEnter(me);
-}
void Slider_draw(entity me)
{
float controlLeft;
}
}
}
+
+float menuLastFocusSoundTime;
+void m_play_focus_sound()
+{
+ if(cvar("menu_sounds") > 1)
+ if(time - menuLastFocusSoundTime > 0.25)
+ {
+ localsound("sound/menu/focus.wav");
+ menuLastFocusSoundTime = time;
+ }
+}
void postMenuDraw(); // this is run just after the menu is drawn (or not). Useful to draw something over everything else.
void m_sync();
+
+// sounds
+
+void m_play_focus_sound();
}
void XonoticServerList_focusEnter(entity me)
{
+ SUPER(XonoticServerList).focusEnter(me);
if(time < me.nextRefreshTime)
{
//print("sorry, no refresh yet\n");