PB5.31 ClearScreen() does not work after OpenScreen()
Posted: Tue Oct 28, 2014 3:13 pm
InitSprite()
OpenScreen(800,600,32,"SOFTWARE")
InitKeyboard()
PX= Random(799) : PY= Random(599) : BYEBYE= 0
Repeat ; THE PROGRAM'S MAIN LOOP STARTS HERE
RELEASE= ElapsedMilliseconds()+ 20 ; LIMITS LOOP SPEED TO 50 Hz
; GATHER THIS LOOP ITERATION'S USER INPUT STATE VARIABLES FROM SYSTEM
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape) : BYEBYE+ 1 : EndIf ; EXIT PROGRAM UNCONDITIONALLY WHEN USER PRESSES ESCAPE
; POPULATE THE SCREEN
ClearScreen($111144)
StartDrawing(ScreenOutput()) : DrawingMode(#PB_2DDrawing_Transparent)
; Box(0,0,800,600,$111144) ; WORKS
DrawText(40,40,"(0,0)",$8888FF) : LineXY(40,40,0,0,$8888FF)
DrawText(40,530,"(0,599)",$8888FF) : LineXY(40,560,0,599,$8888FF)
DrawText(675,40,"(799,0)",$8888FF) : LineXY(752,40,799,0,$8888FF)
DrawText(650,530,"(799,599)",$8888FF) : LineXY(760,560,799,599,$8888FF)
Box(250,225,275,110,$000000)
DrawText(275,250,"Pointer's X @ "+Str(PX),$8888FF)
DrawText(275,280,"Pointer's Y @ "+Str(PY),$8888FF)
StopDrawing() : FlipBuffers()
; LOOP SPEED LIMIT
If ElapsedMilliseconds() < RELEASE
Repeat : Delay(2) : Until ElapsedMilliseconds() > RELEASE
EndIf
Until BYEBYE
End
OpenScreen(800,600,32,"SOFTWARE")
InitKeyboard()
PX= Random(799) : PY= Random(599) : BYEBYE= 0
Repeat ; THE PROGRAM'S MAIN LOOP STARTS HERE
RELEASE= ElapsedMilliseconds()+ 20 ; LIMITS LOOP SPEED TO 50 Hz
; GATHER THIS LOOP ITERATION'S USER INPUT STATE VARIABLES FROM SYSTEM
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape) : BYEBYE+ 1 : EndIf ; EXIT PROGRAM UNCONDITIONALLY WHEN USER PRESSES ESCAPE
; POPULATE THE SCREEN
ClearScreen($111144)
StartDrawing(ScreenOutput()) : DrawingMode(#PB_2DDrawing_Transparent)
; Box(0,0,800,600,$111144) ; WORKS
DrawText(40,40,"(0,0)",$8888FF) : LineXY(40,40,0,0,$8888FF)
DrawText(40,530,"(0,599)",$8888FF) : LineXY(40,560,0,599,$8888FF)
DrawText(675,40,"(799,0)",$8888FF) : LineXY(752,40,799,0,$8888FF)
DrawText(650,530,"(799,599)",$8888FF) : LineXY(760,560,799,599,$8888FF)
Box(250,225,275,110,$000000)
DrawText(275,250,"Pointer's X @ "+Str(PX),$8888FF)
DrawText(275,280,"Pointer's Y @ "+Str(PY),$8888FF)
StopDrawing() : FlipBuffers()
; LOOP SPEED LIMIT
If ElapsedMilliseconds() < RELEASE
Repeat : Delay(2) : Until ElapsedMilliseconds() > RELEASE
EndIf
Until BYEBYE
End