Well, I don't know anything about GetKeyList() and using keys and stuff, but I can easily solve the following dilemma for you:
The compiler tells me that I can't access m_input because it's a private member of Frog::Game.
Ofcourse! You can't access a private member by extending a class. Private members are always private, and only visible to the class that defined them as private. A good programming strategy, is to always hide the members (and local object helper functions) as private, and then make them accessible by public (or protected) functions. So, looking at the game.h file I found this out:
Just as you write:
- Code:
DisplayDevice* display = GetDisplay();
you should write:
- Code:
InputDevice* input = GetInput();
Then, because input is a pointer, you should use the -> syntax to access it's members and functions, so for instance:
- Code:
const InputDevice::KeyList& keys = input->GetKeyList();
Then, looking at the input.h file I found out the following:
The GetKeyList() function returns a constant reference to a KeyList struct. And the struct is defined in the InputDevice class, so that's why you need to classify it as 'const InputDevice::'.
And, since keys is a reference to a KeyList object (or struct if you will) you should use the . to access it's members. (. is for objects and references to object, and -> is for pointers to objects only)
It was so simple back in PF 0.4.5 when you could write: switch(button){ case BUTTON_UP: ... }
You can still use the switch-case if you want. What's stopping you??
- Code:
switch(button)
{
case keys.vkUp:
...
break;
case keys.vkDown;
...
break;
...
default:
...
}
Hope this'll help you out.
Ps. I have not used namespace qualifiers here since they are unnesessary because it looks like you have defined your DrPocket class whithin the Frog namespace. If you had not (and perhapps you should consider this since the DrPocket is not really part of PocketFrog anymore is it) you must use the Frog namespace qualifier before all the objects OR if you like to make it more simple (but less strict) put a 'using namespace Frog;' on the first row in every function that uses PF objects.