Skip to main content
GameDev.net gamedev.net
🔒 Locked

Problems programming pocketpc control for games

Started by slippers2k Jan 12, 2006 at 2:22 PM 3 replies 1.1k views
Original Post
slippers2k
slippers2k
Hey all, I was porting a smartphone game to the pocketpc a while ago, and had trouble when I ran the game on my pocketpc. It's a pong remake, and while I don't have a smartphone device, I was able to get it running on the smartphone emulator that I had at home. When I got my pocketpc, I tried porting it to a pocketpc solution and actually compiled it with only one warning (a problem with a member of a high score window object, nothing else game-related). The only problem is that when I play the game, the pocketpc controls will not move the paddle to hit the ball. Are there any fundamental differences between programming user controls for the smartphone and the pocketpc? The port was almost flawless (I'm still somewhat impressed), but by the same token, the game is no fun without player control. Thank you for your time. Any input you can provide would be appreciated. Later! -slippers2k p.s. here are more technical specs for you taking notes: The pocketpc is an HP iPAQ rx1950 series, running windows mobile 5.0. I initially developed the game for the smartphone (windows smartphone 2003 edition), and ran it on a 2003 smarphone SE emulator in Visual Studio 2005 Beta 2. The emulator ran the program fine. I later tried to convert the program to compile for a 2003 PocketPC device, and was actually able to deploy it to my pocketpc, but again, the game will not move the player device (player controls the paddle to hit ball back to the computer).
Attack life's problems like a Subaru... with all four wheels
yoursort
yoursort
I´ve got the same problem:

I develop a little game for Pocket-PC (2003 SDK). On a 2003 device it runs fine, but on my new Mobile 5 (also iPAQ 1950) the game do not react on button pressing. But sometimes if I press the buttons often enough (20-30 times) the game reacts?!

I have only embedded Visual C++ and so I cannot debug my apps on my new PocketPC ;(

At the moment I´ve got no solution for this problem. Maybe some other has?!
slippers2k
slippers2k
I think I just realized something.

The problem could be due to one of a few things:

1. There is a difference between control scheme programming for pocketpc 2003 devices and windows mobile 5.0 devices...

2. There is a difference in control scheme programming between a windows smartphone and a pocketpc in general (sounds more obvious, but it didn't even give me compile-time errors when I ran the code)

Does windows mobile 5.0 stop using GAPI commands? Did pocketpc 2003 ever use those for controlling games?

I am stumped...
-Ramon
Attack life's problems like a Subaru... with all four wheels
slippers2k
slippers2k
Ok, I think I answered my own question.

PocketPC 2003 and Windows Mobile 5.0 PocketPC specs differ slightly in one regard - the keypress events.

Apparently, while I am not sure about the specifics, one operating system reads hardware keypress commands with the keyDown event, but the other operating system reads hardware keypress commands with the keyPress event. Sounds like a simple change of code, right?

Wrong... there is a difference:

keyDown is a variable that is used with a KeyEventArgs type, such as:

private void System.Windows.Forms.KeyEventArgs keyArgs = null;

but keyPress is a variable that is used with a KeyPressEventArgs type, such as:

private void System.Windows.Forms.KeyPressEventArgs keyArgs2 = null;

The keyArgs and keyArgs2 objects do not have the same members.

keyArgs can reference something called KeyCode to find out what key got pressed on the device. However, keyArgs2 has (or is supposed to have) keyAscii, which is more or less supposed to do the same thing.

(Unless I missed my guess, and the KeyPressEventArgs keyArgs2 variable does have a KeyCode member... I didn't see one in Visual Studio when I was coding.)

Feedback? I would like to know which event to code for so that my game will respond to hardware button presses on a 5.0 device (and a 2003 device as well).

-slippers2k
Attack life's problems like a Subaru... with all four wheels
slippers2k
slippers2k
YES!!! I GOT IT!!!

I would like to thank God, and Google, and perseverance for making this possible.

Anyway, to make a pocketpc 2003 game using directional keys work in mobile 5.0, make sure you are refering to your directional keypad with System.Windows.Forms before each key command, like for example:

private void keyDown(object sender, System.Windows.Forms.KeyEventArgs e){	keyArgs = e;	if ((e.KeyCode == System.Windows.Forms.Keys.Up))	{		// Up		breadPlayerRectangle.Y -= generalSpeed;	}	if ((e.KeyCode == System.Windows.Forms.Keys.Down))	{		// Down		breadPlayerRectangle.Y += generalSpeed;	}        //etc...}


(The rest of my key definitions are in another part of my code, but you get the picture above.)

Once I tried this in my code, it worked. I am RELIEVED.

Good night, people... it's past 3 in the morning in the Eastern Time Zone, and I'm going to bed.

CASE CLOSED!
God bless you,
slippers2k
Attack life's problems like a Subaru... with all four wheels

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.