IsScreenActive()

Advanced game related topics
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

IsScreenActive()

Post by IdeasVacuum »

I have a WindowedScreen which displays a Mesh nicely and then the Mesh can be rotated etc by dragging the mouse etc. So far so good. However, I want to return focus to the Parent Window (or the Window of any other desktop program) if the mouse position is outside of the WindowedScreen.

So far a test such as:

fMousePosnX = MouseX()

Code: Select all

If ( fMousePosnX > (fScreenWth -2) ) 
                  
            ReleaseMouse(1)
                        
EndIf
Just about works but the solution is not elegant because the test checks if the mouse is off screen to the right but including a test to see if it is off screen to the left delivers a false positive.

Also, if the mouse is returned to the WindowedScreen, how does one return the focus to the WindowedScreen?

I have also tried IsScreenActive():

Code: Select all

RenderWorld()

                        DisplaySprite(#CursorSprite, MouseX, MouseY)

                        FlipBuffers()
                        
                        ClearScreen(RGB(0, 0, 0))
                        
                        iScreenActive = IsScreenActive()
IsScreenActive() should return zero if the screen is inactive but I only ever get a return of 1. Perhaps this function only works in Full Screen mode? If so, does anyone know how to emulate it in a WindowedScreen?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: IsScreenActive()

Post by Kaeru Gaman »

I don't know right know about DX9 and 3D stuff...

for 2D stuff and DX7 I posted code some time ago...
http://www.purebasic.fr/german/viewtopic.php?t=11280
thought I also posted it in the english forums, but don't find it quick...
oh... and have a nice day.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: IsScreenActive()

Post by IdeasVacuum »

Hi Kaeru

Your code looks as though it will cure my headache, thank you :)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply