cloud-game/static/js/global.js
giongto35 f491861874 Update Playstation core (#73)
* Update cores setting for ps1

* Update PS3 output + use bytes per row to get the correct number of bytes per row

* Add more inputs

* Update input

* Fix input

* Add resize image comment

* Update screenshot

* Try side by side

* Update Image side by side

* Add image side by side

* Update landing page

* Add landing page image

* Update landing page image
2019-08-28 03:54:18 +08:00

68 lines
1.2 KiB
JavaScript
Vendored

/*
Global Constants
*/
const DEBUG = false;
const KEY_BIT = ["a", "b", "x", "y", "select", "start", "up", "down", "left", "right"];
const INPUT_FPS = 100;
const INPUT_STATE_PACKET = 1;
const PINGPONGPS = 5;
const MENU_TOP_POSITION = 102;
const ICE_TIMEOUT = 2000;
/*
Global variables
*/
// Game state
let screenState = "loader";
let gameList = [];
let gameIdx = 5; // contra
let gamePickerTimer = null;
let roomID = null;
// Game controller state
let keyState = {
// control
a: false,
b: false,
x: false,
y: false,
start: false,
select: false,
// dpad
up: false,
down: false,
left: false,
right: false
}
let unchangePacket = INPUT_STATE_PACKET;
let gameInputTimer = null;
// Network state
let pc, inputChannel;
let localSessionDescription = "";
let remoteSessionDescription = "";
let conn;
// Touch menu state
let menuDrag = null;
let menuTop = MENU_TOP_POSITION;
// Screen state
let isLayoutSwitched = false;
var gameReady = false;
var inputReady = false;
var audioReady = false;
var iceSuccess = true;
var iceSent = false; // TODO: set to false in some init event
var defaultICE = [{urls: "stun:stun.l.google.com:19302"}]