Browse Source

Merge pull request #411 from eska014/web-doc-2.1

HTML5 doc for 2.1
Rémi Verschelde 8 years ago
parent
commit
f47d3e2a1d
1 changed files with 38 additions and 16 deletions
  1. 38 16
      learning/workflow/export/exporting_for_web.rst

+ 38 - 16
learning/workflow/export/exporting_for_web.rst

@@ -12,6 +12,11 @@ parts of the canvas when the browser window is scaled to the game's dimensions.
 This way it can be inserted into an ``<iframe>`` with the game's size, as is
 This way it can be inserted into an ``<iframe>`` with the game's size, as is
 common on most web game hosting sites.
 common on most web game hosting sites.
 
 
+Web export uses *asm.js*, a highly optimizable subset of JavaScript.
+A 64-bit browser is required to run games in asm.js format. Most notably,
+this is a problem with Firefox, which on Windows is shipped as a
+32-bit application by default.
+
 Serving the files
 Serving the files
 -----------------
 -----------------
 
 
@@ -21,8 +26,11 @@ It can also be inserted into another HTML file as an ``<iframe>`` element.
 Users must allow **third-party** cookies when playing a game presented in an
 Users must allow **third-party** cookies when playing a game presented in an
 iframe.
 iframe.
 
 
-The ``.mem`` and ``.pck`` files are binary, usually delivered with MIME-type
-``application/octet-stream``.
+The other exported files are served as they are next to the ``.html`` file,
+names unchanged.
+
+The ``.mem`` and ``.pck`` files are binary, usually delivered with the
+MIME-type ``application/octet-stream``.
 
 
 Delivering the files with gzip compression is recommended especially for the
 Delivering the files with gzip compression is recommended especially for the
 ``.pck``, ``.asm.js`` and ``.mem`` files, which are usually large in size.
 ``.pck``, ``.asm.js`` and ``.mem`` files, which are usually large in size.
@@ -63,23 +71,37 @@ output display in debug mode and a fullscreen button.
 In the default page, the controls are displayed in the top-right corner on top
 In the default page, the controls are displayed in the top-right corner on top
 of the canvas, which can get in the way in games that use the cursor.
 of the canvas, which can get in the way in games that use the cursor.
 
 
-Security restrictions
----------------------
+Web export limitations
+----------------------
+
+Exported files must not be reused
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The exported files ending with ``.html`` and ``fs.js`` are adjusted on export
+specifically for that game's version and the given export options. They must
+not be reused in futher exports.
+
+Some functions must be called from input callbacks
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Browsers do not allow arbitrarily **entering full screen** at any time. The same
+goes for **capturing the cursor**. Instead, these actions have to occur as a
+response to a JavaScript input event. In Godot, this is most easily done by
+entering full screen from within an input callback such as ``_input`` or
+``_unhandled_input``.
+
+Starting exported games from the local file system
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
-Browsers do not allow arbitrarily **entering full screen** at any time.
-Instead, these actions have to occur as a response to a JavaScript input event.
-In Godot, this is most easily done by entering full screen from within an
-``_input()`` callback.
+Many browsers will not load exported projects when **opened locally**
+per ``file://`` protocol. To get around this, use a local server.
 
 
-Chromium-derived browsers will not load exported projects when
-**opened locally** per ``file://`` protocol. To get around this, you can start
-the browser with the ``--allow-file-access-from-files`` flag, or use a local
-server. Python offers an easy way for this, using ``python -m SimpleHTTPServer``
-with Python 2 or ``python -m http.server`` with Python 3 will serve the
-current working directory on ``http://localhost:8000``.
+Python offers an easy method for this, using ``python -m SimpleHTTPServer``
+with Python 2 or ``python -m http.server`` with Python 3 will serve the current
+working directory on ``http://localhost:8000``.
 
 
-Locale
-------
+Locale lookup
+~~~~~~~~~~~~~
 
 
 Godot tries to detect the user's locale using information provided by the
 Godot tries to detect the user's locale using information provided by the
 browser, but this is rather unreliable. A better way is to use CGI to read the
 browser, but this is rather unreliable. A better way is to use CGI to read the