32 lines
935 B
GDScript
32 lines
935 B
GDScript
extends Node
|
|
|
|
const PFD_PATH: String = "pfd#adi,vsi,alt,ias,rht,rpm,hsi"
|
|
|
|
@export var lidia_hostname: String = "localhost"
|
|
@export var lidia_port: int = 5555
|
|
|
|
@onready var controls: Node = $SubViewport2/Controls
|
|
|
|
func _ready():
|
|
if !$CEF.initialize({"incognito":true, "locale":"en-US"}):
|
|
push_error($CEF.get_error())
|
|
get_tree().quit()
|
|
return
|
|
print("CEF version: " + $CEF.get_full_version())
|
|
|
|
# Wait one frame for the texture rect to get its size
|
|
await get_tree().process_frame
|
|
|
|
var browser_pfd = $CEF.create_browser(
|
|
"http://{}:{}/{}".format([lidia_hostname, lidia_port, PFD_PATH], "{}"),
|
|
$SubViewport/TextureRect,
|
|
{ "frame_rate": 90, "javascript": true },
|
|
)
|
|
browser_pfd.name = "pfd"
|
|
browser_pfd.enable_ad_block(false) # Required for lidia static assets
|
|
|
|
# Propagate the calls to child
|
|
func set_controls(current: Vector4):
|
|
controls.set("controls", current)
|
|
func set_trim(trim: Vector4):
|
|
controls.set("trim", trim)
|