All Projects → jkuhlmann → Gainput

jkuhlmann / Gainput

Licence: mit
Cross-platform C++ input library supporting gamepads, keyboard, mouse, touch

Projects that are alternatives of or similar to Gainput

Inputsystem
An efficient and versatile input system for Unity.
Stars: ✭ 1,013 (+59.28%)
Mutual labels:  gamepad, keyboard, mouse, input
Simplexrpgengine
Modular game engine built with MonoGame, with GMS2-like workflow and advanced level editor
Stars: ✭ 122 (-80.82%)
Mutual labels:  game-engine, engine, games
Obengine
2D Game Engine with Lua Scripting made on top of SFML !
Stars: ✭ 335 (-47.33%)
Mutual labels:  cmake, game-engine, engine
Engine
A basic cross-platform 3D game engine
Stars: ✭ 208 (-67.3%)
Mutual labels:  cmake, game-engine, engine
Enigo
Cross platform input simulation in Rust
Stars: ✭ 254 (-60.06%)
Mutual labels:  keyboard, mouse, input
Key Mapper
🎮 An easy to use tool to change the mapping of your input device buttons.
Stars: ✭ 184 (-71.07%)
Mutual labels:  gamepad, mouse, input
Openage
Free (as in freedom) open source clone of the Age of Empires II engine 🚀
Stars: ✭ 10,712 (+1584.28%)
Mutual labels:  cmake, game-engine, engine
Xray 16
Improved version of the X-Ray Engine, the game engine used in the world-famous S.T.A.L.K.E.R. game series by GSC Game World. Join OpenXRay! ;)
Stars: ✭ 1,806 (+183.96%)
Mutual labels:  cmake, game-engine, engine
openinput
Open source firmware for input devices
Stars: ✭ 43 (-93.24%)
Mutual labels:  keyboard, input, mouse
Fabgl
Display Controller (VGA, SSD1306, ST7789, ILI9341), PS/2 Mouse and Keyboard Controller, Graphics Library, Sound Engine, Game Engine and ANSI/VT Terminal for the ESP32
Stars: ✭ 534 (-16.04%)
Mutual labels:  game-engine, keyboard, mouse
input-remapper
🎮 An easy to use tool to change the mapping of your input device buttons.
Stars: ✭ 1,142 (+79.56%)
Mutual labels:  keyboard, mouse, gamepad
Neatinput
A .NET standard project which aims to make keyboard and mouse input monitoring easy on Windows and eventually Linux.
Stars: ✭ 89 (-86.01%)
Mutual labels:  keyboard, mouse, input
CLUSEK-RT
Vulkan based C++ ray-tracing game engine.
Stars: ✭ 24 (-96.23%)
Mutual labels:  cmake, game-engine, engine
Opendiablo2
An open source re-implementation of Diablo 2
Stars: ✭ 10,057 (+1481.29%)
Mutual labels:  game-engine, engine, games
YetAnotherKeyDisplayer
The application for displaying pressed keys of the keyboard
Stars: ✭ 88 (-86.16%)
Mutual labels:  keyboard, games, mouse
LowLevelInput.Net
A thread safe and event driven LowLevelMouse and LowLevelKeyboard Hook
Stars: ✭ 32 (-94.97%)
Mutual labels:  keyboard, input, mouse
input-event
🎹 Read and parse input device(like mouse, keyboard, joystick and IR-Remote)'s event data.
Stars: ✭ 45 (-92.92%)
Mutual labels:  keyboard, input, mouse
Friceengine
🎮 JVM game engine based on Swing/JavaFX.
Stars: ✭ 330 (-48.11%)
Mutual labels:  game-engine, engine
Games
🎮 A list of popular/awesome video games, add-ons, maps, etc. hosted on GitHub. Any genre. Any platform. Any engine.
Stars: ✭ 18,676 (+2836.48%)
Mutual labels:  game-engine, games
Magnum
Lightweight and modular C++11 graphics middleware for games and data visualization
Stars: ✭ 3,728 (+486.16%)
Mutual labels:  cmake, game-engine

Gainput Build Status MIT licensed

Gainput is the awesome C++ input library for your game:

  • handles your input needs from low-level device reading to high-level mapping of user-defined buttons
  • well-documented, clean, lightweight, and easy to use
  • a unified interface on all supported platforms: Android NDK, iOS/tvOS, Linux, macOS, Windows
  • supported devices: keyboard, mouse, gamepad, multi-touch, device built-in sensors
  • Open Source (MIT license)
  • complete list of features
  • API documentation

Usage

#include <gainput/gainput.h>

enum Button
{
	ButtonConfirm
};

gainput::InputManager manager;
manager.SetDisplaySize(displayWidth, displayHeight);
const gainput::DeviceId keyboardId = manager.CreateDevice<gainput::InputDeviceKeyboard>();
const gainput::DeviceId mouseId = manager.CreateDevice<gainput::InputDeviceMouse>();
const gainput::DeviceId padId = manager.CreateDevice<gainput::InputDevicePad>();
const gainput::DeviceId touchId = manager.CreateDevice<gainput::InputDeviceTouch>();

gainput::InputMap map(manager);
map.MapBool(ButtonConfirm, keyboardId, gainput::KeyReturn);
map.MapBool(ButtonConfirm, mouseId, gainput::MouseButtonLeft);
map.MapBool(ButtonConfirm, padId, gainput::PadButtonA);
map.MapBool(ButtonConfirm, touchId, gainput::Touch0Down);

while (running)
{
	manager.Update();

	// May need some platform-specific message handling here

	if (map.GetBoolWasDown(ButtonConfirm))
	{
		// Confirmed!
	}
}

Features

  • Offers a unified interface on all supported platforms. (Some minor changes are necessary to setup the library.)
  • 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.
  • Supports recording and playback of input sequences.
  • Features a network server to obtain information on devices and mappings from.
  • 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.
  • Completely written in portable C++.
  • No STL is used. No exceptions are thrown. No RTTI is used. No C++11, and no boost.
  • No weird external dependencies are used. Relies on the existing platform SDKs.
  • Easily set up and built using your favorite IDE/build tool.
  • Listeners can be installed both for devices buttons as well as user buttons. That way you are notified when a button state changes.
  • Gestures allow for more complex input patterns to be detected, for example double-clicking, pinch/rotation gestures, or holding several buttons simultaneously.
  • An external allocator can be supplied to the library so that all memory management is done the way you want it.
  • Supports raw input on Linux and Windows.
  • Gamepad rumbling is supported where available.
  • 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.
  • Possibly unnecessary features, like gestures or the network server, are easily disabled.
  • Dead zones can be set up for any float-value button.
  • State changes, i.e. if a button is newly down or just released, can be checked for.

Building

By default, Gainput is built using CMake.

  1. Run mkdir build
  2. Run cmake ..
  3. Run make
  4. The library can be found in lib/, the executables in samples/.

Contributing

Everyone is welcome to contribute to the library. If you find any problems, you can submit them using GitHub's issue system. If you want to contribute code, you should fork the project and then send a pull request.

Dependencies

Gainput 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.

Testing

Generally, 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.

The 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.

Alternatives

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].