Screen Flips to Desktop

Just starting out? Need help? Post your questions and find answers here.
lee__48
User
User
Posts: 21
Joined: Thu Dec 08, 2005 3:17 am
Location: UK

Screen Flips to Desktop

Post by lee__48 »

I haven't used PureBasic for a while and I've been updating some old scripts to work with V4.5.

The code below is a stripped down version of the basics of a screen saver I was writing. In it's current form it should just show a black screen. My monitor's native resolution is 1920x1080; when I run the script every 0.5 seconds it swaps between a black screen and the desktop. If I change the resolution to something lower it works fine. The problem seems to fix itself if I ClearScreen() before FlipBuffers(), but this isn't required on lower resolutions - am I doing this wrong or it is a bug?

Lee

Code: Select all

updateDelay = 500

ExamineDesktops()

screenWidth = 1920 ;DesktopWidth(0)
screenHeight = 1080 ;DesktopHeight(0)

If InitKeyboard() = 0 Or InitSprite() = 0
  MessageRequester("Error", "Can't open DirectX 7", 0)
  End
EndIf

If OpenScreen(screenWidth, screenHeight, DesktopDepth(0), "Test") = 0
 MessageRequester("Error", "Can't open a new screen", 0)
 End
EndIf

InitMouse()  
ClearScreen(RGB(0,0,0))

wait = updateDelay+1

;- Main Loop
Repeat
  If wait > updateDelay
    
    ;ClearScreen(RGB(Random(255),Random(255),Random(255)))
    
    FlipBuffers()
    wait = 0
    
  EndIf
  Delay(1)
  wait = wait + 1
  ExamineMouse()
Until MouseButton(#PB_MouseButton_Left)