| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*  library_godot_display.js                                              */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*                         This file is part of:                          */ | 
					
						
							|  |  |  | /*                             GODOT ENGINE                               */ | 
					
						
							|  |  |  | /*                        https://godotengine.org                         */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ | 
					
						
							|  |  |  | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* Permission is hereby granted, free of charge, to any person obtaining  */ | 
					
						
							|  |  |  | /* a copy of this software and associated documentation files (the        */ | 
					
						
							|  |  |  | /* "Software"), to deal in the Software without restriction, including    */ | 
					
						
							|  |  |  | /* without limitation the rights to use, copy, modify, merge, publish,    */ | 
					
						
							|  |  |  | /* distribute, sublicense, and/or sell copies of the Software, and to     */ | 
					
						
							|  |  |  | /* permit persons to whom the Software is furnished to do so, subject to  */ | 
					
						
							|  |  |  | /* the following conditions:                                              */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* The above copyright notice and this permission notice shall be         */ | 
					
						
							|  |  |  | /* included in all copies or substantial portions of the Software.        */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */ | 
					
						
							|  |  |  | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */ | 
					
						
							|  |  |  | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ | 
					
						
							|  |  |  | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */ | 
					
						
							|  |  |  | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */ | 
					
						
							|  |  |  | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */ | 
					
						
							|  |  |  | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-08 23:16:51 +01:00
										 |  |  | const GodotDisplayVK = { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-12 13:40:07 +02:00
										 |  |  | 	$GodotDisplayVK__deps: ['$GodotRuntime', '$GodotConfig', '$GodotEventListeners'], | 
					
						
							| 
									
										
										
										
											2021-03-08 23:16:51 +01:00
										 |  |  | 	$GodotDisplayVK__postset: 'GodotOS.atexit(function(resolve, reject) { GodotDisplayVK.clear(); resolve(); });', | 
					
						
							|  |  |  | 	$GodotDisplayVK: { | 
					
						
							|  |  |  | 		textinput: null, | 
					
						
							|  |  |  | 		textarea: null, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		available: function () { | 
					
						
							|  |  |  | 			return GodotConfig.virtual_keyboard && 'ontouchstart' in window; | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		init: function (input_cb) { | 
					
						
							|  |  |  | 			function create(what) { | 
					
						
							|  |  |  | 				const elem = document.createElement(what); | 
					
						
							|  |  |  | 				elem.style.display = 'none'; | 
					
						
							|  |  |  | 				elem.style.position = 'absolute'; | 
					
						
							|  |  |  | 				elem.style.zIndex = '-1'; | 
					
						
							|  |  |  | 				elem.style.background = 'transparent'; | 
					
						
							|  |  |  | 				elem.style.padding = '0px'; | 
					
						
							|  |  |  | 				elem.style.margin = '0px'; | 
					
						
							|  |  |  | 				elem.style.overflow = 'hidden'; | 
					
						
							|  |  |  | 				elem.style.width = '0px'; | 
					
						
							|  |  |  | 				elem.style.height = '0px'; | 
					
						
							|  |  |  | 				elem.style.border = '0px'; | 
					
						
							|  |  |  | 				elem.style.outline = 'none'; | 
					
						
							|  |  |  | 				elem.readonly = true; | 
					
						
							|  |  |  | 				elem.disabled = true; | 
					
						
							| 
									
										
										
										
											2021-09-12 13:40:07 +02:00
										 |  |  | 				GodotEventListeners.add(elem, 'input', function (evt) { | 
					
						
							| 
									
										
										
										
											2021-03-08 23:16:51 +01:00
										 |  |  | 					const c_str = GodotRuntime.allocString(elem.value); | 
					
						
							|  |  |  | 					input_cb(c_str, elem.selectionEnd); | 
					
						
							|  |  |  | 					GodotRuntime.free(c_str); | 
					
						
							|  |  |  | 				}, false); | 
					
						
							| 
									
										
										
										
											2021-09-12 13:40:07 +02:00
										 |  |  | 				GodotEventListeners.add(elem, 'blur', function (evt) { | 
					
						
							| 
									
										
										
										
											2021-03-08 23:16:51 +01:00
										 |  |  | 					elem.style.display = 'none'; | 
					
						
							|  |  |  | 					elem.readonly = true; | 
					
						
							|  |  |  | 					elem.disabled = true; | 
					
						
							|  |  |  | 				}, false); | 
					
						
							|  |  |  | 				GodotConfig.canvas.insertAdjacentElement('beforebegin', elem); | 
					
						
							|  |  |  | 				return elem; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			GodotDisplayVK.textinput = create('input'); | 
					
						
							|  |  |  | 			GodotDisplayVK.textarea = create('textarea'); | 
					
						
							|  |  |  | 			GodotDisplayVK.updateSize(); | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2022-07-07 14:20:10 -04:00
										 |  |  | 		show: function (text, type, start, end) { | 
					
						
							| 
									
										
										
										
											2021-03-08 23:16:51 +01:00
										 |  |  | 			if (!GodotDisplayVK.textinput || !GodotDisplayVK.textarea) { | 
					
						
							|  |  |  | 				return; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			if (GodotDisplayVK.textinput.style.display !== '' || GodotDisplayVK.textarea.style.display !== '') { | 
					
						
							|  |  |  | 				GodotDisplayVK.hide(); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			GodotDisplayVK.updateSize(); | 
					
						
							| 
									
										
										
										
											2022-07-07 14:20:10 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			let elem = GodotDisplayVK.textinput; | 
					
						
							|  |  |  | 			switch (type) { | 
					
						
							|  |  |  | 			case 0: // KEYBOARD_TYPE_DEFAULT
 | 
					
						
							|  |  |  | 				elem.type = 'text'; | 
					
						
							|  |  |  | 				elem.inputmode = ''; | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			case 1: // KEYBOARD_TYPE_MULTILINE
 | 
					
						
							|  |  |  | 				elem = GodotDisplayVK.textarea; | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			case 2: // KEYBOARD_TYPE_NUMBER
 | 
					
						
							|  |  |  | 				elem.type = 'text'; | 
					
						
							|  |  |  | 				elem.inputmode = 'numeric'; | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			case 3: // KEYBOARD_TYPE_NUMBER_DECIMAL
 | 
					
						
							|  |  |  | 				elem.type = 'text'; | 
					
						
							|  |  |  | 				elem.inputmode = 'decimal'; | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			case 4: // KEYBOARD_TYPE_PHONE
 | 
					
						
							|  |  |  | 				elem.type = 'tel'; | 
					
						
							|  |  |  | 				elem.inputmode = ''; | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			case 5: // KEYBOARD_TYPE_EMAIL_ADDRESS
 | 
					
						
							|  |  |  | 				elem.type = 'email'; | 
					
						
							|  |  |  | 				elem.inputmode = ''; | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			case 6: // KEYBOARD_TYPE_PASSWORD
 | 
					
						
							|  |  |  | 				elem.type = 'password'; | 
					
						
							|  |  |  | 				elem.inputmode = ''; | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			case 7: // KEYBOARD_TYPE_URL
 | 
					
						
							|  |  |  | 				elem.type = 'url'; | 
					
						
							|  |  |  | 				elem.inputmode = ''; | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			default: | 
					
						
							|  |  |  | 				elem.type = 'text'; | 
					
						
							|  |  |  | 				elem.inputmode = ''; | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-08 23:16:51 +01:00
										 |  |  | 			elem.readonly = false; | 
					
						
							|  |  |  | 			elem.disabled = false; | 
					
						
							|  |  |  | 			elem.value = text; | 
					
						
							|  |  |  | 			elem.style.display = 'block'; | 
					
						
							|  |  |  | 			elem.focus(); | 
					
						
							|  |  |  | 			elem.setSelectionRange(start, end); | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		hide: function () { | 
					
						
							|  |  |  | 			if (!GodotDisplayVK.textinput || !GodotDisplayVK.textarea) { | 
					
						
							|  |  |  | 				return; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			[GodotDisplayVK.textinput, GodotDisplayVK.textarea].forEach(function (elem) { | 
					
						
							|  |  |  | 				elem.blur(); | 
					
						
							|  |  |  | 				elem.style.display = 'none'; | 
					
						
							|  |  |  | 				elem.value = ''; | 
					
						
							|  |  |  | 			}); | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		updateSize: function () { | 
					
						
							|  |  |  | 			if (!GodotDisplayVK.textinput || !GodotDisplayVK.textarea) { | 
					
						
							|  |  |  | 				return; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			const rect = GodotConfig.canvas.getBoundingClientRect(); | 
					
						
							|  |  |  | 			function update(elem) { | 
					
						
							|  |  |  | 				elem.style.left = `${rect.left}px`; | 
					
						
							|  |  |  | 				elem.style.top = `${rect.top}px`; | 
					
						
							|  |  |  | 				elem.style.width = `${rect.width}px`; | 
					
						
							|  |  |  | 				elem.style.height = `${rect.height}px`; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			update(GodotDisplayVK.textinput); | 
					
						
							|  |  |  | 			update(GodotDisplayVK.textarea); | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		clear: function () { | 
					
						
							|  |  |  | 			if (GodotDisplayVK.textinput) { | 
					
						
							|  |  |  | 				GodotDisplayVK.textinput.remove(); | 
					
						
							|  |  |  | 				GodotDisplayVK.textinput = null; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			if (GodotDisplayVK.textarea) { | 
					
						
							|  |  |  | 				GodotDisplayVK.textarea.remove(); | 
					
						
							|  |  |  | 				GodotDisplayVK.textarea = null; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | mergeInto(LibraryManager.library, GodotDisplayVK); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | /* | 
					
						
							|  |  |  |  * Display server cursor helper. | 
					
						
							|  |  |  |  * Keeps track of cursor status and custom shapes. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | const GodotDisplayCursor = { | 
					
						
							| 
									
										
										
										
											2020-11-19 16:54:07 +01:00
										 |  |  | 	$GodotDisplayCursor__deps: ['$GodotOS', '$GodotConfig'], | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 	$GodotDisplayCursor__postset: 'GodotOS.atexit(function(resolve, reject) { GodotDisplayCursor.clear(); resolve(); });', | 
					
						
							|  |  |  | 	$GodotDisplayCursor: { | 
					
						
							| 
									
										
										
										
											2022-10-07 10:53:49 -06:00
										 |  |  | 		shape: 'default', | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 		visible: true, | 
					
						
							|  |  |  | 		cursors: {}, | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 		set_style: function (style) { | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 			GodotConfig.canvas.style.cursor = style; | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 		set_shape: function (shape) { | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 			GodotDisplayCursor.shape = shape; | 
					
						
							|  |  |  | 			let css = shape; | 
					
						
							|  |  |  | 			if (shape in GodotDisplayCursor.cursors) { | 
					
						
							|  |  |  | 				const c = GodotDisplayCursor.cursors[shape]; | 
					
						
							| 
									
										
										
										
											2022-10-07 10:53:49 -06:00
										 |  |  | 				css = `url("${c.url}") ${c.x} ${c.y}, default`; | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 			} | 
					
						
							|  |  |  | 			if (GodotDisplayCursor.visible) { | 
					
						
							|  |  |  | 				GodotDisplayCursor.set_style(css); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 		clear: function () { | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 			GodotDisplayCursor.set_style(''); | 
					
						
							| 
									
										
										
										
											2022-10-07 10:53:49 -06:00
										 |  |  | 			GodotDisplayCursor.shape = 'default'; | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 			GodotDisplayCursor.visible = true; | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 			Object.keys(GodotDisplayCursor.cursors).forEach(function (key) { | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 				URL.revokeObjectURL(GodotDisplayCursor.cursors[key]); | 
					
						
							|  |  |  | 				delete GodotDisplayCursor.cursors[key]; | 
					
						
							|  |  |  | 			}); | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2021-09-12 18:13:54 +02:00
										 |  |  | 		lockPointer: function () { | 
					
						
							|  |  |  | 			const canvas = GodotConfig.canvas; | 
					
						
							|  |  |  | 			if (canvas.requestPointerLock) { | 
					
						
							|  |  |  | 				canvas.requestPointerLock(); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		releasePointer: function () { | 
					
						
							|  |  |  | 			if (document.exitPointerLock) { | 
					
						
							|  |  |  | 				document.exitPointerLock(); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		isPointerLocked: function () { | 
					
						
							|  |  |  | 			return document.pointerLockElement === GodotConfig.canvas; | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | mergeInto(LibraryManager.library, GodotDisplayCursor); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | const GodotDisplayScreen = { | 
					
						
							|  |  |  | 	$GodotDisplayScreen__deps: ['$GodotConfig', '$GodotOS', '$GL', 'emscripten_webgl_get_current_context'], | 
					
						
							|  |  |  | 	$GodotDisplayScreen: { | 
					
						
							|  |  |  | 		desired_size: [0, 0], | 
					
						
							| 
									
										
										
										
											2021-03-08 19:31:52 +01:00
										 |  |  | 		hidpi: true, | 
					
						
							|  |  |  | 		getPixelRatio: function () { | 
					
						
							|  |  |  | 			return GodotDisplayScreen.hidpi ? window.devicePixelRatio || 1 : 1; | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 		isFullscreen: function () { | 
					
						
							|  |  |  | 			const elem = document.fullscreenElement || document.mozFullscreenElement | 
					
						
							|  |  |  | 				|| document.webkitFullscreenElement || document.msFullscreenElement; | 
					
						
							|  |  |  | 			if (elem) { | 
					
						
							|  |  |  | 				return elem === GodotConfig.canvas; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			// But maybe knowing the element is not supported.
 | 
					
						
							|  |  |  | 			return document.fullscreen || document.mozFullScreen | 
					
						
							|  |  |  | 				|| document.webkitIsFullscreen; | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		hasFullscreen: function () { | 
					
						
							|  |  |  | 			return document.fullscreenEnabled || document.mozFullScreenEnabled | 
					
						
							|  |  |  | 				|| document.webkitFullscreenEnabled; | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		requestFullscreen: function () { | 
					
						
							|  |  |  | 			if (!GodotDisplayScreen.hasFullscreen()) { | 
					
						
							|  |  |  | 				return 1; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			const canvas = GodotConfig.canvas; | 
					
						
							|  |  |  | 			try { | 
					
						
							|  |  |  | 				const promise = (canvas.requestFullscreen || canvas.msRequestFullscreen | 
					
						
							|  |  |  | 					|| canvas.mozRequestFullScreen || canvas.mozRequestFullscreen | 
					
						
							|  |  |  | 					|| canvas.webkitRequestFullscreen | 
					
						
							|  |  |  | 				).call(canvas); | 
					
						
							|  |  |  | 				// Some browsers (Safari) return undefined.
 | 
					
						
							|  |  |  | 				// For the standard ones, we need to catch it.
 | 
					
						
							|  |  |  | 				if (promise) { | 
					
						
							|  |  |  | 					promise.catch(function () { | 
					
						
							|  |  |  | 						// nothing to do.
 | 
					
						
							|  |  |  | 					}); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} catch (e) { | 
					
						
							|  |  |  | 				return 1; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			return 0; | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		exitFullscreen: function () { | 
					
						
							|  |  |  | 			if (!GodotDisplayScreen.isFullscreen()) { | 
					
						
							|  |  |  | 				return 0; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			try { | 
					
						
							|  |  |  | 				const promise = document.exitFullscreen(); | 
					
						
							|  |  |  | 				if (promise) { | 
					
						
							|  |  |  | 					promise.catch(function () { | 
					
						
							|  |  |  | 						// nothing to do.
 | 
					
						
							|  |  |  | 					}); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} catch (e) { | 
					
						
							|  |  |  | 				return 1; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			return 0; | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		_updateGL: function () { | 
					
						
							| 
									
										
										
										
											2024-05-12 04:16:02 +02:00
										 |  |  | 			const gl_context_handle = _emscripten_webgl_get_current_context(); | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 			const gl = GL.getContext(gl_context_handle); | 
					
						
							|  |  |  | 			if (gl) { | 
					
						
							|  |  |  | 				GL.resizeOffscreenFramebuffer(gl); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		updateSize: function () { | 
					
						
							|  |  |  | 			const isFullscreen = GodotDisplayScreen.isFullscreen(); | 
					
						
							|  |  |  | 			const wantsFullWindow = GodotConfig.canvas_resize_policy === 2; | 
					
						
							|  |  |  | 			const noResize = GodotConfig.canvas_resize_policy === 0; | 
					
						
							| 
									
										
										
										
											2023-08-07 12:59:23 +02:00
										 |  |  | 			const dWidth = GodotDisplayScreen.desired_size[0]; | 
					
						
							|  |  |  | 			const dHeight = GodotDisplayScreen.desired_size[1]; | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 			const canvas = GodotConfig.canvas; | 
					
						
							| 
									
										
										
										
											2023-08-07 12:59:23 +02:00
										 |  |  | 			let width = dWidth; | 
					
						
							|  |  |  | 			let height = dHeight; | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 			if (noResize) { | 
					
						
							|  |  |  | 				// Don't resize canvas, just update GL if needed.
 | 
					
						
							|  |  |  | 				if (canvas.width !== width || canvas.height !== height) { | 
					
						
							|  |  |  | 					GodotDisplayScreen.desired_size = [canvas.width, canvas.height]; | 
					
						
							|  |  |  | 					GodotDisplayScreen._updateGL(); | 
					
						
							|  |  |  | 					return 1; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				return 0; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-03-08 19:31:52 +01:00
										 |  |  | 			const scale = GodotDisplayScreen.getPixelRatio(); | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 			if (isFullscreen || wantsFullWindow) { | 
					
						
							|  |  |  | 				// We need to match screen size.
 | 
					
						
							| 
									
										
										
										
											2025-04-20 16:53:37 +02:00
										 |  |  | 				width = Math.floor(window.innerWidth * scale); | 
					
						
							|  |  |  | 				height = Math.floor(window.innerHeight * scale); | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2025-04-20 16:53:37 +02:00
										 |  |  | 			const csw = `${Math.floor(width / scale)}px`; | 
					
						
							|  |  |  | 			const csh = `${Math.floor(height / scale)}px`; | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 			if (canvas.style.width !== csw || canvas.style.height !== csh || canvas.width !== width || canvas.height !== height) { | 
					
						
							|  |  |  | 				// Size doesn't match.
 | 
					
						
							|  |  |  | 				// Resize canvas, set correct CSS pixel size, update GL.
 | 
					
						
							|  |  |  | 				canvas.width = width; | 
					
						
							|  |  |  | 				canvas.height = height; | 
					
						
							|  |  |  | 				canvas.style.width = csw; | 
					
						
							|  |  |  | 				canvas.style.height = csh; | 
					
						
							|  |  |  | 				GodotDisplayScreen._updateGL(); | 
					
						
							|  |  |  | 				return 1; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			return 0; | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | mergeInto(LibraryManager.library, GodotDisplayScreen); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Display server interface. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Exposes all the functions needed by DisplayServer implementation. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | const GodotDisplay = { | 
					
						
							| 
									
										
										
										
											2021-09-12 13:40:07 +02:00
										 |  |  | 	$GodotDisplay__deps: ['$GodotConfig', '$GodotRuntime', '$GodotDisplayCursor', '$GodotEventListeners', '$GodotDisplayScreen', '$GodotDisplayVK'], | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 	$GodotDisplay: { | 
					
						
							|  |  |  | 		window_icon: '', | 
					
						
							| 
									
										
										
										
											2022-08-15 21:12:19 -07:00
										 |  |  | 		getDPI: function () { | 
					
						
							|  |  |  | 			// devicePixelRatio is given in dppx
 | 
					
						
							|  |  |  | 			// https://drafts.csswg.org/css-values/#resolution
 | 
					
						
							|  |  |  | 			// > due to the 1:96 fixed ratio of CSS *in* to CSS *px*, 1dppx is equivalent to 96dpi.
 | 
					
						
							|  |  |  | 			const dpi = Math.round(window.devicePixelRatio * 96); | 
					
						
							|  |  |  | 			return dpi >= 96 ? dpi : 96; | 
					
						
							| 
									
										
										
										
											2021-02-12 10:50:02 +01:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_is_swap_ok_cancel__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_is_swap_ok_cancel__sig: 'i', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_is_swap_ok_cancel: function () { | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 		const win = (['Windows', 'Win64', 'Win32', 'WinCE']); | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 		const plat = navigator.platform || ''; | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 		if (win.indexOf(plat) !== -1) { | 
					
						
							|  |  |  | 			return 1; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_tts_is_speaking__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 	godot_js_tts_is_speaking__sig: 'i', | 
					
						
							|  |  |  | 	godot_js_tts_is_speaking: function () { | 
					
						
							|  |  |  | 		return window.speechSynthesis.speaking; | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_tts_is_paused__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 	godot_js_tts_is_paused__sig: 'i', | 
					
						
							|  |  |  | 	godot_js_tts_is_paused: function () { | 
					
						
							|  |  |  | 		return window.speechSynthesis.paused; | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_tts_get_voices__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 	godot_js_tts_get_voices__sig: 'vi', | 
					
						
							|  |  |  | 	godot_js_tts_get_voices: function (p_callback) { | 
					
						
							|  |  |  | 		const func = GodotRuntime.get_func(p_callback); | 
					
						
							|  |  |  | 		try { | 
					
						
							|  |  |  | 			const arr = []; | 
					
						
							|  |  |  | 			const voices = window.speechSynthesis.getVoices(); | 
					
						
							|  |  |  | 			for (let i = 0; i < voices.length; i++) { | 
					
						
							|  |  |  | 				arr.push(`${voices[i].lang};${voices[i].name}`); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			const c_ptr = GodotRuntime.allocStringArray(arr); | 
					
						
							|  |  |  | 			func(arr.length, c_ptr); | 
					
						
							|  |  |  | 			GodotRuntime.freeStringArray(c_ptr, arr.length); | 
					
						
							|  |  |  | 		} catch (e) { | 
					
						
							|  |  |  | 			// Fail graciously.
 | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_tts_speak__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 	godot_js_tts_speak__sig: 'viiiffii', | 
					
						
							|  |  |  | 	godot_js_tts_speak: function (p_text, p_voice, p_volume, p_pitch, p_rate, p_utterance_id, p_callback) { | 
					
						
							|  |  |  | 		const func = GodotRuntime.get_func(p_callback); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		function listener_end(evt) { | 
					
						
							| 
									
										
										
										
											2024-05-12 04:16:02 +02:00
										 |  |  | 			evt.currentTarget.cb(1 /* TTS_UTTERANCE_ENDED */, evt.currentTarget.id, 0); | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		function listener_start(evt) { | 
					
						
							| 
									
										
										
										
											2024-05-12 04:16:02 +02:00
										 |  |  | 			evt.currentTarget.cb(0 /* TTS_UTTERANCE_STARTED */, evt.currentTarget.id, 0); | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		function listener_error(evt) { | 
					
						
							| 
									
										
										
										
											2024-05-12 04:16:02 +02:00
										 |  |  | 			evt.currentTarget.cb(2 /* TTS_UTTERANCE_CANCELED */, evt.currentTarget.id, 0); | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		function listener_bound(evt) { | 
					
						
							| 
									
										
										
										
											2024-05-12 04:16:02 +02:00
										 |  |  | 			evt.currentTarget.cb(3 /* TTS_UTTERANCE_BOUNDARY */, evt.currentTarget.id, evt.charIndex); | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		const utterance = new SpeechSynthesisUtterance(GodotRuntime.parseString(p_text)); | 
					
						
							|  |  |  | 		utterance.rate = p_rate; | 
					
						
							|  |  |  | 		utterance.pitch = p_pitch; | 
					
						
							|  |  |  | 		utterance.volume = p_volume / 100.0; | 
					
						
							|  |  |  | 		utterance.addEventListener('end', listener_end); | 
					
						
							|  |  |  | 		utterance.addEventListener('start', listener_start); | 
					
						
							|  |  |  | 		utterance.addEventListener('error', listener_error); | 
					
						
							|  |  |  | 		utterance.addEventListener('boundary', listener_bound); | 
					
						
							|  |  |  | 		utterance.id = p_utterance_id; | 
					
						
							|  |  |  | 		utterance.cb = func; | 
					
						
							|  |  |  | 		const voice = GodotRuntime.parseString(p_voice); | 
					
						
							|  |  |  | 		const voices = window.speechSynthesis.getVoices(); | 
					
						
							|  |  |  | 		for (let i = 0; i < voices.length; i++) { | 
					
						
							|  |  |  | 			if (voices[i].name === voice) { | 
					
						
							|  |  |  | 				utterance.voice = voices[i]; | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		window.speechSynthesis.resume(); | 
					
						
							|  |  |  | 		window.speechSynthesis.speak(utterance); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_tts_pause__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 	godot_js_tts_pause__sig: 'v', | 
					
						
							|  |  |  | 	godot_js_tts_pause: function () { | 
					
						
							|  |  |  | 		window.speechSynthesis.pause(); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_tts_resume__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 	godot_js_tts_resume__sig: 'v', | 
					
						
							|  |  |  | 	godot_js_tts_resume: function () { | 
					
						
							|  |  |  | 		window.speechSynthesis.resume(); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_tts_stop__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 	godot_js_tts_stop__sig: 'v', | 
					
						
							|  |  |  | 	godot_js_tts_stop: function () { | 
					
						
							|  |  |  | 		window.speechSynthesis.cancel(); | 
					
						
							|  |  |  | 		window.speechSynthesis.resume(); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_alert__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_alert__sig: 'vi', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_alert: function (p_text) { | 
					
						
							| 
									
										
										
										
											2020-11-19 16:54:07 +01:00
										 |  |  | 		window.alert(GodotRuntime.parseString(p_text)); // eslint-disable-line no-alert
 | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_screen_dpi_get__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-02-12 10:50:02 +01:00
										 |  |  | 	godot_js_display_screen_dpi_get__sig: 'i', | 
					
						
							|  |  |  | 	godot_js_display_screen_dpi_get: function () { | 
					
						
							| 
									
										
										
										
											2022-08-15 21:12:19 -07:00
										 |  |  | 		return GodotDisplay.getDPI(); | 
					
						
							| 
									
										
										
										
											2021-02-12 10:50:02 +01:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_pixel_ratio_get__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_pixel_ratio_get__sig: 'f', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_pixel_ratio_get: function () { | 
					
						
							| 
									
										
										
										
											2021-03-08 19:31:52 +01:00
										 |  |  | 		return GodotDisplayScreen.getPixelRatio(); | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_fullscreen_request__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 	godot_js_display_fullscreen_request__sig: 'i', | 
					
						
							|  |  |  | 	godot_js_display_fullscreen_request: function () { | 
					
						
							|  |  |  | 		return GodotDisplayScreen.requestFullscreen(); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_fullscreen_exit__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 	godot_js_display_fullscreen_exit__sig: 'i', | 
					
						
							|  |  |  | 	godot_js_display_fullscreen_exit: function () { | 
					
						
							|  |  |  | 		return GodotDisplayScreen.exitFullscreen(); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_desired_size_set__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-06-11 17:15:03 +02:00
										 |  |  | 	godot_js_display_desired_size_set__sig: 'vii', | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 	godot_js_display_desired_size_set: function (width, height) { | 
					
						
							|  |  |  | 		GodotDisplayScreen.desired_size = [width, height]; | 
					
						
							|  |  |  | 		GodotDisplayScreen.updateSize(); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_size_update__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 	godot_js_display_size_update__sig: 'i', | 
					
						
							|  |  |  | 	godot_js_display_size_update: function () { | 
					
						
							| 
									
										
										
										
											2021-03-08 23:16:51 +01:00
										 |  |  | 		const updated = GodotDisplayScreen.updateSize(); | 
					
						
							|  |  |  | 		if (updated) { | 
					
						
							|  |  |  | 			GodotDisplayVK.updateSize(); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return updated; | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_screen_size_get__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 	godot_js_display_screen_size_get__sig: 'vii', | 
					
						
							|  |  |  | 	godot_js_display_screen_size_get: function (width, height) { | 
					
						
							| 
									
										
										
										
											2021-03-08 19:31:52 +01:00
										 |  |  | 		const scale = GodotDisplayScreen.getPixelRatio(); | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 		GodotRuntime.setHeapValue(width, window.screen.width * scale, 'i32'); | 
					
						
							|  |  |  | 		GodotRuntime.setHeapValue(height, window.screen.height * scale, 'i32'); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_window_size_get__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2022-03-13 13:18:15 +01:00
										 |  |  | 	godot_js_display_window_size_get__sig: 'vii', | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 	godot_js_display_window_size_get: function (p_width, p_height) { | 
					
						
							|  |  |  | 		GodotRuntime.setHeapValue(p_width, GodotConfig.canvas.width, 'i32'); | 
					
						
							|  |  |  | 		GodotRuntime.setHeapValue(p_height, GodotConfig.canvas.height, 'i32'); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_has_webgl__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-04-06 12:46:33 +02:00
										 |  |  | 	godot_js_display_has_webgl__sig: 'ii', | 
					
						
							|  |  |  | 	godot_js_display_has_webgl: function (p_version) { | 
					
						
							|  |  |  | 		if (p_version !== 1 && p_version !== 2) { | 
					
						
							|  |  |  | 			return false; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		try { | 
					
						
							|  |  |  | 			return !!document.createElement('canvas').getContext(p_version === 2 ? 'webgl2' : 'webgl'); | 
					
						
							|  |  |  | 		} catch (e) { /* Not available */ } | 
					
						
							|  |  |  | 		return false; | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 	/* | 
					
						
							|  |  |  | 	 * Canvas | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_canvas_focus__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_canvas_focus__sig: 'v', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_canvas_focus: function () { | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 		GodotConfig.canvas.focus(); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_canvas_is_focused__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_canvas_is_focused__sig: 'i', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_canvas_is_focused: function () { | 
					
						
							| 
									
										
										
										
											2020-11-19 16:54:07 +01:00
										 |  |  | 		return document.activeElement === GodotConfig.canvas; | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* | 
					
						
							|  |  |  | 	 * Touchscreen | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_touchscreen_is_available__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_touchscreen_is_available__sig: 'i', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_touchscreen_is_available: function () { | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 		return 'ontouchstart' in window; | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* | 
					
						
							|  |  |  | 	 * Clipboard | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_clipboard_set__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_clipboard_set__sig: 'ii', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_clipboard_set: function (p_text) { | 
					
						
							| 
									
										
										
										
											2020-11-19 16:54:07 +01:00
										 |  |  | 		const text = GodotRuntime.parseString(p_text); | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 		if (!navigator.clipboard || !navigator.clipboard.writeText) { | 
					
						
							|  |  |  | 			return 1; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 		navigator.clipboard.writeText(text).catch(function (e) { | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 			// Setting OS clipboard is only possible from an input callback.
 | 
					
						
							| 
									
										
										
										
											2023-07-05 09:44:07 +07:00
										 |  |  | 			GodotRuntime.error('Setting OS clipboard is only possible from an input callback for the Web platform. Exception:', e); | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 		}); | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_clipboard_get__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_clipboard_get__sig: 'ii', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_clipboard_get: function (callback) { | 
					
						
							| 
									
										
										
										
											2020-11-19 16:54:07 +01:00
										 |  |  | 		const func = GodotRuntime.get_func(callback); | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 		try { | 
					
						
							|  |  |  | 			navigator.clipboard.readText().then(function (result) { | 
					
						
							| 
									
										
										
										
											2020-11-19 16:54:07 +01:00
										 |  |  | 				const ptr = GodotRuntime.allocString(result); | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 				func(ptr); | 
					
						
							| 
									
										
										
										
											2020-11-19 16:54:07 +01:00
										 |  |  | 				GodotRuntime.free(ptr); | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 			}).catch(function (e) { | 
					
						
							|  |  |  | 				// Fail graciously.
 | 
					
						
							|  |  |  | 			}); | 
					
						
							|  |  |  | 		} catch (e) { | 
					
						
							|  |  |  | 			// Fail graciously.
 | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* | 
					
						
							|  |  |  | 	 * Window | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_window_title_set__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_window_title_set__sig: 'vi', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_window_title_set: function (p_data) { | 
					
						
							| 
									
										
										
										
											2020-11-19 16:54:07 +01:00
										 |  |  | 		document.title = GodotRuntime.parseString(p_data); | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_window_icon_set__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_window_icon_set__sig: 'vii', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_window_icon_set: function (p_ptr, p_len) { | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 		let link = document.getElementById('-gd-engine-icon'); | 
					
						
							|  |  |  | 		const old_icon = GodotDisplay.window_icon; | 
					
						
							| 
									
										
										
										
											2023-06-19 16:18:39 +03:00
										 |  |  | 		if (p_ptr) { | 
					
						
							|  |  |  | 			if (link === null) { | 
					
						
							|  |  |  | 				link = document.createElement('link'); | 
					
						
							|  |  |  | 				link.rel = 'icon'; | 
					
						
							|  |  |  | 				link.id = '-gd-engine-icon'; | 
					
						
							|  |  |  | 				document.head.appendChild(link); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			const png = new Blob([GodotRuntime.heapSlice(HEAPU8, p_ptr, p_len)], { type: 'image/png' }); | 
					
						
							|  |  |  | 			GodotDisplay.window_icon = URL.createObjectURL(png); | 
					
						
							|  |  |  | 			link.href = GodotDisplay.window_icon; | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			if (link) { | 
					
						
							|  |  |  | 				link.remove(); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			GodotDisplay.window_icon = null; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 		if (old_icon) { | 
					
						
							|  |  |  | 			URL.revokeObjectURL(old_icon); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* | 
					
						
							|  |  |  | 	 * Cursor | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_cursor_set_visible__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_cursor_set_visible__sig: 'vi', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_cursor_set_visible: function (p_visible) { | 
					
						
							| 
									
										
										
										
											2020-11-19 16:54:07 +01:00
										 |  |  | 		const visible = p_visible !== 0; | 
					
						
							|  |  |  | 		if (visible === GodotDisplayCursor.visible) { | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 			return; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		GodotDisplayCursor.visible = visible; | 
					
						
							|  |  |  | 		if (visible) { | 
					
						
							|  |  |  | 			GodotDisplayCursor.set_shape(GodotDisplayCursor.shape); | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			GodotDisplayCursor.set_style('none'); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_cursor_is_hidden__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_cursor_is_hidden__sig: 'i', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_cursor_is_hidden: function () { | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 		return !GodotDisplayCursor.visible; | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_cursor_set_shape__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_cursor_set_shape__sig: 'vi', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_cursor_set_shape: function (p_string) { | 
					
						
							| 
									
										
										
										
											2020-11-19 16:54:07 +01:00
										 |  |  | 		GodotDisplayCursor.set_shape(GodotRuntime.parseString(p_string)); | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_cursor_set_custom_shape__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_cursor_set_custom_shape__sig: 'viiiii', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_cursor_set_custom_shape: function (p_shape, p_ptr, p_len, p_hotspot_x, p_hotspot_y) { | 
					
						
							| 
									
										
										
										
											2020-11-19 16:54:07 +01:00
										 |  |  | 		const shape = GodotRuntime.parseString(p_shape); | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 		const old_shape = GodotDisplayCursor.cursors[shape]; | 
					
						
							|  |  |  | 		if (p_len > 0) { | 
					
						
							| 
									
										
										
										
											2021-03-03 15:58:28 +01:00
										 |  |  | 			const png = new Blob([GodotRuntime.heapSlice(HEAPU8, p_ptr, p_len)], { type: 'image/png' }); | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 			const url = URL.createObjectURL(png); | 
					
						
							|  |  |  | 			GodotDisplayCursor.cursors[shape] = { | 
					
						
							|  |  |  | 				url: url, | 
					
						
							|  |  |  | 				x: p_hotspot_x, | 
					
						
							|  |  |  | 				y: p_hotspot_y, | 
					
						
							|  |  |  | 			}; | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			delete GodotDisplayCursor.cursors[shape]; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-11-19 16:54:07 +01:00
										 |  |  | 		if (shape === GodotDisplayCursor.shape) { | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 			GodotDisplayCursor.set_shape(GodotDisplayCursor.shape); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (old_shape) { | 
					
						
							|  |  |  | 			URL.revokeObjectURL(old_shape.url); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_cursor_lock_set__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-09-12 18:13:54 +02:00
										 |  |  | 	godot_js_display_cursor_lock_set__sig: 'vi', | 
					
						
							|  |  |  | 	godot_js_display_cursor_lock_set: function (p_lock) { | 
					
						
							|  |  |  | 		if (p_lock) { | 
					
						
							|  |  |  | 			GodotDisplayCursor.lockPointer(); | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			GodotDisplayCursor.releasePointer(); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_cursor_is_locked__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-09-12 18:13:54 +02:00
										 |  |  | 	godot_js_display_cursor_is_locked__sig: 'i', | 
					
						
							|  |  |  | 	godot_js_display_cursor_is_locked: function () { | 
					
						
							|  |  |  | 		return GodotDisplayCursor.isPointerLocked() ? 1 : 0; | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 	/* | 
					
						
							|  |  |  | 	 * Listeners | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_fullscreen_cb__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-09-12 12:19:33 +02:00
										 |  |  | 	godot_js_display_fullscreen_cb__sig: 'vi', | 
					
						
							|  |  |  | 	godot_js_display_fullscreen_cb: function (callback) { | 
					
						
							|  |  |  | 		const canvas = GodotConfig.canvas; | 
					
						
							|  |  |  | 		const func = GodotRuntime.get_func(callback); | 
					
						
							|  |  |  | 		function change_cb(evt) { | 
					
						
							|  |  |  | 			if (evt.target === canvas) { | 
					
						
							|  |  |  | 				func(GodotDisplayScreen.isFullscreen()); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2021-09-12 13:40:07 +02:00
										 |  |  | 		GodotEventListeners.add(document, 'fullscreenchange', change_cb, false); | 
					
						
							|  |  |  | 		GodotEventListeners.add(document, 'mozfullscreenchange', change_cb, false); | 
					
						
							|  |  |  | 		GodotEventListeners.add(document, 'webkitfullscreenchange', change_cb, false); | 
					
						
							| 
									
										
										
										
											2021-09-12 12:19:33 +02:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_window_blur_cb__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-10-05 12:54:42 +02:00
										 |  |  | 	godot_js_display_window_blur_cb__sig: 'vi', | 
					
						
							|  |  |  | 	godot_js_display_window_blur_cb: function (callback) { | 
					
						
							|  |  |  | 		const func = GodotRuntime.get_func(callback); | 
					
						
							| 
									
										
										
										
											2021-09-12 13:40:07 +02:00
										 |  |  | 		GodotEventListeners.add(window, 'blur', function () { | 
					
						
							| 
									
										
										
										
											2021-10-05 12:54:42 +02:00
										 |  |  | 			func(); | 
					
						
							|  |  |  | 		}, false); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_notification_cb__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2020-12-03 12:51:17 +01:00
										 |  |  | 	godot_js_display_notification_cb__sig: 'viiiii', | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 	godot_js_display_notification_cb: function (callback, p_enter, p_exit, p_in, p_out) { | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 		const canvas = GodotConfig.canvas; | 
					
						
							| 
									
										
										
										
											2020-11-19 16:54:07 +01:00
										 |  |  | 		const func = GodotRuntime.get_func(callback); | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 		const notif = [p_enter, p_exit, p_in, p_out]; | 
					
						
							| 
									
										
										
										
											2020-11-23 12:13:52 +01:00
										 |  |  | 		['mouseover', 'mouseleave', 'focus', 'blur'].forEach(function (evt_name, idx) { | 
					
						
							| 
									
										
										
										
											2021-09-12 13:40:07 +02:00
										 |  |  | 			GodotEventListeners.add(canvas, evt_name, function () { | 
					
						
							| 
									
										
										
										
											2021-03-29 20:02:29 +02:00
										 |  |  | 				func(notif[idx]); | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | 			}, true); | 
					
						
							|  |  |  | 		}); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_setup_canvas__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-03-08 19:31:52 +01:00
										 |  |  | 	godot_js_display_setup_canvas__sig: 'viiii', | 
					
						
							|  |  |  | 	godot_js_display_setup_canvas: function (p_width, p_height, p_fullscreen, p_hidpi) { | 
					
						
							| 
									
										
										
										
											2021-02-10 16:22:48 +01:00
										 |  |  | 		const canvas = GodotConfig.canvas; | 
					
						
							| 
									
										
										
										
											2021-09-12 13:40:07 +02:00
										 |  |  | 		GodotEventListeners.add(canvas, 'contextmenu', function (ev) { | 
					
						
							| 
									
										
										
										
											2021-02-10 16:22:48 +01:00
										 |  |  | 			ev.preventDefault(); | 
					
						
							|  |  |  | 		}, false); | 
					
						
							| 
									
										
										
										
											2021-09-12 13:40:07 +02:00
										 |  |  | 		GodotEventListeners.add(canvas, 'webglcontextlost', function (ev) { | 
					
						
							| 
									
										
										
										
											2021-02-10 16:22:48 +01:00
										 |  |  | 			alert('WebGL context lost, please reload the page'); // eslint-disable-line no-alert
 | 
					
						
							|  |  |  | 			ev.preventDefault(); | 
					
						
							|  |  |  | 		}, false); | 
					
						
							| 
									
										
										
										
											2021-03-08 19:31:52 +01:00
										 |  |  | 		GodotDisplayScreen.hidpi = !!p_hidpi; | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 		switch (GodotConfig.canvas_resize_policy) { | 
					
						
							|  |  |  | 		case 0: // None
 | 
					
						
							|  |  |  | 			GodotDisplayScreen.desired_size = [canvas.width, canvas.height]; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 		case 1: // Project
 | 
					
						
							|  |  |  | 			GodotDisplayScreen.desired_size = [p_width, p_height]; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 		default: // Full window
 | 
					
						
							|  |  |  | 			// Ensure we display in the right place, the size will be handled by updateSize
 | 
					
						
							|  |  |  | 			canvas.style.position = 'absolute'; | 
					
						
							|  |  |  | 			canvas.style.top = 0; | 
					
						
							|  |  |  | 			canvas.style.left = 0; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2021-03-09 23:37:34 +01:00
										 |  |  | 		GodotDisplayScreen.updateSize(); | 
					
						
							| 
									
										
										
										
											2021-01-30 11:35:03 +01:00
										 |  |  | 		if (p_fullscreen) { | 
					
						
							|  |  |  | 			GodotDisplayScreen.requestFullscreen(); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2021-02-10 16:22:48 +01:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-08 23:16:51 +01:00
										 |  |  | 	/* | 
					
						
							|  |  |  | 	 * Virtual Keyboard | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_vk_show__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-03-08 23:16:51 +01:00
										 |  |  | 	godot_js_display_vk_show__sig: 'viiii', | 
					
						
							| 
									
										
										
										
											2022-07-07 14:20:10 -04:00
										 |  |  | 	godot_js_display_vk_show: function (p_text, p_type, p_start, p_end) { | 
					
						
							| 
									
										
										
										
											2021-03-08 23:16:51 +01:00
										 |  |  | 		const text = GodotRuntime.parseString(p_text); | 
					
						
							|  |  |  | 		const start = p_start > 0 ? p_start : 0; | 
					
						
							|  |  |  | 		const end = p_end > 0 ? p_end : start; | 
					
						
							| 
									
										
										
										
											2022-07-07 14:20:10 -04:00
										 |  |  | 		GodotDisplayVK.show(text, p_type, start, end); | 
					
						
							| 
									
										
										
										
											2021-03-08 23:16:51 +01:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_vk_hide__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-03-08 23:16:51 +01:00
										 |  |  | 	godot_js_display_vk_hide__sig: 'v', | 
					
						
							|  |  |  | 	godot_js_display_vk_hide: function () { | 
					
						
							|  |  |  | 		GodotDisplayVK.hide(); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_vk_available__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-03-08 23:16:51 +01:00
										 |  |  | 	godot_js_display_vk_available__sig: 'i', | 
					
						
							|  |  |  | 	godot_js_display_vk_available: function () { | 
					
						
							|  |  |  | 		return GodotDisplayVK.available(); | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_tts_available__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-11-04 14:33:37 +02:00
										 |  |  | 	godot_js_display_tts_available__sig: 'i', | 
					
						
							|  |  |  | 	godot_js_display_tts_available: function () { | 
					
						
							|  |  |  | 		return 'speechSynthesis' in window; | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 09:42:03 -04:00
										 |  |  | 	godot_js_display_vk_cb__proxy: 'sync', | 
					
						
							| 
									
										
										
										
											2021-03-08 23:16:51 +01:00
										 |  |  | 	godot_js_display_vk_cb__sig: 'vi', | 
					
						
							|  |  |  | 	godot_js_display_vk_cb: function (p_input_cb) { | 
					
						
							|  |  |  | 		const input_cb = GodotRuntime.get_func(p_input_cb); | 
					
						
							|  |  |  | 		if (GodotDisplayVK.available()) { | 
					
						
							|  |  |  | 			GodotDisplayVK.init(input_cb); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2020-10-23 18:33:20 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | autoAddDeps(GodotDisplay, '$GodotDisplay'); | 
					
						
							|  |  |  | mergeInto(LibraryManager.library, GodotDisplay); |