diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index 388c1ca9fd3..3e84702d7f7 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -47,7 +47,7 @@ jobs: - name: JavaScript style and documentation checks via ESLint and JSDoc run: | - cd platform/javascript + cd platform/web npm ci npm run lint npm run docs -- -d dry-run diff --git a/.github/workflows/javascript_builds.yml b/.github/workflows/web_builds.yml similarity index 91% rename from .github/workflows/javascript_builds.yml rename to .github/workflows/web_builds.yml index 54bde92b167..8c5b14e314b 100644 --- a/.github/workflows/javascript_builds.yml +++ b/.github/workflows/web_builds.yml @@ -1,4 +1,4 @@ -name: 🌐 JavaScript Builds +name: 🌐 Web Builds on: [push, pull_request] # Global Settings @@ -10,11 +10,11 @@ env: EM_CACHE_FOLDER: "emsdk-cache" concurrency: - group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-javascript + group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-web cancel-in-progress: true jobs: - javascript-template: + web-template: runs-on: "ubuntu-20.04" name: Template (target=release, tools=no) @@ -42,7 +42,7 @@ jobs: uses: ./.github/actions/godot-build with: sconsflags: ${{ env.SCONSFLAGS }} - platform: javascript + platform: web target: release tools: false tests: false diff --git a/README.md b/README.md index a7e67f89462..82dbdcfed1a 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,7 @@ comprehensive set of [common tools](https://godotengine.org/features), so that u without having to reinvent the wheel. Games can be exported with one click to a number of platforms, including the major desktop platforms (Linux, macOS, Windows), mobile platforms (Android, iOS), as well as Web-based platforms -(HTML5) and -[consoles](https://docs.godotengine.org/en/latest/tutorials/platform/consoles.html). +and [consoles](https://docs.godotengine.org/en/latest/tutorials/platform/consoles.html). ## Free, open source and community-driven diff --git a/SConstruct b/SConstruct index 55ed3771ac5..4972b214215 100644 --- a/SConstruct +++ b/SConstruct @@ -106,7 +106,7 @@ platform_arg = ARGUMENTS.get("platform", ARGUMENTS.get("p", False)) if platform_arg == "android": custom_tools = ["clang", "clang++", "as", "ar", "link"] -elif platform_arg == "javascript": +elif platform_arg == "web": # Use generic POSIX build toolchain for Emscripten. custom_tools = ["cc", "c++", "ar", "link", "textfile", "zip"] elif os.name == "nt" and methods.get_cmdline_bool("use_mingw", False): diff --git a/core/input/godotcontrollerdb.txt b/core/input/godotcontrollerdb.txt index 7f3570729ab..b2a6160c6cc 100644 --- a/core/input/godotcontrollerdb.txt +++ b/core/input/godotcontrollerdb.txt @@ -7,31 +7,31 @@ __XINPUT_DEVICE__,XInput Gamepad,a:b12,b:b13,x:b14,y:b15,start:b4,back:b5,leftst # Android Default Android Gamepad,Default Controller,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b8,rightshoulder:b10,rightx:a2,start:b6,righty:a3,dpleft:h0.8,lefttrigger:a4,x:b2,dpup:h0.1,back:b4,leftstick:b7,leftshoulder:b9,y:b3,a:b0,dpright:h0.2,righttrigger:a5,b:b1,platform:Android, -# Javascript -standard,Standard Gamepad Mapping,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a6,righttrigger:a7,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b8,start:b9,leftstick:b10,rightstick:b11,dpup:b12,dpdown:b13,dpleft:b14,dpright:b15,guide:b16,leftstick:b10,rightstick:b11,platform:Javascript, -Linux24c6581a,PowerA Xbox One Cabled,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript, -Linux0e6f0301,Logic 3 Controller (xbox compatible),a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript, -Linux045e028e,Microsoft X-Box 360 pad,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript, -Linux045e02d1,Microsoft X-Box One pad,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript, -Linux045e02ea,Microsoft X-Box One S pad,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript, -Linux045e0b12,Microsoft X-Box Series X pad,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript, -Linux044fb315,Thrustmaster dual analog 3.2,a:b0,b:b2,y:b3,x:b1,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:-a5,dpleft:-a4,dpdown:+a5,dpright:+a4,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Javascript, -Linux0e8f0003,PS3 Controller,a:b2,b:b1,back:b8,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Javascript, -MacOSX24c6581a,PowerA Xbox One Cabled,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Javascript -MacOSX045e028e,Xbox 360 Wired Controller,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Javascript -MacOSX045e02d1,Xbox One Controller,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Javascript -MacOSX045e02ea,Xbox One S Controller,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Javascript -MacOSX045e0b12,Xbox Series X Controller,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Javascript -Linux15320a14,Razer Wolverine Ultimate,a:b0,b:b1,y:b3,x:b2,start:b7,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript -Linux05832060,iBuffalo BSGP801,a:b1,b:b0,y:b2,x:b3,start:b7,back:b6,leftshoulder:b4,rightshoulder:b5,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,platform:Javascript -MacOSX05832060,iBuffalo BSGP801,a:b1,b:b0,y:b2,x:b3,start:b7,back:b6,leftshoulder:b4,rightshoulder:b5,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,platform:Javascript -Linux0e8f3013,HuiJia USB GamePad,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftshoulder:b6,rightshoulder:b7,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,platform:Javascript -Windows0e8f3013,HuiJia USB GamePad,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftshoulder:b6,rightshoulder:b7,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,platform:Javascript -MacOSX0e8f3013,HuiJia USB GamePad,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftshoulder:b6,rightshoulder:b7,dpup:-a4,dpleft:-a3,dpdown:+a4,dpright:+a3,platform:Javascript -Linux046dc216,046d-c216-Logitech Logitech Dual Action,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:-a5,dpleft:-a4,dpdown:+a5,dpright:+a4,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Javascript -Linux20d6a713,Bensussen Deutsch & Associates Inc.(BDA) NSW Wired controller,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:-a5,dpleft:-a4,dpdown:+a5,dpright:+a4,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Javascript -Linux054c05c4,Sony Computer Entertainment Wireless Controller,a:b0,b:b1,y:b2,x:b3,start:b9,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript -Linux18d19400,18d1-9400-Google LLC Stadia Controller rev. A,a:b0,b:b1,y:b3,x:b2,start:b7,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,platform:Javascript +# Web +standard,Standard Gamepad Mapping,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a6,righttrigger:a7,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b8,start:b9,leftstick:b10,rightstick:b11,dpup:b12,dpdown:b13,dpleft:b14,dpright:b15,guide:b16,leftstick:b10,rightstick:b11,platform:Web, +Linux24c6581a,PowerA Xbox One Cabled,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Web, +Linux0e6f0301,Logic 3 Controller (xbox compatible),a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Web, +Linux045e028e,Microsoft X-Box 360 pad,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Web, +Linux045e02d1,Microsoft X-Box One pad,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Web, +Linux045e02ea,Microsoft X-Box One S pad,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Web, +Linux045e0b12,Microsoft X-Box Series X pad,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Web, +Linux044fb315,Thrustmaster dual analog 3.2,a:b0,b:b2,y:b3,x:b1,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:-a5,dpleft:-a4,dpdown:+a5,dpright:+a4,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,platform:Web, +Linux0e8f0003,PS3 Controller,a:b2,b:b1,back:b8,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Web, +MacOSX24c6581a,PowerA Xbox One Cabled,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Web +MacOSX045e028e,Xbox 360 Wired Controller,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Web +MacOSX045e02d1,Xbox One Controller,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Web +MacOSX045e02ea,Xbox One S Controller,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Web +MacOSX045e0b12,Xbox Series X Controller,a:b11,b:b12,y:b14,x:b13,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpleft:b2,dpdown:b1,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Web +Linux15320a14,Razer Wolverine Ultimate,a:b0,b:b1,y:b3,x:b2,start:b7,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Web +Linux05832060,iBuffalo BSGP801,a:b1,b:b0,y:b2,x:b3,start:b7,back:b6,leftshoulder:b4,rightshoulder:b5,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,platform:Web +MacOSX05832060,iBuffalo BSGP801,a:b1,b:b0,y:b2,x:b3,start:b7,back:b6,leftshoulder:b4,rightshoulder:b5,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,platform:Web +Linux0e8f3013,HuiJia USB GamePad,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftshoulder:b6,rightshoulder:b7,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,platform:Web +Windows0e8f3013,HuiJia USB GamePad,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftshoulder:b6,rightshoulder:b7,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,platform:Web +MacOSX0e8f3013,HuiJia USB GamePad,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftshoulder:b6,rightshoulder:b7,dpup:-a4,dpleft:-a3,dpdown:+a4,dpright:+a3,platform:Web +Linux046dc216,046d-c216-Logitech Logitech Dual Action,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:-a5,dpleft:-a4,dpdown:+a5,dpright:+a4,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Web +Linux20d6a713,Bensussen Deutsch & Associates Inc.(BDA) NSW Wired controller,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:-a5,dpleft:-a4,dpdown:+a5,dpright:+a4,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Web +Linux054c05c4,Sony Computer Entertainment Wireless Controller,a:b0,b:b1,y:b2,x:b3,start:b9,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Web +Linux18d19400,18d1-9400-Google LLC Stadia Controller rev. A,a:b0,b:b1,y:b3,x:b2,start:b7,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,platform:Web # UWP __UWP_GAMEPAD__,Xbox Controller,a:b2,b:b3,x:b4,y:b5,start:b0,back:b1,leftstick:b12,rightstick:b13,leftshoulder:b10,rightshoulder:b11,dpup:b6,dpdown:b7,dpleft:b8,dpright:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:UWP, diff --git a/core/input/input_builders.py b/core/input/input_builders.py index c0dac26f02c..16f125ff387 100644 --- a/core/input/input_builders.py +++ b/core/input/input_builders.py @@ -50,7 +50,7 @@ def make_default_controller_mappings(target, source, env): "Mac OS X": "#ifdef MACOS_ENABLED", "Android": "#if defined(__ANDROID__)", "iOS": "#ifdef IOS_ENABLED", - "Javascript": "#ifdef JAVASCRIPT_ENABLED", + "Web": "#ifdef WEB_ENABLED", "UWP": "#ifdef UWP_ENABLED", } diff --git a/core/io/http_client_tcp.cpp b/core/io/http_client_tcp.cpp index d983d86b993..9499a6f8e34 100644 --- a/core/io/http_client_tcp.cpp +++ b/core/io/http_client_tcp.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef JAVASCRIPT_ENABLED +#ifndef WEB_ENABLED #include "http_client_tcp.h" @@ -788,4 +788,4 @@ HTTPClientTCP::HTTPClientTCP() { HTTPClient *(*HTTPClient::_create)() = HTTPClientTCP::_create_func; -#endif // #ifndef JAVASCRIPT_ENABLED +#endif // WEB_ENABLED diff --git a/core/os/os.cpp b/core/os/os.cpp index 45cd7109e2b..26a1b0e1608 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -159,7 +159,7 @@ int OS::get_process_id() const { } void OS::vibrate_handheld(int p_duration_ms) { - WARN_PRINT("vibrate_handheld() only works with Android, iOS and HTML5"); + WARN_PRINT("vibrate_handheld() only works with Android, iOS and Web"); } bool OS::is_stdout_verbose() const { diff --git a/doc/Makefile b/doc/Makefile index c29843f303f..ecc5e51dd6e 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -2,7 +2,7 @@ BASEDIR = $(CURDIR) CLASSES = $(BASEDIR)/classes/ $(BASEDIR)/../modules/ OUTPUTDIR = $(BASEDIR)/_build TOOLSDIR = $(BASEDIR)/tools -JSDIR = $(BASEDIR)/../platform/javascript +JSDIR = $(BASEDIR)/../platform/web LANGARG ?= en LANGCMD = -l $(LANGARG) diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 71579d51730..e33d0a28fbf 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1277,7 +1277,7 @@ The [JavaScript] singleton. - [b]Note:[/b] Only implemented on HTML5. + [b]Note:[/b] Only implemented on the Web platform. The [Marshalls] singleton. diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index c5f61cdfd3d..35a2861c546 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -760,7 +760,7 @@ Returns the current refresh rate of the specified screen. If [param screen] is [constant SCREEN_OF_MAIN_WINDOW] (the default value), a screen with the main window will be used. - [b]Note:[/b] Returns [code]-1.0[/code] if the DisplayServer fails to find the refresh rate for the specified screen. On HTML5, [method screen_get_refresh_rate] will always return [code]-1.0[/code] as there is no way to retrieve the refresh rate on that platform. + [b]Note:[/b] Returns [code]-1.0[/code] if the DisplayServer fails to find the refresh rate for the specified screen. On Web, [method screen_get_refresh_rate] will always return [code]-1.0[/code] as there is no way to retrieve the refresh rate on that platform. To fallback to a default refresh rate if the method fails, try: [codeblock] var refresh_rate = DisplayServer.screen_get_refresh_rate() @@ -864,7 +864,7 @@ - [code]name[/code] is voice name. - [code]id[/code] is voice identifier. - [code]language[/code] is language code in [code]lang_Variant[/code] format. [code]lang[/code] part is a 2 or 3-letter code based on the ISO-639 standard, in lowercase. And [code]Variant[/code] part is an engine dependent string describing country, region or/and dialect. - [b]Note:[/b] This method is implemented on Android, iOS, HTML5, Linux, macOS, and Windows. + [b]Note:[/b] This method is implemented on Android, iOS, Web, Linux, macOS, and Windows. @@ -872,35 +872,35 @@ Returns an [PackedStringArray] of voice identifiers for the [param language]. - [b]Note:[/b] This method is implemented on Android, iOS, HTML5, Linux, macOS, and Windows. + [b]Note:[/b] This method is implemented on Android, iOS, Web, Linux, macOS, and Windows. Returns [code]true[/code] if the synthesizer is in a paused state. - [b]Note:[/b] This method is implemented on Android, iOS, HTML5, Linux, macOS, and Windows. + [b]Note:[/b] This method is implemented on Android, iOS, Web, Linux, macOS, and Windows. Returns [code]true[/code] if the synthesizer is generating speech, or have utterance waiting in the queue. - [b]Note:[/b] This method is implemented on Android, iOS, HTML5, Linux, macOS, and Windows. + [b]Note:[/b] This method is implemented on Android, iOS, Web, Linux, macOS, and Windows. Puts the synthesizer into a paused state. - [b]Note:[/b] This method is implemented on Android, iOS, HTML5, Linux, macOS, and Windows. + [b]Note:[/b] This method is implemented on Android, iOS, Web, Linux, macOS, and Windows. Resumes the synthesizer if it was paused. - [b]Note:[/b] This method is implemented on Android, iOS, HTML5, Linux, macOS, and Windows. + [b]Note:[/b] This method is implemented on Android, iOS, Web, Linux, macOS, and Windows. @@ -912,7 +912,7 @@ - [code]TTS_UTTERANCE_STARTED[/code], [code]TTS_UTTERANCE_ENDED[/code], and [code]TTS_UTTERANCE_CANCELED[/code] callable's method should take one [int] parameter, the utterance id. - [code]TTS_UTTERANCE_BOUNDARY[/code] callable's method should take two [int] parameters, the index of the character and the utterance id. [b]Note:[/b] The granularity of the boundary callbacks is engine dependent. - [b]Note:[/b] This method is implemented on Android, iOS, HTML5, Linux, macOS, and Windows. + [b]Note:[/b] This method is implemented on Android, iOS, Web, Linux, macOS, and Windows. @@ -933,14 +933,14 @@ - [param utterance_id] is passed as a parameter to the callback functions. [b]Note:[/b] On Windows and Linux, utterance [param text] can use SSML markup. SSML support is engine and voice dependent. If the engine does not support SSML, you should strip out all XML markup before calling [method tts_speak]. [b]Note:[/b] The granularity of pitch, rate, and volume is engine and voice dependent. Values may be truncated. - [b]Note:[/b] This method is implemented on Android, iOS, HTML5, Linux, macOS, and Windows. + [b]Note:[/b] This method is implemented on Android, iOS, Web, Linux, macOS, and Windows. Stops synthesis in progress and removes all utterances from the queue. - [b]Note:[/b] This method is implemented on Android, iOS, HTML5, Linux, macOS, and Windows. + [b]Note:[/b] This method is implemented on Android, iOS, Web, Linux, macOS, and Windows. @@ -971,7 +971,7 @@ [param max_length] limits the number of characters that can be entered if different from [code]-1[/code]. [param cursor_start] can optionally define the current text cursor position if [param cursor_end] is not set. [param cursor_start] and [param cursor_end] can optionally define the current text selection. - [b]Note:[/b] This method is implemented on Android, iOS and HTML5. + [b]Note:[/b] This method is implemented on Android, iOS and Web. @@ -1396,7 +1396,7 @@ Virtual keyboard for entering a password. On most platforms, this should disable autocomplete and autocapitalization. - [b]Note:[/b] This is not supported on HTML5. Instead, this behaves identically to [constant KEYBOARD_TYPE_DEFAULT]. + [b]Note:[/b] This is not supported on Web. Instead, this behaves identically to [constant KEYBOARD_TYPE_DEFAULT]. Virtual keyboard with additional keys to assist with typing URLs. diff --git a/doc/classes/FileDialog.xml b/doc/classes/FileDialog.xml index ba6f4ffb891..43a941c8c88 100644 --- a/doc/classes/FileDialog.xml +++ b/doc/classes/FileDialog.xml @@ -55,7 +55,7 @@ The file system access scope. See enum [code]Access[/code] constants. - [b]Warning:[/b] Currently, in sandboxed environments such as HTML5 builds or sandboxed macOS apps, FileDialog cannot access the host file system. See [url=https://github.com/godotengine/godot-proposals/issues/1123]godot-proposals#1123[/url]. + [b]Warning:[/b] Currently, in sandboxed environments such as Web builds or sandboxed macOS apps, FileDialog cannot access the host file system. See [url=https://github.com/godotengine/godot-proposals/issues/1123]godot-proposals#1123[/url]. The current working directory of the file dialog. diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml index 97178bc94d7..332ce9d8f41 100644 --- a/doc/classes/HTTPClient.xml +++ b/doc/classes/HTTPClient.xml @@ -11,7 +11,7 @@ For more information on HTTP, see https://developer.mozilla.org/en-US/docs/Web/HTTP (or read RFC 2616 to get it straight from the source: https://tools.ietf.org/html/rfc2616). [b]Note:[/b] When exporting to Android, make sure to enable the [code]INTERNET[/code] permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android. [b]Note:[/b] It's recommended to use transport encryption (SSL/TLS) and to avoid sending sensitive information (such as login credentials) in HTTP GET URL parameters. Consider using HTTP POST requests or HTTP headers for such information instead. - [b]Note:[/b] When performing HTTP requests from a project exported to HTML5, keep in mind the remote server may not allow requests from foreign origins due to [url=https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS]CORS[/url]. If you host the server in question, you should modify its backend to allow requests from foreign origins by adding the [code]Access-Control-Allow-Origin: *[/code] HTTP header. + [b]Note:[/b] When performing HTTP requests from a project exported to Web, keep in mind the remote server may not allow requests from foreign origins due to [url=https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS]CORS[/url]. If you host the server in question, you should modify its backend to allow requests from foreign origins by adding the [code]Access-Control-Allow-Origin: *[/code] HTTP header. [b]Note:[/b] SSL/TLS support is currently limited to TLS 1.0, TLS 1.1, and TLS 1.2. Attempting to connect to a TLS 1.3-only server will return an error. [b]Warning:[/b] SSL/TLS certificate revocation and certificate pinning are currently not supported. Revoked certificates are accepted as long as they are otherwise valid. If this is a concern, you may want to use automatically managed certificates with a short validity period. diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index 90da0005868..56b95fc755c 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -355,7 +355,7 @@ Vibrate handheld devices. - [b]Note:[/b] This method is implemented on Android, iOS, and HTML5. + [b]Note:[/b] This method is implemented on Android, iOS, and Web. [b]Note:[/b] For Android, it requires enabling the [code]VIBRATE[/code] permission in the export preset. [b]Note:[/b] For iOS, specifying the duration is supported in iOS 13 and later. [b]Note:[/b] Some web browsers such as Safari and Firefox for Android do not support this method. diff --git a/doc/classes/JavaScript.xml b/doc/classes/JavaScript.xml index 21eb80155e8..c838422e85c 100644 --- a/doc/classes/JavaScript.xml +++ b/doc/classes/JavaScript.xml @@ -1,10 +1,10 @@ - Singleton that connects the engine with the browser's JavaScript context in HTML5 export. + Singleton that connects the engine with the browser's JavaScript context in Web export. - The JavaScript singleton is implemented only in the HTML5 export. It's used to access the browser's JavaScript context. This allows interaction with embedding pages or calling third-party JavaScript APIs. + The JavaScript singleton is implemented only in the Web export. It's used to access the browser's JavaScript context. This allows interaction with embedding pages or calling third-party JavaScript APIs. [b]Note:[/b] This singleton can be disabled at build-time to improve security. By default, the JavaScript singleton is enabled. Official export templates also have the JavaScript singleton enabled. See [url=$DOCS_URL/development/compiling/compiling_for_web.html]Compiling for the Web[/url] in the documentation for more information. diff --git a/doc/classes/JavaScriptObject.xml b/doc/classes/JavaScriptObject.xml index 5c1a37266b1..e279acf5a4e 100644 --- a/doc/classes/JavaScriptObject.xml +++ b/doc/classes/JavaScriptObject.xml @@ -31,7 +31,7 @@ # [0, 9, [JavaScriptObject:1180]] print(args) [/codeblock] - [b]Note:[/b] Only available in the HTML5 platform. + [b]Note:[/b] Only available in the Web platform. diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml index 5ca2a227492..f8f2375a711 100644 --- a/doc/classes/LineEdit.xml +++ b/doc/classes/LineEdit.xml @@ -379,7 +379,7 @@ Virtual keyboard for entering a password. On most platforms, this should disable autocomplete and autocapitalization. - [b]Note:[/b] This is not supported on HTML5. Instead, this behaves identically to [constant KEYBOARD_TYPE_DEFAULT]. + [b]Note:[/b] This is not supported on Web. Instead, this behaves identically to [constant KEYBOARD_TYPE_DEFAULT]. Virtual keyboard with additional keys to assist with typing URLs. diff --git a/doc/classes/NavigationRegion3D.xml b/doc/classes/NavigationRegion3D.xml index 1e096515be3..87e82e7b2eb 100644 --- a/doc/classes/NavigationRegion3D.xml +++ b/doc/classes/NavigationRegion3D.xml @@ -18,7 +18,7 @@ - Bakes the [NavigationMesh]. If [param on_thread] is set to [code]true[/code] (default), the baking is done on a separate thread. Baking on separate thread is useful because navigation baking is not a cheap operation. When it is completed, it automatically sets the new [NavigationMesh]. Please note that baking on separate thread may be very slow if geometry is parsed from meshes as async access to each mesh involves heavy synchronization. Also, please note that baking on a separate thread is automatically disabled on operating systems that cannot use threads (such as HTML5 with threads disabled). + Bakes the [NavigationMesh]. If [param on_thread] is set to [code]true[/code] (default), the baking is done on a separate thread. Baking on separate thread is useful because navigation baking is not a cheap operation. When it is completed, it automatically sets the new [NavigationMesh]. Please note that baking on separate thread may be very slow if geometry is parsed from meshes as async access to each mesh involves heavy synchronization. Also, please note that baking on a separate thread is automatically disabled on operating systems that cannot use threads (such as Web with threads disabled). diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index e180c737337..13cd9c9ab0d 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -297,7 +297,7 @@ On BSD-based operating systems, this is [code]"FreeBSD"[/code], [code]"NetBSD"[/code], [code]"OpenBSD"[/code], or [code]"BSD"[/code] as a fallback. On Android, this is [code]"Android"[/code]. On iOS, this is [code]"iOS"[/code]. - On the web, this is [code]"HTML5"[/code]. + On the web, this is [code]"Web"[/code]. [b]Note:[/b] Custom builds of the engine may support additional platforms, such as consoles, yielding other return values. [codeblocks] [gdscript] @@ -312,7 +312,7 @@ print("Android") "iOS": print("iOS") - "HTML5": + "Web": print("Web") [/gdscript] [csharp] @@ -338,7 +338,7 @@ case "iOS": GD.Print("iOS"); break; - case "HTML5": + case "Web": GD.Print("Web"); break; } @@ -363,7 +363,7 @@ Returns the name of the CPU model on the host machine (e.g. "Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz"). - [b]Note:[/b] This method is only implemented on Windows, macOS, Linux and iOS. On Android, HTML5 and UWP, [method get_processor_name] returns an empty string. + [b]Note:[/b] This method is only implemented on Windows, macOS, Linux and iOS. On Android, Web and UWP, [method get_processor_name] returns an empty string. @@ -423,7 +423,7 @@ Returns a string that is unique to the device. [b]Note:[/b] This string may change without notice if the user reinstalls/upgrades their operating system or changes their hardware. This means it should generally not be used to encrypt persistent data as the data saved before an unexpected ID change would become inaccessible. The returned string may also be falsified using external programs, so do not rely on the string returned by [method get_unique_id] for security purposes. - [b]Note:[/b] Returns an empty string on HTML5 and UWP, as this method isn't implemented on those platforms yet. + [b]Note:[/b] Returns an empty string on Web and UWP, as this method isn't implemented on those platforms yet. @@ -494,7 +494,7 @@ - If [code]true[/code], the [code]user://[/code] file system is persistent, so that its state is the same after a player quits and starts the game again. Relevant to the HTML5 platform, where this persistence may be unavailable. + If [code]true[/code], the [code]user://[/code] file system is persistent, so that its state is the same after a player quits and starts the game again. Relevant to the Web platform, where this persistence may be unavailable. @@ -610,7 +610,7 @@ - [code]OS.shell_open("https://godotengine.org")[/code] opens the default web browser on the official Godot website. - [code]OS.shell_open("mailto:example@example.com")[/code] opens the default email client with the "To" field set to [code]example@example.com[/code]. See [url=https://datatracker.ietf.org/doc/html/rfc2368]RFC 2368 - The [code]mailto[/code] URL scheme[/url] for a list of fields that can be added. Use [method ProjectSettings.globalize_path] to convert a [code]res://[/code] or [code]user://[/code] path into a system path for use with this method. - [b]Note:[/b] This method is implemented on Android, iOS, HTML5, Linux, macOS and Windows. + [b]Note:[/b] This method is implemented on Android, iOS, Web, Linux, macOS and Windows. @@ -627,7 +627,7 @@ The Vulkan rendering backend. It requires Vulkan 1.0 support and automatically uses features from Vulkan 1.1 and 1.2 if available. - The OpenGL 3 rendering backend. It uses OpenGL 3.3 Core Profile on desktop platforms, OpenGL ES 3.0 on mobile devices, and WebGL 2.0 on HTML5. + The OpenGL 3 rendering backend. It uses OpenGL 3.3 Core Profile on desktop platforms, OpenGL ES 3.0 on mobile devices, and WebGL 2.0 on Web. Sunday. diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index bafd5d57d94..8f749f3a37d 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -528,7 +528,7 @@ Position offset for tooltips, relative to the mouse cursor's hotspot. - If [code]true[/code], allows HiDPI display on Windows, macOS, Android, iOS and HTML5. If [code]false[/code], the platform's low-DPI fallback will be used on HiDPI displays, which causes the window to be displayed in a blurry or pixelated manner (and can cause various window management bugs). Therefore, it is recommended to make your project scale to [url=$DOCS_URL/tutorials/viewports/multiple_resolutions.html]multiple resolutions[/url] instead of disabling this setting. + If [code]true[/code], allows HiDPI display on Windows, macOS, Android, iOS and Web. If [code]false[/code], the platform's low-DPI fallback will be used on HiDPI displays, which causes the window to be displayed in a blurry or pixelated manner (and can cause various window management bugs). Therefore, it is recommended to make your project scale to [url=$DOCS_URL/tutorials/viewports/multiple_resolutions.html]multiple resolutions[/url] instead of disabling this setting. [b]Note:[/b] This setting has no effect on Linux as DPI-awareness fallbacks are not supported there. @@ -546,16 +546,16 @@ Forces the main window to be always on top. - [b]Note:[/b] This setting is ignored on iOS, Android, and HTML5. + [b]Note:[/b] This setting is ignored on iOS, Android, and Web. Forces the main window to be borderless. - [b]Note:[/b] This setting is ignored on iOS, Android, and HTML5. + [b]Note:[/b] This setting is ignored on iOS, Android, and Web. Sets the main window to full screen when the project starts. Note that this is not [i]exclusive[/i] fullscreen. On Windows and Linux, a borderless window is used to emulate fullscreen. On macOS, a new desktop is used to display the running project. Regardless of the platform, enabling fullscreen will change the window size to match the monitor's size. Therefore, make sure your project supports [url=$DOCS_URL/tutorials/rendering/multiple_resolutions.html]multiple resolutions[/url] when enabling fullscreen mode. - [b]Note:[/b] This setting is ignored on iOS, Android, and HTML5. + [b]Note:[/b] This setting is ignored on iOS, Android, and Web. Allows the window to be resizable by default. @@ -569,11 +569,11 @@ On desktop platforms, overrides the game's initial window height. See also [member display/window/size/window_width_override], [member display/window/size/viewport_width] and [member display/window/size/viewport_height]. - [b]Note:[/b] By default, or when set to [code]0[/code], the initial window height is the [member display/window/size/viewport_height]. This setting is ignored on iOS, Android, and HTML5. + [b]Note:[/b] By default, or when set to [code]0[/code], the initial window height is the [member display/window/size/viewport_height]. This setting is ignored on iOS, Android, and Web. On desktop platforms, overrides the game's initial window width. See also [member display/window/size/window_height_override], [member display/window/size/viewport_width] and [member display/window/size/viewport_height]. - [b]Note:[/b] By default, or when set to [code]0[/code], the initial window width is the viewport [member display/window/size/viewport_width]. This setting is ignored on iOS, Android, and HTML5. + [b]Note:[/b] By default, or when set to [code]0[/code], the initial window width is the viewport [member display/window/size/viewport_width]. This setting is ignored on iOS, Android, and Web. Sets the V-Sync mode for the main game window. diff --git a/doc/classes/StreamPeerSSL.xml b/doc/classes/StreamPeerSSL.xml index 7fe9c54e3e3..9d21b914163 100644 --- a/doc/classes/StreamPeerSSL.xml +++ b/doc/classes/StreamPeerSSL.xml @@ -29,7 +29,7 @@ Connects to a peer using an underlying [StreamPeer] [param stream]. If [param validate_certs] is [code]true[/code], [StreamPeerSSL] will validate that the certificate presented by the peer matches the [param for_hostname]. - [b]Note:[/b] Specifying a custom [param valid_certificate] is not supported in HTML5 exports due to browsers restrictions. + [b]Note:[/b] Specifying a custom [param valid_certificate] is not supported in Web exports due to browsers restrictions. diff --git a/doc/classes/VideoStreamPlayer.xml b/doc/classes/VideoStreamPlayer.xml index f6594ff9e70..2774f1fb426 100644 --- a/doc/classes/VideoStreamPlayer.xml +++ b/doc/classes/VideoStreamPlayer.xml @@ -7,7 +7,7 @@ Control node for playing video streams using [VideoStream] resources. Supported video formats are [url=https://www.theora.org/]Ogg Theora[/url] ([code].ogv[/code], [VideoStreamTheora]) and any format exposed via a GDExtension plugin. [b]Note:[/b] Due to a bug, VideoStreamPlayer does not support localization remapping yet. - [b]Warning:[/b] On HTML5, video playback [i]will[/i] perform poorly due to missing architecture-specific assembly optimizations. + [b]Warning:[/b] On Web, video playback [i]will[/i] perform poorly due to missing architecture-specific assembly optimizations. diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index b397d0c665f..a960fced1f1 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1022,7 +1022,7 @@ void RasterizerCanvasGLES3::_bind_instance_data_buffer(uint32_t p_max_index) { } glBindBufferBase(GL_UNIFORM_BUFFER, INSTANCE_UNIFORM_LOCATION, state.canvas_instance_data_buffers[state.current_buffer]); -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED //WebGL 2.0 does not support mapping buffers, so use slow glBufferData instead glBufferData(GL_UNIFORM_BUFFER, sizeof(InstanceData) * p_max_index, state.instance_data_array, GL_DYNAMIC_DRAW); #else diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 33303b1e380..7537636356b 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -69,7 +69,7 @@ #endif #endif -#if !defined(IOS_ENABLED) && !defined(JAVASCRIPT_ENABLED) +#if !defined(IOS_ENABLED) && !defined(WEB_ENABLED) // We include EGL below to get debug callback on GLES2 platforms, // but EGL is not available on iOS. #define CAN_DEBUG diff --git a/drivers/png/SCsub b/drivers/png/SCsub index ad7aaf1ee82..fe8c8fa8cc8 100644 --- a/drivers/png/SCsub +++ b/drivers/png/SCsub @@ -30,7 +30,7 @@ if env["builtin_libpng"]: thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] env_png.Prepend(CPPPATH=[thirdparty_dir]) - # Needed for drivers includes and in platform/javascript + # Needed for drivers includes and in platform/web. env.Prepend(CPPPATH=[thirdparty_dir]) # Currently .ASM filter_neon.S does not compile on NT. diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp index f172f31b243..86adf33d62e 100644 --- a/drivers/unix/net_socket_posix.cpp +++ b/drivers/unix/net_socket_posix.cpp @@ -50,7 +50,7 @@ #include #include -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED #include #endif diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 5bf14056abe..0fbd9f7b8f6 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -92,7 +92,7 @@ static void _setup_clock() { _clock_start = mach_absolute_time() * _clock_scale; } #else -#if defined(CLOCK_MONOTONIC_RAW) && !defined(JAVASCRIPT_ENABLED) // This is a better clock on Linux. +#if defined(CLOCK_MONOTONIC_RAW) && !defined(WEB_ENABLED) // This is a better clock on Linux. #define GODOT_CLOCK CLOCK_MONOTONIC_RAW #else #define GODOT_CLOCK CLOCK_MONOTONIC @@ -292,7 +292,7 @@ uint64_t OS_Unix::get_ticks_usec() const { Error OS_Unix::execute(const String &p_path, const List &p_arguments, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex, bool p_open_console) { #ifdef __EMSCRIPTEN__ // Don't compile this code at all to avoid undefined references. - // Actual virtual call goes to OS_JavaScript. + // Actual virtual call goes to OS_Web. ERR_FAIL_V(ERR_BUG); #else if (r_pipe) { @@ -366,7 +366,7 @@ Error OS_Unix::execute(const String &p_path, const List &p_arguments, St Error OS_Unix::create_process(const String &p_path, const List &p_arguments, ProcessID *r_child_id, bool p_open_console) { #ifdef __EMSCRIPTEN__ // Don't compile this code at all to avoid undefined references. - // Actual virtual call goes to OS_JavaScript. + // Actual virtual call goes to OS_Web. ERR_FAIL_V(ERR_BUG); #else pid_t pid = fork(); diff --git a/editor/debugger/debug_adapter/debug_adapter_parser.cpp b/editor/debugger/debug_adapter/debug_adapter_parser.cpp index 3c3e4faa6f4..ac41306cde6 100644 --- a/editor/debugger/debug_adapter/debug_adapter_parser.cpp +++ b/editor/debugger/debug_adapter/debug_adapter_parser.cpp @@ -201,7 +201,7 @@ Dictionary DebugAdapterParser::req_launch(const Dictionary &p_params) const { } } else if (platform_string == "web") { for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) { - if (EditorExport::get_singleton()->get_export_platform(i)->get_name() == "HTML5") { + if (EditorExport::get_singleton()->get_export_platform(i)->get_name() == "Web") { idx = i; break; } diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 3c12d17c573..b0d27152625 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -1592,7 +1592,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { /////// bool AssetLibraryEditorPlugin::is_available() { -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED // Asset Library can't work on Web editor for now as most assets are sourced // directly from GitHub which does not set CORS. return false; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index a17a759c174..6623792fc0b 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2106,7 +2106,7 @@ void ProjectManager::_confirm_update_settings() { void ProjectManager::_open_selected_projects() { // Show loading text to tell the user that the project manager is busy loading. - // This is especially important for the HTML5 project manager. + // This is especially important for the Web project manager. loading_label->show(); const HashSet &selected_list = _project_list->get_selected_project_keys(); diff --git a/main/main.cpp b/main/main.cpp index 126ac590701..0089faf1299 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1903,7 +1903,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) { MAIN_PRINT("Main: Setup Logo"); -#if defined(JAVASCRIPT_ENABLED) || defined(ANDROID_ENABLED) +#if defined(WEB_ENABLED) || defined(ANDROID_ENABLED) bool show_logo = false; #else bool show_logo = true; diff --git a/modules/denoise/config.py b/modules/denoise/config.py index 350839651a4..20a5e1da2fc 100644 --- a/modules/denoise/config.py +++ b/modules/denoise/config.py @@ -2,7 +2,7 @@ def can_build(env, platform): # Thirdparty dependency OpenImage Denoise includes oneDNN library # and the version we use only supports x86_64. # It's also only relevant for tools build and desktop platforms, - # as doing lightmap generation and denoising on Android or HTML5 + # as doing lightmap generation and denoising on Android or Web # would be a bit far-fetched. desktop_platforms = ["linuxbsd", "macos", "windows"] return env["tools"] and platform in desktop_platforms and env["arch"] == "x86_64" diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub index 8efcd72fb66..2680479acce 100644 --- a/modules/freetype/SCsub +++ b/modules/freetype/SCsub @@ -99,7 +99,7 @@ if env["builtin_freetype"]: sfnt = thirdparty_dir + "src/sfnt/sfnt.c" # Must be done after all CPPDEFINES are being set so we can copy them. - if env["platform"] == "javascript": + if env["platform"] == "web": # Forcibly undefine this macro so SIMD is not used in this file, # since currently unsupported in WASM tmp_env = env_freetype.Clone() diff --git a/modules/mono/build_scripts/mono_configure.py b/modules/mono/build_scripts/mono_configure.py index ef7dbabf66e..c2d54528370 100644 --- a/modules/mono/build_scripts/mono_configure.py +++ b/modules/mono/build_scripts/mono_configure.py @@ -16,7 +16,7 @@ def module_supports_tools_on(platform): def configure(env, env_mono): # is_android = env["platform"] == "android" - # is_javascript = env["platform"] == "javascript" + # is_web = env["platform"] == "web" # is_ios = env["platform"] == "ios" # is_ios_sim = is_ios and env["arch"] in ["x86_32", "x86_64"] diff --git a/modules/mono/config.py b/modules/mono/config.py index b599414a2cb..ad78c8c898e 100644 --- a/modules/mono/config.py +++ b/modules/mono/config.py @@ -1,4 +1,4 @@ -# Prior to .NET Core, we supported these: ["windows", "macos", "linuxbsd", "android", "haiku", "javascript", "ios"] +# Prior to .NET Core, we supported these: ["windows", "macos", "linuxbsd", "android", "haiku", "web", "ios"] # Eventually support for each them should be added back (except Haiku if not supported by .NET Core) supported_platforms = ["windows", "macos", "linuxbsd"] @@ -10,8 +10,8 @@ def can_build(env, platform): def get_opts(platform): from SCons.Variables import BoolVariable, PathVariable - default_mono_static = platform in ["ios", "javascript"] - default_mono_bundles_zlib = platform in ["javascript"] + default_mono_static = platform in ["ios", "web"] + default_mono_bundles_zlib = platform in ["web"] return [ PathVariable( diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props index ad41ab04d54..59ce1da17b0 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props @@ -81,7 +81,7 @@ GODOT_HAIKU;GODOT_PC GODOT_ANDROID;GODOT_MOBILE GODOT_IPHONE;GODOT_IOS;GODOT_MOBILE - GODOT_JAVASCRIPT;GODOT_HTML5;GODOT_WASM;GODOT_WEB + GODOT_JAVASCRIPT;GODOT_HTML5;GODOT_WASM;GODOT_WEB $(GodotDefineConstants);$(GodotPlatformConstants) diff --git a/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs b/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs index b5e4ae7a283..6290b2c56f2 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs @@ -30,7 +30,7 @@ namespace GodotTools.Utils public const string Haiku = "Haiku"; public const string Android = "Android"; public const string iOS = "iOS"; - public const string HTML5 = "HTML5"; + public const string Web = "Web"; } /// @@ -45,7 +45,7 @@ namespace GodotTools.Utils public const string Haiku = "haiku"; public const string Android = "android"; public const string iOS = "ios"; - public const string HTML5 = "javascript"; + public const string Web = "web"; } /// @@ -77,7 +77,7 @@ namespace GodotTools.Utils ["Haiku"] = Platforms.Haiku, ["Android"] = Platforms.Android, ["iOS"] = Platforms.iOS, - ["HTML5"] = Platforms.HTML5 + ["Web"] = Platforms.Web }; public static readonly Dictionary PlatformNameMap = new Dictionary @@ -92,7 +92,7 @@ namespace GodotTools.Utils [Names.Haiku] = Platforms.Haiku, [Names.Android] = Platforms.Android, [Names.iOS] = Platforms.iOS, - [Names.HTML5] = Platforms.HTML5 + [Names.Web] = Platforms.Web }; public static readonly Dictionary DotNetOSPlatformMap = new Dictionary @@ -107,7 +107,7 @@ namespace GodotTools.Utils [Platforms.UWP] = DotNetOS.Win10, [Platforms.Android] = DotNetOS.Android, [Platforms.iOS] = DotNetOS.iOS, - [Platforms.HTML5] = DotNetOS.Browser + [Platforms.Web] = DotNetOS.Browser }; private static bool IsOS(string name) @@ -144,7 +144,7 @@ namespace GodotTools.Utils private static readonly Lazy _isHaiku = new(() => IsOS(Names.Haiku)); private static readonly Lazy _isAndroid = new(() => IsOS(Names.Android)); private static readonly Lazy _isiOS = new(() => IsOS(Names.iOS)); - private static readonly Lazy _isHTML5 = new(() => IsOS(Names.HTML5)); + private static readonly Lazy _isWeb = new(() => IsOS(Names.Web)); private static readonly Lazy _isUnixLike = new(() => IsAnyOS(UnixLikePlatforms)); [SupportedOSPlatformGuard("windows")] public static bool IsWindows => _isWindows.Value || IsUWP; @@ -161,7 +161,7 @@ namespace GodotTools.Utils [SupportedOSPlatformGuard("ios")] public static bool IsiOS => _isiOS.Value; - [SupportedOSPlatformGuard("browser")] public static bool IsHTML5 => _isHTML5.Value; + [SupportedOSPlatformGuard("browser")] public static bool IsWeb => _isWeb.Value; public static bool IsUnixLike => _isUnixLike.Value; public static char PathSep => IsWindows ? ';' : ':'; diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp index 71576c2f806..12960fb9388 100644 --- a/modules/mono/godotsharp_dirs.cpp +++ b/modules/mono/godotsharp_dirs.cpp @@ -137,7 +137,7 @@ private: api_assemblies_base_dir = res_data_dir.plus_file("assemblies"); -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED mono_user_dir = "user://"; #else mono_user_dir = _get_mono_user_dir(); diff --git a/modules/text_server_adv/SCsub b/modules/text_server_adv/SCsub index c6678307afa..7017a203f27 100644 --- a/modules/text_server_adv/SCsub +++ b/modules/text_server_adv/SCsub @@ -143,7 +143,7 @@ if env["builtin_harfbuzz"]: if env["platform"] == "android" or env["platform"] == "linuxbsd": env_harfbuzz.Append(CCFLAGS=["-DHAVE_PTHREAD"]) - if env["platform"] == "javascript": + if env["platform"] == "web": if env["threads_enabled"]: env_harfbuzz.Append(CCFLAGS=["-DHAVE_PTHREAD"]) else: diff --git a/modules/webrtc/SCsub b/modules/webrtc/SCsub index e6b99598401..e315633f55b 100644 --- a/modules/webrtc/SCsub +++ b/modules/webrtc/SCsub @@ -5,7 +5,7 @@ Import("env_modules") env_webrtc = env_modules.Clone() -if env["platform"] == "javascript": +if env["platform"] == "web": # Our JavaScript/C++ interface. env.AddJSLibraries(["library_godot_webrtc.js"]) diff --git a/modules/webrtc/webrtc_data_channel_js.cpp b/modules/webrtc/webrtc_data_channel_js.cpp index 0fb074b0c26..232f6998d33 100644 --- a/modules/webrtc/webrtc_data_channel_js.cpp +++ b/modules/webrtc/webrtc_data_channel_js.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED #include "webrtc_data_channel_js.h" diff --git a/modules/webrtc/webrtc_data_channel_js.h b/modules/webrtc/webrtc_data_channel_js.h index d059ec31edc..0caa76885ac 100644 --- a/modules/webrtc/webrtc_data_channel_js.h +++ b/modules/webrtc/webrtc_data_channel_js.h @@ -31,7 +31,7 @@ #ifndef WEBRTC_DATA_CHANNEL_JS_H #define WEBRTC_DATA_CHANNEL_JS_H -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED #include "webrtc_data_channel.h" @@ -89,6 +89,6 @@ public: ~WebRTCDataChannelJS(); }; -#endif // JAVASCRIPT_ENABLED +#endif // WEB_ENABLED #endif // WEBRTC_DATA_CHANNEL_JS_H diff --git a/modules/webrtc/webrtc_peer_connection.cpp b/modules/webrtc/webrtc_peer_connection.cpp index 75716017d74..d885b9262be 100644 --- a/modules/webrtc/webrtc_peer_connection.cpp +++ b/modules/webrtc/webrtc_peer_connection.cpp @@ -30,7 +30,7 @@ #include "webrtc_peer_connection.h" -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED #include "webrtc_peer_connection_js.h" #endif @@ -44,7 +44,7 @@ void WebRTCPeerConnection::set_default_extension(const StringName &p_extension) } WebRTCPeerConnection *WebRTCPeerConnection::create() { -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED return memnew(WebRTCPeerConnectionJS); #else if (default_extension == String()) { diff --git a/modules/webrtc/webrtc_peer_connection_js.cpp b/modules/webrtc/webrtc_peer_connection_js.cpp index ee3a302fa2c..f48705253b7 100644 --- a/modules/webrtc/webrtc_peer_connection_js.cpp +++ b/modules/webrtc/webrtc_peer_connection_js.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED #include "webrtc_peer_connection_js.h" diff --git a/modules/webrtc/webrtc_peer_connection_js.h b/modules/webrtc/webrtc_peer_connection_js.h index 76b8c7fff82..50266129e4b 100644 --- a/modules/webrtc/webrtc_peer_connection_js.h +++ b/modules/webrtc/webrtc_peer_connection_js.h @@ -31,7 +31,7 @@ #ifndef WEBRTC_PEER_CONNECTION_JS_H #define WEBRTC_PEER_CONNECTION_JS_H -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED #include "webrtc_peer_connection.h" diff --git a/modules/websocket/SCsub b/modules/websocket/SCsub index dc0661995fc..890fb71592a 100644 --- a/modules/websocket/SCsub +++ b/modules/websocket/SCsub @@ -7,7 +7,7 @@ env_ws = env_modules.Clone() thirdparty_obj = [] -if env["platform"] == "javascript": +if env["platform"] == "web": # Our JavaScript/C++ interface. env.AddJSLibraries(["library_godot_websocket.js"]) diff --git a/modules/websocket/doc_classes/WebSocketClient.xml b/modules/websocket/doc_classes/WebSocketClient.xml index f586c58302a..7d73194ea9d 100644 --- a/modules/websocket/doc_classes/WebSocketClient.xml +++ b/modules/websocket/doc_classes/WebSocketClient.xml @@ -24,8 +24,8 @@ If [code]true[/code] is passed as [code]gd_mp_api[/code], the client will behave like a multiplayer peer for the [MultiplayerAPI], connections to non-Godot servers will not work, and [signal data_received] will not be emitted. If [code]false[/code] is passed instead (default), you must call [PacketPeer] functions ([code]put_packet[/code], [code]get_packet[/code], etc.) on the [WebSocketPeer] returned via [code]get_peer(1)[/code] and not on this object directly (e.g. [code]get_peer(1).put_packet(data)[/code]). You can optionally pass a list of [code]custom_headers[/code] to be added to the handshake HTTP request. - [b]Note:[/b] To avoid mixed content warnings or errors in HTML5, you may have to use a [code]url[/code] that starts with [code]wss://[/code] (secure) instead of [code]ws://[/code]. When doing so, make sure to use the fully qualified domain name that matches the one defined in the server's SSL certificate. Do not connect directly via the IP address for [code]wss://[/code] connections, as it won't match with the SSL certificate. - [b]Note:[/b] Specifying [code]custom_headers[/code] is not supported in HTML5 exports due to browsers restrictions. + [b]Note:[/b] To avoid mixed content warnings or errors in Web, you may have to use a [code]url[/code] that starts with [code]wss://[/code] (secure) instead of [code]ws://[/code]. When doing so, make sure to use the fully qualified domain name that matches the one defined in the server's SSL certificate. Do not connect directly via the IP address for [code]wss://[/code] connections, as it won't match with the SSL certificate. + [b]Note:[/b] Specifying [code]custom_headers[/code] is not supported in Web exports due to browsers restrictions. @@ -52,7 +52,7 @@ If specified, this [X509Certificate] will be the only one accepted when connecting to an SSL host. Any other certificate provided by the server will be regarded as invalid. - [b]Note:[/b] Specifying a custom [code]trusted_ssl_certificate[/code] is not supported in HTML5 exports due to browsers restrictions. + [b]Note:[/b] Specifying a custom [code]trusted_ssl_certificate[/code] is not supported in Web exports due to browsers restrictions. If [code]true[/code], SSL certificate verification is enabled. diff --git a/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml b/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml index 23aa6ba3db4..4cc4d515e7d 100644 --- a/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml +++ b/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml @@ -27,7 +27,7 @@ Configures the buffer sizes for this WebSocket peer. Default values can be specified in the Project Settings under [code]network/limits[/code]. For server, values are meant per connected peer. The first two parameters define the size and queued packets limits of the input buffer, the last two of the output buffer. Buffer sizes are expressed in KiB, so [code]4 = 2^12 = 4096 bytes[/code]. All parameters will be rounded up to the nearest power of two. - [b]Note:[/b] HTML5 exports only use the input buffer since the output one is managed by browsers. + [b]Note:[/b] Web exports only use the input buffer since the output one is managed by browsers. diff --git a/modules/websocket/doc_classes/WebSocketPeer.xml b/modules/websocket/doc_classes/WebSocketPeer.xml index 43b765d2fef..627b9c607cb 100644 --- a/modules/websocket/doc_classes/WebSocketPeer.xml +++ b/modules/websocket/doc_classes/WebSocketPeer.xml @@ -17,27 +17,27 @@ Closes this WebSocket connection. [code]code[/code] is the status code for the closure (see RFC 6455 section 7.4 for a list of valid status codes). [code]reason[/code] is the human readable reason for closing the connection (can be any UTF-8 string that's smaller than 123 bytes). [b]Note:[/b] To achieve a clean close, you will need to keep polling until either [signal WebSocketClient.connection_closed] or [signal WebSocketServer.client_disconnected] is received. - [b]Note:[/b] The HTML5 export might not support all status codes. Please refer to browser-specific documentation for more details. + [b]Note:[/b] The Web export might not support all status codes. Please refer to browser-specific documentation for more details. Returns the IP address of the connected peer. - [b]Note:[/b] Not available in the HTML5 export. + [b]Note:[/b] Not available in the Web export. Returns the remote port of the connected peer. - [b]Note:[/b] Not available in the HTML5 export. + [b]Note:[/b] Not available in the Web export. - Returns the current amount of data in the outbound websocket buffer. [b]Note:[/b] HTML5 exports use WebSocket.bufferedAmount, while other platforms use an internal buffer. + Returns the current amount of data in the outbound websocket buffer. [b]Note:[/b] Web exports use WebSocket.bufferedAmount, while other platforms use an internal buffer. @@ -57,7 +57,7 @@ Disable Nagle's algorithm on the underling TCP socket (default). See [method StreamPeerTCP.set_no_delay] for more information. - [b]Note:[/b] Not available in the HTML5 export. + [b]Note:[/b] Not available in the Web export. diff --git a/modules/websocket/doc_classes/WebSocketServer.xml b/modules/websocket/doc_classes/WebSocketServer.xml index 6a7bf8075c0..19c36700e63 100644 --- a/modules/websocket/doc_classes/WebSocketServer.xml +++ b/modules/websocket/doc_classes/WebSocketServer.xml @@ -6,7 +6,7 @@ This class implements a WebSocket server that can also support the high-level multiplayer API. After starting the server ([method listen]), you will need to [method MultiplayerPeer.poll] it at regular intervals (e.g. inside [method Node._process]). When clients connect, disconnect, or send data, you will receive the appropriate signal. - [b]Note:[/b] Not available in HTML5 exports. + [b]Note:[/b] Not available in Web exports. [b]Note:[/b] When exporting to Android, make sure to enable the [code]INTERNET[/code] permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android. diff --git a/modules/websocket/emws_client.cpp b/modules/websocket/emws_client.cpp index e051a3b5648..65e0703c004 100644 --- a/modules/websocket/emws_client.cpp +++ b/modules/websocket/emws_client.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED #include "emws_client.h" @@ -82,12 +82,12 @@ Error EMWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port, String str = "ws://"; if (p_custom_headers.size()) { - WARN_PRINT_ONCE("Custom headers are not supported in HTML5 platform."); + WARN_PRINT_ONCE("Custom headers are not supported in Web platform."); } if (p_ssl) { str = "wss://"; if (ssl_cert.is_valid()) { - WARN_PRINT_ONCE("Custom SSL certificate is not supported in HTML5 platform."); + WARN_PRINT_ONCE("Custom SSL certificate is not supported in Web platform."); } } str += p_host + ":" + itos(p_port) + p_path; @@ -126,11 +126,11 @@ void EMWSClient::disconnect_from_host(int p_code, String p_reason) { } IPAddress EMWSClient::get_connected_host() const { - ERR_FAIL_V_MSG(IPAddress(), "Not supported in HTML5 export."); + ERR_FAIL_V_MSG(IPAddress(), "Not supported in Web export."); } uint16_t EMWSClient::get_connected_port() const { - ERR_FAIL_V_MSG(0, "Not supported in HTML5 export."); + ERR_FAIL_V_MSG(0, "Not supported in Web export."); } int EMWSClient::get_max_packet_size() const { @@ -156,4 +156,4 @@ EMWSClient::~EMWSClient() { } } -#endif // JAVASCRIPT_ENABLED +#endif // WEB_ENABLED diff --git a/modules/websocket/emws_client.h b/modules/websocket/emws_client.h index b71fd781244..ff63a767539 100644 --- a/modules/websocket/emws_client.h +++ b/modules/websocket/emws_client.h @@ -31,7 +31,7 @@ #ifndef EMWS_CLIENT_H #define EMWS_CLIENT_H -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED #include "core/error/error_list.h" #include "emws_peer.h" @@ -66,6 +66,6 @@ public: ~EMWSClient(); }; -#endif // JAVASCRIPT_ENABLED +#endif // WEB_ENABLED #endif // EMWS_CLIENT_H diff --git a/modules/websocket/emws_peer.cpp b/modules/websocket/emws_peer.cpp index 86169f88e9f..859c92b4579 100644 --- a/modules/websocket/emws_peer.cpp +++ b/modules/websocket/emws_peer.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED #include "emws_peer.h" @@ -110,15 +110,15 @@ void EMWSPeer::close(int p_code, String p_reason) { } IPAddress EMWSPeer::get_connected_host() const { - ERR_FAIL_V_MSG(IPAddress(), "Not supported in HTML5 export."); + ERR_FAIL_V_MSG(IPAddress(), "Not supported in Web export."); } uint16_t EMWSPeer::get_connected_port() const { - ERR_FAIL_V_MSG(0, "Not supported in HTML5 export."); + ERR_FAIL_V_MSG(0, "Not supported in Web export."); } void EMWSPeer::set_no_delay(bool p_enabled) { - ERR_FAIL_MSG("'set_no_delay' is not supported in HTML5 export."); + ERR_FAIL_MSG("'set_no_delay' is not supported in Web export."); } EMWSPeer::EMWSPeer() { @@ -129,4 +129,4 @@ EMWSPeer::~EMWSPeer() { close(); } -#endif // JAVASCRIPT_ENABLED +#endif // WEB_ENABLED diff --git a/modules/websocket/emws_peer.h b/modules/websocket/emws_peer.h index f52f615c350..cdbc9212a58 100644 --- a/modules/websocket/emws_peer.h +++ b/modules/websocket/emws_peer.h @@ -31,7 +31,7 @@ #ifndef EMWS_PEER_H #define EMWS_PEER_H -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED #include "core/error/error_list.h" #include "core/io/packet_peer.h" @@ -88,6 +88,6 @@ public: ~EMWSPeer(); }; -#endif // JAVASCRIPT_ENABLED +#endif // WEB_ENABLED #endif // EMWS_PEER_H diff --git a/modules/websocket/register_types.cpp b/modules/websocket/register_types.cpp index 056111ec923..faa7021b2f6 100644 --- a/modules/websocket/register_types.cpp +++ b/modules/websocket/register_types.cpp @@ -36,7 +36,7 @@ #include "websocket_client.h" #include "websocket_server.h" -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED #include "emscripten.h" #include "emws_client.h" #include "emws_peer.h" @@ -59,7 +59,7 @@ static void _editor_init_callback() { void initialize_websocket_module(ModuleInitializationLevel p_level) { if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) { -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED EMWSPeer::make_default(); EMWSClient::make_default(); #else diff --git a/modules/websocket/remote_debugger_peer_websocket.cpp b/modules/websocket/remote_debugger_peer_websocket.cpp index 6319c3c664e..f703873cbfa 100644 --- a/modules/websocket/remote_debugger_peer_websocket.cpp +++ b/modules/websocket/remote_debugger_peer_websocket.cpp @@ -103,7 +103,7 @@ void RemoteDebuggerPeerWebSocket::close() { } bool RemoteDebuggerPeerWebSocket::can_block() const { -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED return false; #else return true; @@ -111,7 +111,7 @@ bool RemoteDebuggerPeerWebSocket::can_block() const { } RemoteDebuggerPeerWebSocket::RemoteDebuggerPeerWebSocket(Ref p_peer) { -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED ws_client = Ref(memnew(EMWSClient)); #else ws_client = Ref(memnew(WSLClient)); diff --git a/modules/websocket/remote_debugger_peer_websocket.h b/modules/websocket/remote_debugger_peer_websocket.h index 3227065dedd..a37a789cbeb 100644 --- a/modules/websocket/remote_debugger_peer_websocket.h +++ b/modules/websocket/remote_debugger_peer_websocket.h @@ -33,7 +33,7 @@ #include "core/debugger/remote_debugger_peer.h" -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED #include "emws_client.h" #else #include "wsl_client.h" diff --git a/modules/websocket/wsl_client.cpp b/modules/websocket/wsl_client.cpp index 478dbb9d47a..2bb57226ea6 100644 --- a/modules/websocket/wsl_client.cpp +++ b/modules/websocket/wsl_client.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef JAVASCRIPT_ENABLED +#ifndef WEB_ENABLED #include "wsl_client.h" #include "core/config/project_settings.h" @@ -404,4 +404,4 @@ WSLClient::~WSLClient() { disconnect_from_host(); } -#endif // JAVASCRIPT_ENABLED +#endif // WEB_ENABLED diff --git a/modules/websocket/wsl_client.h b/modules/websocket/wsl_client.h index 58b867fbe4e..5d90bc40344 100644 --- a/modules/websocket/wsl_client.h +++ b/modules/websocket/wsl_client.h @@ -31,7 +31,7 @@ #ifndef WSL_CLIENT_H #define WSL_CLIENT_H -#ifndef JAVASCRIPT_ENABLED +#ifndef WEB_ENABLED #include "core/error/error_list.h" #include "core/io/stream_peer_ssl.h" @@ -86,6 +86,6 @@ public: ~WSLClient(); }; -#endif // JAVASCRIPT_ENABLED +#endif // WEB_ENABLED #endif // WSL_CLIENT_H diff --git a/modules/websocket/wsl_peer.cpp b/modules/websocket/wsl_peer.cpp index 15df4d039cd..97bd87a5268 100644 --- a/modules/websocket/wsl_peer.cpp +++ b/modules/websocket/wsl_peer.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef JAVASCRIPT_ENABLED +#ifndef WEB_ENABLED #include "wsl_peer.h" @@ -348,4 +348,4 @@ WSLPeer::~WSLPeer() { _data = nullptr; } -#endif // JAVASCRIPT_ENABLED +#endif // WEB_ENABLED diff --git a/modules/websocket/wsl_peer.h b/modules/websocket/wsl_peer.h index aabd3fd43ef..92672eb2c45 100644 --- a/modules/websocket/wsl_peer.h +++ b/modules/websocket/wsl_peer.h @@ -31,7 +31,7 @@ #ifndef WSL_PEER_H #define WSL_PEER_H -#ifndef JAVASCRIPT_ENABLED +#ifndef WEB_ENABLED #include "core/error/error_list.h" #include "core/io/packet_peer.h" @@ -110,6 +110,6 @@ public: ~WSLPeer(); }; -#endif // JAVASCRIPT_ENABLED +#endif // WEB_ENABLED #endif // WSL_PEER_H diff --git a/modules/websocket/wsl_server.cpp b/modules/websocket/wsl_server.cpp index 517b9643f8d..7457ac70878 100644 --- a/modules/websocket/wsl_server.cpp +++ b/modules/websocket/wsl_server.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef JAVASCRIPT_ENABLED +#ifndef WEB_ENABLED #include "wsl_server.h" #include "core/config/project_settings.h" @@ -326,4 +326,4 @@ WSLServer::~WSLServer() { stop(); } -#endif // JAVASCRIPT_ENABLED +#endif // WEB_ENABLED diff --git a/modules/websocket/wsl_server.h b/modules/websocket/wsl_server.h index ec7567c732c..b0b7a6a5c97 100644 --- a/modules/websocket/wsl_server.h +++ b/modules/websocket/wsl_server.h @@ -31,7 +31,7 @@ #ifndef WSL_SERVER_H #define WSL_SERVER_H -#ifndef JAVASCRIPT_ENABLED +#ifndef WEB_ENABLED #include "websocket_server.h" #include "wsl_peer.h" @@ -93,6 +93,6 @@ public: ~WSLServer(); }; -#endif // JAVASCRIPT_ENABLED +#endif // WEB_ENABLED #endif // WSL_SERVER_H diff --git a/modules/webxr/SCsub b/modules/webxr/SCsub index 0a96af0811e..81caa4a2790 100644 --- a/modules/webxr/SCsub +++ b/modules/webxr/SCsub @@ -3,7 +3,7 @@ Import("env") Import("env_modules") -if env["platform"] == "javascript": +if env["platform"] == "web": env.AddJSLibraries(["native/library_godot_webxr.js"]) env.AddJSExterns(["native/webxr.externs.js"]) diff --git a/modules/webxr/doc_classes/WebXRInterface.xml b/modules/webxr/doc_classes/WebXRInterface.xml index 01ad962b200..49ff454f076 100644 --- a/modules/webxr/doc_classes/WebXRInterface.xml +++ b/modules/webxr/doc_classes/WebXRInterface.xml @@ -5,9 +5,9 @@ WebXR is an open standard that allows creating VR and AR applications that run in the web browser. - As such, this interface is only available when running in an HTML5 export. + As such, this interface is only available when running in Web exports. WebXR supports a wide range of devices, from the very capable (like Valve Index, HTC Vive, Oculus Rift and Quest) down to the much less capable (like Google Cardboard, Oculus Go, GearVR, or plain smartphones). - Since WebXR is based on Javascript, it makes extensive use of callbacks, which means that [WebXRInterface] is forced to use signals, where other AR/VR interfaces would instead use functions that return a result immediately. This makes [WebXRInterface] quite a bit more complicated to initialize than other AR/VR interfaces. + Since WebXR is based on JavaScript, it makes extensive use of callbacks, which means that [WebXRInterface] is forced to use signals, where other AR/VR interfaces would instead use functions that return a result immediately. This makes [WebXRInterface] quite a bit more complicated to initialize than other AR/VR interfaces. Here's the minimum code required to start an immersive VR session: [codeblock] extends Node3D diff --git a/modules/webxr/register_types.cpp b/modules/webxr/register_types.cpp index cd403a49965..f4959c482f6 100644 --- a/modules/webxr/register_types.cpp +++ b/modules/webxr/register_types.cpp @@ -33,7 +33,7 @@ #include "webxr_interface.h" #include "webxr_interface_js.h" -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED Ref webxr; #endif @@ -44,7 +44,7 @@ void initialize_webxr_module(ModuleInitializationLevel p_level) { GDREGISTER_ABSTRACT_CLASS(WebXRInterface); -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED webxr.instantiate(); XRServer::get_singleton()->add_interface(webxr); #endif @@ -55,7 +55,7 @@ void uninitialize_webxr_module(ModuleInitializationLevel p_level) { return; } -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED if (webxr.is_valid()) { // uninitialise our interface if it is initialised if (webxr->is_initialized()) { diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp index 07e67605551..7d97dbfa0b1 100644 --- a/modules/webxr/webxr_interface_js.cpp +++ b/modules/webxr/webxr_interface_js.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED #include "webxr_interface_js.h" @@ -518,4 +518,4 @@ WebXRInterfaceJS::~WebXRInterfaceJS() { }; }; -#endif // JAVASCRIPT_ENABLED +#endif // WEB_ENABLED diff --git a/modules/webxr/webxr_interface_js.h b/modules/webxr/webxr_interface_js.h index f1ffedba467..dbe89dad83a 100644 --- a/modules/webxr/webxr_interface_js.h +++ b/modules/webxr/webxr_interface_js.h @@ -31,7 +31,7 @@ #ifndef WEBXR_INTERFACE_JS_H #define WEBXR_INTERFACE_JS_H -#ifdef JAVASCRIPT_ENABLED +#ifdef WEB_ENABLED #include "webxr_interface.h" @@ -98,6 +98,6 @@ public: ~WebXRInterfaceJS(); }; -#endif // JAVASCRIPT_ENABLED +#endif // WEB_ENABLED #endif // WEBXR_INTERFACE_JS_H diff --git a/platform/javascript/.eslintrc.engine.js b/platform/web/.eslintrc.engine.js similarity index 100% rename from platform/javascript/.eslintrc.engine.js rename to platform/web/.eslintrc.engine.js diff --git a/platform/javascript/.eslintrc.js b/platform/web/.eslintrc.js similarity index 100% rename from platform/javascript/.eslintrc.js rename to platform/web/.eslintrc.js diff --git a/platform/javascript/.eslintrc.libs.js b/platform/web/.eslintrc.libs.js similarity index 100% rename from platform/javascript/.eslintrc.libs.js rename to platform/web/.eslintrc.libs.js diff --git a/platform/javascript/README.md b/platform/web/README.md similarity index 84% rename from platform/javascript/README.md rename to platform/web/README.md index 812ab6778b1..1265ca09dfd 100644 --- a/platform/javascript/README.md +++ b/platform/web/README.md @@ -1,12 +1,12 @@ -# HTML5 platform port +# Web platform port -This folder contains the C++ and JavaScript code for the HTML5/WebAssembly platform port, +This folder contains the C++ and JavaScript code for the Web platform port, compiled using [Emscripten](https://emscripten.org/). It also contains a ESLint linting setup (see [`package.json`](package.json)). See also [`misc/dist/html`](/misc/dist/html) folder for additional files used by -this platform such as the HTML5 shell. +this platform such as the html shell (web page). ## Documentation diff --git a/platform/javascript/SCsub b/platform/web/SCsub similarity index 86% rename from platform/javascript/SCsub rename to platform/web/SCsub index 4827dc46272..78d7ce40742 100644 --- a/platform/javascript/SCsub +++ b/platform/web/SCsub @@ -2,14 +2,14 @@ Import("env") -javascript_files = [ - "audio_driver_javascript.cpp", - "display_server_javascript.cpp", - "http_client_javascript.cpp", +web_files = [ + "audio_driver_web.cpp", + "display_server_web.cpp", + "http_client_web.cpp", "javascript_singleton.cpp", - "javascript_main.cpp", - "os_javascript.cpp", - "api/javascript_tools_editor_plugin.cpp", + "web_main.cpp", + "os_web.cpp", + "api/web_tools_editor_plugin.cpp", ] sys_env = env.Clone() @@ -52,14 +52,14 @@ if env["gdnative_enabled"]: # Force exporting the standard library (printf, malloc, etc.) sys_env["ENV"]["EMCC_FORCE_STDLIBS"] = "libc,libc++,libc++abi" # The main emscripten runtime, with exported standard libraries. - sys = sys_env.Program(build_targets, ["javascript_runtime.cpp"]) + sys = sys_env.Program(build_targets, ["web_runtime.cpp"]) # The side library, containing all Godot code. wasm_env = env.Clone() wasm_env.Append(CPPDEFINES=["WASM_GDNATIVE"]) # So that OS knows it can run GDNative libraries. wasm_env.Append(CCFLAGS=["-s", "SIDE_MODULE=2"]) wasm_env.Append(LINKFLAGS=["-s", "SIDE_MODULE=2"]) - wasm = wasm_env.add_program("#bin/godot.side${PROGSUFFIX}.wasm", javascript_files) + wasm = wasm_env.add_program("#bin/godot.side${PROGSUFFIX}.wasm", web_files) build = sys + [wasm[0]] else: build_targets = ["#bin/godot${PROGSUFFIX}.js", "#bin/godot${PROGSUFFIX}.wasm"] @@ -67,7 +67,7 @@ else: build_targets.append("#bin/godot${PROGSUFFIX}.worker.js") # We use IDBFS. Since Emscripten 1.39.1 it needs to be linked explicitly. sys_env.Append(LIBS=["idbfs.js"]) - build = sys_env.Program(build_targets, javascript_files + ["javascript_runtime.cpp"]) + build = sys_env.Program(build_targets, web_files + ["web_runtime.cpp"]) sys_env.Depends(build[0], sys_env["JS_LIBS"]) sys_env.Depends(build[0], sys_env["JS_PRE"]) @@ -78,7 +78,7 @@ engine = [ "js/engine/config.js", "js/engine/engine.js", ] -externs = [env.File("#platform/javascript/js/engine/engine.externs.js")] +externs = [env.File("#platform/web/js/engine/engine.externs.js")] js_engine = env.CreateEngineFile("#bin/godot${PROGSUFFIX}.engine.js", engine, externs) env.Depends(js_engine, externs) diff --git a/platform/javascript/api/api.cpp b/platform/web/api/api.cpp similarity index 92% rename from platform/javascript/api/api.cpp rename to platform/web/api/api.cpp index 46a0a816bf1..a724b0456d4 100644 --- a/platform/javascript/api/api.cpp +++ b/platform/web/api/api.cpp @@ -31,20 +31,20 @@ #include "api.h" #include "core/config/engine.h" #include "javascript_singleton.h" -#include "javascript_tools_editor_plugin.h" +#include "web_tools_editor_plugin.h" -static JavaScript *javascript_eval; +static JavaScript *javascript_singleton; -void register_javascript_api() { - JavaScriptToolsEditorPlugin::initialize(); +void register_web_api() { + WebToolsEditorPlugin::initialize(); GDREGISTER_ABSTRACT_CLASS(JavaScriptObject); GDREGISTER_ABSTRACT_CLASS(JavaScript); - javascript_eval = memnew(JavaScript); - Engine::get_singleton()->add_singleton(Engine::Singleton("JavaScript", javascript_eval)); + javascript_singleton = memnew(JavaScript); + Engine::get_singleton()->add_singleton(Engine::Singleton("JavaScript", javascript_singleton)); } -void unregister_javascript_api() { - memdelete(javascript_eval); +void unregister_web_api() { + memdelete(javascript_singleton); } JavaScript *JavaScript::singleton = nullptr; @@ -76,7 +76,7 @@ void JavaScript::_bind_methods() { ADD_SIGNAL(MethodInfo("pwa_update_available")); } -#if !defined(JAVASCRIPT_ENABLED) || !defined(JAVASCRIPT_EVAL_ENABLED) +#if !defined(WEB_ENABLED) || !defined(JAVASCRIPT_EVAL_ENABLED) Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { return Variant(); } @@ -104,7 +104,7 @@ Variant JavaScript::_create_object_bind(const Variant **p_args, int p_argcount, return Ref(); } #endif -#if !defined(JAVASCRIPT_ENABLED) +#if !defined(WEB_ENABLED) bool JavaScript::pwa_needs_update() const { return false; } diff --git a/platform/javascript/api/api.h b/platform/web/api/api.h similarity index 93% rename from platform/javascript/api/api.h rename to platform/web/api/api.h index 97e06c85776..f073e817d1a 100644 --- a/platform/javascript/api/api.h +++ b/platform/web/api/api.h @@ -28,10 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef JAVASCRIPT_API_H -#define JAVASCRIPT_API_H +#ifndef WEB_API_H +#define WEB_API_H -void register_javascript_api(); -void unregister_javascript_api(); +void register_web_api(); +void unregister_web_api(); -#endif // JAVASCRIPT_API_H +#endif // WEB_API_H diff --git a/platform/javascript/api/javascript_singleton.h b/platform/web/api/javascript_singleton.h similarity index 100% rename from platform/javascript/api/javascript_singleton.h rename to platform/web/api/javascript_singleton.h diff --git a/platform/javascript/api/javascript_tools_editor_plugin.cpp b/platform/web/api/web_tools_editor_plugin.cpp similarity index 87% rename from platform/javascript/api/javascript_tools_editor_plugin.cpp rename to platform/web/api/web_tools_editor_plugin.cpp index 1507f323753..6f684a73c27 100644 --- a/platform/javascript/api/javascript_tools_editor_plugin.cpp +++ b/platform/web/api/web_tools_editor_plugin.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* javascript_tools_editor_plugin.cpp */ +/* web_tools_editor_plugin.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#if defined(TOOLS_ENABLED) && defined(JAVASCRIPT_ENABLED) -#include "javascript_tools_editor_plugin.h" +#if defined(TOOLS_ENABLED) && defined(WEB_ENABLED) +#include "web_tools_editor_plugin.h" #include "core/config/engine.h" #include "core/config/project_settings.h" @@ -40,24 +40,24 @@ #include -// JavaScript functions defined in library_godot_editor_tools.js +// Web functions defined in library_godot_editor_tools.js extern "C" { extern void godot_js_os_download_buffer(const uint8_t *p_buf, int p_buf_size, const char *p_name, const char *p_mime); } -static void _javascript_editor_init_callback() { - EditorNode::get_singleton()->add_editor_plugin(memnew(JavaScriptToolsEditorPlugin)); +static void _web_editor_init_callback() { + EditorNode::get_singleton()->add_editor_plugin(memnew(WebToolsEditorPlugin)); } -void JavaScriptToolsEditorPlugin::initialize() { - EditorNode::add_init_callback(_javascript_editor_init_callback); +void WebToolsEditorPlugin::initialize() { + EditorNode::add_init_callback(_web_editor_init_callback); } -JavaScriptToolsEditorPlugin::JavaScriptToolsEditorPlugin() { - add_tool_menu_item("Download Project Source", callable_mp(this, &JavaScriptToolsEditorPlugin::_download_zip)); +WebToolsEditorPlugin::WebToolsEditorPlugin() { + add_tool_menu_item("Download Project Source", callable_mp(this, &WebToolsEditorPlugin::_download_zip)); } -void JavaScriptToolsEditorPlugin::_download_zip(Variant p_v) { +void WebToolsEditorPlugin::_download_zip(Variant p_v) { if (!Engine::get_singleton() || !Engine::get_singleton()->is_editor_hint()) { ERR_PRINT("Downloading the project as a ZIP archive is only available in Editor mode."); return; @@ -95,7 +95,7 @@ void JavaScriptToolsEditorPlugin::_download_zip(Variant p_v) { DirAccess::remove_file_or_error(output_path); } -void JavaScriptToolsEditorPlugin::_zip_file(String p_path, String p_base_path, zipFile p_zip) { +void WebToolsEditorPlugin::_zip_file(String p_path, String p_base_path, zipFile p_zip) { Ref f = FileAccess::open(p_path, FileAccess::READ); if (f.is_null()) { WARN_PRINT("Unable to open file for zipping: " + p_path); @@ -121,7 +121,7 @@ void JavaScriptToolsEditorPlugin::_zip_file(String p_path, String p_base_path, z zipCloseFileInZip(p_zip); } -void JavaScriptToolsEditorPlugin::_zip_recursive(String p_path, String p_base_path, zipFile p_zip) { +void WebToolsEditorPlugin::_zip_recursive(String p_path, String p_base_path, zipFile p_zip) { Ref dir = DirAccess::open(p_path); if (dir.is_null()) { WARN_PRINT("Unable to open directory for zipping: " + p_path); diff --git a/platform/javascript/api/javascript_tools_editor_plugin.h b/platform/web/api/web_tools_editor_plugin.h similarity index 85% rename from platform/javascript/api/javascript_tools_editor_plugin.h rename to platform/web/api/web_tools_editor_plugin.h index cbf5f494973..6af1dec3fba 100644 --- a/platform/javascript/api/javascript_tools_editor_plugin.h +++ b/platform/web/api/web_tools_editor_plugin.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* javascript_tools_editor_plugin.h */ +/* web_tools_editor_plugin.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,15 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef JAVASCRIPT_TOOLS_EDITOR_PLUGIN_H -#define JAVASCRIPT_TOOLS_EDITOR_PLUGIN_H +#ifndef WEB_TOOLS_EDITOR_PLUGIN_H +#define WEB_TOOLS_EDITOR_PLUGIN_H -#if defined(TOOLS_ENABLED) && defined(JAVASCRIPT_ENABLED) +#if defined(TOOLS_ENABLED) && defined(WEB_ENABLED) #include "core/io/zip_io.h" #include "editor/editor_plugin.h" -class JavaScriptToolsEditorPlugin : public EditorPlugin { - GDCLASS(JavaScriptToolsEditorPlugin, EditorPlugin); +class WebToolsEditorPlugin : public EditorPlugin { + GDCLASS(WebToolsEditorPlugin, EditorPlugin); private: void _zip_file(String p_path, String p_base_path, zipFile p_zip); @@ -46,13 +46,13 @@ private: public: static void initialize(); - JavaScriptToolsEditorPlugin(); + WebToolsEditorPlugin(); }; #else -class JavaScriptToolsEditorPlugin { +class WebToolsEditorPlugin { public: static void initialize() {} }; #endif -#endif // JAVASCRIPT_TOOLS_EDITOR_PLUGIN_H +#endif // WEB_TOOLS_EDITOR_PLUGIN_H diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/web/audio_driver_web.cpp similarity index 89% rename from platform/javascript/audio_driver_javascript.cpp rename to platform/web/audio_driver_web.cpp index d45885b8e86..0e37afc2cc4 100644 --- a/platform/javascript/audio_driver_javascript.cpp +++ b/platform/web/audio_driver_web.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* audio_driver_javascript.cpp */ +/* audio_driver_web.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,27 +28,27 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "audio_driver_javascript.h" +#include "audio_driver_web.h" #include "core/config/project_settings.h" #include -AudioDriverJavaScript::AudioContext AudioDriverJavaScript::audio_context; +AudioDriverWeb::AudioContext AudioDriverWeb::audio_context; -bool AudioDriverJavaScript::is_available() { +bool AudioDriverWeb::is_available() { return godot_audio_is_available() != 0; } -void AudioDriverJavaScript::_state_change_callback(int p_state) { - AudioDriverJavaScript::audio_context.state = p_state; +void AudioDriverWeb::_state_change_callback(int p_state) { + AudioDriverWeb::audio_context.state = p_state; } -void AudioDriverJavaScript::_latency_update_callback(float p_latency) { - AudioDriverJavaScript::audio_context.output_latency = p_latency; +void AudioDriverWeb::_latency_update_callback(float p_latency) { + AudioDriverWeb::audio_context.output_latency = p_latency; } -void AudioDriverJavaScript::_audio_driver_process(int p_from, int p_samples) { +void AudioDriverWeb::_audio_driver_process(int p_from, int p_samples) { int32_t *stream_buffer = reinterpret_cast(output_rb); const int max_samples = memarr_len(output_rb); @@ -74,7 +74,7 @@ void AudioDriverJavaScript::_audio_driver_process(int p_from, int p_samples) { } } -void AudioDriverJavaScript::_audio_driver_capture(int p_from, int p_samples) { +void AudioDriverWeb::_audio_driver_capture(int p_from, int p_samples) { if (get_input_buffer().size() == 0) { return; // Input capture stopped. } @@ -100,7 +100,7 @@ void AudioDriverJavaScript::_audio_driver_capture(int p_from, int p_samples) { } } -Error AudioDriverJavaScript::init() { +Error AudioDriverWeb::init() { int latency = GLOBAL_GET("audio/driver/output_latency"); if (!audio_context.inited) { audio_context.mix_rate = GLOBAL_GET("audio/driver/mix_rate"); @@ -132,29 +132,29 @@ Error AudioDriverJavaScript::init() { return OK; } -void AudioDriverJavaScript::start() { +void AudioDriverWeb::start() { start(output_rb, memarr_len(output_rb), input_rb, memarr_len(input_rb)); } -void AudioDriverJavaScript::resume() { +void AudioDriverWeb::resume() { if (audio_context.state == 0) { // 'suspended' godot_audio_resume(); } } -float AudioDriverJavaScript::get_latency() { +float AudioDriverWeb::get_latency() { return audio_context.output_latency + (float(buffer_length) / mix_rate); } -int AudioDriverJavaScript::get_mix_rate() const { +int AudioDriverWeb::get_mix_rate() const { return mix_rate; } -AudioDriver::SpeakerMode AudioDriverJavaScript::get_speaker_mode() const { +AudioDriver::SpeakerMode AudioDriverWeb::get_speaker_mode() const { return get_speaker_mode_by_total_channels(channel_count); } -void AudioDriverJavaScript::finish() { +void AudioDriverWeb::finish() { finish_driver(); if (output_rb) { memdelete_arr(output_rb); @@ -166,7 +166,7 @@ void AudioDriverJavaScript::finish() { } } -Error AudioDriverJavaScript::capture_start() { +Error AudioDriverWeb::capture_start() { lock(); input_buffer_init(buffer_length); unlock(); @@ -176,7 +176,7 @@ Error AudioDriverJavaScript::capture_start() { return OK; } -Error AudioDriverJavaScript::capture_stop() { +Error AudioDriverWeb::capture_stop() { godot_audio_capture_stop(); lock(); input_buffer.clear(); diff --git a/platform/javascript/audio_driver_javascript.h b/platform/web/audio_driver_web.h similarity index 91% rename from platform/javascript/audio_driver_javascript.h rename to platform/web/audio_driver_web.h index 807e2f936b9..dfce277c0c9 100644 --- a/platform/javascript/audio_driver_javascript.h +++ b/platform/web/audio_driver_web.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* audio_driver_javascript.h */ +/* audio_driver_web.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef AUDIO_DRIVER_JAVASCRIPT_H -#define AUDIO_DRIVER_JAVASCRIPT_H +#ifndef AUDIO_DRIVER_WEB_H +#define AUDIO_DRIVER_WEB_H #include "core/os/mutex.h" #include "core/os/thread.h" @@ -37,7 +37,7 @@ #include "godot_audio.h" -class AudioDriverJavaScript : public AudioDriver { +class AudioDriverWeb : public AudioDriver { private: struct AudioContext { bool inited = false; @@ -58,7 +58,7 @@ private: static void _state_change_callback(int p_state); static void _latency_update_callback(float p_latency); - static AudioDriverJavaScript *singleton; + static AudioDriverWeb *singleton; protected: void _audio_driver_process(int p_from = 0, int p_samples = 0); @@ -86,11 +86,11 @@ public: static void resume(); - AudioDriverJavaScript() {} + AudioDriverWeb() {} }; #ifdef NO_THREADS -class AudioDriverScriptProcessor : public AudioDriverJavaScript { +class AudioDriverScriptProcessor : public AudioDriverWeb { private: static void _process_callback(); @@ -109,7 +109,7 @@ public: AudioDriverScriptProcessor() { singleton = this; } }; -class AudioDriverWorklet : public AudioDriverJavaScript { +class AudioDriverWorklet : public AudioDriverWeb { private: static void _process_callback(int p_pos, int p_samples); static void _capture_callback(int p_pos, int p_samples); @@ -129,7 +129,7 @@ public: AudioDriverWorklet() { singleton = this; } }; #else -class AudioDriverWorklet : public AudioDriverJavaScript { +class AudioDriverWorklet : public AudioDriverWeb { private: enum { STATE_LOCK, @@ -158,4 +158,4 @@ public: }; #endif -#endif // AUDIO_DRIVER_JAVASCRIPT_H +#endif // AUDIO_DRIVER_WEB_H diff --git a/platform/javascript/detect.py b/platform/web/detect.py similarity index 98% rename from platform/javascript/detect.py rename to platform/web/detect.py index 048c9c2eb45..ae0ff2c4ea8 100644 --- a/platform/javascript/detect.py +++ b/platform/web/detect.py @@ -18,7 +18,7 @@ def is_active(): def get_name(): - return "JavaScript" + return "Web" def can_build(): @@ -182,8 +182,8 @@ def configure(env): env["LIBPREFIXES"] = ["$LIBPREFIX"] env["LIBSUFFIXES"] = ["$LIBSUFFIX"] - env.Prepend(CPPPATH=["#platform/javascript"]) - env.Append(CPPDEFINES=["JAVASCRIPT_ENABLED", "UNIX_ENABLED"]) + env.Prepend(CPPPATH=["#platform/web"]) + env.Append(CPPDEFINES=["WEB_ENABLED", "UNIX_ENABLED"]) if env["opengl3"]: env.AppendUnique(CPPDEFINES=["GLES3_ENABLED"]) diff --git a/platform/javascript/display_server_javascript.cpp b/platform/web/display_server_web.cpp similarity index 72% rename from platform/javascript/display_server_javascript.cpp rename to platform/web/display_server_web.cpp index 30240ad2db7..b36f9d14a4c 100644 --- a/platform/javascript/display_server_javascript.cpp +++ b/platform/web/display_server_web.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* display_server_javascript.cpp */ +/* display_server_web.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "display_server_javascript.h" +#include "display_server_web.h" #ifdef GLES3_ENABLED #include "drivers/gles3/rasterizer_gles3.h" #endif -#include "platform/javascript/os_javascript.h" +#include "platform/web/os_web.h" #include "servers/rendering/dummy/rasterizer_dummy.h" #include @@ -48,17 +48,17 @@ #define DOM_BUTTON_XBUTTON1 3 #define DOM_BUTTON_XBUTTON2 4 -DisplayServerJavaScript *DisplayServerJavaScript::get_singleton() { - return static_cast(DisplayServer::get_singleton()); +DisplayServerWeb *DisplayServerWeb::get_singleton() { + return static_cast(DisplayServer::get_singleton()); } // Window (canvas) -bool DisplayServerJavaScript::check_size_force_redraw() { +bool DisplayServerWeb::check_size_force_redraw() { return godot_js_display_size_update() != 0; } -void DisplayServerJavaScript::fullscreen_change_callback(int p_fullscreen) { - DisplayServerJavaScript *display = get_singleton(); +void DisplayServerWeb::fullscreen_change_callback(int p_fullscreen) { + DisplayServerWeb *display = get_singleton(); if (p_fullscreen) { display->window_mode = WINDOW_MODE_FULLSCREEN; } else { @@ -67,8 +67,8 @@ void DisplayServerJavaScript::fullscreen_change_callback(int p_fullscreen) { } // Drag and drop callback. -void DisplayServerJavaScript::drop_files_js_callback(char **p_filev, int p_filec) { - DisplayServerJavaScript *ds = get_singleton(); +void DisplayServerWeb::drop_files_js_callback(char **p_filev, int p_filec) { + DisplayServerWeb *ds = get_singleton(); if (!ds) { ERR_FAIL_MSG("Unable to drop files because the DisplayServer is not active"); } @@ -86,9 +86,9 @@ void DisplayServerJavaScript::drop_files_js_callback(char **p_filev, int p_filec ds->drop_files_callback.callp((const Variant **)&vp, 1, ret, ce); } -// JavaScript quit request callback. -void DisplayServerJavaScript::request_quit_callback() { - DisplayServerJavaScript *ds = get_singleton(); +// Web quit request callback. +void DisplayServerWeb::request_quit_callback() { + DisplayServerWeb *ds = get_singleton(); if (ds && !ds->window_event_callback.is_null()) { Variant event = int(DisplayServer::WINDOW_EVENT_CLOSE_REQUEST); Variant *eventp = &event; @@ -100,18 +100,18 @@ void DisplayServerJavaScript::request_quit_callback() { // Keys -void DisplayServerJavaScript::dom2godot_mod(Ref ev, int p_mod) { +void DisplayServerWeb::dom2godot_mod(Ref ev, int p_mod) { ev->set_shift_pressed(p_mod & 1); ev->set_alt_pressed(p_mod & 2); ev->set_ctrl_pressed(p_mod & 4); ev->set_meta_pressed(p_mod & 8); } -void DisplayServerJavaScript::key_callback(int p_pressed, int p_repeat, int p_modifiers) { - DisplayServerJavaScript *ds = get_singleton(); +void DisplayServerWeb::key_callback(int p_pressed, int p_repeat, int p_modifiers) { + DisplayServerWeb *ds = get_singleton(); JSKeyEvent &key_event = ds->key_event; // Resume audio context after input in case autoplay was denied. - OS_JavaScript::get_singleton()->resume_audio(); + OS_Web::get_singleton()->resume_audio(); Ref ev; ev.instantiate(); @@ -133,8 +133,8 @@ void DisplayServerJavaScript::key_callback(int p_pressed, int p_repeat, int p_mo // Mouse -int DisplayServerJavaScript::mouse_button_callback(int p_pressed, int p_button, double p_x, double p_y, int p_modifiers) { - DisplayServerJavaScript *ds = get_singleton(); +int DisplayServerWeb::mouse_button_callback(int p_pressed, int p_button, double p_x, double p_y, int p_modifiers) { + DisplayServerWeb *ds = get_singleton(); Point2 pos(p_x, p_y); Ref ev; @@ -199,7 +199,7 @@ int DisplayServerJavaScript::mouse_button_callback(int p_pressed, int p_button, Input::get_singleton()->parse_input_event(ev); // Resume audio context after input in case autoplay was denied. - OS_JavaScript::get_singleton()->resume_audio(); + OS_Web::get_singleton()->resume_audio(); // Make sure to flush all events so we can call restricted APIs inside the event. Input::get_singleton()->flush_buffered_events(); @@ -209,7 +209,7 @@ int DisplayServerJavaScript::mouse_button_callback(int p_pressed, int p_button, return true; } -void DisplayServerJavaScript::mouse_move_callback(double p_x, double p_y, double p_rel_x, double p_rel_y, int p_modifiers) { +void DisplayServerWeb::mouse_move_callback(double p_x, double p_y, double p_rel_x, double p_rel_y, int p_modifiers) { MouseButton input_mask = Input::get_singleton()->get_mouse_button_mask(); // For motion outside the canvas, only read mouse movement if dragging // started inside the canvas; imitating desktop app behaviour. @@ -233,7 +233,7 @@ void DisplayServerJavaScript::mouse_move_callback(double p_x, double p_y, double } // Cursor -const char *DisplayServerJavaScript::godot2dom_cursor(DisplayServer::CursorShape p_shape) { +const char *DisplayServerWeb::godot2dom_cursor(DisplayServer::CursorShape p_shape) { switch (p_shape) { case DisplayServer::CURSOR_ARROW: return "default"; @@ -274,15 +274,15 @@ const char *DisplayServerJavaScript::godot2dom_cursor(DisplayServer::CursorShape } } -bool DisplayServerJavaScript::tts_is_speaking() const { +bool DisplayServerWeb::tts_is_speaking() const { return godot_js_tts_is_speaking(); } -bool DisplayServerJavaScript::tts_is_paused() const { +bool DisplayServerWeb::tts_is_paused() const { return godot_js_tts_is_paused(); } -void DisplayServerJavaScript::update_voices_callback(int p_size, const char **p_voice) { +void DisplayServerWeb::update_voices_callback(int p_size, const char **p_voice) { get_singleton()->voices.clear(); for (int i = 0; i < p_size; i++) { Vector tokens = String::utf8(p_voice[i]).split(";", true, 2); @@ -296,12 +296,12 @@ void DisplayServerJavaScript::update_voices_callback(int p_size, const char **p_ } } -TypedArray DisplayServerJavaScript::tts_get_voices() const { +TypedArray DisplayServerWeb::tts_get_voices() const { godot_js_tts_get_voices(update_voices_callback); return voices; } -void DisplayServerJavaScript::tts_speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int p_utterance_id, bool p_interrupt) { +void DisplayServerWeb::tts_speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int p_utterance_id, bool p_interrupt) { if (p_interrupt) { tts_stop(); } @@ -314,18 +314,18 @@ void DisplayServerJavaScript::tts_speak(const String &p_text, const String &p_vo CharString string = p_text.utf8(); utterance_ids[p_utterance_id] = string; - godot_js_tts_speak(string.get_data(), p_voice.utf8().get_data(), CLAMP(p_volume, 0, 100), CLAMP(p_pitch, 0.f, 2.f), CLAMP(p_rate, 0.1f, 10.f), p_utterance_id, DisplayServerJavaScript::_js_utterance_callback); + godot_js_tts_speak(string.get_data(), p_voice.utf8().get_data(), CLAMP(p_volume, 0, 100), CLAMP(p_pitch, 0.f, 2.f), CLAMP(p_rate, 0.1f, 10.f), p_utterance_id, DisplayServerWeb::_js_utterance_callback); } -void DisplayServerJavaScript::tts_pause() { +void DisplayServerWeb::tts_pause() { godot_js_tts_pause(); } -void DisplayServerJavaScript::tts_resume() { +void DisplayServerWeb::tts_resume() { godot_js_tts_resume(); } -void DisplayServerJavaScript::tts_stop() { +void DisplayServerWeb::tts_stop() { for (const KeyValue &E : utterance_ids) { tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, E.key); } @@ -333,8 +333,8 @@ void DisplayServerJavaScript::tts_stop() { godot_js_tts_stop(); } -void DisplayServerJavaScript::_js_utterance_callback(int p_event, int p_id, int p_pos) { - DisplayServerJavaScript *ds = (DisplayServerJavaScript *)DisplayServer::get_singleton(); +void DisplayServerWeb::_js_utterance_callback(int p_event, int p_id, int p_pos) { + DisplayServerWeb *ds = (DisplayServerWeb *)DisplayServer::get_singleton(); if (ds->utterance_ids.has(p_id)) { int pos = 0; if ((TTSUtteranceEvent)p_event == DisplayServer::TTS_UTTERANCE_BOUNDARY) { @@ -358,7 +358,7 @@ void DisplayServerJavaScript::_js_utterance_callback(int p_event, int p_id, int } } -void DisplayServerJavaScript::cursor_set_shape(CursorShape p_shape) { +void DisplayServerWeb::cursor_set_shape(CursorShape p_shape) { ERR_FAIL_INDEX(p_shape, CURSOR_MAX); if (cursor_shape == p_shape) { return; @@ -367,11 +367,11 @@ void DisplayServerJavaScript::cursor_set_shape(CursorShape p_shape) { godot_js_display_cursor_set_shape(godot2dom_cursor(cursor_shape)); } -DisplayServer::CursorShape DisplayServerJavaScript::cursor_get_shape() const { +DisplayServer::CursorShape DisplayServerWeb::cursor_get_shape() const { return cursor_shape; } -void DisplayServerJavaScript::cursor_set_custom_image(const Ref &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) { +void DisplayServerWeb::cursor_set_custom_image(const Ref &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) { if (p_cursor.is_valid()) { Ref texture = p_cursor; Ref atlas_texture = p_cursor; @@ -446,8 +446,8 @@ void DisplayServerJavaScript::cursor_set_custom_image(const Ref &p_cur } // Mouse mode -void DisplayServerJavaScript::mouse_set_mode(MouseMode p_mode) { - ERR_FAIL_COND_MSG(p_mode == MOUSE_MODE_CONFINED || p_mode == MOUSE_MODE_CONFINED_HIDDEN, "MOUSE_MODE_CONFINED is not supported for the HTML5 platform."); +void DisplayServerWeb::mouse_set_mode(MouseMode p_mode) { + ERR_FAIL_COND_MSG(p_mode == MOUSE_MODE_CONFINED || p_mode == MOUSE_MODE_CONFINED_HIDDEN, "MOUSE_MODE_CONFINED is not supported for the Web platform."); if (p_mode == mouse_get_mode()) { return; } @@ -466,7 +466,7 @@ void DisplayServerJavaScript::mouse_set_mode(MouseMode p_mode) { } } -DisplayServer::MouseMode DisplayServerJavaScript::mouse_get_mode() const { +DisplayServer::MouseMode DisplayServerWeb::mouse_get_mode() const { if (godot_js_display_cursor_is_hidden()) { return MOUSE_MODE_HIDDEN; } @@ -477,12 +477,12 @@ DisplayServer::MouseMode DisplayServerJavaScript::mouse_get_mode() const { return MOUSE_MODE_VISIBLE; } -Point2i DisplayServerJavaScript::mouse_get_position() const { +Point2i DisplayServerWeb::mouse_get_position() const { return Input::get_singleton()->get_mouse_position(); } // Wheel -int DisplayServerJavaScript::mouse_wheel_callback(double p_delta_x, double p_delta_y) { +int DisplayServerWeb::mouse_wheel_callback(double p_delta_x, double p_delta_y) { if (!godot_js_display_canvas_is_focused()) { if (get_singleton()->cursor_inside_canvas) { godot_js_display_canvas_focus(); @@ -532,8 +532,8 @@ int DisplayServerJavaScript::mouse_wheel_callback(double p_delta_x, double p_del } // Touch -void DisplayServerJavaScript::touch_callback(int p_type, int p_count) { - DisplayServerJavaScript *ds = get_singleton(); +void DisplayServerWeb::touch_callback(int p_type, int p_count) { + DisplayServerWeb *ds = get_singleton(); const JSTouchEvent &touch_event = ds->touch_event; for (int i = 0; i < p_count; i++) { @@ -555,7 +555,7 @@ void DisplayServerJavaScript::touch_callback(int p_type, int p_count) { Ref ev; // Resume audio context after input in case autoplay was denied. - OS_JavaScript::get_singleton()->resume_audio(); + OS_Web::get_singleton()->resume_audio(); ev.instantiate(); ev->set_index(touch_event.identifier[i]); @@ -571,13 +571,13 @@ void DisplayServerJavaScript::touch_callback(int p_type, int p_count) { } } -bool DisplayServerJavaScript::screen_is_touchscreen(int p_screen) const { +bool DisplayServerWeb::screen_is_touchscreen(int p_screen) const { return godot_js_display_touchscreen_is_available(); } // Virtual Keyboard -void DisplayServerJavaScript::vk_input_text_callback(const char *p_text, int p_cursor) { - DisplayServerJavaScript *ds = DisplayServerJavaScript::get_singleton(); +void DisplayServerWeb::vk_input_text_callback(const char *p_text, int p_cursor) { + DisplayServerWeb *ds = DisplayServerWeb::get_singleton(); if (!ds || ds->input_text_callback.is_null()) { return; } @@ -604,20 +604,20 @@ void DisplayServerJavaScript::vk_input_text_callback(const char *p_text, int p_c } } -void DisplayServerJavaScript::virtual_keyboard_show(const String &p_existing_text, const Rect2 &p_screen_rect, VirtualKeyboardType p_type, int p_max_input_length, int p_cursor_start, int p_cursor_end) { +void DisplayServerWeb::virtual_keyboard_show(const String &p_existing_text, const Rect2 &p_screen_rect, VirtualKeyboardType p_type, int p_max_input_length, int p_cursor_start, int p_cursor_end) { godot_js_display_vk_show(p_existing_text.utf8().get_data(), p_type, p_cursor_start, p_cursor_end); } -void DisplayServerJavaScript::virtual_keyboard_hide() { +void DisplayServerWeb::virtual_keyboard_hide() { godot_js_display_vk_hide(); } -void DisplayServerJavaScript::window_blur_callback() { +void DisplayServerWeb::window_blur_callback() { Input::get_singleton()->release_pressed_events(); } // Gamepad -void DisplayServerJavaScript::gamepad_callback(int p_index, int p_connected, const char *p_id, const char *p_guid) { +void DisplayServerWeb::gamepad_callback(int p_index, int p_connected, const char *p_id, const char *p_guid) { Input *input = Input::get_singleton(); if (p_connected) { input->joy_connection_changed(p_index, true, String::utf8(p_id), String::utf8(p_guid)); @@ -626,7 +626,7 @@ void DisplayServerJavaScript::gamepad_callback(int p_index, int p_connected, con } } -void DisplayServerJavaScript::process_joypads() { +void DisplayServerWeb::process_joypads() { Input *input = Input::get_singleton(); int32_t pads = godot_js_input_gamepad_sample_count(); int32_t s_btns_num = 0; @@ -654,7 +654,7 @@ void DisplayServerJavaScript::process_joypads() { } } -Vector DisplayServerJavaScript::get_rendering_drivers_func() { +Vector DisplayServerWeb::get_rendering_drivers_func() { Vector drivers; #ifdef GLES3_ENABLED drivers.push_back("opengl3"); @@ -663,23 +663,23 @@ Vector DisplayServerJavaScript::get_rendering_drivers_func() { } // Clipboard -void DisplayServerJavaScript::update_clipboard_callback(const char *p_text) { +void DisplayServerWeb::update_clipboard_callback(const char *p_text) { get_singleton()->clipboard = String::utf8(p_text); } -void DisplayServerJavaScript::clipboard_set(const String &p_text) { +void DisplayServerWeb::clipboard_set(const String &p_text) { clipboard = p_text; int err = godot_js_display_clipboard_set(p_text.utf8().get_data()); ERR_FAIL_COND_MSG(err, "Clipboard API is not supported."); } -String DisplayServerJavaScript::clipboard_get() const { +String DisplayServerWeb::clipboard_get() const { godot_js_display_clipboard_get(update_clipboard_callback); return clipboard; } -void DisplayServerJavaScript::send_window_event_callback(int p_notification) { - DisplayServerJavaScript *ds = get_singleton(); +void DisplayServerWeb::send_window_event_callback(int p_notification) { + DisplayServerWeb *ds = get_singleton(); if (!ds) { return; } @@ -695,7 +695,7 @@ void DisplayServerJavaScript::send_window_event_callback(int p_notification) { } } -void DisplayServerJavaScript::set_icon(const Ref &p_icon) { +void DisplayServerWeb::set_icon(const Ref &p_icon) { ERR_FAIL_COND(p_icon.is_null()); Ref icon = p_icon; if (icon->is_compressed()) { @@ -727,7 +727,7 @@ void DisplayServerJavaScript::set_icon(const Ref &p_icon) { godot_js_display_window_icon_set(png.ptr(), len); } -void DisplayServerJavaScript::_dispatch_input_event(const Ref &p_event) { +void DisplayServerWeb::_dispatch_input_event(const Ref &p_event) { Callable cb = get_singleton()->input_event_callback; if (!cb.is_null()) { Variant ev = p_event; @@ -738,11 +738,11 @@ void DisplayServerJavaScript::_dispatch_input_event(const Ref &p_eve } } -DisplayServer *DisplayServerJavaScript::create_func(const String &p_rendering_driver, WindowMode p_window_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Size2i &p_resolution, Error &r_error) { - return memnew(DisplayServerJavaScript(p_rendering_driver, p_window_mode, p_vsync_mode, p_flags, p_resolution, r_error)); +DisplayServer *DisplayServerWeb::create_func(const String &p_rendering_driver, WindowMode p_window_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Size2i &p_resolution, Error &r_error) { + return memnew(DisplayServerWeb(p_rendering_driver, p_window_mode, p_vsync_mode, p_flags, p_resolution, r_error)); } -DisplayServerJavaScript::DisplayServerJavaScript(const String &p_rendering_driver, WindowMode p_window_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Size2i &p_resolution, Error &r_error) { +DisplayServerWeb::DisplayServerWeb(const String &p_rendering_driver, WindowMode p_window_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Size2i &p_resolution, Error &r_error) { r_error = OK; // Always succeeds for now. // Ensure the canvas ID. @@ -788,17 +788,17 @@ DisplayServerJavaScript::DisplayServerJavaScript(const String &p_rendering_drive #endif // JS Input interface (js/libs/library_godot_input.js) - godot_js_input_mouse_button_cb(&DisplayServerJavaScript::mouse_button_callback); - godot_js_input_mouse_move_cb(&DisplayServerJavaScript::mouse_move_callback); - godot_js_input_mouse_wheel_cb(&DisplayServerJavaScript::mouse_wheel_callback); - godot_js_input_touch_cb(&DisplayServerJavaScript::touch_callback, touch_event.identifier, touch_event.coords); - godot_js_input_key_cb(&DisplayServerJavaScript::key_callback, key_event.code, key_event.key); + godot_js_input_mouse_button_cb(&DisplayServerWeb::mouse_button_callback); + godot_js_input_mouse_move_cb(&DisplayServerWeb::mouse_move_callback); + godot_js_input_mouse_wheel_cb(&DisplayServerWeb::mouse_wheel_callback); + godot_js_input_touch_cb(&DisplayServerWeb::touch_callback, touch_event.identifier, touch_event.coords); + godot_js_input_key_cb(&DisplayServerWeb::key_callback, key_event.code, key_event.key); godot_js_input_paste_cb(update_clipboard_callback); godot_js_input_drop_files_cb(drop_files_js_callback); - godot_js_input_gamepad_cb(&DisplayServerJavaScript::gamepad_callback); + godot_js_input_gamepad_cb(&DisplayServerWeb::gamepad_callback); // JS Display interface (js/libs/library_godot_display.js) - godot_js_display_fullscreen_cb(&DisplayServerJavaScript::fullscreen_change_callback); + godot_js_display_fullscreen_cb(&DisplayServerWeb::fullscreen_change_callback); godot_js_display_window_blur_cb(&window_blur_callback); godot_js_display_notification_cb(&send_window_event_callback, WINDOW_EVENT_MOUSE_ENTER, @@ -810,7 +810,7 @@ DisplayServerJavaScript::DisplayServerJavaScript(const String &p_rendering_drive Input::get_singleton()->set_event_dispatch_function(_dispatch_input_event); } -DisplayServerJavaScript::~DisplayServerJavaScript() { +DisplayServerWeb::~DisplayServerWeb() { #ifdef GLES3_ENABLED if (webgl_ctx) { emscripten_webgl_commit_frame(); @@ -819,7 +819,7 @@ DisplayServerJavaScript::~DisplayServerJavaScript() { #endif } -bool DisplayServerJavaScript::has_feature(Feature p_feature) const { +bool DisplayServerWeb::has_feature(Feature p_feature) const { switch (p_feature) { //case FEATURE_GLOBAL_MENU: //case FEATURE_HIDPI: @@ -846,139 +846,139 @@ bool DisplayServerJavaScript::has_feature(Feature p_feature) const { } } -void DisplayServerJavaScript::register_javascript_driver() { - register_create_function("javascript", create_func, get_rendering_drivers_func); +void DisplayServerWeb::register_web_driver() { + register_create_function("web", create_func, get_rendering_drivers_func); } -String DisplayServerJavaScript::get_name() const { - return "javascript"; +String DisplayServerWeb::get_name() const { + return "web"; } -int DisplayServerJavaScript::get_screen_count() const { +int DisplayServerWeb::get_screen_count() const { return 1; } -Point2i DisplayServerJavaScript::screen_get_position(int p_screen) const { +Point2i DisplayServerWeb::screen_get_position(int p_screen) const { return Point2i(); // TODO offsetX/Y? } -Size2i DisplayServerJavaScript::screen_get_size(int p_screen) const { +Size2i DisplayServerWeb::screen_get_size(int p_screen) const { int size[2]; godot_js_display_screen_size_get(size, size + 1); return Size2(size[0], size[1]); } -Rect2i DisplayServerJavaScript::screen_get_usable_rect(int p_screen) const { +Rect2i DisplayServerWeb::screen_get_usable_rect(int p_screen) const { int size[2]; godot_js_display_window_size_get(size, size + 1); return Rect2i(0, 0, size[0], size[1]); } -int DisplayServerJavaScript::screen_get_dpi(int p_screen) const { +int DisplayServerWeb::screen_get_dpi(int p_screen) const { return godot_js_display_screen_dpi_get(); } -float DisplayServerJavaScript::screen_get_scale(int p_screen) const { +float DisplayServerWeb::screen_get_scale(int p_screen) const { return godot_js_display_pixel_ratio_get(); } -float DisplayServerJavaScript::screen_get_refresh_rate(int p_screen) const { - return SCREEN_REFRESH_RATE_FALLBACK; // Javascript doesn't have much of a need for the screen refresh rate, and there's no native way to do so. +float DisplayServerWeb::screen_get_refresh_rate(int p_screen) const { + return SCREEN_REFRESH_RATE_FALLBACK; // Web doesn't have much of a need for the screen refresh rate, and there's no native way to do so. } -Vector DisplayServerJavaScript::get_window_list() const { +Vector DisplayServerWeb::get_window_list() const { Vector ret; ret.push_back(MAIN_WINDOW_ID); return ret; } -DisplayServerJavaScript::WindowID DisplayServerJavaScript::get_window_at_screen_position(const Point2i &p_position) const { +DisplayServerWeb::WindowID DisplayServerWeb::get_window_at_screen_position(const Point2i &p_position) const { return MAIN_WINDOW_ID; } -void DisplayServerJavaScript::window_attach_instance_id(ObjectID p_instance, WindowID p_window) { +void DisplayServerWeb::window_attach_instance_id(ObjectID p_instance, WindowID p_window) { window_attached_instance_id = p_instance; } -ObjectID DisplayServerJavaScript::window_get_attached_instance_id(WindowID p_window) const { +ObjectID DisplayServerWeb::window_get_attached_instance_id(WindowID p_window) const { return window_attached_instance_id; } -void DisplayServerJavaScript::window_set_rect_changed_callback(const Callable &p_callable, WindowID p_window) { +void DisplayServerWeb::window_set_rect_changed_callback(const Callable &p_callable, WindowID p_window) { // Not supported. } -void DisplayServerJavaScript::window_set_window_event_callback(const Callable &p_callable, WindowID p_window) { +void DisplayServerWeb::window_set_window_event_callback(const Callable &p_callable, WindowID p_window) { window_event_callback = p_callable; } -void DisplayServerJavaScript::window_set_input_event_callback(const Callable &p_callable, WindowID p_window) { +void DisplayServerWeb::window_set_input_event_callback(const Callable &p_callable, WindowID p_window) { input_event_callback = p_callable; } -void DisplayServerJavaScript::window_set_input_text_callback(const Callable &p_callable, WindowID p_window) { +void DisplayServerWeb::window_set_input_text_callback(const Callable &p_callable, WindowID p_window) { input_text_callback = p_callable; } -void DisplayServerJavaScript::window_set_drop_files_callback(const Callable &p_callable, WindowID p_window) { +void DisplayServerWeb::window_set_drop_files_callback(const Callable &p_callable, WindowID p_window) { drop_files_callback = p_callable; } -void DisplayServerJavaScript::window_set_title(const String &p_title, WindowID p_window) { +void DisplayServerWeb::window_set_title(const String &p_title, WindowID p_window) { godot_js_display_window_title_set(p_title.utf8().get_data()); } -int DisplayServerJavaScript::window_get_current_screen(WindowID p_window) const { +int DisplayServerWeb::window_get_current_screen(WindowID p_window) const { return 1; } -void DisplayServerJavaScript::window_set_current_screen(int p_screen, WindowID p_window) { +void DisplayServerWeb::window_set_current_screen(int p_screen, WindowID p_window) { // Not implemented. } -Point2i DisplayServerJavaScript::window_get_position(WindowID p_window) const { +Point2i DisplayServerWeb::window_get_position(WindowID p_window) const { return Point2i(); // TODO Does this need implementation? } -void DisplayServerJavaScript::window_set_position(const Point2i &p_position, WindowID p_window) { +void DisplayServerWeb::window_set_position(const Point2i &p_position, WindowID p_window) { // Not supported. } -void DisplayServerJavaScript::window_set_transient(WindowID p_window, WindowID p_parent) { +void DisplayServerWeb::window_set_transient(WindowID p_window, WindowID p_parent) { // Not supported. } -void DisplayServerJavaScript::window_set_max_size(const Size2i p_size, WindowID p_window) { +void DisplayServerWeb::window_set_max_size(const Size2i p_size, WindowID p_window) { // Not supported. } -Size2i DisplayServerJavaScript::window_get_max_size(WindowID p_window) const { +Size2i DisplayServerWeb::window_get_max_size(WindowID p_window) const { return Size2i(); } -void DisplayServerJavaScript::window_set_min_size(const Size2i p_size, WindowID p_window) { +void DisplayServerWeb::window_set_min_size(const Size2i p_size, WindowID p_window) { // Not supported. } -Size2i DisplayServerJavaScript::window_get_min_size(WindowID p_window) const { +Size2i DisplayServerWeb::window_get_min_size(WindowID p_window) const { return Size2i(); } -void DisplayServerJavaScript::window_set_size(const Size2i p_size, WindowID p_window) { +void DisplayServerWeb::window_set_size(const Size2i p_size, WindowID p_window) { godot_js_display_desired_size_set(p_size.x, p_size.y); } -Size2i DisplayServerJavaScript::window_get_size(WindowID p_window) const { +Size2i DisplayServerWeb::window_get_size(WindowID p_window) const { int size[2]; godot_js_display_window_size_get(size, size + 1); return Size2i(size[0], size[1]); } -Size2i DisplayServerJavaScript::window_get_real_size(WindowID p_window) const { +Size2i DisplayServerWeb::window_get_real_size(WindowID p_window) const { return window_get_size(p_window); } -void DisplayServerJavaScript::window_set_mode(WindowMode p_mode, WindowID p_window) { +void DisplayServerWeb::window_set_mode(WindowMode p_mode, WindowID p_window) { if (window_mode == p_mode) { return; } @@ -993,65 +993,65 @@ void DisplayServerJavaScript::window_set_mode(WindowMode p_mode, WindowID p_wind case WINDOW_MODE_EXCLUSIVE_FULLSCREEN: case WINDOW_MODE_FULLSCREEN: { int result = godot_js_display_fullscreen_request(); - ERR_FAIL_COND_MSG(result, "The request was denied. Remember that enabling fullscreen is only possible from an input callback for the HTML5 platform."); + ERR_FAIL_COND_MSG(result, "The request was denied. Remember that enabling fullscreen is only possible from an input callback for the Web platform."); } break; case WINDOW_MODE_MAXIMIZED: case WINDOW_MODE_MINIMIZED: - WARN_PRINT("WindowMode MAXIMIZED and MINIMIZED are not supported in HTML5 platform."); + WARN_PRINT("WindowMode MAXIMIZED and MINIMIZED are not supported in Web platform."); break; default: break; } } -DisplayServerJavaScript::WindowMode DisplayServerJavaScript::window_get_mode(WindowID p_window) const { +DisplayServerWeb::WindowMode DisplayServerWeb::window_get_mode(WindowID p_window) const { return window_mode; } -bool DisplayServerJavaScript::window_is_maximize_allowed(WindowID p_window) const { +bool DisplayServerWeb::window_is_maximize_allowed(WindowID p_window) const { return false; } -void DisplayServerJavaScript::window_set_flag(WindowFlags p_flag, bool p_enabled, WindowID p_window) { +void DisplayServerWeb::window_set_flag(WindowFlags p_flag, bool p_enabled, WindowID p_window) { // Not supported. } -bool DisplayServerJavaScript::window_get_flag(WindowFlags p_flag, WindowID p_window) const { +bool DisplayServerWeb::window_get_flag(WindowFlags p_flag, WindowID p_window) const { return false; } -void DisplayServerJavaScript::window_request_attention(WindowID p_window) { +void DisplayServerWeb::window_request_attention(WindowID p_window) { // Not supported. } -void DisplayServerJavaScript::window_move_to_foreground(WindowID p_window) { +void DisplayServerWeb::window_move_to_foreground(WindowID p_window) { // Not supported. } -bool DisplayServerJavaScript::window_can_draw(WindowID p_window) const { +bool DisplayServerWeb::window_can_draw(WindowID p_window) const { return true; } -bool DisplayServerJavaScript::can_any_window_draw() const { +bool DisplayServerWeb::can_any_window_draw() const { return true; } -void DisplayServerJavaScript::process_events() { +void DisplayServerWeb::process_events() { Input::get_singleton()->flush_buffered_events(); if (godot_js_input_gamepad_sample() == OK) { process_joypads(); } } -int DisplayServerJavaScript::get_current_video_driver() const { +int DisplayServerWeb::get_current_video_driver() const { return 1; } -bool DisplayServerJavaScript::get_swap_cancel_ok() { +bool DisplayServerWeb::get_swap_cancel_ok() { return swap_cancel_ok; } -void DisplayServerJavaScript::swap_buffers() { +void DisplayServerWeb::swap_buffers() { #ifdef GLES3_ENABLED if (webgl_ctx) { emscripten_webgl_commit_frame(); diff --git a/platform/javascript/display_server_javascript.h b/platform/web/display_server_web.h similarity index 95% rename from platform/javascript/display_server_javascript.h rename to platform/web/display_server_web.h index cbb91477b7b..85076b906f5 100644 --- a/platform/javascript/display_server_javascript.h +++ b/platform/web/display_server_web.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* display_server_javascript.h */ +/* display_server_web.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,15 +28,15 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef DISPLAY_SERVER_JAVASCRIPT_H -#define DISPLAY_SERVER_JAVASCRIPT_H +#ifndef DISPLAY_SERVER_WEB_H +#define DISPLAY_SERVER_WEB_H #include "servers/display_server.h" #include #include -class DisplayServerJavaScript : public DisplayServer { +class DisplayServerWeb : public DisplayServer { private: struct JSTouchEvent { uint32_t identifier[32] = { 0 }; @@ -112,7 +112,7 @@ protected: public: // Override return type to make writing static callbacks less tedious. - static DisplayServerJavaScript *get_singleton(); + static DisplayServerWeb *get_singleton(); // utilities bool check_size_force_redraw(); @@ -220,9 +220,9 @@ public: virtual bool get_swap_cancel_ok() override; virtual void swap_buffers() override; - static void register_javascript_driver(); - DisplayServerJavaScript(const String &p_rendering_driver, WindowMode p_window_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Size2i &p_resolution, Error &r_error); - ~DisplayServerJavaScript(); + static void register_web_driver(); + DisplayServerWeb(const String &p_rendering_driver, WindowMode p_window_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Size2i &p_resolution, Error &r_error); + ~DisplayServerWeb(); }; -#endif // DISPLAY_SERVER_JAVASCRIPT_H +#endif // DISPLAY_SERVER_WEB_H diff --git a/platform/javascript/dom_keys.inc b/platform/web/dom_keys.inc similarity index 100% rename from platform/javascript/dom_keys.inc rename to platform/web/dom_keys.inc diff --git a/platform/javascript/emscripten_helpers.py b/platform/web/emscripten_helpers.py similarity index 97% rename from platform/javascript/emscripten_helpers.py rename to platform/web/emscripten_helpers.py index 3cb1d75e52e..b7b1026ef7e 100644 --- a/platform/javascript/emscripten_helpers.py +++ b/platform/web/emscripten_helpers.py @@ -39,11 +39,11 @@ def create_engine_file(env, target, source, externs): def create_template_zip(env, js, wasm, extra): binary_name = "godot.tools" if env["tools"] else "godot" - zip_dir = env.Dir("#bin/.javascript_zip") + zip_dir = env.Dir("#bin/.web_zip") in_files = [ js, wasm, - "#platform/javascript/js/libs/audio.worklet.js", + "#platform/web/js/libs/audio.worklet.js", ] out_files = [ zip_dir.File(binary_name + ".js"), diff --git a/platform/javascript/export/export_server.h b/platform/web/export/editor_http_server.h similarity index 97% rename from platform/javascript/export/export_server.h rename to platform/web/export/editor_http_server.h index ddbe3cca303..1e50e60a284 100644 --- a/platform/javascript/export/export_server.h +++ b/platform/web/export/editor_http_server.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* export_server.h */ +/* editor_http_server.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef JAVASCRIPT_EXPORT_SERVER_H -#define JAVASCRIPT_EXPORT_SERVER_H +#ifndef WEB_EDITOR_HTTP_SERVER_H +#define WEB_EDITOR_HTTP_SERVER_H #include "core/io/image_loader.h" #include "core/io/stream_peer_ssl.h" @@ -247,4 +247,4 @@ public: } }; -#endif // JAVASCRIPT_EXPORT_SERVER_H +#endif // WEB_EDITOR_HTTP_SERVER_H diff --git a/platform/javascript/export/export.cpp b/platform/web/export/export.cpp similarity index 97% rename from platform/javascript/export/export.cpp rename to platform/web/export/export.cpp index ea236f62f72..3d40f2c10d7 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/web/export/export.cpp @@ -33,7 +33,7 @@ #include "editor/editor_settings.h" #include "export_plugin.h" -void register_javascript_exporter() { +void register_web_exporter() { EDITOR_DEF("export/web/http_host", "localhost"); EDITOR_DEF("export/web/http_port", 8060); EDITOR_DEF("export/web/use_ssl", false); @@ -43,7 +43,7 @@ void register_javascript_exporter() { EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/web/ssl_key", PROPERTY_HINT_GLOBAL_FILE, "*.key")); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/web/ssl_certificate", PROPERTY_HINT_GLOBAL_FILE, "*.crt,*.pem")); - Ref platform; + Ref platform; platform.instantiate(); EditorExport::get_singleton()->add_export_platform(platform); } diff --git a/platform/javascript/export/export.h b/platform/web/export/export.h similarity index 94% rename from platform/javascript/export/export.h rename to platform/web/export/export.h index 29c335ed0eb..7947f292a4a 100644 --- a/platform/javascript/export/export.h +++ b/platform/web/export/export.h @@ -28,9 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef JAVASCRIPT_EXPORT_H -#define JAVASCRIPT_EXPORT_H +#ifndef WEB_EXPORT_H +#define WEB_EXPORT_H -void register_javascript_exporter(); +void register_web_exporter(); -#endif // JAVASCRIPT_EXPORT_H +#endif // WEB_EXPORT_H diff --git a/platform/javascript/export/export_plugin.cpp b/platform/web/export/export_plugin.cpp similarity index 88% rename from platform/javascript/export/export_plugin.cpp rename to platform/web/export/export_plugin.cpp index 0bdee110184..996d1db2e76 100644 --- a/platform/javascript/export/export_plugin.cpp +++ b/platform/web/export/export_plugin.cpp @@ -33,7 +33,7 @@ #include "core/config/project_settings.h" #include "editor/editor_settings.h" -Error EditorExportPlatformJavaScript::_extract_template(const String &p_template, const String &p_dir, const String &p_name, bool pwa) { +Error EditorExportPlatformWeb::_extract_template(const String &p_template, const String &p_dir, const String &p_name, bool pwa) { Ref io_fa; zlib_filefunc_def io = zipio_create_io(&io_fa); unzFile pkg = unzOpen2(p_template.utf8().get_data(), &io); @@ -89,7 +89,7 @@ Error EditorExportPlatformJavaScript::_extract_template(const String &p_template return OK; } -Error EditorExportPlatformJavaScript::_write_or_error(const uint8_t *p_content, int p_size, String p_path) { +Error EditorExportPlatformWeb::_write_or_error(const uint8_t *p_content, int p_size, String p_path) { Ref f = FileAccess::open(p_path, FileAccess::WRITE); if (f.is_null()) { add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), vformat(TTR("Could not write file: \"%s\"."), p_path)); @@ -99,7 +99,7 @@ Error EditorExportPlatformJavaScript::_write_or_error(const uint8_t *p_content, return OK; } -void EditorExportPlatformJavaScript::_replace_strings(HashMap p_replaces, Vector &r_template) { +void EditorExportPlatformWeb::_replace_strings(HashMap p_replaces, Vector &r_template) { String str_template = String::utf8(reinterpret_cast(r_template.ptr()), r_template.size()); String out; Vector lines = str_template.split("\n"); @@ -117,7 +117,7 @@ void EditorExportPlatformJavaScript::_replace_strings(HashMap p_ } } -void EditorExportPlatformJavaScript::_fix_html(Vector &p_html, const Ref &p_preset, const String &p_name, bool p_debug, int p_flags, const Vector p_shared_objects, const Dictionary &p_file_sizes) { +void EditorExportPlatformWeb::_fix_html(Vector &p_html, const Ref &p_preset, const String &p_name, bool p_debug, int p_flags, const Vector p_shared_objects, const Dictionary &p_file_sizes) { // Engine.js config Dictionary config; Array libs; @@ -159,7 +159,7 @@ void EditorExportPlatformJavaScript::_fix_html(Vector &p_html, const Re _replace_strings(replaces, p_html); } -Error EditorExportPlatformJavaScript::_add_manifest_icon(const String &p_path, const String &p_icon, int p_size, Array &r_arr) { +Error EditorExportPlatformWeb::_add_manifest_icon(const String &p_path, const String &p_icon, int p_size, Array &r_arr) { const String name = p_path.get_file().get_basename(); const String icon_name = vformat("%s.%dx%d.png", name, p_size, p_size); const String icon_dest = p_path.get_base_dir().plus_file(icon_name); @@ -192,7 +192,7 @@ Error EditorExportPlatformJavaScript::_add_manifest_icon(const String &p_path, c return err; } -Error EditorExportPlatformJavaScript::_build_pwa(const Ref &p_preset, const String p_path, const Vector &p_shared_objects) { +Error EditorExportPlatformWeb::_build_pwa(const Ref &p_preset, const String p_path, const Vector &p_shared_objects) { String proj_name = ProjectSettings::get_singleton()->get_setting("application/config/name"); if (proj_name.is_empty()) { proj_name = "Godot Game"; @@ -303,7 +303,7 @@ Error EditorExportPlatformJavaScript::_build_pwa(const Ref & return OK; } -void EditorExportPlatformJavaScript::get_preset_features(const Ref &p_preset, List *r_features) const { +void EditorExportPlatformWeb::get_preset_features(const Ref &p_preset, List *r_features) const { if (p_preset->get("vram_texture_compression/for_desktop")) { r_features->push_back("s3tc"); } @@ -326,7 +326,7 @@ void EditorExportPlatformJavaScript::get_preset_features(const Ref *r_options) { +void EditorExportPlatformWeb::get_export_options(List *r_options) { r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), "")); @@ -350,25 +350,25 @@ void EditorExportPlatformJavaScript::get_export_options(List *r_op r_options->push_back(ExportOption(PropertyInfo(Variant::COLOR, "progressive_web_app/background_color", PROPERTY_HINT_COLOR_NO_ALPHA), Color())); } -String EditorExportPlatformJavaScript::get_name() const { - return "HTML5"; +String EditorExportPlatformWeb::get_name() const { + return "Web"; } -String EditorExportPlatformJavaScript::get_os_name() const { - return "HTML5"; +String EditorExportPlatformWeb::get_os_name() const { + return "Web"; } -Ref EditorExportPlatformJavaScript::get_logo() const { +Ref EditorExportPlatformWeb::get_logo() const { return logo; } -bool EditorExportPlatformJavaScript::has_valid_export_configuration(const Ref &p_preset, String &r_error, bool &r_missing_templates) const { +bool EditorExportPlatformWeb::has_valid_export_configuration(const Ref &p_preset, String &r_error, bool &r_missing_templates) const { #ifndef DEV_ENABLED - // We don't provide export templates for the HTML5 platform currently as there + // We don't provide export templates for the Web platform currently as there // is no suitable renderer to use with them. So we forbid exporting and tell // users why. This is skipped in DEV_ENABLED so that contributors can still test // the pipeline once we start having WebGL or WebGPU support. - r_error = "The HTML5 platform is currently not supported in Godot 4.0, as there is no suitable renderer for it.\n"; + r_error = "The Web platform is currently not supported in Godot 4.0, as there is no suitable renderer for it.\n"; return false; #endif @@ -403,13 +403,13 @@ bool EditorExportPlatformJavaScript::has_valid_export_configuration(const Ref &p_preset, String &r_error) const { +bool EditorExportPlatformWeb::has_valid_project_configuration(const Ref &p_preset, String &r_error) const { #ifndef DEV_ENABLED - // We don't provide export templates for the HTML5 platform currently as there + // We don't provide export templates for the Web platform currently as there // is no suitable renderer to use with them. So we forbid exporting and tell // users why. This is skipped in DEV_ENABLED so that contributors can still test // the pipeline once we start having WebGL or WebGPU support. - r_error = "The HTML5 platform is currently not supported in Godot 4.0, as there is no suitable renderer for it.\n"; + r_error = "The Web platform is currently not supported in Godot 4.0, as there is no suitable renderer for it.\n"; return false; #endif @@ -433,13 +433,13 @@ bool EditorExportPlatformJavaScript::has_valid_project_configuration(const Ref EditorExportPlatformJavaScript::get_binary_extensions(const Ref &p_preset) const { +List EditorExportPlatformWeb::get_binary_extensions(const Ref &p_preset) const { List list; list.push_back("html"); return list; } -Error EditorExportPlatformJavaScript::export_project(const Ref &p_preset, bool p_debug, const String &p_path, int p_flags) { +Error EditorExportPlatformWeb::export_project(const Ref &p_preset, bool p_debug, const String &p_path, int p_flags) { ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags); const String custom_debug = p_preset->get("custom_template/debug"); @@ -562,7 +562,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref preset; for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) { @@ -586,15 +586,15 @@ bool EditorExportPlatformJavaScript::poll_export() { return menu_options != prev; } -Ref EditorExportPlatformJavaScript::get_option_icon(int p_index) const { +Ref EditorExportPlatformWeb::get_option_icon(int p_index) const { return p_index == 1 ? stop_icon : EditorExportPlatform::get_option_icon(p_index); } -int EditorExportPlatformJavaScript::get_options_count() const { +int EditorExportPlatformWeb::get_options_count() const { return menu_options; } -Error EditorExportPlatformJavaScript::run(const Ref &p_preset, int p_option, int p_debug_flags) { +Error EditorExportPlatformWeb::run(const Ref &p_preset, int p_option, int p_debug_flags) { if (p_option == 1) { MutexLock lock(server_lock); server->stop(); @@ -663,12 +663,12 @@ Error EditorExportPlatformJavaScript::run(const Ref &p_prese return OK; } -Ref EditorExportPlatformJavaScript::get_run_icon() const { +Ref EditorExportPlatformWeb::get_run_icon() const { return run_icon; } -void EditorExportPlatformJavaScript::_server_thread_poll(void *data) { - EditorExportPlatformJavaScript *ej = static_cast(data); +void EditorExportPlatformWeb::_server_thread_poll(void *data) { + EditorExportPlatformWeb *ej = static_cast(data); while (!ej->server_quit) { OS::get_singleton()->delay_usec(6900); { @@ -678,12 +678,12 @@ void EditorExportPlatformJavaScript::_server_thread_poll(void *data) { } } -EditorExportPlatformJavaScript::EditorExportPlatformJavaScript() { +EditorExportPlatformWeb::EditorExportPlatformWeb() { server.instantiate(); server_thread.start(_server_thread_poll, this); - logo = ImageTexture::create_from_image(memnew(Image(_javascript_logo))); - run_icon = ImageTexture::create_from_image(memnew(Image(_javascript_run_icon))); + logo = ImageTexture::create_from_image(memnew(Image(_web_logo))); + run_icon = ImageTexture::create_from_image(memnew(Image(_web_run_icon))); Ref theme = EditorNode::get_singleton()->get_editor_theme(); if (theme.is_valid()) { @@ -693,7 +693,7 @@ EditorExportPlatformJavaScript::EditorExportPlatformJavaScript() { } } -EditorExportPlatformJavaScript::~EditorExportPlatformJavaScript() { +EditorExportPlatformWeb::~EditorExportPlatformWeb() { server->stop(); server_quit = true; server_thread.wait_to_finish(); diff --git a/platform/javascript/export/export_plugin.h b/platform/web/export/export_plugin.h similarity index 93% rename from platform/javascript/export/export_plugin.h rename to platform/web/export/export_plugin.h index 16bab02d540..9c1bf2a5efe 100644 --- a/platform/javascript/export/export_plugin.h +++ b/platform/web/export/export_plugin.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef JAVASCRIPT_EXPORT_PLUGIN_H -#define JAVASCRIPT_EXPORT_PLUGIN_H +#ifndef WEB_EXPORT_PLUGIN_H +#define WEB_EXPORT_PLUGIN_H #include "core/config/project_settings.h" #include "core/io/image_loader.h" @@ -39,13 +39,13 @@ #include "editor/editor_node.h" #include "editor/export/editor_export_platform.h" #include "main/splash.gen.h" -#include "platform/javascript/logo.gen.h" -#include "platform/javascript/run_icon.gen.h" +#include "platform/web/logo.gen.h" +#include "platform/web/run_icon.gen.h" -#include "export_server.h" +#include "editor_http_server.h" -class EditorExportPlatformJavaScript : public EditorExportPlatform { - GDCLASS(EditorExportPlatformJavaScript, EditorExportPlatform); +class EditorExportPlatformWeb : public EditorExportPlatform { + GDCLASS(EditorExportPlatformWeb, EditorExportPlatform); Ref logo; Ref run_icon; @@ -141,8 +141,8 @@ public: String get_debug_protocol() const override { return "ws://"; } - EditorExportPlatformJavaScript(); - ~EditorExportPlatformJavaScript(); + EditorExportPlatformWeb(); + ~EditorExportPlatformWeb(); }; -#endif // JAVASCRIPT_EXPORT_PLUGIN_H +#endif // WEB_EXPORT_PLUGIN_H diff --git a/platform/javascript/godot_audio.h b/platform/web/godot_audio.h similarity index 100% rename from platform/javascript/godot_audio.h rename to platform/web/godot_audio.h diff --git a/platform/javascript/godot_js.h b/platform/web/godot_js.h similarity index 100% rename from platform/javascript/godot_js.h rename to platform/web/godot_js.h diff --git a/platform/javascript/godot_webgl2.h b/platform/web/godot_webgl2.h similarity index 100% rename from platform/javascript/godot_webgl2.h rename to platform/web/godot_webgl2.h diff --git a/platform/javascript/http_client_javascript.cpp b/platform/web/http_client_web.cpp similarity index 74% rename from platform/javascript/http_client_javascript.cpp rename to platform/web/http_client_web.cpp index 32bdfed4c78..bfdea95f4a9 100644 --- a/platform/javascript/http_client_javascript.cpp +++ b/platform/web/http_client_web.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* http_client_javascript.cpp */ +/* http_client_web.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,19 +28,19 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "http_client_javascript.h" +#include "http_client_web.h" -void HTTPClientJavaScript::_parse_headers(int p_len, const char **p_headers, void *p_ref) { - HTTPClientJavaScript *client = static_cast(p_ref); +void HTTPClientWeb::_parse_headers(int p_len, const char **p_headers, void *p_ref) { + HTTPClientWeb *client = static_cast(p_ref); for (int i = 0; i < p_len; i++) { client->response_headers.push_back(String::utf8(p_headers[i])); } } -Error HTTPClientJavaScript::connect_to_host(const String &p_host, int p_port, bool p_ssl, bool p_verify_host) { +Error HTTPClientWeb::connect_to_host(const String &p_host, int p_port, bool p_ssl, bool p_verify_host) { close(); if (p_ssl && !p_verify_host) { - WARN_PRINT("Disabling HTTPClientJavaScript's host verification is not supported for the HTML5 platform, host will be verified"); + WARN_PRINT("Disabling HTTPClientWeb's host verification is not supported for the Web platform, host will be verified"); } port = p_port; @@ -71,17 +71,17 @@ Error HTTPClientJavaScript::connect_to_host(const String &p_host, int p_port, bo return OK; } -void HTTPClientJavaScript::set_connection(const Ref &p_connection) { - ERR_FAIL_MSG("Accessing an HTTPClientJavaScript's StreamPeer is not supported for the HTML5 platform."); +void HTTPClientWeb::set_connection(const Ref &p_connection) { + ERR_FAIL_MSG("Accessing an HTTPClientWeb's StreamPeer is not supported for the Web platform."); } -Ref HTTPClientJavaScript::get_connection() const { - ERR_FAIL_V_MSG(Ref(), "Accessing an HTTPClientJavaScript's StreamPeer is not supported for the HTML5 platform."); +Ref HTTPClientWeb::get_connection() const { + ERR_FAIL_V_MSG(Ref(), "Accessing an HTTPClientWeb's StreamPeer is not supported for the Web platform."); } -Error HTTPClientJavaScript::request(Method p_method, const String &p_url, const Vector &p_headers, const uint8_t *p_body, int p_body_len) { +Error HTTPClientWeb::request(Method p_method, const String &p_url, const Vector &p_headers, const uint8_t *p_body, int p_body_len) { ERR_FAIL_INDEX_V(p_method, METHOD_MAX, ERR_INVALID_PARAMETER); - ERR_FAIL_COND_V_MSG(p_method == METHOD_TRACE || p_method == METHOD_CONNECT, ERR_UNAVAILABLE, "HTTP methods TRACE and CONNECT are not supported for the HTML5 platform."); + ERR_FAIL_COND_V_MSG(p_method == METHOD_TRACE || p_method == METHOD_CONNECT, ERR_UNAVAILABLE, "HTTP methods TRACE and CONNECT are not supported for the Web platform."); ERR_FAIL_COND_V(status != STATUS_CONNECTED, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(host.is_empty(), ERR_UNCONFIGURED); ERR_FAIL_COND_V(port < 0, ERR_UNCONFIGURED); @@ -107,7 +107,7 @@ Error HTTPClientJavaScript::request(Method p_method, const String &p_url, const return OK; } -void HTTPClientJavaScript::close() { +void HTTPClientWeb::close() { host = ""; port = -1; use_tls = false; @@ -121,23 +121,23 @@ void HTTPClientJavaScript::close() { } } -HTTPClientJavaScript::Status HTTPClientJavaScript::get_status() const { +HTTPClientWeb::Status HTTPClientWeb::get_status() const { return status; } -bool HTTPClientJavaScript::has_response() const { +bool HTTPClientWeb::has_response() const { return response_headers.size() > 0; } -bool HTTPClientJavaScript::is_response_chunked() const { +bool HTTPClientWeb::is_response_chunked() const { return godot_js_fetch_is_chunked(js_id); } -int HTTPClientJavaScript::get_response_code() const { +int HTTPClientWeb::get_response_code() const { return polled_response_code; } -Error HTTPClientJavaScript::get_response_headers(List *r_response) { +Error HTTPClientWeb::get_response_headers(List *r_response) { if (!response_headers.size()) { return ERR_INVALID_PARAMETER; } @@ -148,11 +148,11 @@ Error HTTPClientJavaScript::get_response_headers(List *r_response) { return OK; } -int64_t HTTPClientJavaScript::get_response_body_length() const { +int64_t HTTPClientWeb::get_response_body_length() const { return godot_js_fetch_body_length_get(js_id); } -PackedByteArray HTTPClientJavaScript::read_response_body_chunk() { +PackedByteArray HTTPClientWeb::read_response_body_chunk() { ERR_FAIL_COND_V(status != STATUS_BODY, PackedByteArray()); if (response_buffer.size() != read_limit) { @@ -177,23 +177,23 @@ PackedByteArray HTTPClientJavaScript::read_response_body_chunk() { return chunk; } -void HTTPClientJavaScript::set_blocking_mode(bool p_enable) { - ERR_FAIL_COND_MSG(p_enable, "HTTPClientJavaScript blocking mode is not supported for the HTML5 platform."); +void HTTPClientWeb::set_blocking_mode(bool p_enable) { + ERR_FAIL_COND_MSG(p_enable, "HTTPClientWeb blocking mode is not supported for the Web platform."); } -bool HTTPClientJavaScript::is_blocking_mode_enabled() const { +bool HTTPClientWeb::is_blocking_mode_enabled() const { return false; } -void HTTPClientJavaScript::set_read_chunk_size(int p_size) { +void HTTPClientWeb::set_read_chunk_size(int p_size) { read_limit = p_size; } -int HTTPClientJavaScript::get_read_chunk_size() const { +int HTTPClientWeb::get_read_chunk_size() const { return read_limit; } -Error HTTPClientJavaScript::poll() { +Error HTTPClientWeb::poll() { switch (status) { case STATUS_DISCONNECTED: return ERR_UNCONFIGURED; @@ -227,9 +227,9 @@ Error HTTPClientJavaScript::poll() { #ifdef DEBUG_ENABLED // forcing synchronous requests is not possible on the web if (last_polling_frame == Engine::get_singleton()->get_process_frames()) { - WARN_PRINT("HTTPClientJavaScript polled multiple times in one frame, " + WARN_PRINT("HTTPClientWeb polled multiple times in one frame, " "but request cannot progress more than once per " - "frame on the HTML5 platform."); + "frame on the Web platform."); } last_polling_frame = Engine::get_singleton()->get_process_frames(); #endif @@ -258,15 +258,15 @@ Error HTTPClientJavaScript::poll() { return OK; } -HTTPClient *HTTPClientJavaScript::_create_func() { - return memnew(HTTPClientJavaScript); +HTTPClient *HTTPClientWeb::_create_func() { + return memnew(HTTPClientWeb); } -HTTPClient *(*HTTPClient::_create)() = HTTPClientJavaScript::_create_func; +HTTPClient *(*HTTPClient::_create)() = HTTPClientWeb::_create_func; -HTTPClientJavaScript::HTTPClientJavaScript() { +HTTPClientWeb::HTTPClientWeb() { } -HTTPClientJavaScript::~HTTPClientJavaScript() { +HTTPClientWeb::~HTTPClientWeb() { close(); } diff --git a/platform/javascript/http_client_javascript.h b/platform/web/http_client_web.h similarity index 94% rename from platform/javascript/http_client_javascript.h rename to platform/web/http_client_web.h index fcd225ffc91..ff776d72af8 100644 --- a/platform/javascript/http_client_javascript.h +++ b/platform/web/http_client_web.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* http_client_javascript.h */ +/* http_client_web.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef HTTP_CLIENT_JAVASCRIPT_H -#define HTTP_CLIENT_JAVASCRIPT_H +#ifndef HTTP_CLIENT_WEB_H +#define HTTP_CLIENT_WEB_H #include "core/io/http_client.h" @@ -59,7 +59,7 @@ extern int godot_js_fetch_is_chunked(int p_id); } #endif -class HTTPClientJavaScript : public HTTPClient { +class HTTPClientWeb : public HTTPClient { private: int js_id = 0; Status status = STATUS_DISCONNECTED; @@ -102,8 +102,8 @@ public: void set_read_chunk_size(int p_size) override; int get_read_chunk_size() const override; Error poll() override; - HTTPClientJavaScript(); - ~HTTPClientJavaScript(); + HTTPClientWeb(); + ~HTTPClientWeb(); }; -#endif // HTTP_CLIENT_JAVASCRIPT_H +#endif // HTTP_CLIENT_WEB_H diff --git a/platform/javascript/javascript_singleton.cpp b/platform/web/javascript_singleton.cpp similarity index 98% rename from platform/javascript/javascript_singleton.cpp rename to platform/web/javascript_singleton.cpp index 204e92b82bf..36ab4db4522 100644 --- a/platform/javascript/javascript_singleton.cpp +++ b/platform/web/javascript_singleton.cpp @@ -31,7 +31,7 @@ #include "api/javascript_singleton.h" #include "emscripten.h" -#include "os_javascript.h" +#include "os_web.h" extern "C" { extern void godot_js_os_download_buffer(const uint8_t *p_buf, int p_buf_size, const char *p_name, const char *p_mime); @@ -359,8 +359,8 @@ void JavaScript::download_buffer(Vector p_arr, const String &p_name, co } bool JavaScript::pwa_needs_update() const { - return OS_JavaScript::get_singleton()->pwa_needs_update(); + return OS_Web::get_singleton()->pwa_needs_update(); } Error JavaScript::pwa_update() { - return OS_JavaScript::get_singleton()->pwa_update(); + return OS_Web::get_singleton()->pwa_update(); } diff --git a/platform/javascript/js/engine/config.js b/platform/web/js/engine/config.js similarity index 100% rename from platform/javascript/js/engine/config.js rename to platform/web/js/engine/config.js diff --git a/platform/javascript/js/engine/engine.externs.js b/platform/web/js/engine/engine.externs.js similarity index 100% rename from platform/javascript/js/engine/engine.externs.js rename to platform/web/js/engine/engine.externs.js diff --git a/platform/javascript/js/engine/engine.js b/platform/web/js/engine/engine.js similarity index 99% rename from platform/javascript/js/engine/engine.js rename to platform/web/js/engine/engine.js index d2ba595083e..6f0d51b2be7 100644 --- a/platform/javascript/js/engine/engine.js +++ b/platform/web/js/engine/engine.js @@ -6,7 +6,7 @@ * of `Promises `__. * * @module Engine - * @header HTML5 shell class reference + * @header Web export JavaScript reference */ const Engine = (function () { const preloader = new Preloader(); diff --git a/platform/javascript/js/engine/preloader.js b/platform/web/js/engine/preloader.js similarity index 100% rename from platform/javascript/js/engine/preloader.js rename to platform/web/js/engine/preloader.js diff --git a/platform/javascript/js/jsdoc2rst/publish.js b/platform/web/js/jsdoc2rst/publish.js similarity index 100% rename from platform/javascript/js/jsdoc2rst/publish.js rename to platform/web/js/jsdoc2rst/publish.js diff --git a/platform/javascript/js/libs/audio.worklet.js b/platform/web/js/libs/audio.worklet.js similarity index 100% rename from platform/javascript/js/libs/audio.worklet.js rename to platform/web/js/libs/audio.worklet.js diff --git a/platform/javascript/js/libs/library_godot_audio.js b/platform/web/js/libs/library_godot_audio.js similarity index 100% rename from platform/javascript/js/libs/library_godot_audio.js rename to platform/web/js/libs/library_godot_audio.js diff --git a/platform/javascript/js/libs/library_godot_display.js b/platform/web/js/libs/library_godot_display.js similarity index 99% rename from platform/javascript/js/libs/library_godot_display.js rename to platform/web/js/libs/library_godot_display.js index 768eaf9e1d1..91cb8e728a1 100644 --- a/platform/javascript/js/libs/library_godot_display.js +++ b/platform/web/js/libs/library_godot_display.js @@ -536,7 +536,7 @@ const GodotDisplay = { } navigator.clipboard.writeText(text).catch(function (e) { // Setting OS clipboard is only possible from an input callback. - GodotRuntime.error('Setting OS clipboard is only possible from an input callback for the HTML5 plafrom. Exception:', e); + GodotRuntime.error('Setting OS clipboard is only possible from an input callback for the Web plafrom. Exception:', e); }); return 0; }, diff --git a/platform/javascript/js/libs/library_godot_fetch.js b/platform/web/js/libs/library_godot_fetch.js similarity index 100% rename from platform/javascript/js/libs/library_godot_fetch.js rename to platform/web/js/libs/library_godot_fetch.js diff --git a/platform/javascript/js/libs/library_godot_input.js b/platform/web/js/libs/library_godot_input.js similarity index 100% rename from platform/javascript/js/libs/library_godot_input.js rename to platform/web/js/libs/library_godot_input.js diff --git a/platform/javascript/js/libs/library_godot_javascript_singleton.js b/platform/web/js/libs/library_godot_javascript_singleton.js similarity index 100% rename from platform/javascript/js/libs/library_godot_javascript_singleton.js rename to platform/web/js/libs/library_godot_javascript_singleton.js diff --git a/platform/javascript/js/libs/library_godot_os.js b/platform/web/js/libs/library_godot_os.js similarity index 100% rename from platform/javascript/js/libs/library_godot_os.js rename to platform/web/js/libs/library_godot_os.js diff --git a/platform/javascript/js/libs/library_godot_runtime.js b/platform/web/js/libs/library_godot_runtime.js similarity index 100% rename from platform/javascript/js/libs/library_godot_runtime.js rename to platform/web/js/libs/library_godot_runtime.js diff --git a/platform/javascript/logo.png b/platform/web/logo.png similarity index 100% rename from platform/javascript/logo.png rename to platform/web/logo.png diff --git a/platform/javascript/os_javascript.cpp b/platform/web/os_web.cpp similarity index 69% rename from platform/javascript/os_javascript.cpp rename to platform/web/os_web.cpp index dc81b8b4b6a..461dc71119a 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/web/os_web.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* os_javascript.cpp */ +/* os_web.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "os_javascript.h" +#include "os_web.h" #include "core/debugger/engine_debugger.h" #include "drivers/unix/dir_access_unix.h" #include "drivers/unix/file_access_unix.h" #include "main/main.h" -#include "platform/javascript/display_server_javascript.h" +#include "platform/web/display_server_web.h" #include "modules/modules_enabled.gen.h" // For websocket. #ifdef MODULE_WEBSOCKET_ENABLED @@ -48,14 +48,14 @@ #include "api/javascript_singleton.h" #include "godot_js.h" -void OS_JavaScript::alert(const String &p_alert, const String &p_title) { +void OS_Web::alert(const String &p_alert, const String &p_title) { godot_js_display_alert(p_alert.utf8().get_data()); } // Lifecycle -void OS_JavaScript::initialize() { +void OS_Web::initialize() { OS_Unix::initialize_core(); - DisplayServerJavaScript::register_javascript_driver(); + DisplayServerWeb::register_web_driver(); #ifdef MODULE_WEBSOCKET_ENABLED EngineDebugger::register_uri_handler("ws://", RemoteDebuggerPeerWebSocket::create); @@ -63,23 +63,23 @@ void OS_JavaScript::initialize() { #endif } -void OS_JavaScript::resume_audio() { - AudioDriverJavaScript::resume(); +void OS_Web::resume_audio() { + AudioDriverWeb::resume(); } -void OS_JavaScript::set_main_loop(MainLoop *p_main_loop) { +void OS_Web::set_main_loop(MainLoop *p_main_loop) { main_loop = p_main_loop; } -MainLoop *OS_JavaScript::get_main_loop() const { +MainLoop *OS_Web::get_main_loop() const { return main_loop; } -void OS_JavaScript::fs_sync_callback() { +void OS_Web::fs_sync_callback() { get_singleton()->idb_is_syncing = false; } -bool OS_JavaScript::main_loop_iterate() { +bool OS_Web::main_loop_iterate() { if (is_userfs_persistent() && idb_needs_sync && !idb_is_syncing) { idb_is_syncing = true; idb_needs_sync = false; @@ -91,16 +91,16 @@ bool OS_JavaScript::main_loop_iterate() { return Main::iteration(); } -void OS_JavaScript::delete_main_loop() { +void OS_Web::delete_main_loop() { if (main_loop) { memdelete(main_loop); } main_loop = nullptr; } -void OS_JavaScript::finalize() { +void OS_Web::finalize() { delete_main_loop(); - for (AudioDriverJavaScript *driver : audio_drivers) { + for (AudioDriverWeb *driver : audio_drivers) { memdelete(driver); } audio_drivers.clear(); @@ -108,44 +108,44 @@ void OS_JavaScript::finalize() { // Miscellaneous -Error OS_JavaScript::execute(const String &p_path, const List &p_arguments, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex, bool p_open_console) { +Error OS_Web::execute(const String &p_path, const List &p_arguments, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex, bool p_open_console) { return create_process(p_path, p_arguments); } -Error OS_JavaScript::create_process(const String &p_path, const List &p_arguments, ProcessID *r_child_id, bool p_open_console) { +Error OS_Web::create_process(const String &p_path, const List &p_arguments, ProcessID *r_child_id, bool p_open_console) { Array args; for (const String &E : p_arguments) { args.push_back(E); } String json_args = Variant(args).to_json_string(); int failed = godot_js_os_execute(json_args.utf8().get_data()); - ERR_FAIL_COND_V_MSG(failed, ERR_UNAVAILABLE, "OS::execute() or create_process() must be implemented in JavaScript via 'engine.setOnExecute' if required."); + ERR_FAIL_COND_V_MSG(failed, ERR_UNAVAILABLE, "OS::execute() or create_process() must be implemented in Web via 'engine.setOnExecute' if required."); return OK; } -Error OS_JavaScript::kill(const ProcessID &p_pid) { - ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "OS::kill() is not available on the HTML5 platform."); +Error OS_Web::kill(const ProcessID &p_pid) { + ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "OS::kill() is not available on the Web platform."); } -int OS_JavaScript::get_process_id() const { - ERR_FAIL_V_MSG(0, "OS::get_process_id() is not available on the HTML5 platform."); +int OS_Web::get_process_id() const { + ERR_FAIL_V_MSG(0, "OS::get_process_id() is not available on the Web platform."); } -bool OS_JavaScript::is_process_running(const ProcessID &p_pid) const { +bool OS_Web::is_process_running(const ProcessID &p_pid) const { return false; } -int OS_JavaScript::get_processor_count() const { +int OS_Web::get_processor_count() const { return godot_js_os_hw_concurrency_get(); } -bool OS_JavaScript::_check_internal_feature_support(const String &p_feature) { +bool OS_Web::_check_internal_feature_support(const String &p_feature) { if (p_feature == "html5" || p_feature == "web") { return true; } #ifdef JAVASCRIPT_EVAL_ENABLED - if (p_feature == "javascript") { + if (p_feature == "web") { return true; } #endif @@ -163,42 +163,42 @@ bool OS_JavaScript::_check_internal_feature_support(const String &p_feature) { return false; } -String OS_JavaScript::get_executable_path() const { +String OS_Web::get_executable_path() const { return OS::get_executable_path(); } -Error OS_JavaScript::shell_open(String p_uri) { +Error OS_Web::shell_open(String p_uri) { // Open URI in a new tab, browser will deal with it by protocol. godot_js_os_shell_open(p_uri.utf8().get_data()); return OK; } -String OS_JavaScript::get_name() const { - return "HTML5"; +String OS_Web::get_name() const { + return "Web"; } -void OS_JavaScript::vibrate_handheld(int p_duration_ms) { +void OS_Web::vibrate_handheld(int p_duration_ms) { godot_js_input_vibrate_handheld(p_duration_ms); } -String OS_JavaScript::get_user_data_dir() const { +String OS_Web::get_user_data_dir() const { return "/userfs"; } -String OS_JavaScript::get_cache_path() const { +String OS_Web::get_cache_path() const { return "/home/web_user/.cache"; } -String OS_JavaScript::get_config_path() const { +String OS_Web::get_config_path() const { return "/home/web_user/.config"; } -String OS_JavaScript::get_data_path() const { +String OS_Web::get_data_path() const { return "/home/web_user/.local/share"; } -void OS_JavaScript::file_access_close_callback(const String &p_file, int p_flags) { - OS_JavaScript *os = OS_JavaScript::get_singleton(); +void OS_Web::file_access_close_callback(const String &p_file, int p_flags) { + OS_Web *os = OS_Web::get_singleton(); if (!(os->is_userfs_persistent() && (p_flags & FileAccess::WRITE))) { return; // FS persistence is not working or we are not writing. } @@ -212,24 +212,24 @@ void OS_JavaScript::file_access_close_callback(const String &p_file, int p_flags } } -void OS_JavaScript::update_pwa_state_callback() { - if (OS_JavaScript::get_singleton()) { - OS_JavaScript::get_singleton()->pwa_is_waiting = true; +void OS_Web::update_pwa_state_callback() { + if (OS_Web::get_singleton()) { + OS_Web::get_singleton()->pwa_is_waiting = true; } if (JavaScript::get_singleton()) { JavaScript::get_singleton()->emit_signal("pwa_update_available"); } } -Error OS_JavaScript::pwa_update() { +Error OS_Web::pwa_update() { return godot_js_pwa_update() ? FAILED : OK; } -bool OS_JavaScript::is_userfs_persistent() const { +bool OS_Web::is_userfs_persistent() const { return idb_available; } -Error OS_JavaScript::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path, String *r_resolved_path) { +Error OS_Web::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path, String *r_resolved_path) { String path = p_path.get_file(); p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW); ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + p_path + ". Error: " + dlerror()); @@ -241,21 +241,21 @@ Error OS_JavaScript::open_dynamic_library(const String p_path, void *&p_library_ return OK; } -OS_JavaScript *OS_JavaScript::get_singleton() { - return static_cast(OS::get_singleton()); +OS_Web *OS_Web::get_singleton() { + return static_cast(OS::get_singleton()); } -void OS_JavaScript::initialize_joypads() { +void OS_Web::initialize_joypads() { } -OS_JavaScript::OS_JavaScript() { +OS_Web::OS_Web() { char locale_ptr[16]; godot_js_config_locale_get(locale_ptr, 16); setenv("LANG", locale_ptr, true); - godot_js_pwa_cb(&OS_JavaScript::update_pwa_state_callback); + godot_js_pwa_cb(&OS_Web::update_pwa_state_callback); - if (AudioDriverJavaScript::is_available()) { + if (AudioDriverWeb::is_available()) { #ifdef NO_THREADS audio_drivers.push_back(memnew(AudioDriverScriptProcessor)); #endif diff --git a/platform/javascript/os_javascript.h b/platform/web/os_web.h similarity index 92% rename from platform/javascript/os_javascript.h rename to platform/web/os_web.h index d932745177f..64f3a4d1338 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/web/os_web.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* os_javascript.h */ +/* os_web.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,19 +28,19 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef OS_JAVASCRIPT_H -#define OS_JAVASCRIPT_H +#ifndef OS_WEB_H +#define OS_WEB_H -#include "audio_driver_javascript.h" +#include "audio_driver_web.h" #include "core/input/input.h" #include "drivers/unix/os_unix.h" #include "servers/audio_server.h" #include -class OS_JavaScript : public OS_Unix { +class OS_Web : public OS_Unix { MainLoop *main_loop = nullptr; - List audio_drivers; + List audio_drivers; bool idb_is_syncing = false; bool idb_available = false; @@ -65,7 +65,7 @@ protected: public: // Override return type to make writing static callbacks less tedious. - static OS_JavaScript *get_singleton(); + static OS_Web *get_singleton(); bool pwa_needs_update() const { return pwa_is_waiting; } Error pwa_update(); @@ -87,7 +87,7 @@ public: Error shell_open(String p_uri) override; String get_name() const override; // Override default OS implementation which would block the main thread with delay_usec. - // Implemented in javascript_main.cpp loop callback instead. + // Implemented in web_main.cpp loop callback instead. void add_frame_delay(bool p_can_draw) override {} void vibrate_handheld(int p_duration_ms) override; @@ -105,7 +105,7 @@ public: void resume_audio(); - OS_JavaScript(); + OS_Web(); }; -#endif // OS_JAVASCRIPT_H +#endif // OS_WEB_H diff --git a/platform/javascript/package-lock.json b/platform/web/package-lock.json similarity index 100% rename from platform/javascript/package-lock.json rename to platform/web/package-lock.json diff --git a/platform/javascript/package.json b/platform/web/package.json similarity index 93% rename from platform/javascript/package.json rename to platform/web/package.json index 8c38bc89e8a..a57205415af 100644 --- a/platform/javascript/package.json +++ b/platform/web/package.json @@ -2,7 +2,7 @@ "name": "godot", "private": true, "version": "1.0.0", - "description": "Development and linting setup for Godot's HTML5 platform code", + "description": "Development and linting setup for Godot's Web platform code", "scripts": { "docs": "jsdoc --template js/jsdoc2rst/ js/engine/engine.js js/engine/config.js --destination ''", "lint": "npm run lint:engine && npm run lint:libs && npm run lint:modules && npm run lint:tools", diff --git a/platform/javascript/platform_config.h b/platform/web/platform_config.h similarity index 97% rename from platform/javascript/platform_config.h rename to platform/web/platform_config.h index 1970fe0fa04..5e48992af81 100644 --- a/platform/javascript/platform_config.h +++ b/platform/web/platform_config.h @@ -30,4 +30,4 @@ #include -#define OPENGL_INCLUDE_H "platform/javascript/godot_webgl2.h" +#define OPENGL_INCLUDE_H "platform/web/godot_webgl2.h" diff --git a/platform/javascript/run_icon.png b/platform/web/run_icon.png similarity index 100% rename from platform/javascript/run_icon.png rename to platform/web/run_icon.png diff --git a/platform/javascript/serve.json b/platform/web/serve.json similarity index 100% rename from platform/javascript/serve.json rename to platform/web/serve.json diff --git a/platform/javascript/javascript_main.cpp b/platform/web/web_main.cpp similarity index 90% rename from platform/javascript/javascript_main.cpp rename to platform/web/web_main.cpp index 307a80feead..0f4411727a1 100644 --- a/platform/javascript/javascript_main.cpp +++ b/platform/web/web_main.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* javascript_main.cpp */ +/* web_main.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -31,21 +31,21 @@ #include "core/config/engine.h" #include "core/io/resource_loader.h" #include "main/main.h" -#include "platform/javascript/display_server_javascript.h" -#include "platform/javascript/os_javascript.h" +#include "platform/web/display_server_web.h" +#include "platform/web/os_web.h" #include #include #include "godot_js.h" -static OS_JavaScript *os = nullptr; +static OS_Web *os = nullptr; static uint64_t target_ticks = 0; void exit_callback() { emscripten_cancel_main_loop(); // After this, we can exit! Main::cleanup(); - int exit_code = OS_JavaScript::get_singleton()->get_exit_code(); + int exit_code = OS_Web::get_singleton()->get_exit_code(); memdelete(os); os = nullptr; emscripten_force_exit(exit_code); // No matter that we call cancel_main_loop, regular "exit" will not work, forcing. @@ -58,7 +58,7 @@ void cleanup_after_sync() { void main_loop_callback() { uint64_t current_ticks = os->get_ticks_usec(); - bool force_draw = DisplayServerJavaScript::get_singleton()->check_size_force_redraw(); + bool force_draw = DisplayServerWeb::get_singleton()->check_size_force_redraw(); if (force_draw) { Main::force_redraw(); } else if (current_ticks < target_ticks) { @@ -81,8 +81,8 @@ void main_loop_callback() { } /// When calling main, it is assumed FS is setup and synced. -extern EMSCRIPTEN_KEEPALIVE int godot_js_main(int argc, char *argv[]) { - os = new OS_JavaScript(); +extern EMSCRIPTEN_KEEPALIVE int godot_web_main(int argc, char *argv[]) { + os = new OS_Web(); // We must override main when testing is enabled TEST_MAIN_OVERRIDE diff --git a/platform/javascript/javascript_runtime.cpp b/platform/web/web_runtime.cpp similarity index 93% rename from platform/javascript/javascript_runtime.cpp rename to platform/web/web_runtime.cpp index 932d0d5cb6f..93a1745a83c 100644 --- a/platform/javascript/javascript_runtime.cpp +++ b/platform/web/web_runtime.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* javascript_runtime.cpp */ +/* web_runtime.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -extern int godot_js_main(int argc, char *argv[]); +extern int godot_web_main(int argc, char *argv[]); int main(int argc, char *argv[]) { - return godot_js_main(argc, argv); + return godot_web_main(argc, argv); } diff --git a/platform/windows/README.md b/platform/windows/README.md index 17ce6f216b2..c04032ae1dd 100644 --- a/platform/windows/README.md +++ b/platform/windows/README.md @@ -1,6 +1,6 @@ # Windows platform port -This folder contains the C++ and JavaScript code for the Windows platform port. +This folder contains the C++ code for the Windows platform port. See also [`misc/dist/windows`](/misc/dist/windows) folder for additional files used by this platform.