You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
This mainly covers the new Pixel Streaming plugin version along with minor changes to other parts of the engine: * removed multiple copies of FThread as it's now a part of Core * changes to SlateUser required to fix user input in Pixel Streaming This wasn't formally reviewed due to the size of Pixel Streaming changes, but was skimmed over by Zack Letters before integration #rb zack.letters [CL 9486237 by Andriy Tylychko in Main branch]
65 lines
1.5 KiB
JavaScript
65 lines
1.5 KiB
JavaScript
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
// repeat with the interval of 2 seconds
|
|
let timerId = setInterval(() => requestEvents(), 4000);
|
|
|
|
function logMessage(msg)
|
|
{
|
|
console.log(msg);
|
|
document.getElementById('debugDiv').innerHTML += '<p><pre>' + msg + '</pre></p>';
|
|
}
|
|
|
|
function clearLog() {
|
|
document.getElementById('debugDiv').innerHTML = '';
|
|
}
|
|
|
|
// Based on https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Sending_forms_through_JavaScript
|
|
function sendCmd(data, handler) {
|
|
var XHR = new XMLHttpRequest();
|
|
|
|
// Define what happens on successful data submission
|
|
XHR.onload = function (event) {
|
|
|
|
// Convert the response's JSON text into a javascript Object
|
|
var replyObj = JSON.parse(event.srcElement.responseText);
|
|
logMessage("RECEIVE_OK: " + JSON.stringify(replyObj, null, 4));
|
|
|
|
if ('reply' in replyObj)
|
|
if (handler != undefined)
|
|
handler(replyObj.reply);
|
|
if ('events' in replyObj)
|
|
handleEvents(replyObj.events);
|
|
};
|
|
|
|
// Define what happens in case of error
|
|
XHR.onerror = function (event) {
|
|
logMessage("SEND FAILED.");
|
|
};
|
|
|
|
// Set up our request
|
|
XHR.open('POST', 'http://127.0.0.1:40080');
|
|
|
|
XHR.setRequestHeader('Content-Type', 'application/json');
|
|
|
|
// Finally, send our data.
|
|
logMessage("SEND: " + JSON.stringify(data, null, 4));
|
|
XHR.send(JSON.stringify(data));
|
|
}
|
|
|
|
function handleEvents(events)
|
|
{
|
|
if (events.length == 0)
|
|
return;
|
|
|
|
logMessage("Handling events");
|
|
}
|
|
|
|
function requestEvents() {
|
|
return;
|
|
sendCmd(
|
|
{
|
|
'cmd': 'getevents', 'params': {} },
|
|
function () {
|
|
logMessage("Handling reply");
|
|
})
|
|
} |