Minigamepad
A simple, cross platform lightweight single-header gamepad library for handling controller input. With C89 support.
A simple, cross platform lightweight single-header gamepad library for handling controller input. The project is written primarily in C, distributed under the zlib License license, first published in 2025. Key topics include: c, c89, cross-platform, directinput, evdev.
minigamepad

A simple, cross platform lightweight single-header gamepad library for handling controller input.
Written with support for C89, using overridable C99 features, eg. stdint.h and inline with #define MG_C89.
Note: this project is early in development so there are some things missing and bugs to be worked out.
basic example
c#define MG_IMPLEMENTATION #include "minigamepad.h" #include <stdio.h> int main(void) { mg_gamepads gamepads = {0}; mg_gamepad* cur; mg_gamepads_init(&gamepads); while (mg_gamepads_update(&gamepads, NULL)); for (cur = gamepads.list.head; cur; cur = cur->next) { printf("%s\n", cur->name); } mg_gamepads_free(&gamepads); return 0; }
Then compile with:
linux gcc main.c
macos: gcc main.c -framework IOKit -framework CoreFoundation
windows: gcc main.c OR cl main.c
wasm: emcc main.c -s ASYNCIFY
Contributors
Showing top 2 contributors by commit count.
