Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Is there a way to check for window focus?

Author
Message
Levanthus
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 24th Jul 2010 12:44
ok Simple thing here, making a game, when in windowed mode the mouse is "glued" to the centre of the game screen, but if you switch to another application window the mouse stays stuck in the middle of the screen where it is placed within the game, is there any way to check if the game window is the main focus? so when it's out of focus it "unlocks" the mouse pointer?

I can see from your smile, you're not here for the sunset

Windows 7 64 bit, AMD Phenom II x4 Black edition, 4 GB Ram, Radeon HD 4650, 540 GB HDD
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Jul 2010 20:37
So I guess you are using the POSITION MOUSE command to keep the mouse pointer centralised?

In that case, you can use the HAS FOCUS function provided in one of my plug-ins, and only call the POSITION MOUSE command when it returns a 1:


Levanthus
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 24th Jul 2010 23:19
OUTSTANDING!!! thank you so much that's PERFECT!!... why was that not in the program to start with?? anyway, thats brilliant thank you

I can see from your smile, you're not here for the sunset

Windows 7 64 bit, AMD Phenom II x4 Black edition, 4 GB Ram, Radeon HD 4650, 540 GB HDD

Login to post a reply

Server time is: 2024-11-24 13:59:34
Your offset time is: 2024-11-24 13:59:34