I'm still confused about this business of setting back buffer/front buffer/flipping/whatever. Making good progress with the Learn To Program... book, but I don't want to go any further until I absolutely understand this.
Here's some code from the book that I had to experiment with (inserting the two 'Flip' commands) until it actually worked. Even then, when you press 'ESCAPE', it opens a new window for the 'Are you sure you want to quit? (Y/N)" bit.
So - can someone explain how the buffering/flipping thing works and do I have to 'Flip' every time I print something?
I know I'm new and everything, but at the moment it seems like an unnecessary complication that wasn't in Blitz2D or 3D. :)
----------
;set graphics mode
Graphics 640,480
;set the back buffer or something
SetBuffer BackBuffer()
;initialise our "GameInProcess" variable to 1 (TRUE)
iGameInProcess=True
Repeat
;clear the screen
Cls
;write out text
Text 270,240,"Hello, Blitz Basic!"
Flip
;wait for 250 milliseconds
Delay(250)
;clear the screen
Cls
Flip
;wait for 250 mills
Delay(250)
;if the user hits escape
If KeyHit(1)
Cls
;ask the user if they really want to quit
QuitAnswer$=Input$("Really Quit (Y/N)?")
;if the user enters a 'Y'
If QuitAnswer$="Y" Or QuitAnswer$="y"
;set our condition flag to False
iGameInProcess=False
EndIf ;end of if quitanswer$
EndIf ;end of it keyhit(1)
Until Not igameinprocess
;end of program
End
----------
Here's some code from the book that I had to experiment with (inserting the two 'Flip' commands) until it actually worked. Even then, when you press 'ESCAPE', it opens a new window for the 'Are you sure you want to quit? (Y/N)" bit.
So - can someone explain how the buffering/flipping thing works and do I have to 'Flip' every time I print something?
I know I'm new and everything, but at the moment it seems like an unnecessary complication that wasn't in Blitz2D or 3D. :)
----------
;set graphics mode
Graphics 640,480
;set the back buffer or something
SetBuffer BackBuffer()
;initialise our "GameInProcess" variable to 1 (TRUE)
iGameInProcess=True
Repeat
;clear the screen
Cls
;write out text
Text 270,240,"Hello, Blitz Basic!"
Flip
;wait for 250 milliseconds
Delay(250)
;clear the screen
Cls
Flip
;wait for 250 mills
Delay(250)
;if the user hits escape
If KeyHit(1)
Cls
;ask the user if they really want to quit
QuitAnswer$=Input$("Really Quit (Y/N)?")
;if the user enters a 'Y'
If QuitAnswer$="Y" Or QuitAnswer$="y"
;set our condition flag to False
iGameInProcess=False
EndIf ;end of if quitanswer$
EndIf ;end of it keyhit(1)
Until Not igameinprocess
;end of program
End
----------