home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / joystk12 / jsample.frm < prev    next >
Text File  |  1994-01-18  |  5KB  |  141 lines

  1. VERSION 2.00
  2. Begin Form JSample 
  3.    Caption         =   "Joystick Sample"
  4.    ClientHeight    =   5070
  5.    ClientLeft      =   1515
  6.    ClientTop       =   1755
  7.    ClientWidth     =   8175
  8.    Height          =   5475
  9.    Left            =   1455
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5070
  12.    ScaleWidth      =   8175
  13.    Top             =   1410
  14.    Width           =   8295
  15.    Begin Timer Timer1 
  16.       Interval        =   1000
  17.       Left            =   7560
  18.       Top             =   3120
  19.    End
  20.    Begin Joystick Joystick1 
  21.       Enabled         =   0   'False
  22.       Left            =   3360
  23.       Top             =   240
  24.    End
  25.    Begin CommandButton Command1 
  26.       Caption         =   "Capture Joystick"
  27.       Height          =   315
  28.       Left            =   2580
  29.       TabIndex        =   3
  30.       Top             =   1920
  31.       Width           =   1785
  32.    End
  33.    Begin Label Label6 
  34.       Caption         =   "The property named Period is used to set the amount of time in milliseconds that the joystick driver uses for checking position and button status. The other properties should be more-or-less obvious. You can expirement by setting Capture to True in the Properties Window and changing/observing the other properties. Good Luck!"
  35.       Height          =   915
  36.       Left            =   210
  37.       TabIndex        =   8
  38.       Top             =   4020
  39.       Width           =   7785
  40.    End
  41.    Begin Label Label5 
  42.       Caption         =   "Joystick_ButtonUp( Button As Integer )"
  43.       Height          =   285
  44.       Left            =   480
  45.       TabIndex        =   7
  46.       Top             =   3600
  47.       Width           =   6675
  48.    End
  49.    Begin Label Label4 
  50.       Caption         =   "Joystick_ButtonDown( Button As Integer )"
  51.       Height          =   285
  52.       Left            =   480
  53.       TabIndex        =   6
  54.       Top             =   3180
  55.       Width           =   6585
  56.    End
  57.    Begin Label Label2 
  58.       Caption         =   "Joystick_Move( X As Integer, Y As Integer, Z As Integer)"
  59.       Height          =   285
  60.       Left            =   480
  61.       TabIndex        =   5
  62.       Top             =   2760
  63.       Width           =   6555
  64.    End
  65.    Begin Label Label1 
  66.       Caption         =   "Once the joystick has been captured there are three events that may be generated:"
  67.       Height          =   285
  68.       Index           =   2
  69.       Left            =   240
  70.       TabIndex        =   4
  71.       Top             =   2340
  72.       Width           =   7755
  73.    End
  74.    Begin Label Label1 
  75.       Caption         =   "Before the control will generate events, or update the position properties you must enable it by setting Capture to True. Press the following button to set Capture to True/False. "
  76.       Height          =   495
  77.       Index           =   1
  78.       Left            =   210
  79.       TabIndex        =   2
  80.       Top             =   1350
  81.       Width           =   7815
  82.    End
  83.    Begin Label Label1 
  84.       Caption         =   "JOYSTK.VBX contains a fully functional joystick control. Using this control you can easily  respond to joystick movements and button presses."
  85.       Height          =   495
  86.       Index           =   0
  87.       Left            =   210
  88.       TabIndex        =   1
  89.       Top             =   720
  90.       Width           =   7785
  91.    End
  92.    Begin Label Label3 
  93.       Caption         =   "Joystick Control"
  94.       FontBold        =   -1  'True
  95.       FontItalic      =   0   'False
  96.       FontName        =   "MS Sans Serif"
  97.       FontSize        =   18
  98.       FontStrikethru  =   0   'False
  99.       FontUnderline   =   0   'False
  100.       Height          =   495
  101.       Left            =   240
  102.       TabIndex        =   0
  103.       Top             =   150
  104.       Width           =   2925
  105.    End
  106. End
  107.  
  108. Sub Command1_Click ()
  109.     Joystick1.Enabled = Not Joystick1.Enabled
  110.     If (Joystick1.Enabled) Then
  111.         Command1.Caption = "Release Joystick"
  112.     Else
  113.         Command1.Caption = "Capture Joystick"
  114.     End If
  115. End Sub
  116.  
  117. Sub Form_Load ()
  118.     JSample.Top = (Screen.Height - JSample.Height) / 2
  119.     JSample.Left = (Screen.Width - JSample.Width) / 2
  120. End Sub
  121.  
  122. Sub Joystick1_ButtonDown (button As Integer)
  123.     Label4.Caption = "Joystick_ButtonDown(" & Str(button) & " )"
  124.     Label4.ForeColor = RGB(255, 0, 0)
  125. End Sub
  126.  
  127. Sub Joystick1_ButtonUp (button As Integer)
  128.     Label5.Caption = "Joystick_ButtonUp(" & Str(button) & " )"
  129.     Label5.ForeColor = RGB(255, 0, 0)
  130. End Sub
  131.  
  132. Sub Joystick1_Move (x As Integer, y As Integer, z As Integer)
  133.     Label2.Caption = "Joystick1_Move(" & Str(x) & "," & Str(y) & "," & Str(z) & ")"
  134. End Sub
  135.  
  136. Sub Timer1_Timer ()
  137.     Label4.ForeColor = 0
  138.     Label5.ForeColor = 0
  139. End Sub
  140.  
  141.