mirror of
https://github.com/CrispyPin/ovr-utils.git
synced 2024-11-22 15:40:25 +01:00
cleanup
This commit is contained in:
parent
5b949ee0c6
commit
be6173ba83
4 changed files with 22 additions and 20 deletions
|
@ -9,8 +9,6 @@ enum TARGETS { head, left, right, world }
|
||||||
export (TARGETS) var target = TARGETS.head setget _set_target
|
export (TARGETS) var target = TARGETS.head setget _set_target
|
||||||
export var overlay_scene = preload("res://addons/openvr_overlay/MissingOverlay.tscn")\
|
export var overlay_scene = preload("res://addons/openvr_overlay/MissingOverlay.tscn")\
|
||||||
setget set_overlay_scene
|
setget set_overlay_scene
|
||||||
#export var offset_pos := Vector3(0, 0, -1) setget set_offset_pos
|
|
||||||
#export var offset_rot: Vector3 setget set_offset_rot
|
|
||||||
export var width_meters = 0.4 setget set_width_in_meters
|
export var width_meters = 0.4 setget set_width_in_meters
|
||||||
export var fallback_to_hmd = false # fallback is only applied if tracker is not present at startup
|
export var fallback_to_hmd = false # fallback is only applied if tracker is not present at startup
|
||||||
# so this is not fully implemented
|
# so this is not fully implemented
|
||||||
|
@ -80,7 +78,7 @@ func get_tracker_id() -> int:
|
||||||
func _set_target(new: int):
|
func _set_target(new: int):
|
||||||
target = new
|
target = new
|
||||||
update_tracker_id()
|
update_tracker_id()
|
||||||
update_offset()
|
call_deferred("update_offset")
|
||||||
emit_signal("target_changed")
|
emit_signal("target_changed")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ extends Node
|
||||||
signal setting_changed # emitted with name, value
|
signal setting_changed # emitted with name, value
|
||||||
signal settings_loaded # emitted when settings are loaded from file, needs to be connected in _init()
|
signal settings_loaded # emitted when settings are loaded from file, needs to be connected in _init()
|
||||||
|
|
||||||
const DEBUG_SETTINGS = true
|
const DEBUG_SETTINGS = false
|
||||||
const SETTINGS_PATH = "user://settings.json"
|
const SETTINGS_PATH = "user://settings.json"
|
||||||
const SETTINGS_DEF = {
|
const SETTINGS_DEF = {
|
||||||
"example_1": {
|
"example_1": {
|
||||||
|
|
|
@ -3,24 +3,27 @@ extends Label
|
||||||
var _delay = 0
|
var _delay = 0
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
_delay += delta
|
_delay += delta
|
||||||
if _delay > 1:
|
if _delay > 1:
|
||||||
update_text()
|
update_text()
|
||||||
_delay = 0
|
_delay = 0
|
||||||
|
|
||||||
|
|
||||||
func update_text():
|
func update_text():
|
||||||
var l = "NaN"
|
var l = "??"
|
||||||
var r = "NaN"
|
var r = "??"
|
||||||
|
|
||||||
if OverlayInit.left_id:
|
if OverlayInit.left_id:
|
||||||
l = OverlayInit.ovr_config.get_device_battery_percentage(OverlayInit.left_id)*100
|
l = OverlayInit.ovr_config.get_device_battery_percentage(OverlayInit.left_id)
|
||||||
l = str(int(l))
|
l = str(int(l * 100))
|
||||||
|
if OverlayInit.ovr_config.is_device_charging(OverlayInit.left_id):
|
||||||
|
l += "+"
|
||||||
|
|
||||||
if OverlayInit.right_id:
|
if OverlayInit.right_id:
|
||||||
r = OverlayInit.ovr_config.get_device_battery_percentage(OverlayInit.right_id)*100
|
r = OverlayInit.ovr_config.get_device_battery_percentage(OverlayInit.right_id)
|
||||||
r = str(int(r))
|
r = str(int(r * 100))
|
||||||
if OverlayInit.ovr_config.is_device_charging(OverlayInit.right_id):
|
if OverlayInit.ovr_config.is_device_charging(OverlayInit.right_id):
|
||||||
r += "+"
|
r += "+"
|
||||||
text = "Left: " + l + "% Right: " + r + "%"
|
|
||||||
|
text = "L: " + l + "% R: " + r + "%"
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
extends Label
|
extends Label
|
||||||
|
|
||||||
|
var _delay = 0
|
||||||
func _ready() -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
func _process(_delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
_update_time()
|
_delay += delta
|
||||||
|
if _delay > 0.5:
|
||||||
|
update_time()
|
||||||
|
_delay = 0
|
||||||
|
|
||||||
|
|
||||||
func _update_time():
|
func update_time():
|
||||||
var h = str(OS.get_time().hour)
|
var h = str(OS.get_time().hour)
|
||||||
var m = str(OS.get_time().minute)
|
var m = str(OS.get_time().minute)
|
||||||
h = h if len(h) == 2 else "0" + h
|
h = h if len(h) == 2 else "0" + h
|
||||||
|
|
Loading…
Reference in a new issue