Skip to content
A basic SDL input wrapper for supportinf dynamic control reassignments
C C++ Makefile
Find file
Latest commit 16a9204 Jun 12, 2015 @TheJosh Update
Failed to load latest commit information.
example First version May 30, 2013
src First version May 30, 2013
LICENSE Update LICENSE May 31, 2013
Makefile First version May 30, 2013 Update Jun 12, 2015
docs.txt First version May 30, 2013


A basic SDL input wrapper for supporting dynamic control reassignments

When you start a game, you think about controls in a very direct way - A = move left, D = move right, for example. This is a problem if you would like to have more complcated control schemes and/or dynamic controls.

Instead of implementing dynamic controls as a big (even more complex) switch statement, I tried to solve the problem in a more abstract manner, thus SDL_input.

It's a C++ wrapper around the event structures.

Intead of thinking mouse moves and key presses, you instead think the final variables you care about, such as float player_x or bool player_jumping and then allow SDL_input to map the controls to the values for you.

How it works

You define one or more Profiles. These can be enabled and disabled at will.

Each profile contains one or more Bindings. These bindings have a type and a source.

The type can be one of:

  • onoff - binary, is the key/mouse button currently pressed
  • toggle - binary, toggles on each key press/mouse button press
  • absolute value - increments/decrements according to movement
  • relative value - represents how much movement has happened since last update

The binding sources can be key presses, mouse button clicks and mouse axises. Joystick and gamepad support is planned.

Interestingly, some odd bindings are possible, such as binding a pair of keys to an absolute or relative value. They will then behave as a simulated mouse axis.

Something went wrong with that request. Please try again.