PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

pfrog+phal running in background?

I'm currently trying to debug my client/server app on a PC. For this, I disabled a statement in game.cpp, which ran Sleep() while game's window inactive, because I want two pfrog apps running simultaneously - a server, and a client.

This doesn't work - game fails with an exception once I make it's window inactive. I researched this - and found that GetDisplay returns 0.
Further research brought me to this:

Code:
/// Begin a scene. Must be called before rendering. This function will fail if your
/// window doesn't have focus.
/// @remark GetBackBuffer() will return 0 if BeginScene() fails or is not called first.
bool BeginScene();


I tried disabling BeginScene() call in GetDisplay(), but game still hangs(now in SetRenderTarget()). Probably something else was digged deep into game logic.

Is it actually possible to run pocketfrog in background?
I think if your app is smart enough to not try to draw when it is inactive, it would work.

I made an app with pocketfrog that created a timer thread so that it could lose focus, then regain focus when the timer expired. It worked, but the only processing when minimized was in the timer thread. It could have done more I suppose, like your network code.
fast_rx wrote:I think if your app is smart enough to not try to draw when it is inactive, it would work.

Yes, but I want it to draw when inactive!!
Just pretend that it's drawing. No one will know the difference.

But seriously, are you wanting to draw to the screen when inactive, or just a buffer?
fast_rx wrote:Just pretend that it's drawing. No one will know the difference.

But seriously, are you wanting to draw to the screen when inactive, or just a buffer?


I want to see the animation, happening on both client and server. Client sends info, server recieves, animation starts and goes on on both of them, then server sends info and client recieves it, another animation, another action. Such stuff.

Currently I have to do following: do something in active window, switch to inactive, see what happens, switch back, do stuff again, switch forth, see what happens, switch back, etc, etc.
Tired of useless switching here and there.

PS: Luckily, my game is turn-based. It wouldn't have worked at all if it wasn't.
Thought that I point out this: my game is in background, but that doesn't mean that i'ts window unseen. It's just inactive.