forked from Repair-Lab/Vision_Gaming-VR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvr_connection_test.py
More file actions
680 lines (560 loc) · 24.2 KB
/
vr_connection_test.py
File metadata and controls
680 lines (560 loc) · 24.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
#!/usr/bin/env python3
"""
VR Gaming Server - Connection Test Client (Text-Version)
=========================================
Eine vereinfachte Test-Software, die die Verbindungen zum VR Gaming Server testet.
Diese Version läuft ohne GUI und verwendet nur die Kommandozeile.
Autor: GitHub Copilot
Datum: 30. August 2025
"""
import time
import sys
from enum import Enum
# Test-Szenarien
class TestScenario(Enum):
FULL_HD = {"width": 1920, "height": 1080, "name": "Full HD (1920x1080)"}
FOUR_K = {"width": 3840, "height": 2160, "name": "4K (3840x2160)"}
EIGHT_K = {"width": 7680, "height": 4320, "name": "8K (7680x4320)"}
class VRConnectionTest:
def __init__(self):
self.current_scenario = None
self.test_running = False
self.test_start_time = 0
self.connection_status = "Nicht verbunden"
self.test_results = {}
self.movement_stage = 0
def connect_to_server(self):
"""Simuliert die Verbindung zum VR Gaming Server"""
print("🔌 Verbinde mit VR Gaming Server...")
time.sleep(1) # Simuliere Verbindungsaufbau
# Simuliere erfolgreiche Verbindung
self.connection_status = "Verbunden mit Server (simuliert)"
print("✅ Verbindung hergestellt!")
return True
def simulate_vr_movement(self, stage):
"""Simuliert VR-Bewegungen für eine Stufe"""
movements = [
"🐌 Langsam: Leichte Kopfbewegungen (hoch/runter/links/rechts)",
"🏃 Mittel: Schnellere Bewegungen mit mehr Amplitude",
"🚀 Schnell: Extreme Bewegungen für Performance-Test"
]
print(f"🎮 {movements[stage]}")
# Simuliere Bewegung mit Punkten
for _ in range(10):
print(".", end="", flush=True)
time.sleep(0.1)
print(" ✓")
def run_test_scenario(self, scenario):
"""Führt ein Test-Szenario aus"""
self.current_scenario = scenario
self.test_running = True
self.test_start_time = time.time()
print(f"\n🎯 Starte Test-Szenario: {scenario.value['name']}")
print("=" * 50)
# Verbindung testen
if not self.connect_to_server():
print("❌ Verbindungsfehler!")
return
# Test-Durchführung
print(f"\n📺 Teste Auflösung: {scenario.value['width']}x{scenario.value['height']}")
print("⏱️ Test-Dauer: 10 Sekunden")
print("🎮 Simuliere VR-Bewegungen in 3 Stufen:\n")
start_time = time.time()
stage_duration = 10.0 / 3 # 3.33 Sekunden pro Stufe
movements = [
"🐌 Langsam: Leichte Kopfbewegungen (hoch/runter/links/rechts)",
"🏃 Mittel: Schnellere Bewegungen mit mehr Amplitude",
"🚀 Schnell: Extreme Bewegungen für Performance-Test"
]
for stage in range(3):
print(f"🎮 {movements[stage]}")
stage_start = time.time()
while time.time() - stage_start < stage_duration:
print(".", end="", flush=True)
time.sleep(0.1)
print(" ✓")
# Test abschließen
duration = time.time() - start_time
result = {
"scenario": scenario.value["name"],
"duration": duration,
"connection_status": self.connection_status,
"success": duration >= 9.0 and "Verbunden" in self.connection_status
}
self.test_results[scenario.name] = result
self.test_running = False
print("\n📊 Test-Ergebnis:")
print(f" ✅ Erfolgreich: {result['success']}")
print(f" ⏱️ Dauer: {result['duration']:.1f}s")
print(f" 🔗 Verbindung: {result['connection_status']}")
def run_interactive_test(self):
"""Führt einen interaktiven Test durch"""
print("🎮 VR Gaming Server - Connection Test Client")
print("=" * 50)
print("Diese Software testet die Verbindung zum VR Gaming Server")
print("und simuliert VR-Bewegungen in verschiedenen Auflösungen.\n")
while True:
print("\nWählen Sie ein Test-Szenario:")
print(" 1. Full HD (1920x1080) - Standard VR")
print(" 2. 4K (3840x2160) - High-End VR")
print(" 3. 8K (7680x4320) - Extreme VR")
print(" 4. Alle Szenarien testen")
print(" q. Beenden")
choice = input("\nIhre Wahl: ").strip().lower()
if choice == "q":
break
elif choice == "1":
self.run_test_scenario(TestScenario.FULL_HD)
elif choice == "2":
self.run_test_scenario(TestScenario.FOUR_K)
elif choice == "3":
self.run_test_scenario(TestScenario.EIGHT_K)
elif choice == "4":
print("\n🔄 Führe alle Tests durch...")
scenarios = [TestScenario.FULL_HD, TestScenario.FOUR_K, TestScenario.EIGHT_K]
for scenario in scenarios:
self.run_test_scenario(scenario)
time.sleep(2) # Pause zwischen Tests
else:
print("❌ Ungültige Eingabe!")
continue
# Zusammenfassung anzeigen
if self.test_results:
print("\n📈 Test-Zusammenfassung:")
print("=" * 30)
for name, result in self.test_results.items():
status = "✅" if result["success"] else "❌"
print(f" {result['scenario']}: {status} ({result['duration']:.1f}s)")
print("\n💡 Tipp: Alle Tests sollten erfolgreich sein, bevor Sie mit VR spielen beginnen!")
def run_automated_test(self):
"""Führt alle Tests automatisch durch"""
print("🤖 VR Gaming Server - Automatischer Connection Test")
print("=" * 50)
scenarios = [TestScenario.FULL_HD, TestScenario.FOUR_K, TestScenario.EIGHT_K]
for scenario in scenarios:
self.run_test_scenario(scenario)
time.sleep(1)
# Finale Zusammenfassung
print("\n🎯 Finale Test-Zusammenfassung:")
print("=" * 40)
all_success = True
for name, result in self.test_results.items():
status = "✅ ERFOLGREICH" if result["success"] else "❌ FEHLGESCHLAGEN"
print(f" {result['scenario']}: {status}")
if not result["success"]:
all_success = False
print("\n" + "=" * 40)
if all_success:
print("🎉 ALLE TESTS ERFOLGREICH! VR Gaming Server ist bereit!")
print("🚀 Sie können jetzt sicher mit VR spielen beginnen.")
else:
print("⚠️ EINIGE TESTS FEHLGESCHLAGEN!")
print("🔧 Überprüfen Sie die Server-Konfiguration und Netzwerkverbindung.")
print("📞 Kontaktieren Sie den Support bei anhaltenden Problemen.")
return all_success
def main():
"""Hauptfunktion"""
test_client = VRConnectionTest()
if len(sys.argv) > 1 and sys.argv[1] == "--auto":
# Automatischer Modus
success = test_client.run_automated_test()
sys.exit(0 if success else 1)
else:
# Interaktiver Modus
test_client.run_interactive_test()
if __name__ == "__main__":
main()
import time
import asyncio
import json
import threading
from enum import Enum
# Test-Szenarien
class TestScenario(Enum):
FULL_HD = {"width": 1920, "height": 1080, "name": "Full HD (1920x1080)"}
FOUR_K = {"width": 3840, "height": 2160, "name": "4K (3840x2160)"}
EIGHT_K = {"width": 7680, "height": 4320, "name": "8K (7680x4320)"}
class VRConnectionTest:
def __init__(self):
self.current_scenario = None
self.test_running = False
self.test_start_time = 0
self.connection_status = "Nicht verbunden"
self.test_results = {}
self.movement_stage = 0
def connect_to_server(self):
"""Simuliert die Verbindung zum VR Gaming Server"""
print("🔌 Verbinde mit VR Gaming Server...")
time.sleep(1) # Simuliere Verbindungsaufbau
# Simuliere erfolgreiche Verbindung
self.connection_status = "Verbunden mit Server (simuliert)"
print("✅ Verbindung hergestellt!")
return True
def simulate_vr_movement(self, stage):
"""Simuliert VR-Bewegungen für eine Stufe"""
movements = [
"🐌 Langsam: Leichte Kopfbewegungen (hoch/runter/links/rechts)",
"🏃 Mittel: Schnellere Bewegungen mit mehr Amplitude",
"🚀 Schnell: Extreme Bewegungen für Performance-Test"
]
print(f"🎮 {movements[stage]}")
# Simuliere Bewegung mit Punkten
for i in range(10):
print(".", end="", flush=True)
time.sleep(0.1)
print(" ✓")
def run_test_scenario(self, scenario):
"""Führt ein Test-Szenario aus"""
self.current_scenario = scenario
self.test_running = True
self.test_start_time = time.time()
print(f"🎯 Starte Test-Szenario: {scenario.value['name']}")
print("=" * 50)
# Verbindung testen
if not self.connect_to_server():
print("❌ Verbindungsfehler!")
return
# Test-Durchführung
print(f"📺 Teste Auflösung: {scenario.value['width']}x{scenario.value['height']}")
print("⏱️ Test-Dauer: 10 Sekunden")
print("🎮 Simuliere VR-Bewegungen in 3 Stufen:")
start_time = time.time()
stage_duration = 10.0 / 3 # 3.33 Sekunden pro Stufe
for stage in range(3):
stage_start = start_time + (stage * stage_duration)
while time.time() - stage_start < stage_duration:
remaining = stage_duration - (time.time() - stage_start)
if remaining > 0:
self.simulate_vr_movement(stage)
break
# Test abschließen
duration = time.time() - start_time
result = {
"scenario": scenario.value["name"],
"duration": duration,
"connection_status": self.connection_status,
"success": duration >= 9.0 and "Verbunden" in self.connection_status
}
self.test_results[scenario.name] = result
self.test_running = False
print("📊 Test-Ergebnis:")
print(f" ✅ Erfolgreich: {result['success']}")
print(f" 🔗 Verbindung: {result['connection_status']}")
def run_interactive_test(self):
"""Führt einen interaktiven Test durch"""
print("🎮 VR Gaming Server - Connection Test Client")
print("=" * 50)
print("Diese Software testet die Verbindung zum VR Gaming Server")
print("und simuliert VR-Bewegungen in verschiedenen Auflösungen.")
scenarios = [
("1", TestScenario.FULL_HD, "Full HD (1920x1080) - Standard VR"),
("2", TestScenario.FOUR_K, "4K (3840x2160) - High-End VR"),
("3", TestScenario.EIGHT_K, "8K (7680x4320) - Extreme VR"),
("4", "all", "Alle Szenarien testen")
]
while True:
print("Wählen Sie ein Test-Szenario:")
for key, scenario, desc in scenarios:
if scenario == "all":
print(f" {key}. {desc}")
else:
print(f" {key}. {desc}")
print(" q. Beenden")
choice = input("Ihre Wahl: ").strip().lower()
if choice == "q":
break
elif choice == "1":
self.run_test_scenario(TestScenario.FULL_HD)
elif choice == "2":
self.run_test_scenario(TestScenario.FOUR_K)
elif choice == "3":
self.run_test_scenario(TestScenario.EIGHT_K)
elif choice == "4":
print("🔄 Führe alle Tests durch...")
for _, scenario, _ in scenarios[:-1]: # Alle außer "all"
self.run_test_scenario(scenario)
time.sleep(2) # Pause zwischen Tests
else:
print("❌ Ungültige Eingabe!")
continue
# Zusammenfassung anzeigen
if self.test_results:
print("📈 Test-Zusammenfassung:")
print("=" * 30)
for name, result in self.test_results.items():
status = "✅" if result["success"] else "❌"
print(f" {result['scenario']}: {status}")
print("💡 Tipp: Alle Tests sollten erfolgreich sein, bevor Sie mit VR spielen beginnen!")
def run_automated_test(self):
"""Führt alle Tests automatisch durch"""
print("🤖 VR Gaming Server - Automatischer Connection Test")
print("=" * 50)
scenarios = [TestScenario.FULL_HD, TestScenario.FOUR_K, TestScenario.EIGHT_K]
for scenario in scenarios:
self.run_test_scenario(scenario)
time.sleep(1)
# Finale Zusammenfassung
print("🎯 Finale Test-Zusammenfassung:")
print("=" * 40)
all_success = True
for name, result in self.test_results.items():
status = "✅ ERFOLGREICH" if result["success"] else "❌ FEHLGESCHLAGEN"
print(f" {result['scenario']}: {status}")
if not result["success"]:
all_success = False
print("" + "=" * 40)
if all_success:
print("🎉 ALLE TESTS ERFOLGREICH! VR Gaming Server ist bereit!")
print("🚀 Sie können jetzt sicher mit VR spielen beginnen.")
else:
print("⚠️ EINIGE TESTS FEHLGESCHLAGEN!")
print("🔧 Überprüfen Sie die Server-Konfiguration und Netzwerkverbindung.")
print("📞 Kontaktieren Sie den Support bei anhaltenden Problemen.")
return all_success
def main():
"""Hauptfunktion"""
import sys
test_client = VRConnectionTest()
if len(sys.argv) > 1 and sys.argv[1] == "--auto":
# Automatischer Modus
success = test_client.run_automated_test()
sys.exit(0 if success else 1)
else:
# Interaktiver Modus
test_client.run_interactive_test()
if __name__ == "__main__":
main()
import pygame
import sys
import time
import asyncio
import websockets
import json
import threading
from enum import Enum
# Konstanten
WINDOW_WIDTH = 1280
WINDOW_HEIGHT = 720
FPS = 60
# Test-Szenarien
class TestScenario(Enum):
FULL_HD = {"width": 1920, "height": 1080, "name": "Full HD (1920x1080)"}
FOUR_K = {"width": 3840, "height": 2160, "name": "4K (3840x2160)"}
EIGHT_K = {"width": 7680, "height": 4320, "name": "8K (7680x4320)"}
# Farben
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
GRAY = (128, 128, 128)
class VRConnectionTest:
def __init__(self):
pygame.init()
self.screen = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT))
pygame.display.set_caption("VR Gaming Server - Connection Test")
self.clock = pygame.time.Clock()
self.font = pygame.font.Font(None, 36)
self.small_font = pygame.font.Font(None, 24)
# Test-Status
self.current_scenario = None
self.test_running = False
self.test_start_time = 0
self.connection_status = "Nicht verbunden"
self.test_results = {}
# Simulations-Parameter
self.ball_pos = [WINDOW_WIDTH // 2, WINDOW_HEIGHT // 2]
self.ball_speed = [0, 0]
self.movement_stage = 0 # 0: langsam, 1: mittel, 2: schnell
# Server-Verbindung
self.server_connected = False
self.websocket = None
def draw_button(self, text, x, y, width, height, color, hover_color=None):
"""Zeichnet einen Button"""
mouse_pos = pygame.mouse.get_pos()
if x <= mouse_pos[0] <= x + width and y <= mouse_pos[1] <= y + height:
if hover_color:
pygame.draw.rect(self.screen, hover_color, (x, y, width, height))
else:
pygame.draw.rect(self.screen, color, (x, y, width, height))
else:
pygame.draw.rect(self.screen, color, (x, y, width, height))
text_surf = self.font.render(text, True, WHITE)
text_rect = text_surf.get_rect(center=(x + width // 2, y + height // 2))
self.screen.blit(text_surf, text_rect)
return x <= mouse_pos[0] <= x + width and y <= mouse_pos[1] <= y + height
def draw_ball(self):
"""Zeichnet die simulierte VR-Kugel"""
pygame.draw.circle(self.screen, RED, (int(self.ball_pos[0]), int(self.ball_pos[1])), 20)
def update_ball_movement(self, delta_time):
"""Aktualisiert die Ball-Bewegung basierend auf der Stufe"""
speeds = [
[100, 50], # Stufe 0: langsam
[200, 100], # Stufe 1: mittel
[400, 200] # Stufe 2: schnell
]
speed_x, speed_y = speeds[self.movement_stage]
# Bewegung: hoch, runter, links, rechts
self.ball_pos[0] += speed_x * delta_time * (-1 if self.ball_pos[0] > WINDOW_WIDTH // 2 else 1)
self.ball_pos[1] += speed_y * delta_time * (-1 if self.ball_pos[1] > WINDOW_HEIGHT // 2 else 1)
# Begrenzung
self.ball_pos[0] = max(20, min(WINDOW_WIDTH - 20, self.ball_pos[0]))
self.ball_pos[1] = max(20, min(WINDOW_HEIGHT - 20, self.ball_pos[1]))
def connect_to_server(self):
"""Verbindet mit dem VR Gaming Server"""
try:
# Hier würde die echte WebSocket-Verbindung stehen
# Für die Demo simulieren wir nur die Verbindung
self.server_connected = True
self.connection_status = "Verbunden mit Server"
print("Verbindung zum Server hergestellt")
except Exception as e:
self.connection_status = f"Verbindungsfehler: {str(e)}"
print(f"Verbindungsfehler: {str(e)}")
def run_test_scenario(self, scenario):
"""Führt ein Test-Szenario aus"""
self.current_scenario = scenario
self.test_running = True
self.test_start_time = time.time()
self.ball_pos = [WINDOW_WIDTH // 2, WINDOW_HEIGHT // 2]
self.movement_stage = 0
print(f"Starte Test-Szenario: {scenario.value['name']}")
# Simuliere Server-Verbindung für dieses Szenario
self.connect_to_server()
def stop_test(self):
"""Stoppt den aktuellen Test"""
if self.test_running:
duration = time.time() - self.test_start_time
result = {
"scenario": self.current_scenario.value["name"],
"duration": duration,
"connection_status": self.connection_status,
"success": duration >= 10.0 and self.server_connected
}
self.test_results[self.current_scenario.name] = result
print(f"Test beendet: {result}")
self.test_running = False
self.current_scenario = None
def draw_ui(self):
"""Zeichnet die Benutzeroberfläche"""
self.screen.fill(BLACK)
self.draw_title()
self.draw_status()
self.draw_test_buttons()
self.draw_test_status()
self.draw_results()
self.draw_instructions()
def draw_title(self):
"""Zeichnet den Titel"""
title = self.font.render("VR Gaming Server - Connection Test", True, WHITE)
self.screen.blit(title, (WINDOW_WIDTH // 2 - title.get_width() // 2, 50))
def draw_status(self):
"""Zeichnet den Verbindungsstatus"""
status_color = GREEN if self.server_connected else RED
status_text = self.small_font.render(f"Server-Status: {self.connection_status}", True, status_color)
self.screen.blit(status_text, (50, 120))
def draw_test_buttons(self):
"""Zeichnet die Test-Buttons"""
button_y = 200
button_width = 300
button_height = 50
if self.draw_button("Test Full HD", 50, button_y, button_width, button_height, BLUE, (0, 0, 150)):
if pygame.mouse.get_pressed()[0]:
self.run_test_scenario(TestScenario.FULL_HD)
if self.draw_button("Test 4K", 400, button_y, button_width, button_height, BLUE, (0, 0, 150)):
if pygame.mouse.get_pressed()[0]:
self.run_test_scenario(TestScenario.FOUR_K)
if self.draw_button("Test 8K", 750, button_y, button_width, button_height, BLUE, (0, 0, 150)):
if pygame.mouse.get_pressed()[0]:
self.run_test_scenario(TestScenario.EIGHT_K)
def draw_test_status(self):
"""Zeichnet den aktuellen Test-Status"""
if self.test_running and self.current_scenario:
test_time = time.time() - self.test_start_time
progress = min(test_time / 10.0, 1.0)
# Fortschrittsbalken
pygame.draw.rect(self.screen, GRAY, (50, 300, 400, 20))
pygame.draw.rect(self.screen, GREEN, (50, 300, int(400 * progress), 20))
# Test-Info
test_info = self.small_font.render(
f"Test: {self.current_scenario.value['name']} - Zeit: {test_time:.1f}s / 10.0s",
True, WHITE
)
self.screen.blit(test_info, (50, 330))
# Bewegung-Stufe
stage_names = ["Langsam", "Mittel", "Schnell"]
stage_text = self.small_font.render(f"Bewegungsstufe: {stage_names[self.movement_stage]}", True, WHITE)
self.screen.blit(stage_text, (50, 360))
# Simulierte Kugel
self.draw_ball()
def draw_results(self):
"""Zeichnet die Test-Ergebnisse"""
result_y = 400
for scenario_name, result in self.test_results.items():
color = GREEN if result["success"] else RED
result_text = self.small_font.render(
f"{result['scenario']}: {'Erfolgreich' if result['success'] else 'Fehlgeschlagen'} "
f"({result['duration']:.1f}s)",
True, color
)
self.screen.blit(result_text, (50, result_y))
result_y += 30
def draw_instructions(self):
"""Zeichnet die Anweisungen"""
instructions = [
"Klicken Sie auf einen Test-Button, um das entsprechende Szenario zu starten.",
"Jeder Test läuft 10 Sekunden und simuliert VR-Bewegungen.",
"Die Kugel bewegt sich in drei Stufen: langsam, mittel, schnell.",
"Prüfen Sie die Server-Verbindung und Test-Ergebnisse."
]
for i, instruction in enumerate(instructions):
inst_text = self.small_font.render(instruction, True, WHITE)
self.screen.blit(inst_text, (50, WINDOW_HEIGHT - 150 + i * 25))
def run(self):
"""Haupt-Loop der Anwendung"""
running = True
last_time = time.time()
while running:
current_time = time.time()
delta_time = current_time - last_time
last_time = current_time
running = self.handle_events()
self.update_test_logic(current_time, delta_time)
self.draw_ui()
self.clock.tick(FPS)
self.cleanup()
def handle_events(self):
"""Behandelt Pygame-Events"""
for event in pygame.event.get():
if event.type == pygame.QUIT:
return False
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
return False
return True
def update_test_logic(self, current_time, delta_time):
"""Aktualisiert die Test-Logik"""
if self.test_running:
test_duration = current_time - self.test_start_time
# Bewegung-Stufe ändern alle 3.33 Sekunden
self.movement_stage = min(int(test_duration / 3.33), 2)
# Ball-Bewegung aktualisieren
self.update_ball_movement(delta_time)
# Test nach 10 Sekunden beenden
if test_duration >= 10.0:
self.stop_test()
def cleanup(self):
"""Bereinigt und beendet die Anwendung"""
pygame.quit()
sys.exit()
def main():
"""Hauptfunktion"""
print("VR Gaming Server - Connection Test Client")
print("=========================================")
print("Diese Software testet die Verbindung zum VR Gaming Server")
print("und simuliert VR-Bewegungen in verschiedenen Auflösungen.")
print("")
test_client = VRConnectionTest()
test_client.run()
if __name__ == "__main__":
main()