A wrapper around SDL2's game controller API.

Overview

fishsticks

Apache-2.0 OR MIT

System for handling gamepad input, using SDL2's game controller API as the backend.

License

Fishsticks is dual-licensed under either

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Comments
  • Add an Error type

    Add an Error type

    I have introduced an error type in FishFight, so that we can convert remote errors into this type, to make it less of a hassle to work with all the various Error types in the various dependencies. It would therefore be helpful to have an Error type in fishsticks, so that I can set the appropriate ErrorKind for these errors in the From implementation used to convert into FishFight error. This does not need to be anything comprehensive; I believe a type Error = &'static str will suffice.

    I'll create a PR for this

    enhancement 
    opened by olefasting 2
  • add From implementation to GamepadId so that id can be used for indexing etc

    add From implementation to GamepadId so that id can be used for indexing etc

    This adds a From<&GamepadId> implementation to usize so that we can use the index to look up sets of gamepad button mappings, among other things.

    opened by olefasting 1
  • Publishing to crates.io

    Publishing to crates.io

    @PotatoTech

    I want to publish rust-rpg-toolkit to crates.io but that is currently not possible as they do not allow crates to have git as the sole source for any of their dependencies.

    I made some additions to Cargo.toml in #15, in preparation for publishing and if you have no objections to publishing now, I can do it, as I have everything set up for it. As it is your project, you might want to do it yourself, though, so you get ownership...

    question 
    opened by olefasting 1
  • Stop exposing references to gamepads

    Stop exposing references to gamepads

    Right now, users query the gamepad context for references to gamepads, which they then query for input state. This makes it difficult to support multiple backends with different gamepad types, as some (e.g. gilrs) have lifetimes, while others (e.g. SDL2) do not. We do not want users to deal with unnecessary lifetimes just because one implementation requires them. A better way is to eliminate all public gamepad references and just have users query the gamepad context directly for input state.

    refactor 
    opened by PotatoTech 1
  • Add gilrs implementation

    Add gilrs implementation

    Now that the backend and the public API are more loosely coupled, we should implement gilrs as a second backend. People who do not want to depend on SDL2 just for its game controller subsystem could use this instead.

    enhancement 
    opened by PotatoTech 1
  • Make SDL2 an optional dependency

    Make SDL2 an optional dependency

    Previously, users choosing the gilrs implementation were forced to compile SDL2, even when it was not used. Now, they can avoid this by disabling default features.

    opened by PotatoTech 0
  • Add gilrs implementation

    Add gilrs implementation

    Fixes #7.

    This addresses the lifetime issue described in #12 but uses an alternative solution. We only store the implementation gamepads if the implementation requires us to own them, as is the case with SDL2. If the implementation owns and manages its gamepads, as is the case with gilrs, then we have no need to store them, since we can just query the implementation's context to retrieve references to the gamepads.

    opened by PotatoTech 0
  • Allow users to set custom deadzones

    Allow users to set custom deadzones

    Currently, the deadzones for analog inputs are fixed. There should be a way for users to customize them. This could be done when they initialize the GamepadContext, or it could be done by calling a method on the context.

    enhancement 
    opened by PotatoTech 0
  • Move backend behind an interface

    Move backend behind an interface

    Fixes #5.

    I left Axis and Button public for the sake of simplicity, but they can be placed behind wrappers in the future if we want to support users changing the backend arbitrarily.

    GamepadId is public as well, but the SDL2 implementation already defines it as a wrapper anyways, and I saw no reason to put a wrapper around a wrapper. One alternative is to define a type alias in the implementation instead of a wrapper. Then, GamepadId can be defined in the crate root as a wrapper around the implementation's id.

    opened by PotatoTech 0
  • Create an interface that can support multiple backends

    Create an interface that can support multiple backends

    Currently, the library only supports using SDL2 as the backend. To support other backends, such as gilrs, Gamepad and GamepadContext should act upon an interface that abstracts away the backends.

    opened by PotatoTech 0
  • Improve Analog API

    Improve Analog API

    Fixes #1.

    • Analog interface now returns only f32 and Option<f32>
    • Added methods for treating analog inputs like digital values
      • Digital methods use a separate deadzone
    opened by PotatoTech 0
  • We should create an interface for Axis

    We should create an interface for Axis

    I am doing some testing with WASM and I noticed that the Axis type, used as argument to [..]::digital_value varies from backend to backend.

    We should probably create a common enum type that can be used in our API and, if needed, be converted to the appropriate type by the individual backends, in stead of using generics.

    enhancement 
    opened by olefasting 3
  • Investigate SDL2 WebAssembly support

    Investigate SDL2 WebAssembly support

    The library does not compile when targeting wasm32-unknown-unknown and using SDL2. The C library can compile to WASM via Emscripten, so it should be possible to make it work.

    enhancement help wanted 
    opened by PotatoTech 1
Owner
null
A Rust wrapper and bindings of Allegro 5 game programming library

