1
1
class_name XrOrFlatModeLauncher
2
2
extends Node
3
3
4
-
5
4
##
6
5
## XR / Flat Mode Game Launcher
7
6
##
8
- ## @desc:
9
- ## The script launches the game in either flat or xr modes based on
10
- ## either features added to the export options, command-line arguments,
11
- ## or autodetected based on whether the XR interface can be started,
12
- ## i.e. if a VR headset is connected or not.
7
+ ## The script launches the game in either flat or xr modes based on
8
+ ## either features added to the export options, command-line arguments,
9
+ ## or autodetected based on whether the XR interface can be started,
10
+ ## i.e. if a VR headset is connected or not.
13
11
##
14
12
15
13
16
14
func _ready ():
17
- if _check_os_features (): return
18
- if _check_args (): return
15
+ if _check_os_features ():
16
+ return
17
+ if _check_args ():
18
+ return
19
19
_autodetect ()
20
20
21
21
@@ -71,8 +71,8 @@ func _check_args() -> bool:
71
71
func _autodetect () -> void :
72
72
# if we didn't specify, autodetect
73
73
print ("Autodetecting XR or non-XR mode on whether a headset is connected..." )
74
- var xrInterface := ARVRServer .find_interface ("OpenXR" )
75
- if xrInterface and xrInterface .initialize ():
74
+ var xr_interface := ARVRServer .find_interface ("OpenXR" )
75
+ if xr_interface and xr_interface .initialize ():
76
76
launch_xr ()
77
77
else :
78
78
launch_flat ()
@@ -81,7 +81,7 @@ func _autodetect() -> void:
81
81
# Launch the XR scene
82
82
func launch_xr () -> void :
83
83
print ("XR Mode Active" )
84
- XrOrFlatMode .CurrentMode = XrOrFlatMode .XR
84
+ XrOrFlatMode .current_mode = XrOrFlatMode . Mode .XR
85
85
if get_tree ().change_scene ("res://example_level/xr.tscn" ) != OK :
86
86
print ("Failed to load initial scene, quitting..." )
87
87
get_tree ().notification (NOTIFICATION_WM_QUIT_REQUEST )
@@ -90,9 +90,7 @@ func launch_xr() -> void:
90
90
# Launch the Flat Scene
91
91
func launch_flat () -> void :
92
92
print ("Standard Non-XR Mode Active" )
93
- XrOrFlatMode .CurrentMode = XrOrFlatMode .Flat
93
+ XrOrFlatMode .current_mode = XrOrFlatMode .Mode . FLAT
94
94
if get_tree ().change_scene ("res://example_level/flat.tscn" ) != OK :
95
95
print ("Failed to load initial scene, quitting..." )
96
96
get_tree ().notification (NOTIFICATION_WM_QUIT_REQUEST )
97
-
98
-
0 commit comments