FPS camera and windowed mode

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

FPS camera and windowed mode

Post by Acki »

Hi,
I'm not sure if this is intended to be like it is, though...
I tested this with the special fx demo (#08 )...

when you create an app in windowed mode and using a fps camera, then if you move the mouse fastly sideways (look around) so the mouse gets out of the window the movement (rotation of the cam) stops and the mouse curser stays outside the window until you move it back over the app's window...

I think this is a bug, because you can't play a game in windowed mode where you have to turn around fast...
let's say an enemy stands behind you and you want to turn around to shoot him, then you can't do this fast, because the mouse gets out of the window and you don't rotate anymore until you move the mouse back over the window... :?
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

Actually, I think it's better for a developer to code a "net" for the cursor than having it by default :P
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Why would you use windowed mode then :? Also, might be a problem with your Desktop setup, maybe your window manager grabs the focus?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

hybrid wrote:Why would you use windowed mode then :?
what a question is this ?!?!? :shock:
why should I not use windowed mode, or at least let the user decide to use fullscreen or windowed ???
hybrid wrote:Also, might be a problem with your Desktop setup, maybe your window manager grabs the focus?
no, the focus always stays on the app's window and I also don't press any mouse buttons to change the focus...

maybe someone can test this with the examples from the sdk where a fps camera is used (02.Quake3Map, 07.Collision, 08.SpecialFX, ...) ???
start them (they are in windowed mode by default) and move the mouse fast sideways...
I think it's easiest to see with 08.SpecialFX with realtime shadows, because it's more hardware challenging and the mouse updates not as often as (e.g.) with the 02.Quake3Map example... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

Acki is right.
Same here.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Yup, that looks like a bug. It's escaping completely on Windows, and on Ubuntu 8.10 (in VmWare) it temporarily escapes but then gets recaptured again. I'll look into it... wait for it... waaaait... now.

Hah, got it. A very quick movement can take the cursor out of the window in a single tick. We then don't get any more mouse events for it, but we still think that it's at the window centre, and so never set it back there.

I've made the position setting unconditional in CSceneNodeAnimatorCameraFPS::animateNode(), so that we always grab the pointer back again.

This does mean that if you do smgr->drawAll() without checking device->isWindowActive() then the cursor will always be moved back even when you switch windows (e.g. to a debugger). However, it's the most robust solution. I tried registering for WM_MOUSELEAVE messages on Windows, which did help, but was still able to escape the logic and lose the pointer with very frenetic movements. If anyone can get that working robustly, knock yourself out. ;)

1.5 branch : SVN 1965
Trunk : SVN 1966.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply