Board index » delphi » acessing the joystick from Delphi

acessing the joystick from Delphi

Does any of you guys have a piece of code that uses the joystick
from Delphi? Is it difficult?

Thanx

 

Re:acessing the joystick from Delphi


Quote
leonardo fuks wrote:

> Does any of you guys have a piece of code that uses the joystick
> from Delphi? Is it difficult?

> Thanx

Not difficult from Delphi 1.  I've got a unit somewhere that does it.
Basically the same as in DOS.  Delphi 2 now, that's another matter.

Robb Brown
hrbr...@telusplanet.net

Re:acessing the joystick from Delphi


Actually, with Delphi 2 its a breeze. The following was taken from working
code, so you'll have to adapt it for your own purposes, but it should point
you in the right direction.

var
  myjoy: tjoyinfo;
begin
  joygetpos(joystickid1,@myjoy);
  trackbar1.position := myjoy.wypos;
  trackbar2.position := myjoy.wxpos;
  radiobutton1.checked := (myjoy.wbuttons and joy_button1)>0;
  radiobutton2.checked := (myjoy.wbuttons and joy_button2)>0;
end;

Make sure to include MMSYSTEM in your USES clause.

Regards, Mark Wilkinson

Robert Brown <hrbr...@telusplanet.net> wrote in article
<3349A017.5...@telusplanet.net>...

Quote
> leonardo fuks wrote:

> > Does any of you guys have a piece of code that uses the joystick
> > from Delphi? Is it difficult?

> > Thanx

> Not difficult from Delphi 1.  I've got a unit somewhere that does it.
> Basically the same as in DOS.  Delphi 2 now, that's another matter.

> Robb Brown
> hrbr...@telusplanet.net

Other Threads