Joystick Test - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Joystick Test

afizafiz Posts: 1Member
please help me.
I have new program but my program can't connencted with with my hard ware. it's my list
everyone please help me.thank's
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,MMSYSTEM, ExtCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Timer1: TTimer;
Label1: TLabel;
Panel2: TPanel;
Edit3: TEdit;
Edit4: TEdit;
Label2: TLabel;
Edit5: TEdit;
Edit6: TEdit;
procedure ReadAndDisplayJoystick;
procedure ReadJoystick(var li1,li2:longint;var bo1,bo2,bo3,bo4:boolean);
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
li1,li2 : longint;
bo1, bo2, bo3,bo4 : boolean;
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}
{ untuk membaca joystick}
procedure TForm1.ReadJoystick(var li1,li2:longint;var bo1,bo2,bo3,bo4:boolean);
var myjoy: tjoyinfo;
begin
joygetpos(joystickid1,@myjoy);
li1 := myjoy.wxpos;
li2 := myjoy.wypos;
bo1 :=(myjoy.wbuttons and 1)>0;
bo2 :=(myjoy.wbuttons and 2)>0;
bo3 :=(myjoy.wbuttons and 3)>0;
bo4 :=(myjoy.wbuttons and 4)>0;
end;

{ untuk display joystick }
procedure TForm1.ReadAndDisplayJoystick;
begin
li1:=0;
li2:=0;
bo1:=true;
bo2:=true;
bo3:=true;
bo4:=true; (*Can be anything, going into proc*)
ReadJoystick(li1,li2,bo1,bo2,bo3,bo4);
Edit1.text:=inttostr(li1);
Edit2.text:=inttostr(li2);
if bo1=true
then Edit3.text:=' Pressed' else Edit3.text:=' NOT pressed';
if bo2=true
then Edit4.text:=' Pressed' else Edit4.text:=' NOT pressed';
if bo3=true
then Edit5.text:=' Pressed' else Edit5.text:=' NOT pressed';
if bo4=true
then Edit6.text:=' Pressed' else Edit6.text:=' NOT pressed';
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
ReadAndDisplayJoystick;


end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Application.Terminate;
end;

end.

Please help me to send in my email
ken_afiz @yahoo.com

Sign In or Register to comment.