DayZ
1.24
Loading...
Searching...
No Matches
HoverEffect.c
Go to the documentation of this file.
1
// -----------------------------------------------------------
2
class
HoverEffect
:
ScriptedWidgetEventHandler
3
{
4
reference
float
speed
;
5
reference
float
amount
;
6
protected
float
m_orginal_width
;
7
protected
float
m_orginal_height
;
8
protected
Widget
m_root
;
9
protected
ref
AnimatorTimer
m_anim
;
10
11
void
HoverEffect
()
12
{
13
m_anim
=
new
AnimatorTimer
();
14
}
15
16
// -----------------------------------------------------------
17
void
OnWidgetScriptInit
(
Widget
w
)
18
{
19
m_root
=
w
;
20
m_root
.SetHandler(
this
);
21
}
22
23
// -----------------------------------------------------------
24
protected
void
Update
()
25
{
26
float
p
=
amount
*
m_anim
.GetValue();
27
m_root
.SetSize(
m_orginal_width
+ (
m_orginal_width
*
p
),
m_orginal_height
+ (
m_orginal_height
*
p
));
28
29
float
c
= 1.0 - (0.5 *
m_anim
.GetValue());
30
m_root
.SetColor(
ARGBF
(1, 1,
c
,
c
));
31
}
32
33
// -----------------------------------------------------------
34
override
bool
OnMouseEnter
(
Widget
w
,
int
x
,
int
y
)
35
{
36
if
(!
m_anim
.IsRunning())
m_root
.GetSize(
m_orginal_width
,
m_orginal_height
);
37
m_anim
.Animate(1.0,
speed
);
38
39
return
false
;
40
}
41
42
// -----------------------------------------------------------
43
override
bool
OnMouseLeave
(
Widget
w
,
Widget
enterW
,
int
x
,
int
y
)
44
{
45
m_anim
.Animate(0.0,
speed
);
46
return
false
;
47
}
48
49
};
x
Icon x
y
Icon y
AnimatorTimer
Definition
tools.c:705
HoverEffect
Definition
HoverEffect.c:3
HoverEffect::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
HoverEffect.c:34
HoverEffect::speed
reference float speed
Definition
HoverEffect.c:4
HoverEffect::m_anim
ref AnimatorTimer m_anim
Definition
HoverEffect.c:9
HoverEffect::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
HoverEffect.c:43
HoverEffect::OnWidgetScriptInit
void OnWidgetScriptInit(Widget w)
Definition
HoverEffect.c:17
HoverEffect::m_root
Widget m_root
Definition
HoverEffect.c:8
HoverEffect::amount
reference float amount
Definition
HoverEffect.c:5
HoverEffect::m_orginal_width
float m_orginal_width
Definition
HoverEffect.c:6
HoverEffect::m_orginal_height
float m_orginal_height
Definition
HoverEffect.c:7
HoverEffect::Update
void Update()
Definition
HoverEffect.c:24
HoverEffect::HoverEffect
void HoverEffect()
Definition
HoverEffect.c:11
Param3
Definition
EntityAI.c:95
ScriptedWidgetEventHandler
map: item x vector(index, width, height)
Definition
EnWidgets.c:651
Widget
Definition
EnWidgets.c:190
ARGBF
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.
Definition
proto.c:332
scripts
3_Game
GUI
Effects
HoverEffect.c
Generated by
1.10.0