Newbie needs Help! Flipping!

BlitzPlus Forums/BlitzPlus Beginners Area/Newbie needs Help! Flipping!

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Diceman, in Blitz you use double buffering (i.e. there are two buffers and whilst one is showing you draw on the other one.) Your code first fills the screen (BackBuffer) with white and then calls flip. This shows the white screen. The current drawing buffer is now a blank black one. You wait for a mouse click and draw a black pixel on a black background and call flip again. This shows the black screen and now the white screen becomes your drawing buffer. Then when you click the mouse you get a black dot on the white background and flip will show this frame and so on.

A quick solution is to draw everything twice (once on each buffer) but this is a bit lame (I have added 2 new lines to your code).

Graphics 800,600 
ClsColor 255,255,255
Cls
Flip
Cls ;new code
Color 0,0,0
While Not KeyHit(1) 
button=GetMouse()
If button=1
Plot MouseX(),MouseY() 
Flip
Plot MouseX(),MouseY() ;new code
EndIf
Wend 


Really you should be drawing to an Image (in the memory) instead and then draw this image onto the current buffer before flipping it (as per CS_TBL's code). Then you only have to draw enverything once and it will be easy to overlay a mouse cursor. Hope you get it.