Results 1 to 10 of 27

Thread: TBDI - DirectInput Joystick module

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    thinBasic MVPs Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Germany
    Age
    58
    Posts
    3,299
    Rep Power
    348

    TBDI - DirectInput Joystick module

    Hi folks,

    I didn't know where to post it so feel free to move it. Here is the first directinput module for joystick support and a text file with the syntax of the 5 commands in it. Just 5, some will ask? Don't worry, I just got PowerBasic to do what I want.

    I thought I needed a conversion of a C macro but no, I had false examples. After a look inside the MS SDK docu I found the bug and voila, now joystick behaves like a good boy. I would like you to test it temporary inside TopDown and let me know if it works or crashes. Before someone asks, copy the DLL inside the thinBasic lib folder.

    After more tests are done and I added more stuff to it, I will ask Eros to include this module into the official distribution and hand it over to him.

    Here is some code that has to be added to TopDown:

    [code=thinbasic] USES "TBDI"
    '...
    DIM But1 as integer
    dim direturn as long
    dim joyX as integer
    dim joyY as integer
    ...
    'Initialize DirectInput Joystick support
    direturn = tbdi_init(0)
    '...
    'Check the state of both axxis and the button no.1
    joyX = tbdi_joyX
    joyY = tbdi_joyy
    but1 = tbdi_joybutton(1)
    '...

    if GetAsyncKeyState(%VK_SPACE) or but1 then
    '...
    if GetAsyncKeyState(%VK_UP) or joyY < 0 then
    '...
    if GetAsyncKeyState(%VK_DOWN) or joyY> 0 then
    '...
    'Don't forget to release the joystick
    tbdi_close
    [/code]

    I think it is easy to use, or? I hope it works on your machines.

    Cheers
    Michael Hartlef
    Attached Files Attached Files

Similar Threads

  1. So how do you get along with the TBDI module?
    By Michael Hartlef in forum TBDI module. thinBasic Direct Input integration by MikeHart
    Replies: 36
    Last Post: 30-08-2007, 09:07

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •