home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
pascal
/
library
/
dos
/
joystick
/
joystick.doc
< prev
next >
Wrap
Text File
|
1989-11-14
|
4KB
|
107 lines
JOYSTICK Unit for Turbo Pascal (JSTICK.ARC)
Public Domain by JonSoft Technologies Inc.
This ARCHIVED file should contain -
JOYSTICK.PAS - the JOYSTICK unit source code
JOYSTICK.TPU - the JOYSTICK unit for TP 5.x (see notes!)
JOYDEMO.PAS - joystick demonstration program
JOYSTICK.DOC - this file!
UP&CMING.DOC - Up & Coming releases from JonSoft Inc.
COPYRITE.DOC - full copyright agreement
** NOTE - JOYSTICK.TPU is for version 5.x (5.0/5.5 etc) of Turbo Pascal
and WILL NOT WORK with Version 4.x without recompilation.
To use with version 4.x, load JOYSTICK.PAS into the editor and recompile it
to disk. This unit WILL NOT WORK with version 3.x or below!!!!!
*** Using JOYSTICK ***
1.1 Initialization
If you are planning to use the joystick unit to retrieve X,Y, and button
values from the joystick only, there is no need to call either of the
initialization procedures.
If you plan to use to 8-position converter routines (HORIZ, VERT- see
procedure listings) then you should call either of the two initialization
procedures.
1.2 Procedure listing
FastInitJS
Initializes the joystick without any messages and without requiring the
joystick to be moved into the corners and the middle. This procedure is
intended only for your personal programs, as not all joysticks will work with
this procedure and very few will work with some adjusting of the joystick.
BetterInitJS ( Range : byte )
Initializes the joystick MUCH more accurately than FastInitJS. Asks the
user if he or she is using a joystick, and sets the variable Joyst to TRUE
or FALSE accordingly. If a joystick is present, asks the user to place the
the joystick in the upper-right-hand corner, center, and lower-left positions,
pressing a button each time.
RANGE specifies the fraction of total distance that the joystick
should approximately cover before producing a reading other than zero in the
Horiz and Vert procedures. For example, a range of 2 specifies that the
joystick should travel 1/2 of the distance from the center to a direction
before producing a reading.
JoyX function (returns BYTE)
Returns the X-coordinate of the joystick.
JoyY function (returns BYTE)
Returns the Y-coordunate of the joystick.
Button1 function (returns BYTE)
Returns 1 if button 1 is pressed, otherwise 0.
Button2 function (returns BYTE)
Returns 1 if button 2 is pressed, otherwise 0.
Horiz function (returns SHORTINT)
Returns -1 if the joystick is LEFT of the center, 0 if it is in the center,
and 1 is it is RIGHT of the center.
Vert function (returns SHORTINT)
Returns -1 if the joystick is ABOVE the center, 0 is it is in the center,
and 1 if it is BELOW the center.
Horiz and Vert are useful in arcade games and other programs where the
program must only know which general direction the joystick is pointing.
1.3 Variables
CentX - byte; returns the X-center of the joystick; set on
initialization.
CentY - byte; returns the Y-center of the joystick; set on
initialization.
JoySt - boolean; return TRUE if a joystick was found upon initialization,
FALSE otherwise. Defaults to TRUE.
LET ME KNOW!!!!
Let me know what you think of this and other JonSoft products. Write to:
JonSoft Technologies Inc.
741 Daffodil Way
Concord, CA 94518-2341
Or, write to Jonathan Suite via E-Mail :
CompuServe : 72377,2463
PC-Link : FATHER JON
Prodigy : VPFT10B