Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim port As Boolean
Private p1 As Panel
Private p2 As Panel
Dim im1,im2,im3,im4,im5,im6,im7,im8,im9,im10,im11,im12,im13,im14,im15,im16,im17,im18,im19,im20,im21,im22,im23,im24,im25 As Button
Dim imag(24) As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("maingame")
If Activity.Height>Activity.Width Then
port = True
Else
port=False
End If
inicio(Main.gamenumber,port)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub inicio (ngame As Byte, orient As Boolean)
Dim x As Int
If orient=True Then
x=Activity.width
Else
x=Activity.height
End If
If x Mod ngame=0 Then
p1.width=x
Else
Do Until x Mod ngame=0
x=x-1
Loop
End If
p1.width=x
p1.height=p1.width
p1.top=0
p1.left=0
If orient=True Then
p2.width=p1.width
p2.height=Activity.height-p1.height
p2.left=0
p2.top=p1.height
Else If orient=False Then
p2.height=p1.height
p2.width=Activity.width-p1.width
p2.top=0
p2.left=p1.width
End If
'hier I start add imageviews by code
Dim i As Byte
Dim leftx, topy, widthx,heighty As Int
leftx=0
topy=0
widthx=p1.Width/ngame
heighty=widthx
'heighty=0
imag=Array As Button(im1,im2,im3,im4,im5,im6,im7,im8,im9,im10,im11,im12,im13,im14,im15,im16,im17,im18,im19,im20,im21,im22,im23,im24,im25)
For i=0 To ngame*ngame-1
imag(i).Initialize("im")
p1.AddView(imag(i),leftx ,topy ,widthx,heighty)
leftx=leftx+widthx
If ngame=3 And i=2 Or i=5 Then
leftx=0
topy=topy+widthx
End If
Next
End Sub