I'm a Blitz3D user that's recently bought BlitzMax. I tried to convert one of my old programs over to BlitzMax and found that the conversion has both the graphics and sound jerky while the BlitzBasic version is smooth.
I have both versions on my site with graphics and audio.
http://www.tomtoad.com/BlitzStuff/tiggerbb.zip
http://www.tomtoad.com/BlitzStuff/tiggerbmx.zip
[ETA] Strange, I just recompiled the program, unmodified, and now it runs just fine, although there's some tearing in the graphics. [/ETA]
[ETA2] Well, it seems to be working ok now. I fixed the tearing by using HARDSYNC in the graphics. As far as the jerkiness, I have no clue what was causing it, but I seem to have no problems now.[/ETA2]
Here is the code for the two diffeent versions.
BlitzBasic version
and BlitzMax version
I've tried using FlushMem before the Flip, but it didn't make any difference.
I have both versions on my site with graphics and audio.
http://www.tomtoad.com/BlitzStuff/tiggerbb.zip
http://www.tomtoad.com/BlitzStuff/tiggerbmx.zip
[ETA] Strange, I just recompiled the program, unmodified, and now it runs just fine, although there's some tearing in the graphics. [/ETA]
[ETA2] Well, it seems to be working ok now. I fixed the tearing by using HARDSYNC in the graphics. As far as the jerkiness, I have no clue what was causing it, but I seem to have no problems now.[/ETA2]
Here is the code for the two diffeent versions.
BlitzBasic version
Graphics 640,480,32,0 SetBuffer BackBuffer() tiggerleft = LoadImage("tigger-left.bmp") MaskImage tiggerleft,90,255,49 tiggerright = LoadImage("tigger-right.bmp") MaskImage tiggerright,90,255,49 background = LoadImage("forest.jpg") song = LoadSound("tigger.ogg") LoopSound song PlaySound song tiggercurrent = tiggerright Color 255,0,0 time = MilliSecs() acc# = .0032 push# = -.5 friction# = .1 velocity# = -1.3 xv# = 284.0 xd# = .3 y# = 293.0 While Not KeyDown(1) timepass = MilliSecs() delta# = timepass - time time = timepass finalspeed# = velocity# + acc# * delta# distance# = (velocity# + finalspeed#)/2.0 * delta# If y# + distance# > 293.0 totaldistance# = 293.0 - y# totaltime# = (Sqr((2.0*velocity#)^2 + 8.0 * acc# * totaldistance#)-2.0*velocity#)/(2.0*acc#) finaltime# = delta# - totaltime# totalvelocity# = -(velocity# + acc# * totaltime#) finalspeed# = totalvelocity# + acc# * finaltime# distance# = ((totalvelocity# + finalspeed#)/2.0) * finaltime# y# = 293.0 End If y# = y# + distance# xv# = xv# + xd# * delta# If xv# >= 534.0 xv# = 1068.0 - xv# xd# = - xd# tiggercurrent = tiggerleft Else If xv# < 0 xv# = -xv# xd# = -xd# tiggercurrent = tiggerright End If DrawBlock background,0,0 DrawImage tiggercurrent,xv#,y# velocity# = finalspeed# Flip Wend WaitKey()
and BlitzMax version
Graphics 640,480,32 SetMaskColor(90,255,49) tiggerleft:TImage = LoadImage("tigger-left.bmp") tiggerright:TImage = LoadImage("tigger-right.bmp") background:TImage = LoadImage("forest.jpg") song:TSound = LoadSound("tigger.ogg") channel:TChannel = PlaySound(song) tiggercurrent:TImage = tiggerright time = MilliSecs() acc# = .0032 push# = -.5 friction# = .1 velocity# = -1.3 xv# = 284.0 xd# = .3 y# = 293.0 While Not KeyDown(KEY_ESCAPE) timepass = MilliSecs() delta# = timepass - time time = timepass finalspeed# = velocity# + acc# * delta# distance# = (velocity# + finalspeed#)/2.0 * delta# If y# + distance# > 293.0 totaldistance# = 293.0 - y# totaltime# = (Sqr((2.0*velocity#)^2 + 8.0 * acc# * totaldistance#)-2.0*velocity#)/(2.0*acc#) finaltime# = delta# - totaltime# totalvelocity# = -(velocity# + acc# * totaltime#) finalspeed# = totalvelocity# + acc# * finaltime# distance# = ((totalvelocity# + finalspeed#)/2.0) * finaltime# y# = 293.0 End If y# = y# + distance# xv# = xv# + xd# * delta# If xv# >= 534.0 xv# = 1068.0 - xv# xd# = - xd# tiggercurrent = tiggerleft Else If xv# < 0 xv# = -xv# xd# = -xd# tiggercurrent = tiggerright End If SetBlend(SOLIDBLEND) DrawImage(background,0,0) SetBlend(MASKBLEND) DrawImage(tiggercurrent,xv#,y#) velocity# = finalspeed# If Not ChannelPlaying(channel) Then channel = PlaySound(song) Flip Wend
I've tried using FlushMem before the Flip, but it didn't make any difference.