Git Product home page Git Product logo

Comments (3)

sulix avatar sulix commented on August 14, 2024

I've added the SDL_gamecontroller header to the API class: it shouldn't be hard to make the GamePad class in OpenTK wrap that. Otherwise, the (far more hacky) solution would just be to expose the API class directly and use if for MonoGame.

The SDL_GameController API lets you access the bindings to the underlying joystick directly, so it should be easy to add axis flipping if needed, or even to fall back to using the MonoGame gamepad config.

I'll leave implementing it up to you: my gamepad is so old it plugs into a SoundBlaster 16. You'll need to wrap any SDL call in a lock(API.sdl_api_lock) block, but other than that it should be pretty straightforward.

-- David

from opentk-sdl2.

sulix avatar sulix commented on August 14, 2024

Okay, there's an early revision of GamePad support in the opentk-sdl2 MonoGame branch. It didn't detect the joystick I plugged in, but I probably just stuffed up my SDL_CONTROLLERCONFIG env var.

I haven't implemented OpenTK's GamePad interface, but rather just opened up the raw SDL API to MonoGame. Hacky? Yes! At the moment only recognized SDL GameControllers should work (and even then, it't totally untested). I've vague plans to have it simply use the Joystick API and grab configs from GameController if they're around, but for now I'll stick with this.

If you want to give it a go, it all compiles and runs with Codename lolno. It'll spit a fair bit of debug to stdout, and hopefully it won't crash if it actually detects a controller it likes.

I'll see if I can fix it up later, but for the moment GamePad support is pretty low on the priority list.

-- David

from opentk-sdl2.

sulix avatar sulix commented on August 14, 2024

Fixed a crash issue with the raw bindings in the API class (can't wait to switch to SDL2#) We can detect controllers from Steam Big Picture now, though nothing actually works once they're done.

from opentk-sdl2.

Related Issues (2)

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.