soon-to-be-button too slow...

Blitz3D Forums/Blitz3D Programming/soon-to-be-button too slow...

RRK1020(Posted 2006) [#1]
OK. My computer might just not be able to handle this (doubt it), or there is some reason it is not workin very fast. Please tell me why.

While Not KeyDown(1)
Color 56,78,112:Rect 1,2,75,12:Rect 1,13,75,12
Color 50,255,100:Text 1,2,"New Game":Text 1,13,"Load Game"
While MouseY()<14 And MouseY()>2
While MouseX()<76 And MouseX()>1
Color 50,170,170:Rect 1,2,75,12
Wend
Wend
Wend


Scherererer(Posted 2006) [#2]
try this:




RRK1020(Posted 2006) [#3]
Oh yeah, forgot the clear-screen... thanx


octothorpe(Posted 2006) [#4]
Actually, your program was executing really really fast. The flickering you experience occurs when the screen is drawn after you draw your rectangles but before you draw your text. Flip() uses a backbuffer to ensure that the user will only see fully drawn screens. It'll also slow your program down to the maximum frame rate that can be achieved.

P.S. Not clearing the screen wasn't affecting anything in your sample code because you are redrawing every pixel every frame.


RRK1020(Posted 2006) [#5]
well, after i put in the clear screens it did get alot faster than it was...

I'll try other stuff...
-ryan

This also made it a little better:

Function MENU()
Repeat
Cls
Color 56,78,112:Rect 1,2,75,12:Rect 1,13,75,12:Color 50,255,100:Text 1,2,"New Game":Text 1,13,"Load Game"
While MouseY()<14 And MouseY()>2
While MouseX()<76 And MouseX()>1
Color 50,170,170:Rect 1,2,75,12:Flip
If MouseDown(1) Then
NEW_GAME()
EndIf
Wend
Wend
Flip
Forever
End Function