Skip to content

Commit 6363606

Browse files
committed
Update samples
1 parent 1ca7924 commit 6363606

3 files changed

Lines changed: 23 additions & 41 deletions

File tree

C++/GetData/GetData/GetData.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ int main()
8282
//Read parameters from registry
8383
CRegKey key;
8484
TCHAR libPath[MAX_PATH];
85-
DWORD ScreenIndex, ScreenControl, UserWidth, UserHeight, Scale, RenderWidth, RenderHeight;
85+
DWORD ScreenIndex, ScreenControl, RenderWidth, RenderHeight;
8686

8787
LONG status = key.Open(HKEY_CURRENT_USER, _T("Software\\TrueOpenVR"));
8888
if (status == ERROR_SUCCESS)
@@ -104,9 +104,6 @@ int main()
104104
key.QueryDWORDValue(_T("ScreenIndex"), ScreenIndex);
105105
key.QueryDWORDValue(_T("ScreenControl"), ScreenControl);
106106
ScreenIndex -= 1;
107-
key.QueryDWORDValue(_T("UserWidth"), UserWidth);
108-
key.QueryDWORDValue(_T("UserHeight"), UserHeight);
109-
key.QueryDWORDValue(_T("Scale"), Scale);
110107
key.QueryDWORDValue(_T("RenderWidth"), RenderWidth);
111108
key.QueryDWORDValue(_T("RenderHeight"), RenderHeight);
112109
}
@@ -185,14 +182,16 @@ int main()
185182

186183
DWORD Result;
187184

