VgaGames4

VgaGames4 - input man-pages

[.. upper level ..]

# vg4->input->keylist()

Get list of key-entries.

SYNTAX
int vg4->input->keylist(struct VG_KeyList *keylist, int gcid)
FUNCTION PARAMETERS

keylist | For returning key-entry list, (may be NULL)
gcid | 0 = keyboard or >0 = gamecontroller-ID

RETURN VALUE
Returns the number of key-entries
DESCRIPTION
Get list of key-entries.
EXAMPLE

    struct VG_KeyList keylist;
    struct VG_GCList gclist;
    int igc, ikey;

    /* get key-entries and key-codes of keyboard */
    vg4->input->keylist(&keylist, 0);
    printf("Keyboard:\n");
    for (ikey = 0; ikey < keylist.max; ikey++) {
      printf(" - keyref=%d, keyname=%s, is_chg=%d, is_nw=%d, code=%d, codename=%s\n",
             keylist.key[ikey].keyref,
             keylist.key[ikey].keyname,
             keylist.key[ikey].is_changeable,
             keylist.key[ikey].is_nwkey,
             keylist.key[ikey].code,
             keylist.key[ikey].codename);
    }

    /* gamecontrollers */
    vg4->input->gclist(&gclist);
    for (igc = 0; igc < gclist.max; igc++) {
      /* get key-entries and key-codes of this gamecontroller */
      vg4->input->keylist(&keylist, gclist.gc[igc].id);
      printf("GC[%d]:\n", gclist.gc[igc].id);
      for (ikey = 0; ikey < keylist.max; ikey++) {
        printf(" - keyref=%d, keyname=%s, is_chg=%d, is_nw=%d, code=%d, codename=%s\n",
               keylist.key[ikey].keyref,
               keylist.key[ikey].keyname,
               keylist.key[ikey].is_changeable,
               keylist.key[ikey].is_nwkey,
               keylist.key[ikey].code,
               keylist.key[ikey].codename);
      }
    }

SEE ALSO
struct VG_KeyList vg4->input->key_insert()