SkillAgentSearch skills...

Minigamepad

A simple, cross platform lightweight single-header gamepad library for handling controller input. With C89 support.

Install / Use

/learn @ColleagueRiley/Minigamepad

README

minigamepad

THE MINIGAMEPAD Logo

workflow workflow windows workflow macOS workflow wasm

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

#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

View on GitHub
GitHub Stars48
CategoryCustomer
Updated1mo ago
Forks5

Languages

C

Security Score

95/100

Audited on Feb 17, 2026

No findings