185+
Sleep(100);
186+
188187
//Get data
189188
while (true) {
190189
system("cls");
191190

192191
printf("Window parameters\r\nWidth=%d, Height=%d, Left=%d, ", DevMode.dmPelsWidth, DevMode.dmPelsHeight, DevMode.dmPosition);
193-
printf("UserWidth=%d, UserHeight=%d,\r\nScale=%d, ", UserWidth, UserHeight, Scale);
194-
printf("RenderWidth=%d, RenderHeight=%d, ", RenderWidth, RenderHeight);
195-
printf("Refresh rate=%d\r\n\r\n", DevMode.dmDisplayFrequency);
192+
printf("Refresh rate=%d\r\n", DevMode.dmDisplayFrequency);
193+
printf("RenderWidth=%d, RenderHeight=%d\r\n\r\n", RenderWidth, RenderHeight);
194+
196195

197196
Result = GetHMDData(&myHMD);
198197
if (Result) {
@@ -239,7 +238,7 @@ int main()
239238
printf("\r\nHotkeys\r\n\HMD centring\t\tCTRL + ALT + R\r\nController 1 centring\tCTRL + ALT + 1\r\nController 2 centring\tCTRL + ALT + 2\r\nController feedback\tCTRL + ALT + 3\r\nExit\t\t\tESC\r\n");
240239

241240

242-
if ((GetAsyncKeyState(VK_ESCAPE) & 0x8000) != 0) break;
241+
if ((GetAsyncKeyState(VK_ESCAPE) & 0x8000) != 0 || (GetAsyncKeyState(VK_RETURN) & 0x8000)) break;
243242

244243
//Centring
245244
if ((GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0 && (GetAsyncKeyState(VK_MENU) & 0x8000) != 0 && (GetAsyncKeyState(82) & 0x8000) != 0) //HMD - CTRL + ALT + R

Delphi/Get data/Unit1.dfm

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ object Main: TMain
44
BorderIcons = [biSystemMenu]
55
BorderStyle = bsSingle
66
Caption = 'TrueOpenVR Get Data'
7-
ClientHeight = 345
7+
ClientHeight = 322
88
ClientWidth = 583
99
Color = clBtnFace
1010
Font.Charset = DEFAULT_CHARSET
@@ -20,15 +20,15 @@ object Main: TMain
2020
TextHeight = 13
2121
object AboutLbl: TLabel
2222
Left = 400
23-
Top = 312
23+
Top = 288
2424
Width = 30
2525
Height = 13
2626
Alignment = taCenter
2727
Caption = 'TOVR'
2828
end
2929
object GetBtn: TButton
3030
Left = 8
31-
Top = 312
31+
Top = 288
3232
Width = 75
3333
Height = 25
3434
Caption = 'Get'
@@ -39,7 +39,7 @@ object Main: TMain
3939
Left = 8
4040
Top = 8
4141
Width = 185
42-
Height = 289
42+
Height = 265
4343
Caption = 'HMD'
4444
TabOrder = 4
4545
object ScrIndLbl: TLabel
@@ -49,23 +49,16 @@ object Main: TMain
4949
Height = 13
5050
Caption = 'Screen index = 0'
5151
end
52-
object ScaleLbl: TLabel
52+
object IPDLbl: TLabel
5353
Left = 8
5454
Top = 216
55-
Width = 61
56-
Height = 13
57-
Caption = 'Scale = false'
58-
end
59-
object UserResLbl: TLabel
60-
Left = 8
61-
Top = 240
62-
Width = 105
55+
Width = 36
6356
Height = 13
64-
Caption = 'User resolution = 0 x 0'
57+
Caption = 'IPD = 0'
6558
end
6659
object RndResLbl: TLabel
6760
Left = 8
68-
Top = 264
61+
Top = 240
6962
Width = 118
7063
Height = 13
7164
Caption = 'Render resolution = 0 x 0'
@@ -133,7 +126,7 @@ object Main: TMain
133126
Left = 200
134127
Top = 8
135128
Width = 185
136-
Height = 289
129+
Height = 265
137130
Caption = 'Controller 1'
138131
TabOrder = 5
139132
object CtrlXLbl: TLabel
@@ -209,7 +202,7 @@ object Main: TMain
209202
end
210203
object CloseBtn: TButton
211204
Left = 248
212-
Top = 312
205+
Top = 288
213206
Width = 75
214207
Height = 25
215208
Caption = 'Close'
@@ -220,7 +213,7 @@ object Main: TMain
220213
Left = 392
221214
Top = 7
222215
Width = 185
223-
Height = 290
216+
Height = 266
224217
Caption = 'Controller 2'
225218
TabOrder = 6
226219
object Ctrl2XLbl: TLabel
@@ -296,7 +289,7 @@ object Main: TMain
296289
end
297290
object CentringBtn: TButton
298291
Left = 88
299-
Top = 312
292+
Top = 288
300293
Width = 75
301294
Height = 25
302295
Caption = 'Centring'
@@ -305,7 +298,7 @@ object Main: TMain
305298
end
306299
object FeedbackBtn: TButton
307300
Left = 168
308-
Top = 312
301+
Top = 288
309302
Width = 75
310303
Height = 25
311304
Caption = 'Feedback'

Delphi/Get data/Unit1.pas

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ TMain = class(TForm)
2222
hmdPitchLbl: TLabel;
2323
hmdRollLbl: TLabel;
2424
ScrIndLbl: TLabel;
25-
ScaleLbl: TLabel;
26-
UserResLbl: TLabel;
25+
IPDLbl: TLabel;
2726
CtrlXLbl: TLabel;
2827
CtrlYLbl: TLabel;
2928
CtrlZLbl: TLabel;
@@ -69,7 +68,7 @@ _HMDData = record
6968
X: double;
7069
Y: double;
7170
Z: double;
72-
Yaw: double;
71+
Yaw: real;
7372
Pitch: double;
7473
Roll: double;
7574
end;
@@ -166,18 +165,9 @@ procedure TMain.GetRegValues;
166165
ScrIndLbl.Caption:='Screen index = ' + IntToStr(ScreenIndex);
167166
ScreenIndex:=ScreenIndex - 1;
168167
ScreenControl:=Reg.ReadBool('ScreenControl');
169-
170-
if Reg.ReadBool('Scale') = false then
171-
ScaleLbl.Caption:='Scale = false'
172-
else
173-
ScaleLbl.Caption:='Scale = true';
174-
UserResLbl.Caption:='User resolution = ' + IntToStr(Reg.ReadInteger('UserWidth')) + ' x ' + IntToStr(Reg.ReadInteger('UserHeight'));
168+
IPDLbl.Caption:='IPD = ' + FloatToStr(Reg.ReadFloat('IPD'));
175169
RndResLbl.Caption:='Render resolution = ' + IntToStr(Reg.ReadInteger('RenderWidth')) + ' x ' + IntToStr(Reg.ReadInteger('RenderHeight'));
176170
except
177-
ScrIndLbl.Caption:='Screen index = 1';
178-
ScaleLbl.Caption:='Scale = true';
179-
UserResLbl.Caption:='User resolution = 1280 x 720';
180-
RndResLbl.Caption:='Render resolution = 1280 x 720';
181171
end;
182172

183173
Reg.CloseKey;

0 commit comments

Comments
 (0)