Don't get me wrong, I know
how to indent. It's just that I also know from personal experience that my own manual indents are never as consitant as I'd like them to be. A mechanical way of indenting my code would be really attractive to me. There isn't even a third party app or something that'll do it?
[Edit] WOOT! IndeED does this, for free, with its Pretty Format function, and it does a very good job of it, too! If anyone else wanted this feature, it's right there in the toolbox under IDEs. Yay!
[Edited again!] Except, D'OH! IndeEd's Pretty Format doesn't seem to process handle nestled commands properly. :(
This:
Type Delta
'Delta Time code provided by Truplos@....
Global DeltaTime#
Global TimeDelay%
Function Start()
'Call Delta.Start() before main loop
TimeDelay = MilliSecs()
End Function
Function Time#()
'EXAMPLE:
'use this: Speed:+ 10*Delta.Time
'instead of this: Speed:+ 10
Return DeltaTime#
End Function
Function Update()
'Call Delta.Update() once in the main loop.
DeltaTime = ( MilliSecs()- TimeDelay )*0.001
TimeDelay = MilliSecs()
EndFunction
End Type
Type FPS
' FPS_Counter <> Runs and displays the FPS
Global Counter, Time, TFPS
Function Calc%()
Counter:+1
If Time < MilliSecs()
TFPS = Counter' <- Frames/Sec
Time = MilliSecs() + 1000'Update
Counter = 0
EndIf
Return TFPS
EndFunction
EndType
Graphics 800,600,0
Delta.Start()
Repeat
Delta.Update()
DrawText "Your FPS: "+FPS.Calc(),10,10
DrawOval Rand(0,400),Rand(0,400),Rand(0,400),Rand(0,400)
Flip;Cls
Until KeyDown(Key_Escape)
Becomes this:
Type Delta
'Delta Time code provided by Truplos@....
Global DeltaTime#
Global TimeDelay%
Function Start()
'Call Delta.Start() before main loop
TimeDelay = MilliSecs()
End Function
Function Time#()
'EXAMPLE:
'use this: Speed:+ 10*Delta.Time
'instead of this: Speed:+ 10
Return DeltaTime#
End Function
Function Update()
'Call Delta.Update() once in the main loop.
DeltaTime = ( MilliSecs()- TimeDelay )*0.001
TimeDelay = MilliSecs()
EndFunction
End Type
Type FPS
' FPS_Counter <> Runs and displays the FPS
Global Counter, Time, TFPS
Function Calc%()
Counter:+1
If Time < MilliSecs()
TFPS = Counter' <- Frames/Sec
Time = MilliSecs() + 1000'Update
Counter = 0
EndIf
Return TFPS
EndFunction
EndType
Graphics 800,600,0
Delta.Start()
Repeat
Delta.Update()
DrawText "Your FPS: "+FPS.Calc(),10,10
DrawOval Rand(0,400),Rand(0,400),Rand(0,400),Rand(0,400)
Flip;Cls
Until KeyDown(Key_Escape)
When I think it should probabaly look like this:
Type Delta
'Delta Time code provided by Truplos@....
Global DeltaTime#
Global TimeDelay%
Function Start()
'Call Delta.Start() before main loop
TimeDelay = MilliSecs()
End Function
Function Time#()
'EXAMPLE:
'use this: Speed:+ 10*Delta.Time
'instead of this: Speed:+ 10
Return DeltaTime#
End Function
Function Update()
'Call Delta.Update() once in the main loop.
DeltaTime = ( MilliSecs()- TimeDelay )*0.001
TimeDelay = MilliSecs()
EndFunction
End Type
Type FPS
' FPS_Counter <> Runs and displays the FPS
Global Counter, Time, TFPS
Function Calc%()
Counter:+1
If Time < MilliSecs()
TFPS = Counter' <- Frames/Sec
Time = MilliSecs() + 1000'Update
Counter = 0
EndIf
Return TFPS
EndFunction
EndType
Graphics 800,600,0
Delta.Start()
Repeat
Delta.Update()
DrawText "Your FPS: "+FPS.Calc(),10,10
DrawOval Rand(0,400),Rand(0,400),Rand(0,400),Rand(0,400)
Flip;Cls
Until KeyDown(Key_Escape)
I have tried messing with the PrettyFormat rules, but I haven't had any luck so far. Does anyone know what my rules should look like if I want types, functions, and other self-contained blocks of code to always end on the same line where they began? After experimenting with rules, I'm starting to think maybe the only way to do it properly would be if IndeED actually
parsed the code and applied rules to each set of Function and End Function commands as a discreet pair. :/
Maybe I'll try some other IDEs, too. Does anyone know which one auto-formats the best?