forked from Pakz001/Monkey2examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBeginners - Enum.monkey2
49 lines (36 loc) · 966 Bytes
/
Beginners - Enum.monkey2
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
#Import "<std>"
#Import "<mojo>"
Using std..
Using mojo..
Global instance:AppInstance
' Here we create the enum
' it gives a number to each variable in the enum section
Enum test
a,b,c
End Enum
Enum test2
a = 10
b = 20
c = 30
End Enum
Class MyWindow Extends Window
Method New()
End Method
Method OnRender( canvas:Canvas ) Override
App.RequestRender() ' Activate this method
' if key escape then quit
If Keyboard.KeyReleased(Key.Escape) Then instance.Terminate()
'
if test.a = 0 then canvas.DrawText("Enum a = 0",0,0)
If test.b = 1 then canvas.DrawText("Enum b = 1",0,15)
If test.c = 2 then canvas.DrawText("Enum c = 2",0,30)
if test2.a = 10 then canvas.DrawText("Enum 2 a = 10",110,0)
If test2.b = 20 then canvas.DrawText("Enum 2 b = 20",110,15)
If test2.c = 30 then canvas.DrawText("Enum 2 c = 30",110,30)
End Method
End Class
Function Main()
instance = New AppInstance
New MyWindow
App.Run()
End Function