PocketMatrix forums

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

PC Visual C++ 6 'emulator' keys ?

I have most of an article together re: PocketFrog emulators & have VC6++ emulation working fine. My question is >

which PC keyboard keys are used to represent the PocketPC keys ( if any ). I need to mention this in the article for completeness.

Thanks in advance

ps: I already have a French translator so at least I can't pester you for that :lol:
Key input in the emulators is done through your PC's keyboard... So basically all the keys are available.

My guess is that you are talking about the key codes returned by the GAPI layer...

- Arrows: VK_UP, VK_DOWN, VK_LEFT and VK_RIGHT
- Start = <Enter>

I think the ABCDE keys are mapped to 12345, but I'm not sure... You can look it up inside file SimpleGAPI.CPP.
Conan · 11 Jun 2002, 21:25 UTC — PC Emulator keys
Thanks, I was looking in the wrong place ( input.cpp etc ) I will be able to test one I add in some code.

Your PC emulation is pretty smart :!:

ps: I will do what I can re: J720 gapi re: solid hardware information & get back to you.
Conan · 12 Jun 2002, 14:18 UTC — identifying the hard keys
I have converted the 0.4.5 button demo code so that I can identify the button down & button up events & this is working ( using the same onscreen rectangles as the original demo + some text).

What I can't figure out is how to reference the key definitions so I can tell which key is pressed. I spent aged ( maybe 2 hours ) looking at the input.c input.h & pocketpc code but still could not figure how to get the values.

So I know a button has been pressed/released but not which one ( vkLeft etc )
I know this must be easy when you know how but I'm totally stuck :(
The list of key codes is retrieved through the InputDevice Object. Inside the framework:

Code:

const InputDevice::KeyList& keys = GetInput()->GetKeyList();

if (myKey == keys.vkUp)
...
else if (myKey == keys.vkDown)
...

The key codes when using the emulator (or desktop):

Code:

GXKeyList keys;

keys.vkUp = VK_UP;
keys.vkDown = VK_DOWN;
keys.vkLeft = VK_LEFT;
keys.vkRight = VK_RIGHT;
keys.vkA = '1';
keys.vkB = '2';
keys.vkC = '3';
keys.vkStart = '\r';
Conan · 12 Jun 2002, 16:54 UTC — thanks for sorting me out
the good news is that it was my syntax which was all messed up. I was trying to use InputDevice etc but I kept getting it all wrong.

It's working fine now in my code.

the bad news is that I still can't parse this line & understand it fully. I know exactly what's going on but my brain can't see the logic in the statement
'const InputDevice::KeyList& keys = GetInput()->GetKeyList();' It's a long way from a textbook explanation of a class to this. I will study some more. The Jornada 710 is a heck of a good device to read manuals on compared to the iPaq & I'm ploughing through a C++ course at the moment.
The InputDevice::GetKeyList() method is returning a constant reference to a InputDevice::KeyList object. I am simply assigning this returned value to a local reference (i.e.: const InputDevice::KeyList&).

You could also add a member to MyGame, something like:

Code:

class MyGame : public Game
{
...

private:

InputDevice::KeyList m_keys;
};

And initialize the object in GameInit():

Code:

void MyGame::GameInit()
{
...
m_keys = GetInput()->GetKeyList();
...
}


Hope this helps!
Conan · 12 Jun 2002, 17:16 UTC — yes, that's a clearer way :)
the 2nd suggestion looks less confusing. Once I can use all the built-in functionality I don't need to worry as my own code won't have much C++.
If you saw the terrain code I converted back to normal C for PocketGL you would think I'm mad
At least this time I'm trying to work with the system rather than retro-fitting old methods onto it.

I suppose you know the tale about how the writers of C deliberately made the syntax complex to keep out non-programmers. With C++ they just kept on going. Most of my game coding was assembler with no structure whatsoever. Course I spent a lot of time in a debugger whereas now I hardly ever have to step through anything.