RustAllegro A thin Rust wrapper of Allegro 5. Game loop example extern crate allegro; extern crate allegro_font; use allegro::*; use allegro_font::*;

null 80 Dec 31, 2022
A simple example showcasing how to use Bevy to display a square with acceleration (controllable with your keyboard) that wraps around the screen!

Bevy Wrapping Square example A simple example showcasing how to use Bevy to display a square with acceleration (controllable with your keyboard) that

Luciano Mammino 3 Oct 23, 2022
Victorem - easy UDP game server and client framework for creating simple 2D and 3D online game prototype in Rust.

Victorem Easy UDP game server and client framework for creating simple 2D and 3D online game prototype in Rust. Example Cargo.toml [dependencies] vict

Victor Winbringer 27 Jan 7, 2023
2-player game made with Rust and "ggez" engine, based on "Conway's Game of Life"

fight-for-your-life A 2-player game based on the "Conway's Game of Life", made with Rust and the game engine "ggez". Create shapes on the grid that wi

Petros 3 Oct 25, 2021
2d Endless Runner Game made with Bevy Game Engine

Cute-runner A 2d Endless Runner Game made with Bevy Game Engine. Table of contents Project Infos Usage Screenshots Disclaimer Project Infos Date: Sept

JoaoMarinho 2 Jul 15, 2022
A tetris game I wrote in rust using ncurses. I'm sure that there's a better way to write a tetris game, and the code may be sus, but it techinically works

rustetris A tetris game I wrote in rust using ncurses. I'm sure that there's a better way to write a tetris game, and the code may be sus, but it tech

Eric G 3 Oct 15, 2022
A game for the game jam "1-Button Jam 2021"

One click ninja A game for the game jam "1-Button Jam 2021" written in Rust with the Bevy engine. A rhythm game, where you play a soldier that can def

Alex Helfet 7 Apr 12, 2022
A game of snake written in Rust using the Bevy game engine, targeting WebGL2

Snake using the Bevy Game Engine Prerequisites cargo install cargo-make Build and serve WASM version Set your local ip address in Makefile.toml (loca

Michael Dorst 0 Dec 26, 2021
Wasm game of life - A Rust and WebAssembly tutorial implementing the Game of Life

wasm_game_of_life Conway's Game of Life in Rust and WebAssembly Contributing | Chat Built with ?? ?? by The Rust and WebAssembly Working Group About T

Rust and WebAssembly 236 Dec 24, 2022
My first attempt at game programming. This is a simple target shooting game built in macroquad.

sergio My first attempt at game programming. This is a simple target shooting game built in macroquad. Rules Hit a target to increase score by 1 Score

Laz 1 Jan 11, 2022
Conway's Game of Life implemented for Game Boy Advance in Rust

game-of-life An implementation of a Conway's Game of Life environment on GBA. The ultimate game should have two modes: Edit and Run mode which can be

Shane Snover 1 Feb 16, 2022
A game made in one week for the Bevy engine's first game jam

¿Quien es el MechaBurro? An entry for the first Bevy game jam following the theme of "Unfair Advantage." It was made in one week using the wonderful B

mike 20 Dec 23, 2022
A Client/Server game networking plugin using QUIC, for the Bevy game engine.

Bevy Quinnet A Client/Server game networking plugin using QUIC, for the Bevy game engine. Bevy Quinnet QUIC as a game networking protocol Features Roa

Gilles Henaux 65 Feb 20, 2023
Managed game servers, matchmaking, and DDoS mitigation that lets you focus on building your game

Managed game servers, matchmaking, and DDoS mitigation that lets you focus on building your game. Home - Docs - Twitter - Discord ?? Features Everythi

Rivet 58 Jun 25, 2023
An immediate mode 2D drawing API for Bevy game engine

Bevy Canvas API prototype An unofficial immediate mode 2D drawing API for Bevy game engine. Check the documentation or the examples to know how to use

Federico Rinaldi 20 Apr 21, 2022
Self Study on developing a game engine using wgpu as the rendering API. Learning as I go.

Fabled Engine Any issues, enhancement, features, or bugs report are always welcome in Issues. The obj branch is where frequent development and up to d

Khalid 20 Jan 5, 2023
🎳 Rust binding and wrapper over NVIDIA PhysX 🦀

?? physx-rs Rust binding and wrapper over NVIDIA PhysX, a popular and mature physics engine particularly well-suited for games. Created and maintained

Embark 489 Dec 29, 2022
A refreshingly simple data-driven game engine built in Rust

What is Bevy? Bevy is a refreshingly simple data-driven game engine built in Rust. It is free and open-source forever! WARNING Bevy is still in the ve

Bevy Engine 21.1k Jan 4, 2023
Rust library to create a Good Game Easily

ggez What is this? ggez is a Rust library to create a Good Game Easily. The current version is 0.6.0-rc0. This is a RELEASE CANDIDATE version, which m

null 3.6k Jan 7, 2023