Skip to content

Commit 2a2f21f

Browse files
committed
Update Delphi sample
1 parent b874ad5 commit 2a2f21f

1 file changed

Lines changed: 12 additions & 17 deletions

File tree

Delphi/Get data/Unit1.pas

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,14 @@ _Controller = record
8383
Yaw: double;
8484
Pitch: double;
8585
Roll: double;
86-
Buttons: dword;
86+
Buttons: word;
8787
Trigger: byte;
8888
ThumbX: smallint;
8989
ThumbY: smallint;
9090
end;
9191
Controller = _Controller;
9292
TController = Controller;
9393

94-
const
95-
IDHMD = 0;
96-
IDController = 1;
97-
IDController2 = 2;
98-
9994
var
10095
Main: TMain;
10196
LibPath: string;
@@ -173,10 +168,10 @@ procedure TMain.GetBtnClick(Sender: TObject);
173168
Label14.Caption:='Pitch = ' + FloatToStr(myController.Pitch);
174169
Label15.Caption:='Roll = ' + FloatToStr(myController.Roll);
175170

176-
if (myController.Buttons and 1) <> 0 then keys:=keys + '1 ';
177-
if (myController.Buttons and 2) <> 0 then keys:=keys + '2 ';
178-
if (myController.Buttons and 4) <> 0 then keys:=keys + '3 ';
179-
if (myController.Buttons and 8) <> 0 then keys:=keys + '4 ';
171+
if (myController.Buttons and 1) <> 0 then keys:=keys + 'GP ';
172+
if (myController.Buttons and 2) <> 0 then keys:=keys + 'TS ';
173+
if (myController.Buttons and 4) <> 0 then keys:=keys + 'MN ';
174+
if (myController.Buttons and 8) <> 0 then keys:=keys + 'SM ';
180175

181176
if keys <> '' then
182177
Label16.Caption:='Buttons = ' + keys;
@@ -197,10 +192,10 @@ procedure TMain.GetBtnClick(Sender: TObject);
197192

198193
keys:='';
199194

200-
if (myController2.Buttons and 1) <> 0 then keys:=keys + '1 ';
201-
if (myController2.Buttons and 2) <> 0 then keys:=keys + '2 ';
202-
if (myController2.Buttons and 4) <> 0 then keys:=keys + '3 ';
203-
if (myController2.Buttons and 8) <> 0 then keys:=keys + '4 ';
195+
if (myController2.Buttons and 1) <> 0 then keys:=keys + 'GP ';
196+
if (myController2.Buttons and 2) <> 0 then keys:=keys + 'TS ';
197+
if (myController2.Buttons and 4) <> 0 then keys:=keys + 'MN ';
198+
if (myController2.Buttons and 8) <> 0 then keys:=keys + 'SM ';
204199

205200
if keys <> '' then
206201
Label27.Caption:='Buttons = ' + keys;
@@ -241,14 +236,14 @@ procedure TMain.Button1Click(Sender: TObject);
241236
var
242237
iResult: integer;
243238
begin
244-
iResult:=SetCentering(IDHMD);
239+
iResult:=SetCentering(0);
245240
if iResult = 1 then ShowMessage('Centering success');
246241
end;
247242

248243
procedure TMain.Button2Click(Sender: TObject);
249244
begin
250-
SetControllerData(IDController, 65535);
251-
SetControllerData(IDController2, 32761);
245+
SetControllerData(1, 32761);
246+
SetControllerData(2, 65535);
252247
end;
253248

254249
end.

0 commit comments

Comments
 (0)