{"id":13419145,"url":"https://github.com/jkuhlmann/gainput","last_synced_at":"2026-01-10T07:23:34.652Z","repository":{"id":5313963,"uuid":"6496126","full_name":"jkuhlmann/gainput","owner":"jkuhlmann","description":"Cross-platform C++ input library supporting gamepads, keyboard, mouse, touch","archived":true,"fork":false,"pushed_at":"2021-09-06T20:03:56.000Z","size":2944,"stargazers_count":845,"open_issues_count":40,"forks_count":103,"subscribers_count":45,"default_branch":"master","last_synced_at":"2024-07-31T22:45:50.531Z","etag":null,"topics":["android","android-ndk","c-plus-plus","cmake","engine","game-engine","game-engine-library","gamepad","games","gestures","input","ios","keyboard","linux","low-level","macos","mouse","multi-touch","unified-interface","windows"],"latest_commit_sha":null,"homepage":"http://gainput.johanneskuhlmann.de/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jkuhlmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-01T19:49:40.000Z","updated_at":"2024-07-29T07:59:57.000Z","dependencies_parsed_at":"2022-09-13T08:10:27.260Z","dependency_job_id":null,"html_url":"https://github.com/jkuhlmann/gainput","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkuhlmann%2Fgainput","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkuhlmann%2Fgainput/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkuhlmann%2Fgainput/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkuhlmann%2Fgainput/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jkuhlmann","download_url":"https://codeload.github.com/jkuhlmann/gainput/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243685506,"owners_count":20330980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-ndk","c-plus-plus","cmake","engine","game-engine","game-engine-library","gamepad","games","gestures","input","ios","keyboard","linux","low-level","macos","mouse","multi-touch","unified-interface","windows"],"created_at":"2024-07-30T22:01:11.946Z","updated_at":"2026-01-10T07:23:34.578Z","avatar_url":"https://github.com/jkuhlmann.png","language":"C++","funding_links":[],"categories":["TODO scan for Android support in followings","Libraries","GameProgramming"],"sub_categories":["C++"],"readme":"This project is archived. It's neither maintained nor developed anymore.\n=======\n\nGainput [![Build Status](https://travis-ci.org/jkuhlmann/gainput.png?branch=master)](https://travis-ci.org/jkuhlmann/gainput) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n=======\n\nGainput is the awesome C++ input library for your game:\n\n- handles your input needs from low-level device reading to high-level mapping of user-defined buttons\n- well-documented, clean, lightweight, and easy to use\n- a unified interface on all supported platforms: **Android NDK, iOS/tvOS, Linux, macOS, Windows**\n- supported devices: keyboard, mouse, gamepad, multi-touch, device built-in sensors\n- [Open Source (MIT license)](https://github.com/jkuhlmann/gainput/blob/master/LICENSE)\n- [complete list of features](#features)\n- [API documentation](http://gainput.johanneskuhlmann.de/api/)\n\n\nUsage\n-----\n\n```cpp\n#include \u003cgainput/gainput.h\u003e\n\nenum Button\n{\n\tButtonConfirm\n};\n\ngainput::InputManager manager;\nmanager.SetDisplaySize(displayWidth, displayHeight);\nconst gainput::DeviceId keyboardId = manager.CreateDevice\u003cgainput::InputDeviceKeyboard\u003e();\nconst gainput::DeviceId mouseId = manager.CreateDevice\u003cgainput::InputDeviceMouse\u003e();\nconst gainput::DeviceId padId = manager.CreateDevice\u003cgainput::InputDevicePad\u003e();\nconst gainput::DeviceId touchId = manager.CreateDevice\u003cgainput::InputDeviceTouch\u003e();\n\ngainput::InputMap map(manager);\nmap.MapBool(ButtonConfirm, keyboardId, gainput::KeyReturn);\nmap.MapBool(ButtonConfirm, mouseId, gainput::MouseButtonLeft);\nmap.MapBool(ButtonConfirm, padId, gainput::PadButtonA);\nmap.MapBool(ButtonConfirm, touchId, gainput::Touch0Down);\n\nwhile (running)\n{\n\tmanager.Update();\n\n\t// May need some platform-specific message handling here\n\n\tif (map.GetBoolWasDown(ButtonConfirm))\n\t{\n\t\t// Confirmed!\n\t}\n}\n```\n\n\nFeatures\n--------\n\n- Offers a **unified interface** on all supported platforms. (Some minor changes are necessary to setup the library.)\n- Provides a low-level and high-level interface: Query the state of input devices buttons directly or map device buttons to a user button. That way it's easy to support alternative inputs or change the **input mappings** around later.\n- Supports **recording and playback** of input sequences.\n- Features a **network server** to obtain information on devices and mappings from.\n- Two Gainput instances can **sync device states over the network**. It's also possible to receive **multi-touch inputs from a smartphone**'s regular browser.\n- Completely written in portable **C++**.\n- **No STL** is used. **No exceptions** are thrown. **No RTTI** is used. **No C++11**, and **no boost**.\n- **No weird external dependencies** are used. Relies on the existing platform SDKs.\n- **Easily set up and built** using your favorite IDE/build tool.\n- **Listeners** can be installed both for devices buttons as well as user buttons. That way you are notified when a button state changes.\n- **Gestures** allow for more complex input patterns to be detected, for example double-clicking, pinch/rotation gestures, or holding several buttons simultaneously.\n- An **external allocator** can be supplied to the library so that all memory management is done the way you want it.\n- Supports **raw input** on Linux and Windows.\n- Gamepad rumbling is supported where available.\n- It's easy to check for all pressed buttons so that offering a way to the players to remap their buttons is easy to implement. Similarly it's easy to save and load mappings.\n- Possibly unnecessary features, like gestures or the network server, are easily disabled.\n- **Dead zones** can be set up for any float-value button.\n- **State changes**, i.e. if a button is newly down or just released, can be checked for.\n\n\nBuilding\n--------\n\nBy default, Gainput is built using [CMake](http://www.cmake.org/).\n\n1. Run `mkdir build`\n1. Run `cmake ..`\n1. Run `make`\n1. The library can be found in `lib/`, the executables in `samples/`.\n\n\nContributing\n------------\n\nEveryone is welcome to contribute to the library. If you find any problems, you can submit them using [GitHub's issue system](https://github.com/jkuhlmann/gainput/issues). If you want to contribute code, you should fork the project and then send a pull request.\n\n\nDependencies\n------------\n\nGainput has a minimal number of external dependencies to make it as self-contained as possible. It uses the platforms' default ways of getting inputs and doesn't use the STL.\n\n\nTesting\n-------\n\nGenerally, testing should be done by building and running Gainput on all supported platforms. The samples in the `samples/` folder should be used in order to determine if the library is functional.\n\nThe unit tests in the `test/` folder are built by the normal CMake build. The executable can be found in the `test/` folder. All build configurations and unit tests are built and run by Travis CI whenever something is pushed into the repository.\n\n\nAlternatives\n------------\n\n- [OIS](https://github.com/wgois/Object-oriented-Input-System--OIS-)\n- [SDL](http://www.libsdl.org/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkuhlmann%2Fgainput","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjkuhlmann%2Fgainput","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkuhlmann%2Fgainput/lists"}