Code: Select all
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitSound() = 0 Or InitSprite() = 0
MessageRequester("Error", "Unable to init system utilities (Possible Direct X7 or higher not installed!)", 0)
End
EndIf
OpenWindow(0, 0, 0, 640, 480, "A screen in a window...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If OpenWindowedScreen(WindowID(0), 0, 0, 640, 480) = 0
MessageRequester("Error", "Can't open windowed screen!", 0)
End
EndIf
StartDrawing(ScreenOutput())
Box(5,5,100,100,RGB(255,255,255))
StopDrawing()
FlipBuffers()
ClearScreen(0)
Repeat
;Exit the program by keyboard or X on window
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape)
End
EndIf
Event = WindowEvent()
If event = #PB_Event_CloseWindow
End
EndIf
ForEver
Code: Select all
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitSound() = 0 Or InitSprite() = 0
MessageRequester("Error", "Unable to init system utilities (Possible Direct X7 or higher not installed!)", 0)
End
EndIf
OpenWindow(0, 0, 0, 640, 480, "A screen in a window...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If OpenWindowedScreen(WindowID(0), 0, 0, 640, 480) = 0
MessageRequester("Error", "Can't open windowed screen!", 0)
End
EndIf
StartDrawing(ScreenOutput())
Box(5,5,100,100,RGB(255,255,255))
StopDrawing()
;Commneting these out so the compiler is not compile them
;FlipBuffers()
;ClearScreen(0)
;My box is showing Strange....
Repeat
;Exit the program by keyboard or X on window
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape)
End
EndIf
Event = WindowEvent()
If event = #PB_Event_CloseWindow
End
EndIf
ForEver
Do i code the lines startdrawing .. Trough clearscreen(0) inside the repeat...Forever loop the code is working to.
But then i think its start drawing on the backbuffer. But why does this happend with only the first drawing command.