Dayz Explorer
1.28.160049
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
};
AnimatorTimer
Definition
tools.c:749
HoverEffect
Definition
hovereffect.c:3
HoverEffect::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
hovereffect.c:34
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::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
x
Icon x
y
Icon y
ARGBF
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.
Definition
proto.c:332
Daten
3_game
gui
effects
hovereffect.c
Generated by
1.12.0