Giter Club home page Giter Club logo

sdl-input's Introduction

Development status: alpha (sdli::Device breaking overhauls are unlikely to happen.) Version: 0.1a

Goals of the library

  • Easy integration
  • Clear, self-explaining usage interface
  • Multiplayer input handling in mind
  • Game-Development in mind
  • Extensible interfaces

Compiler support

  • Clang (Requirement for 'master' and 'develop' branch)
  • gcc (Requirement for 'master' branch)
  • MinGW-w64 (untested - next version probally)
  • VS13 MSVC (planned - untested)

Branches

  • master: stable build, will contain flags once first working release is out
  • develop: contains the latest compile-able version, mostly untested by other people or lacking test code

Conceptual (move to wiki later)

  • Processor: represent an interface used by your game engine to get devices and create new contexts. Also handles sdl events. (You can use callbacks to add new functionality to events)
  • Device: a handle for the user to interact with the interface, allows disconnected/reconnected devices to work properly
  • Interface: represents a single input device (controller/gamepad, mouse+keyboard)
  • Context: represents a contextual mapping of a input device
  • A device requires an active context (default is no context - as no mapping)
  • It is highly advised to use enums (or enum class) as arguments for InputAction, InputAxis, ContextId

Implementation statistics

  • Keyboard support [80%] - Lacking: Key-polling for non-axes
  • Gamecontroller support [90%] - Lacking multi-controller (One device for any controller)
  • Joystick support [0%]
  • Mouse support [10%] - generally untested but in work

See samples/ for intended usage. Especially samples/usage

If you find anything lacking tickets, patches and contribution are welcome. (Especially once I start optimization phase.) Multiple library support may be added if concepts are not broken by doing so. (glfw, sfml, mostly requires passing functions)

sdl-input's People

Contributors

hatigamedev avatar

Stargazers

 avatar Michael Dale Long avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

00mjk

sdl-input's Issues

Poll axes

SDL events do not properly fire events representing the current state.
Therefore it is required to poll axes every frame, and interpolate every dispatch.

Axes always return vec2

On axis get always return a 2d-vector (assuming we don't get proper 3-dimensional input devices soon)

Device: dispatch

dispatching currently does not work correctly.

standard is poll (dispatch is collecting events via push and handle them all at once, rather than pull all events - mainly useful for buttons/keystrokes)

Decouple from SDL

After looking into other input libraries I may decouple this library from SDL2.
This is ofc a greater task and needs more active testing and documentation.

Thus this won't happen before version 1.0 (release).

32-bitness

Fix ints and all unbounded values to 32-bit. actions, indexes, etc.

Double assigned actions not firing properly

ctx->mapButton(SDL_SCANCODE_W, ::Jump);
ctx->mapButton(SDL_SCANCODE_SPACE, ::Jump);

Is not working as expected:
Expectation: Able to jump with Space or W

Behaviour:
Only the latest definition is usable and behaving correctly

InputMultiplexer

Multiple contexts can be "active" at once,
the head-input gets handled first, and if pass-through is enabled - it will use the second and so on..

might be useful - needs evaluation

Mono device

Enabling the user to have one device, to actually represent any device.
So you can create one greater context for keyboard, gamecontrollers, mouse and other devices you want to support.
Making it easier to write code for it. (Current approach is to support multiple interfaces in a single device.)

Hugest problem is how to handle axes with this approach.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.