[HTML5] Easier HTML templates, better canvas size handling #46200
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR:
HTML Templates
Improving on the proposal, now the minimum JS code is just the collowing:
The minimal HTML example is as folowing:
You'll be able to set overrides during
start
andstartGame
phases, e.g.:There are 2 additional tags that are recommended but optional:
$GODOT_HEAD_INCLUDE
- the custom HTML head include.$GODOT_PROJECT_NAME
- for the project title (if you want to set it as the title in the page for better browser caching).Canvas Size
The full window option is now renamed to
Canvas Resize Policy
and is a 3-state enum:None
: Godot window settings are ignored.Project
: Godot handles the canvas like a native app (resizing it when setting the window size).Adaptive
: Canvas size will always adapt to browser window size.Use
None
if you want to control the canvas size with custom JavaScript code.Both canvas resizing functions and fullscreen functions has been moved to an internal implementation.
There is a
3.2
branch that can be tested here: https://github.com/Faless/godot/tree/js/3.x_canvas_size_pr