PDA

View Full Version : TBDI - Test script



Michael Hartlef
07-03-2007, 00:20
Hi folks,

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


'
' 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"


Please copy the TBGL font into the scripts folder.

kryton9
07-03-2007, 00:57
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.