Event receiver in background?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
aeronmike
Posts: 45
Joined: Thu May 24, 2012 5:00 am
Location: Rio de Janeiro, Brazil

Event receiver in background?

Post by aeronmike »

Hey..

The event receiver only works when the game window is active/focused.

Let me explain what I want to do and why:

My game client can have up to 2 instances (for now). I coded something that let them to intercommunicate. I created a multiplayer mode (in a few words).
But you may be wondering WHY I need 2 clients instead of just one running a split screen?
Well, I have two 23" monitors connected to the system and I want that each game client instance to be visually run on each monitor. (I also have 2 joysticks).

However, the problem is:
When one client loses focus, its event receiver is "paused". So the respective player cannot send input to the game (Irrlicht does not receive them while the window is inactive).

So, is there any possibility for the engine to still get the user input while not focused?

Thanks.
d3jake
Posts: 198
Joined: Sat Mar 22, 2008 7:49 pm
Location: United States of America

Re: Event receiver in background?

Post by d3jake »

Does your EventReceiver return true or false once a case is hit? If I recall, if you have it set to... true the receiver "eats" the keypress, so nothing else can see it. Have you tried it the other way around?
The Open Descent Foundation is always looking for programmers! http://www.odf-online.org
"I'll find out if what I deleted was vital here shortly..." -d3jake
aeronmike
Posts: 45
Joined: Thu May 24, 2012 5:00 am
Location: Rio de Janeiro, Brazil

Re: Event receiver in background?

Post by aeronmike »

It was returning false (due to the built-in FPS camera). But even when I tested the opposite the same occurred.

I don't know what I could do... I use Irrlicht a bit recently. And I also didn't find anything related in its reference pages. :/
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Event receiver in background?

Post by CuteAlien »

There's 2 problems here. The first is simple.. most Irrlicht examples pause running the application when it's not active. That's just that line:

Code: Select all

 
if (device->isWindowActive())
 
The other problem is simply that keys in Windows are sent to the active window. No idea to work around that ... this is not an Irrlicht problem, Irrlicht just passes on the events it gets, this is rather something you have to solve in Windows.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
smso
Posts: 246
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: Event receiver in background?

Post by smso »

I think you better off using a server-client model with a network library e.g. irrnet, irrnetlite or irrnetz.

Regards,
smso
aeronmike
Posts: 45
Joined: Thu May 24, 2012 5:00 am
Location: Rio de Janeiro, Brazil

Re: Event receiver in background?

Post by aeronmike »

Well.. It seems more complex than I thought. LoL

Thanks you guys
Post Reply