#ifndef PW_PLAYER_H #define PW_PLAYER_H #include #include #include #define PW_PLAYERS_MAX 8 /** * PICO-8 players. */ struct pw_players { SDL_Gamepad *gamepads[PW_PLAYERS_MAX]; }; /** * Allocates and initializes the PICO-8 player state. */ struct pw_players *pw_players_init(void); /** * Cleanup and free the PICO-8 input state. */ void pw_players_free(struct pw_players *players); /** * Handles an SDL events for updating connected players. */ bool pw_players_event(struct pw_players *players, SDL_Event *event); /** * The connection status of each player, as a convenience returns the * number of connected players. */ size_t pw_players_status(struct pw_players *players, bool connected[static PW_PLAYERS_MAX]); /** * Finds the player associated with a gamepad. Returns `PW_PLAYERS_MAX` if not * found. */ size_t pw_player_find(struct pw_players *players, SDL_JoystickID gamepad); #endif