Jump to content
Sign in to follow this  
STuFF

gapidraw : how to handle incoming call ?

Recommended Posts

im beginning in win32 developpement, and I found that Gapidraw is a great lib, especially its GapiApplication Class, which avoid me to handle a lot of win32 stuff i really dont understand... But this class do not catch incomming call properly (and probably other things like reminder, etc)

I've finished (almost 8D) a game (sokoban clone) for the SPV, but the only thing stopping me is this anoying problem.

I've asked the question on the pocketmatrix forum, but no one gave me a solution to my problem. If someone know the solution, or better, can give me the modified GapiDrawApplication.h, it would be great.

thanks by advance.

Share this post


Link to post
Share on other sites

It should be catching messages from the OS in the main loop somewhere. What you need to catch is a few specific messages,

WM_KILLFOCUS, when a call comes in your app goes into background and this message tells it that is happening. GAPI, cos it access the screen directly will keep drawing to the screen even if it's in the background.

When you get a WM_KILLFOCUS you need to either, close your app (and save states), or stop screen access and put your app in a paused mode.

WM_QUIT? (I think that's the one). If your app goes background (ie you had the WM_KILLFOCUS above and you just paused it and left it there, then the OS may later decide that it needs the system resources back and send your app a WM_QUIT. When you receive this message you MUST program your app to shutdown.

Hope that helps... if the app doesn't seem to have a message handling routine (I haven't looked at gapi draw too much myself, and I know it does some of these things itself), post again and I'll go look some stuff up.

PS. WM_KILLFOCUS covers all possibilitys including reminders etc (I think)

Share this post


Link to post
Share on other sites

thanx again for help spacemonkey :)

You already told me quickly those things, and with your help, i manage to "minimize" my game when a call is comming. The other problem, but maybe it's a "normal" thing, when my game is minimized, i cant answer the call, but at the end, my games is still minimized, and doesnt seem to receive any other message, so it can't get on foreground by itself.

Maybe I should not "minimize" it, but just hide, or whatever else. Maybe im going to save states and exit as you say. Forcing the player to restart the game after all.

I have to say i didnt catch WM_KILLFOCUS for that, but WM_ACTIVATE, looking for WA_INACTIVE.

The original main loop uses a 'SetForegroundWindow' their to keep it in foreground at any cost, which is not (for me) very clever...

another time, thank you spacemonkey !

Share this post


Link to post
Share on other sites

Yeah... depends how you want it to run... It seems that it's dropping to the background but the process is still intercepting all the key presses which is why you can't answer the call.

My stuff I've gone for a full quit when a call comes in, but cos I've just been playing with emulators I think that behaviour is appropriate, cos they take lots of memory etc. Also, when I save state it's the full game state, so when you reload your game is exactly where it was when you quit. This means that the player isn't loseing anything by me closing it fully. The other factor I looked at, was if I just went background, what if they never went back to the game and maybe didn't shutdown their phone cleanly, removed the battery or something weird... then they would have never saved their game which would be bad.

Anyway, good luck and I look forwards to playing your sokoban clone :)

Share this post


Link to post
Share on other sites

oups...

i've wrote "i cant answer the call". It was "I CAN answer" all is fine. The only thing is that my game keep itself in background. Weird thing, the sound thread (fmodCE) is really well done, the sound stop when a call appends, and came back when the call stops ! At the end, the gapidraw thread is "minimized" but the sound is there :)

I've finished all the game, and im going to look further to resolve this fuc**** problem !

Here is some snapshots, to wait a bit until the release ;)

boxy1.gifboxy2.gif

boxy3.gifboxy4.gif

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×