#ifndef PLAYER_H #define PLAYER_H #define MAX_PLAYER_COMMANDS 128 /* list of standard command ids */ #define PLAYER_MOVE 1 #define PLAYER_KICK 2 #define PLAYER_TUMBLE 3 typedef struct { int x; int y; } player_struct; player_struct player; void (*player_commands[128]) (); // pointer to array of command functions /** playerSetCommand This function ties a command function to a command id, as contained within the player_commands array. After tying a command to a function, a command can be directly called with the following syntax: (*player_commands[PLAYER_MOVE])(argument_1, argument_2, ...) or via the playerCommand helper function: playerCommand(PLAYER_MOVE, argument_1, argument_2, ...) **/ void playerSetCommand(int command_id, void(*function)); void playerMove(int direction, int distance); #endif