Topic: I have problems with "isKeyPressed ()" in laptops

the "isKeyPressed ()" function is not detected when I press the number keys on a laptop, how can I solve this problem?

Last edited by ArielRiv (2015-08-17 01:47:03)

Re: I have problems with "isKeyPressed ()" in laptops

Yes, it's a limitation, sorry.
This case is not handled in the code,
it need to be added inside "MGameWinEvents.h"

Re: I have problems with "isKeyPressed ()" in laptops

Can I make this in a simple way?

Re: I have problems with "isKeyPressed ()" in laptops

yes, but you'll have to compile Maratis from source.

open "MGameWinEvents.h", in the function "getKeyName", in the "switch(key)"

change:

    case MKEY_KP0: return "0";
    case MKEY_KP1: return "1";
    case MKEY_KP2: return "2";
    case MKEY_KP3: return "3";
    case MKEY_KP4: return "4";
    case MKEY_KP5: return "5";
    case MKEY_KP6: return "6";
    case MKEY_KP7: return "7";
    case MKEY_KP8: return "8";
    case MKEY_KP9: return "9";

to:

    case '0': case MKEY_KP0: return "0";
    case '1': case MKEY_KP1: return "1";
    case '2': case MKEY_KP2: return "2";
    case '3': case MKEY_KP3: return "3";
    case '4': case MKEY_KP4: return "4";
    case '5': case MKEY_KP5: return "5";
    case '6': case MKEY_KP6: return "6";
    case '7': case MKEY_KP7: return "7";
    case '8': case MKEY_KP8: return "8";
    case '9': case MKEY_KP9: return "9";

Re: I have problems with "isKeyPressed ()" in laptops

and if it's not enough, in the function "gameWinEvents" add :

case MWIN_EVENT_CHAR:
        {
            unsigned int key = windowEvents->data[0];
            const char * name = getKeyName(key);
            if(name)
                input->downKey(name);
        }
        break;

(to be tested)