2010-05-12

More on Joysticks

Slowly working through the Options menu. I really hate UI design.

The good news is the UK election is sorted. I'm not convinced it will last more than a couple of years, and things aren't exactly how I'd like them, but they'll do. We shouldn't be running off invading any more countries illegally for the time being anyway. :oP


Anyway, Joysticks.
I have Joystick support implemented and working. It feels fine to me, but I don't like joystick controls on this sort of game personally.
I edited the OpenTK source to implement it in the end with a semi-clumsy hack.
I'm fairly certain it's badly optimised, but it work for now. I'm not looking to break any optimisation records with Hoshi. ;o)

I'm not extensively testing it. Random unplugs etc are undefined. It's mostly there as a testbed for future projects among which will probably be platformers, for which joystick support is a must.

4 comments:

  1. This is probably pretty random, but you are the best source I have found in like a week of searching.

    Basically, I'm working on a pretty simple shooter game using OpenTK and C#. I haven't had much of a problem getting things to work, although while trying to add joystick support I have hit a complete wall. You seem to have hit and overcome the same issue..

    What have you done to get joystick support working? I can't get the events (OnButtonDown, OnMove, ...) to fire for anything, and trying to manually check the button state returns everything as not pressed every time. It's pretty frustrating because it correctly detects the number of axises and buttons.

    It would be awesome if you could point me the right direction on this :)

    Anyway, keep up the good work on your game a month thing you got goin on. That's a pretty cool idea that I might end up borrowing :D

    ReplyDelete
  2. You need to recompile the OpenTK source code.
    Open GameWindow.cs and add InputDriver.Poll(); just before OnUpdateFrameInternal(update_args);
    That's on line 452 in svn revision 2701, I'm not sure where it is in the RC source.

    After that, you need to use your new DLL instead of the old one and it should 'just work'.

    If you can't manage to recompile it, then download Hoshi (http://codedrops.blogspot.com/2010/05/hoshi-release.html) and use the version of OpenTK supplied with that.

    ReplyDelete
  3. OMG dude (or chick? sorry I don't even know who you are at all :P), I could give you like a million hugs or something right now :)

    This stuff has been a hobby for a long time, but it's my first experience using OpenTK (or even OpenGL for that matter), so this *really* helped.

    I'll remember you and hopefully be able to pay you back one day :)

    ReplyDelete
  4. Thanks so much for a working dll for joystick support !

    ReplyDelete