Skip to content

Commit

Permalink
Merge pull request #43 from patrickdown/update-t5manager_with-version…
Browse files Browse the repository at this point in the history
…-=check

This updates T5Interface and T5Manager with the version check
  • Loading branch information
patrickdown authored Oct 25, 2023
2 parents 39f1084 + 354476c commit 90e721b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
13 changes: 13 additions & 0 deletions example/addons/tiltfive/T5Interface.gd
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ func _enter_tree():

XRServer.add_interface(tilt_five_xr_interface)
tilt_five_xr_interface.glasses_event.connect(_on_glasses_event)
tilt_five_xr_interface.service_event.connect(_on_service_event)

func _exit_tree():
if tilt_five_xr_interface:
tilt_five_xr_interface.service_event.disconnect(_on_service_event)
tilt_five_xr_interface.glasses_event.disconnect(_on_glasses_event)
if tilt_five_xr_interface.is_initialized():
tilt_five_xr_interface.uninitialize()
Expand Down Expand Up @@ -93,6 +95,17 @@ func _process_glasses():
glasses_state.attempting_to_reserve = true
tilt_five_xr_interface.reserve_glasses(glasses_id, t5_manager.get_glasses_display_name(glasses_id))

func _on_service_event(event_num):
match event_num:
TiltFiveXRInterface.E_SERVICE_RUNNING:
t5_manager.service_started()
TiltFiveXRInterface.E_SERVICE_STOPPED:
t5_manager.service_stopped()
TiltFiveXRInterface.E_SERVICE_T5_UNAVAILABLE:
t5_manager.service_unvailable()
TiltFiveXRInterface.E_SERVICE_T5_INCOMPATIBLE_VERSION:
t5_manager.service_incorrect_version()

func _on_glasses_event(glasses_id, event_num):
var glasses_state = glasses_dict.get(glasses_id) as GlassesState
if not glasses_state:
Expand Down
18 changes: 18 additions & 0 deletions example/addons/tiltfive/T5ManagerBase.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@ func _enter_tree():
func _exit_tree():
T5Interface.t5_manager = null

## Invoked by T5Interface when the Tilt Five service has started
func service_started():
pass

## Invoked by T5Interface when the Tilt Five service has stopped
func service_stopped():
pass

## Invoked by T5Interface when the Tilt Five service is not available
## The driver might not be installed
func service_unvailable():
pass

## Invoked by T5Interface when the Tilt Five service installed does
## not meet the minimum version requirements
func service_incorrect_version():
pass

## Invoked by the T5Interface to find out if the glasses should be used in
## game
func should_use_glasses(glasses_id : String) -> bool:
Expand Down

0 comments on commit 90e721b

Please sign in to comment.