Help?! :)
BlitzMax Forums/BlitzMax Programming/Help?! :)
| ||
BlitzMax 1.30 Hello ppl! I'm pretty new when it comes to coding in blitzbasic (MAX). The reason I'm asking here, is because my text scroller seems to flicker/stutter. The flickering is kinda random, but it's really annoying. And I don't know why this small code should flicker like this.. Could any one give me a hint or a sollution of this problem? I have tried several ways, but the scroller just seems to shake or something. I got the same problem in every application I make in BlitzMax. My specs are as follows: CPU: AMD Athlon X2 6400+ dual core (3.2Ghz) Graphics: EVGA e-GeForce 8800 GTS Memory: 2GB OS: Windows XP Pro Latest DirectX/Soundcard/Graphics drivers - The scroller code - SuperStrict Const W:Int = 640 ' Height Const H:Int = 480 ' Width Const D:Int = 0 ' Depth (0 = window mode) Graphics W,H,D Global scrollList:TList = New TList Global movespeed:Float=2.0 HideMouse Type scroller Field x:Float Field y:Float Field char:String Method update() For Local s:scroller = EachIn scrollList s.x:-movespeed DrawText s.char,s.x,s.y If s.x<-50 Then scrollList.remove s Next End Method Function Create:scroller(x:Float,y:Float,char:String) Local s:scroller = New scroller s.x=x s.y=y s.char=char scrollList.addlast s End Function End Type ' Scroller text Local text:String text=" Hello ppl! This small scroller is kinda flickering and stuttering.. " text:+" Why is it stuttering and flickering in BlitzMax??? ........................... " Local wait:Int = 0 Local letter:Int = 0 Local s:scroller = New scroller Repeat Cls If wait>5 Local tmp:String=Mid(text,letter,1) Local s:scroller = New scroller s.Create(640,400,tmp) wait=0 letter:+1 If letter > Len(text) Then letter=0 EndIf wait:+1 s.update Flip Until KeyHit(KEY_ESCAPE) End -- End code -- Thanks in advance, Docster |
| ||
It's smooth in fullscreen mode but in windowed mode it stutters because you are using Flip with no param which uses -1 which means BMax sets up a 60Hz timer which is probably not in sync with your desktop refresh rate. Try Flip 1 instead which uses VSync, that's smooth on mine. However, eventually you'll need to invest some time into getting a decent timing routine sorted out. |
| ||
Thanks Grey Alien for your fast reply.. :) Well, it flickers in windowed and full screen mode here. And I can't find out why it does. No CPU spikes eighter. After writting a small FPS routine, it looks like it's jumping from 60 to 61 FPS. Which tells me that this thingy is out of sync as you said. Now I just need to write a decent timing routine, which I never have done before. I'll try it out. :) |
| ||
welcome. So Flip 1 still flickered? |
| ||
Flip(1) should do the trick as Grey alien said |
| ||
Yes, the flip 1 worked. :) But, sometimes there are some flickering. But, it's much better than -1 .. :) Thanks alot! :D |
| ||
"Yes, the flip 1 worked. :) But, sometimes there are some flickering. But, it's much better than -1 .. :) Thanks alot! :D" Welcome to proper pc game coding. Where jitters, quirks, hiccups, etc, are quite common. :) |
| ||
Well, there seems to be a problem with flip 1 too. If I set "3D settings->Adjust image settings to preview->Use my preference emphasizing" to Performance, in the NVIDIA Control Panel, it seems like flip 1 doesn't comply any longer. Any work around for this one? Or could anyone help me creating a timer routine that works? I don't seem to get the timer function to work properly. Thanks. :) |
| ||
you probably turned off vysnc from your 3d settings. You should probably see "tear" once in a while as the image draws on itself. Research "fixed rate logic" in the search link, that's what you need to do. :) |
| ||
Tnx! I'll have a look! :D |