PocketMatrix forums

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

suspend, focus etc - PF 0.6

I'm using the standard PF. IS it only PFplus that deals with suspend (ie: when a reminder pops up over the game) & if so how do I implement in regular PF?

(this is one of the very last bits of functionality in need in Space Treker III so look out for hardware testing coming soon to a PPC in your pocket :)
PF 0.7 has it already.
Yeah, I think I added those methods in the last release to integrate Hekkus cleanly.
Ok, I downloaded 0.7 from

http://www.droneship.com/downloads.html

I will build & see if it actually works with my code......

Ok, thanks Frank, I see you provided built Libs & some good samples. The Hekkus one covers what I need. PF 0_7_0 just slotted in where 0_6_0 had been & seems to work fine. I may even try your fonts at some point. I'm using the ones from Gersen (of Hekkus fame)
This is another reason why I think there should be some "formal" documentation for Pocket Frog. Personally, I have never heard of the "suspend" feature, yet it sounds very useful.

How can you fully utilize the benefits of Pocket Frog if you don't even know what they are to begin with? This seems like a valid concern to me. Is it up to each person to wade through the class definitions to figure out the full strengths of the pocket frog library???

I'd appreciate hearing your opinion on this topic...

Thanks!
:)
I fully agree. Fortunately i'm only a couple of week's away from finishing Space Treker III and in my 'big rest' I can do more work. As you will see I have already written several beginner's articles. These need updated & I need to draw together all the docs that exist & ensure that people can find this.

I'm hoping that my game will be well received & if so this will reflect well on PF & hopefull introduce more developers to PF.
You have to understand that PF has always been very much a "hacker's" library, meaning it has never been a commercial-quality product. By commercial-quality I mean nothing more than it's never been well-documented or well-supported, it's always been a "just go figure it out" kind of thing, and a "it'll get updated when there is free time" kind of thing.

In other words, it's a true open-source project! :)

For some this is wonderful because it puts you in complete control. I mean, I can along and was able to add some things, and *I* didn't even know all the things it could do, didn't understand the code to the fullest extent possible. Whether that's a good thing or not is up to each person to decide of course ;)

This is in contrast to something like GapiDraw, where complete, detailed documentation comes along with it because it's a fully supported project. That's not to say it's BETTER necasserily (compare the two and decide for yourself, some people think PF is da bomb, and I hate myself for using that phrase!).

In short, you can't complain about PF's lack of documentaton, or even say it's a shortcoming because an open-source project almost by definition is done at the whim of someone or some group, and most developer's when faces with the task of writing documentation will simply go to sleep at that point.

Conan has written some docs, and his efforts I know are appreciated by all. If anyone else thinks the docs are lacking, go ahead and write your own and release them. That's the whole point of an open-source product: anyone can get involved and contribute.

If you don't have the time or inclination to that because you want to concentrate not on figuring out some else' work but on writing your game, then I suggest looking at something like GD instead because an open-source project is probably not for you in the first place (that's the reason I went with GD in my last game, by and large).
Heya guys,

I know it's been said before, but I'm having trouble finding it. What code has to be in place to keep PF from crashing when it regains focus after a system message, like a low battery warning.

I'm using PF 0.7.0 (and have been for the past 6 months or so) and it crashes every single time there's a system message.

If the device is turned off and back on, it's just fine. But if my app loses/regains focus, it's toast. All help is appreciated.

Thanks,
-John
Are you using Hekkus? I think you need to call the suspend function when you lose focus.

Also, you may want to check that GetDisplay is returning something other than NULL.

Other than that, I don't think PF 0.7 should be crashing.
Hey fast_rx,

I'm using hekkus with Dr. Pocket, but I'm using FMOD in my new application. In the game.cpp file for PF0.7.0, I see the following code:
Code:

// Added 6/10/2003 by Frank W. Zammetti
void Game::GameSuspend()
{
}


// Added 6/10/2003 by Frank W. Zammetti
void Game::GameResume()
{
}


LRESULT Game::OnActivate( UINT msg, WPARAM wparam, LPARAM lparam, BOOL& bHandled )
{
if (LOWORD(wparam) == WA_INACTIVE)
{
if (!m_bSuspended)
{
PocketPC::Suspend();
m_bSuspended = true;
Game::GameSuspend(); // Added 6/10/2003 by Frank W. Zammetti
}
}
else
{
if (m_bSuspended)
{
PocketPC::Resume();
m_bSuspended = false;
Game::GameResume(); // Added 6/10/2003 by Frank W. Zammetti
}
}


ShowTaskbar( LOWORD(wparam) == WA_INACTIVE );

return 0;
}


LRESULT Game::OnSetFocus( UINT msg, WPARAM wparam, LPARAM lparam, BOOL& bHandled )
{
return OnActivate( WM_ACTIVATE, WA_ACTIVE, 0, bHandled );
}

So... When the game gets focus (after losing it to a system message), I assume Game::OnSetFocus is called, which in turn calls Game::OnActivate, which finally calls PocketPC::Resume() and Game::GameResume()...

Now, at the start of the program (in the Splash() function, I actually store the GetDisplay() value into a global DisplayDevice *pDisplay. So, in Game::GameResume(), should I be checking that pDisplay == GetDisplay()? Something like...
Code:

void MyGame::GameResume()
{
if(pDisplay != GetDisplay())
pDisplay = GetDisplay();
}

I'll see if this fixes it and post another reply.

-John
That didn't fix it. :(

In fact, my program wasn't even in the list of running applications, so it must've died before I could resume it.
Try one of the examples and see if it crashes...

I think you can simulate the problem by using:
MessageBox(_T("TEST!"),_T("A Popup"),IDOK);

If the example doesn't crash, then maybe it's something to do with the way you're handling the display object.