Problem with screensaver and lockscreen.

Advanced game related topics
True29
User
User
Posts: 64
Joined: Sun Feb 03, 2013 1:50 am

Problem with screensaver and lockscreen.

Post by True29 »

Hello,
i use directx subsystem in my game.

now the problem is when the game is running and the screensaver starts or i lock my screen , window key+l then
return to my game the Gfx is frozen the other things sound/Control main loop runs well.

What is the normal way to solv this 2 Problems ?
I could go with opengl subsystem and solve this problems, but then there are 2 new problems with opengl ;)
So Opengl is no solution for me.

Thanks.
Greets. Johannes
Last edited by True29 on Tue Apr 02, 2013 10:59 pm, edited 1 time in total.
True29
User
User
Posts: 64
Joined: Sun Feb 03, 2013 1:50 am

Re: Problem with screensaver and lockscreen.

Post by True29 »

i have found a small solution for lost focus > IsScreenActive.

But how to check if screensaver is activ or the screen is locked ?
When this happen i will rebuild the screen.

update:
i will swith to opengl Subsystem thread closed.

Greets.
Alex777
User
User
Posts: 49
Joined: Sun Nov 16, 2008 12:47 am
Location: Cayman Is.
Contact:

Re: Problem with screensaver and lockscreen.

Post by Alex777 »

try something like this (exception handling omitted):

Code: Select all

Procedure.i ASE_CheckLostDevice()
    ; handles a DX9 lost device event such as when user ALT + TABs
    ; ALL video resources must be recreated
    ; a Window is needed so we can listen for Windows Events
    ; returns: #True after a lost device event if user returns to program
    ;          -1 after a lost device event if user terminates program
    ;          #False otherwise
    
    Protected event.i, win.i
  
    If IsScreenActive() = #False
        
        CloseScreen()

        win = OpenWindow(#PB_Any, 1, 1, 1, 1, Title$, #PB_Window_Minimize | #PB_Window_BorderLess)
        
        Repeat
            
            event = WaitWindowEvent(10) 
            
            If (event = #PB_Event_CloseWindow) And (EventWindow() = win)
                
                ProcedureReturn -1
            EndIf
            
        Until (event = #PB_Event_Repaint) And (EventWindow() = win)

        CloseWindow(win)
        
        OpenScreen(width, height, depth, Title$)
        
        ProcedureReturn #True
        
    EndIf
    
    ProcedureReturn #False
  
EndProcedure
True29
User
User
Posts: 64
Joined: Sun Feb 03, 2013 1:50 am

Re: Problem with screensaver and lockscreen.

Post by True29 »

ok thanks i will test it ;)
Post Reply