Results 1 to 2 of 2

Thread: TBDI - Test script

  1. #1

    TBDI - Test script

    Hi folks,

    here is a little test script, so you can see which command returns what value:

    [code=thinbasic]'
    ' TBDI Demoscript : Read Joystick
    '
    ' Michael Hartlef 2007
    '

    Uses "TBGL"
    Uses "UI"
    Uses "TBDI"

    dim hWnd as dword
    dim i,j as integer

    MSGBOX 0, "Welcome to the TBDI module demonstration"+$LF+$LF+"It reads all values of a connected joystick", %MB_ICONINFORMATION, "TBDI demo"

    hWnd = TBGL_CreateWindow("Read Joystick - press ESC to quit") ' Creates OpenGL window, it returns handle
    TBGL_ShowWindow ' Shows the window

    Tbgl_LoadBMPFont App_SourcePath+"TBGL_Font.bmp" ' Loads texture for font

    GetAsyncKeyState(%VK_ESCAPE) ' Resets ESC key status before checking
    tbdi_joysetdeadzonexyz(50)
    while IsWindow(hWnd)

    TBGL_ClearFrame ' Prepares clear frame

    TBGL_Camera 0,0,5,0,0,0 ' Setups camera to look from 0,0,5 to 0,0,0
    TBGL_ResetMatrix ' Important before printing on screen !

    TBGL_Color 255,128,0
    tbgl_printBMP "TBDI_JoyX= "+str$(tbdi_joyX),1,1
    TBGL_Color 0,0,255
    tbgl_printBMP "TBDI_JoyY= "+str$(tbdi_joyY),1,2
    TBGL_Color 255,128,0
    tbgl_printBMP "TBDI_JoyZ= "+str$(tbdi_joyz),1,3

    TBGL_Color 0,0,255
    tbgl_printBMP "TBDI_JoyRX= "+str$(tbdi_joyrX),1,5
    TBGL_Color 255,128,0
    tbgl_printBMP "TBDI_JoyRY= "+str$(tbdi_joyrY),1,6
    TBGL_Color 0,0,255
    tbgl_printBMP "TBDI_JoyRZ= "+str$(tbdi_joyrZ),1,7

    TBGL_Color 0,0,255
    tbgl_printBMP "TBDI_JoyPOV(1)= "+str$(tbdi_joypov(1)),1,9
    TBGL_Color 255,128,0
    tbgl_printBMP "TBDI_JoyPOV(2)= "+str$(tbdi_joypov(2)),1,10
    TBGL_Color 0,0,255
    tbgl_printBMP "TBDI_JoyPOV(3)= "+str$(tbdi_joypov(3)),1,11
    TBGL_Color 255,128,0
    tbgl_printBMP "TBDI_JoyPOV(4)= "+str$(tbdi_joypov(4)),1,12

    TBGL_Color 0,0,255
    tbgl_printBMP "TBDI_JoySlider(1)= "+str$(tbdi_joyslider(1)),1,14
    TBGL_Color 255,128,0
    tbgl_printBMP "TBDI_JoySlider(2)= "+str$(tbdi_joyslider(2)),1,15

    TBGL_Color 0,0,255
    tbgl_printBMP "TBDI_JoyAvail= "+str$(TBDI_JoyAvail),1,17
    TBGL_Color 255,128,0
    tbgl_printBMP "TBDI_JoyCountBtn= "+str$(TBDI_JoyCountBtn),1,18
    TBGL_Color 0,0,255
    tbgl_printBMP "TBDI_JoyCountAxes= "+str$(TBDI_JoyCountAxes),1,19
    TBGL_Color 255,128,0
    tbgl_printBMP "TBDI_JoyCountPOV= "+str$(TBDI_JoyCountPOV),1,20
    'TBGL_Color 0,0,255
    'tbgl_printBMP "TBDI_JoyHasFF= "+str$(TBDI_JoyHASFF),1,21
    j = 0
    for i = 1 to tbdi_joycountbtn
    TBGL_Color 255,128,0
    if tbdi_joybutton(i) then
    tbgl_printBMP "TBDI_JOYBUTTON("+str$(i)+")= "+str$(TBDI_Joybutton(i)),1,23+j
    j = j + 1
    end if
    next


    TBGL_DrawFrame ' Swaps the buffers - displays rendered image

    if GetAsyncKeyState(%VK_ESCAPE) then exit while


    wend

    TBGL_DestroyWindow ' Closes OpenGL window

    MSGBOX 0, "This is the end", %MB_ICONINFORMATION or %MB_TOPMOST, "TBDI demo"
    [/code]

    Please copy the TBGL font into the scripts folder.
    Attached Files Attached Files

  2. #2
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: TBDI - Test script

    Thanks Mike. worked nicely. Fun to click and see all the changes. I got an idea already for a quick project now using your new module!!

    Hopefully I can get it done tonight.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

Similar Threads

  1. Re: TBDI Test Program, Robot Arm
    By kryton9 in forum TBDI module. thinBasic Direct Input integration by MikeHart
    Replies: 10
    Last Post: 22-03-2007, 08:08

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
  •