-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfade_screen.kn
39 lines (38 loc) · 918 Bytes
/
fade_screen.kn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
+class fadeScreen()
var color: int
var alpha: int
*func ctor()
do me.color :: 0x00FFFFFF
end func
+func show(in_alpha: int)
do in_alpha :: in_alpha / 16 * 16
if(me.alpha < in_alpha)
do me.alpha :+ 16
elif(me.alpha > in_alpha)
do me.alpha :- 16
end if
do draw@rect(0.0, 0.0, 8000.0, 6000.0, 0x00FF0000 + 0x01000000 * me.alpha)
end func
end class
+class fadeOut()
var color: int
var alpha: int
var active: bool
*func ctor()
do me.color :: 0x00000000
end func
+func show(x: int, y: int, w: int, h: int, in_alpha: int)
if(me.active)
do in_alpha :: in_alpha / 16 * 16
if(me.alpha < in_alpha)
do me.alpha :+ 2
elif(me.alpha > in_alpha)
do me.alpha :- 2
end if
do draw@rect(x $ float, y $ float, w $ float, h $ float, 0x00000000 + 0x01000000 * me.alpha)
end if
end func
+func on()
do me.active :: true
end func
end class