the sample of astar_demo.bmx

BlitzMax Forums/BlitzMax Beginners Area/the sample of astar_demo.bmx

yossi(Posted 2014) [#1]
what is the purpose of the parameter "times" in the redraw method ?

I can see that it sets how many times the redraw of the screen should be done but
why ever we should redraw more then once ?

it seems to me that if times is more then once then we loop the same think more then one time and I cant understand what we achieve by that.


GfK(Posted 2014) [#2]
As the code comment says:
' Redraws the map and last found path. You can tell it to draw more than once for double buffer purposes
Method redraw(times:Int = 1, flipIt:Int = 1)
While times > 0
drawMap()
drawPath()
drawTerrains()
drawInfo()
drawMapButtons()
If flipIt Then Flip
times :- 1
Wend
End Method


I don't see the point of that, either. And it looks to me as if this code has been written in another version of Blitz (BlitzPlus, 3D, BlitzBasic), and translated to Blitzmax at a later point - you can't even draw to the front buffer in Blitzmax like you can with other versions of Blitz, so I'm guessing this is just some legacy functionality that has no real merit here.


yossi(Posted 2014) [#3]
I agree.


Floyd(Posted 2014) [#4]
I'm almost certain the AStar demo was included with the first release of BlitzMax. That means it was written while BlitzMax was being developed, and was probably based on earlier code in a previous Blitz language.