Does this code seem correctly written?
SuperStrict
Graphics 128,128
Local clock:TClock = TClock.Create()
While Not KeyDown(KEY_ESCAPE)
Cls
clock.Update()
clock.Draw()
Flip 1
Wend
End
Type TClock
Field Time:Int
Field timeArr:Int[] = [0,0,0]
Field timeStr:String
Field x:Int = 0
Field y:Int = 0
Function Create:TClock()
Local t:TClock = New TClock
t.Time = MilliSecs()
Return t
End Function
Method Update()
timeStr = ""
If MilliSecs() >= Time Then
Time :+ 10
timeArr[2]:+1
If timeArr[2] >= 100 Then
timeArr[1]:+1
timeArr[2] = 0
If timeArr[1] >= 60 Then
timeArr[0]:+1
timeArr[1] = 0
End If
End If
End If
For Local i:Int = 0 Until 3
If i><0 Then timeStr:+":"
If timeArr[i] < 10 Then
timeStr:+"0"+timeArr[i]
Else
timeStr:+timeArr[i]
End If
Next
End Method
Method Draw()
DrawText timeStr,x,y
End Method
End Type
|