Register
Site Login
Site Search
Forums
Advertisement
Welcome to PocketMatrix. PocketMatrix is dedicated to providing the best online community for mobile device developers and enthusiests. What's new?

PC Visual C++ 6 'emulator' keys ?


PC Visual C++ 6 'emulator' keys ?

Postby Conan » Jun 11, 2002 @ 10:02pm

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:
What is Best in Life ?
User avatar
Conan
pm Member
 
Posts: 1309
Joined: Dec 24, 2001 @ 5:16am
Location: the Shades, Ankh-Morpock


Postby Kzinti » Jun 11, 2002 @ 10:15pm

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.
Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


PC Emulator keys

Postby Conan » Jun 11, 2002 @ 10:25pm

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.
What is Best in Life ?
User avatar
Conan
pm Member
 
Posts: 1309
Joined: Dec 24, 2001 @ 5:16am
Location: the Shades, Ankh-Morpock


identifying the hard keys

Postby Conan » Jun 12, 2002 @ 3:18pm

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 :(
What is Best in Life ?
User avatar
Conan
pm Member
 
Posts: 1309
Joined: Dec 24, 2001 @ 5:16am
Location: the Shades, Ankh-Morpock


Postby Kzinti » Jun 12, 2002 @ 5:31pm

The list of key codes is retrieved through the InputDevice Object. Inside the framework:

Code: Select all






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

if (myKey == keys.vkUp)
   ...
else if (myKey == keys.vkDown)
   ...
6 lines; 4 keywds; 0 nums; 27 ops; 0 strs; 0 coms    Syntactic Coloring v0.4 - Dan East  

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

Code: Select all









10 
    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';
10 lines; 0 keywds; 0 nums; 25 ops; 4 strs; 0 coms    Syntactic Coloring v0.4 - Dan East  
Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


thanks for sorting me out

Postby Conan » Jun 12, 2002 @ 5:54pm

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.
What is Best in Life ?
User avatar
Conan
pm Member
 
Posts: 1309
Joined: Dec 24, 2001 @ 5:16am
Location: the Shades, Ankh-Morpock


Postby Kzinti » Jun 12, 2002 @ 5:58pm

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: Select all








class MyGame : public Game
{
   ...

private:

   InputDevice::KeyList m_keys;
};
8 lines; 3 keywds; 0 nums; 11 ops; 0 strs; 0 coms    Syntactic Coloring v0.4 - Dan East  

And initialize the object in GameInit():

Code: Select all






void MyGame::GameInit()
{
   ...
   m_keys = GetInput()->GetKeyList();
   ...
}
6 lines; 1 keywds; 0 nums; 20 ops; 0 strs; 0 coms    Syntactic Coloring v0.4 - Dan East  


Hope this helps!
Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


yes, that's a clearer way :)

Postby Conan » Jun 12, 2002 @ 6:16pm

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.
What is Best in Life ?
User avatar
Conan
pm Member
 
Posts: 1309
Joined: Dec 24, 2001 @ 5:16am
Location: the Shades, Ankh-Morpock


Return to PocketFrog & PocketHAL


Sort


Forum Description

SDKs for fast and robust device-independent access to Pocket PC display hardware.

Moderators:

sponge, Kzinti

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum