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), SUB_Null)
ATTRIB(Button, onClickEntity, entity, NULL)
ATTRIB(Button, src, string, string_null)
float Button_mousePress(entity me, vector pos)
{
me.mouseDrag(me, pos); // verify coordinates
- if(cvar("menu_sounds"))
- localsound("sound/misc/menu2.wav");
return 1;
}
float Button_mouseRelease(entity me, vector pos)
{
+ if(cvar("menu_sounds"))
+ localsound("sound/misc/menu2.wav");
me.mouseDrag(me, pos); // verify coordinates
if(me.pressed)
{
{
me.focusable = !me.disabled;
}
-.float playedfocus;
+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;
me.onClick(me, me.onClickEntity);
}
me.clickTime -= frametime;
-
- if(cvar("menu_sounds") > 1)
- if(me.focused && !me.playedfocus)
- {
- localsound("sound/misc/menu1.wav");
- me.playedfocus = 1;
- }
- else if(!me.focused && me.playedfocus)
- me.playedfocus = 0;
}
#endif
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))
//me.mouseDrag(me, pos);
}
}
- if(cvar("menu_sounds"))
- localsound("sound/misc/menu2.wav");
return 1;
}
float Slider_mouseRelease(entity me, vector pos)
{
+ if(cvar("menu_sounds"))
+ localsound("sound/misc/menu2.wav");
me.pressed = 0;
if(me.disabled)
return 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;