Skip to content

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

License

Notifications You must be signed in to change notification settings

ColleagueRiley/minigamepad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 projct 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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published