Small Basic Joystick / Game Controller Extension v0.3

Discussion Small Basic Joystick / Game Controller Extension v0.3

  • Wednesday, August 08, 2012 3:50 AM
    Answerer
     
     

    I have written an extension to use any joystick / game controller / racing wheel / etc. with Small Basic. It is pretty slow as is, so optimizations should be coming soon. It is written in C# with SlimDX, a wrapper for DirectX with managed code. I welcome anyone to decompile and improve upon it. I have added XML documentation, so parameters, returns, etc. will be built in to Small Basic. Suggestions are also welcome.

    Download link: http://www.mediafire.com/download.php?qbbt7j2m23gruzn and prerequisite:  http://slimdx.googlecode.com/files/SlimDX%20Runtime%20.NET%202.0%20%28January%202012%29.msi.

    Beginners can use the  JoystickForSmallBasic class while more advanced users can use the MUCH faster JoystickForSmallBasicAdvanced class (just don't foget to Acquire() at the beginning and Unacquire() at the end if you use the advanced version).

    Also, please be warned that the extension does not set a Cooperative Level with other DirecX input devices, so keyboard and mouse input may be interrupted while information is being retrieved from the joystick (this is because SetCooperativeLevel requires calling from a static method).

    (Credit to http://shahardev.blogspot.com/2011/10/talking-to-joysticks-using-slimdx.html for code on how to acquire joysticks)






    • Edited by gungan37Editor Sunday, August 12, 2012 3:15 AM Corrected "DirecX" to "DirectX"
    •  

All Replies

  • Wednesday, August 08, 2012 4:25 AM
    Answerer
     
     

    any Idea what this is?


    Zock77


    • Edited by Zock77Editor Wednesday, August 08, 2012 4:25 AM
    •  
  • Wednesday, August 08, 2012 2:07 PM
    Answerer
     
     

    Hi Zock77!

    There are really two possibilities to solve this problem.

    1) Did you copy all 4 files from the Zip archive? All 4 files are necessary.

    2) If copying all the files didn't work, install this http://slimdx.googlecode.com/files/SlimDX%20Runtime%20.NET%202.0%20%28January%202012%29.msi (the prerequisites for SlimDX, the DirectX Wrapper I used).

  • Wednesday, August 08, 2012 4:09 PM
    Answerer
     
     
    That fixed it!! Thanks! i'll use that!

    Zock77


    • Edited by Zock77Editor Wednesday, August 08, 2012 4:11 PM
    •  
  • Wednesday, August 08, 2012 4:37 PM
    Answerer
     
     
    Glad it worked! Was it the first step or the second that fixed it?
  • Wednesday, August 08, 2012 8:08 PM
    Answerer
     
     
    The second

    Zock77

  • Wednesday, August 08, 2012 9:38 PM
    Answerer
     
     

    Is there any way I can make it faster?


    Zock77

  • Wednesday, August 08, 2012 10:33 PM
    Answerer
     
     
    Yes, I can write it so that it does not acquire the joystick then unacquire it after every poll. However, this could cause issues for beginners who do not acquire the joystick first then unacquire it an free its resources afterwards. What I will do (probably this afternoon) is make an advanced version that allows for acquiring / unacquiring to increase speed.
  • Wednesday, August 08, 2012 11:08 PM
    Answerer
     
     
    Version 3 is out now, with a class for advanced users (JoystickForSmallBasicAdvanced) that allows for VERY FAST reading of the game controller. Just don't forget to call Acquire() at the beginning of the program and Unacquire() at the the end. 
  • Thursday, August 09, 2012 1:46 AM
    Answerer
     
     
    How do i get it?

    Zock77

  • Thursday, August 09, 2012 2:35 AM
    Answerer
     
     
    It is in the main thread. The link is http://www.mediafire.com/download.php?qbbt7j2m23gruzn and it contains both the advanced and beginner versions.
  • Thursday, August 09, 2012 4:13 AM
    Answerer
     
     
    PKH977 works pretty well for a test.

    Zock77

  • Thursday, August 09, 2012 4:29 PM
    Answerer
     
     
    Nice test! It works very well. I also have written TextWindow-based FGM626 for my own use when I was developing the extension.