-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample1.monkey
More file actions
63 lines (41 loc) · 945 Bytes
/
example1.monkey
File metadata and controls
63 lines (41 loc) · 945 Bytes
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Import webp
Import mojo
Import "./example1-pic1.jpg"
Import "./example1-pic1.webp"
#IMAGE_FILES="*.png|*.jpg|*.webp"
Function Main:Int()
New TestApp
Return 0
End Function
Class TestApp Extends App
Field pic1:Image
Method AssertNotNull(t:Object)
If t = Null Then
Error("Object is null")
End If
End Method
Method OnCreate:Int()
SetUpdateRate(60)
Local t1:Int, t2:Int
t1 = Millisecs()
AssertNotNull(LoadImage("example1-pic1.jpg"))
t2 = Millisecs()
Print("TestApp - JPEG loading time: " + (t2 - t1) + " ms")
t1 = Millisecs()
pic1 = WebP.LoadImage("example1-pic1.webp")
AssertNotNull(pic1)
t2 = Millisecs()
Print("TestApp - WEBP loading time: " + (t2 - t1) + " ms")
Return 0
End Method
Method OnUpdate:Int()
Return 0
End Method
Method OnRender:Int()
Cls(0, 0, 0)
DrawImage(pic1, 0, 0)
DrawText("WebP example", 0, 0)
If TouchHit(0) Error("")
Return 0
End Method
End Class