Prechádzať zdrojové kódy

Merge branch 'master' of https://github.com/defold/doc

Björn Ritzl 3 rokov pred
rodič
commit
4e7fa3ce21

+ 24 - 0
docs/en/manuals/bundling.md

@@ -55,4 +55,28 @@ It is possible to create a special version of an HTML5 application bundle specif
 
 ## Bundling from the command line
 
+The editor uses our command line tool [Bob](/manuals/bob/) to bundle the application.
+
 While doing day to day development of your application it is likely that you build and bundle from within the Defold editor. In other circumstances you may wish to automatically generate application bundles, for instance batch building for all targets when releasing a new version or when creating nightly builds of the latest version of the game, perhaps in a CI environment. Building and bundling of an application can be done outside the normal editor workflow using the [Bob command line tool](/manuals/bob/).
+
+## The bundle layout
+
+The logical bundle layout is structured like this:
+
+![](images/bundling/bundle_schematic_01.png)
+
+A bundle is output into a folder. Depending on platform, that folder may also be zip archived into an `.apk` or `.ipa`.
+The contents of the folder depends on the platform.
+
+Apart from the executable files, our bundling process also collects the required assets for the platform (e.g. the .xml resource files for Android).
+
+Using the [bundle_resources](https://defold.com/manuals/project-settings/#bundle-resources) setting, you can configure assets that should be placed within the bundle as-is.
+You can control this per platform.
+
+The game assets are located in the `game.arcd` file, and they are individually compressed using LZ4 compression.
+Using the [custom_resources](https://defold.com/manuals/project-settings/#custom-resources) setting, you can configure assets that should be placed (with compression) within the game.arcd.
+These assets can be accessed via the [sys.load_resource()](https://defold.com/ref/sys/#sys.load_resource) function.
+
+
+
+

+ 4 - 4
docs/en/manuals/extensions.md

@@ -64,10 +64,10 @@ To create a new extension, create a folder in the project root. This folder will
 
 The optional *manifests* folder of an extension contains additional files used in the build and bundling process. Files should be placed in subfolders named by `platform`:
 
-* `android` - This folder accepts a manifest stub file to be merged into the main application ([as described here](extension-manifest-merge-tool)). The folder can also contain a `build.gradle` file with dependencies to be resolved by Gradle ([example](https://github.com/defold/extension-facebook/blob/master/facebook/manifests/android/build.gradle)). Finally the folder can also contain zero or more ProGuard files (experimental).
-* `ios` - This folder accepts a manifest stub file to be merged into the main application ([as described here](extension-manifest-merge-tool)).
-* `osx` - This folder accepts a manifest stub file to be merged into the main application ([as described here](extension-manifest-merge-tool)).
-* `web` - This folder accepts a manifest stub file to be merged into the main application ([as described here](extension-manifest-merge-tool)).
+* `android` - This folder accepts a manifest stub file to be merged into the main application ([as described here](extensions-manifest-merge-tool)). The folder can also contain a `build.gradle` file with dependencies to be resolved by Gradle ([example](https://github.com/defold/extension-facebook/blob/master/facebook/manifests/android/build.gradle)). Finally the folder can also contain zero or more ProGuard files (experimental).
+* `ios` - This folder accepts a manifest stub file to be merged into the main application ([as described here](extensions-manifest-merge-tool)).
+* `osx` - This folder accepts a manifest stub file to be merged into the main application ([as described here](extensions-manifest-merge-tool)).
+* `web` - This folder accepts a manifest stub file to be merged into the main application ([as described here](extensions-manifest-merge-tool)).
 
 
 ## Sharing an extension

BIN
docs/en/manuals/images/bundling/bundle_schematic_01.png


+ 13 - 6
docs/en/manuals/project-settings.md

@@ -37,17 +37,24 @@ Enables compression of archives when bundling. Note that this currently applies
 A list of URLs to the project *Library URL*s. Refer to the [Libraries manual](/manuals/libraries/) for more information.
 
 #### Custom Resources
+`custom_resources`
 A comma separated list of resources that will be included in the project. If directories are specified, all files and directories in that directory are recursively included. The resources can be loaded using [`sys.load_resource()`](/ref/sys/#sys.load_resource).
 
 #### Bundle Resources
+`bundle_resources`
 A comma separated list of directories containing resource files and folders that should be copied as-is into the resulting package when bundling. The directories must be specified with an absolute path from the project root, for example `/res`. The resource directory must contain subfolders named by `platform`, or `architecure-platform`.
 
-  Supported platforms are `ios`, `android`, `osx`, `win32`, `linux`, `web`.
+Supported platforms are `ios`, `android`, `osx`, `win32`, `linux`, `web`, `switch`
 
-  A subfolder named `common` is also allowed, containing resource files common for all platforms.
+A subfolder named `common` is also allowed, containing resource files common for all platforms.
+
+Access to files within the the bundle resources is platform specific. The Lua module `io` is one way to do it. Care must be taken to have the correct file paths for the platform.
+(e.g. prefix using "file:///android_asset/" on Android)
 
 #### Bundle Exclude Resources
+`bundle_exclude_resources`
 A comma separated list of resources that should not be included in the bundle.
+That is, they're removed from the result of the collection of the `bundle_resources` step.
 
 ---
 
@@ -114,16 +121,16 @@ Check if the app should dynamically switch between portrait and landscape on dev
 ### Render
 
 #### Clear Color Red
-Clear color red channel, used by the render script and when the window is created. Added in 1.2.167.
+Clear color red channel, used by the render script and when the window is created.
 
 #### Clear Color Green
-Clear color green channel, used by the render script and when the window is created. Added in 1.2.167.
+Clear color green channel, used by the render script and when the window is created.
 
 #### Clear Color Blue
-Clear color blue channel, used by the render script and when the window is created. Added in 1.2.167.
+Clear color blue channel, used by the render script and when the window is created.
 
 #### Clear Color ALpha
-Clear color alpha channel, used by the render script and when the window is created. Added in 1.2.167.
+Clear color alpha channel, used by the render script and when the window is created.
 
 ---
 

+ 2 - 0
docs/en/tutorials/snake.md

@@ -226,6 +226,8 @@ A proper solution to this problem is to store the input in a queue and pull entr
 
 ```lua
 function init(self)
+    msg.post(".", "acquire_input_focus")
+
     self.segments = {
         {x = 7, y = 24},
         {x = 8, y = 24},

+ 23 - 0
docs/zh/manuals/bundling.md

@@ -56,4 +56,27 @@ brief: 本教程介绍了如何打包应用.
 
 ## 命令行打包
 
+编辑器使用命令行工具 [Bob](/manuals/bob/) 进行应用打包.
+
 日常开发中一般使用 Defold 编辑器编译和打包应用. 如果需要自动生成机制, 比如发布新版本时批处理所有平台或者使用持续集成环境持续生成最新版本. 可以使用 [Bob 命令行工具](/manuals/bob/) 编译和打包.
+
+## Bundle 结构
+
+Bundle 的逻辑结构是这样的:
+
+![](images/bundling/bundle_schematic_01.png)
+
+Bundle 会被输出到一个文件夹. 不同平台位置各异, 还有可能作为 zip 文件包含进 `.apk` 或者 `.ipa` 中.
+Bundle 文件夹的内容每个平台也不一样.
+
+除了可执行文件, 打包过程中也会收集相关平台所必须的资源 (比如安卓平台用的 .xml 资源文件).
+
+通过 [bundle_resources](https://defold.com/manuals/project-settings/#bundle-resources) 项, 设置应打包进 bundle 里的资源.
+可以针对不同平台分别设置.
+
+游戏资源被保存在 `game.arcd` 文件中, 使用 LZ4 算法逐个压缩.
+通过 [custom_resources](https://defold.com/manuals/project-settings/#custom-resources) 项, 设置应打包 (同时也被压缩) 进 game.arcd 里的资源.
+这类资源可以使用 [sys.load_resource()](https://defold.com/ref/sys/#sys.load_resource) 函数来进行访问.
+
+
+

+ 4 - 4
docs/zh/manuals/extensions.md

@@ -64,10 +64,10 @@ Defold 提供了一个云端服务器编译方案. 游戏项目的各种依赖,
 
 *manifests* 包含编译时不同平台所需的配置文件. 配置文件要根据称为 `platform` 的子文件夹分类放置:
 
-* `android` - 这里存放片段配置文件用以与主配置文件混合 ([就像这里介绍的那样](extension-manifest-merge-tool)). 还可以存放 `build.gradle` 文件及其依赖以便 Gradle 可以解析 ([示例](https://github.com/defold/extension-facebook/blob/master/facebook/manifests/android/build.gradle)). 还能存放0个或多个 ProGuard 代码混淆文件 (试验功能).
-* `ios` - 这里存放片段配置文件用以与主配置文件混合 ([就像这里介绍的那样](extension-manifest-merge-tool)).
-* `osx` - 这里存放片段配置文件用以与主配置文件混合 ([就像这里介绍的那样](extension-manifest-merge-tool)).
-* `web` - 这里存放片段配置文件用以与主配置文件混合 ([就像这里介绍的那样](extension-manifest-merge-tool)).
+* `android` - 这里存放片段配置文件用以与主配置文件混合 ([就像这里介绍的那样](extensions-manifest-merge-tool)). 还可以存放 `build.gradle` 文件及其依赖以便 Gradle 可以解析 ([示例](https://github.com/defold/extension-facebook/blob/master/facebook/manifests/android/build.gradle)). 还能存放0个或多个 ProGuard 代码混淆文件 (试验功能).
+* `ios` - 这里存放片段配置文件用以与主配置文件混合 ([就像这里介绍的那样](extensions-manifest-merge-tool)).
+* `osx` - 这里存放片段配置文件用以与主配置文件混合 ([就像这里介绍的那样](extensions-manifest-merge-tool)).
+* `web` - 这里存放片段配置文件用以与主配置文件混合 ([就像这里介绍的那样](extensions-manifest-merge-tool)).
 
 
 ## 共享原生扩展

+ 13 - 6
docs/zh/manuals/project-settings.md

@@ -37,17 +37,24 @@ $ adb shell cat /mnt/sdcard/Android/data/com.defold.dmengine/files/log.txt
 项目的 *Library URL* 列表. 详情请见 [Libraries 教程](/manuals/libraries/).
 
 #### Custom Resources
+`custom_resources`
 项目中包含的以逗号分隔的资源列表. 如指定的是目录, 则目录下所有文件及其子目录都会包含进去. 这些资源可以通过 [`sys.load_resource()`](/ref/sys/#sys.load_resource) 载入.
 
 #### Bundle Resources
+`bundle_resources`
 需要根据平台单独打包的以逗号分隔的资源目录列表. 目录必须是以项目根目录开始的绝对路径, 比如像 `/res`. 资源目录里要包含 `platform`, 或者 `architecure-platform` 的子目录.
 
-  支持的 platform 有 `ios`, `android`, `osx`, `win32`, `linux`, `web`.
+支持的 platform 有 `ios`, `android`, `osx`, `win32`, `linux`, `web`, `switch`.
 
-  允许名叫 `common` 的子目录, 用以容纳平台间共享的资源.
+支持包含名为 `common` 的文件夹, 可以在其中加入各平台公用的资源文件.
+
+不同平台访问 bundle 资源的方法不一样. 使用 Lua 的 `io` 模块是可行的. 但是要特别注意写对各平台的文件路径.
+(举例: 在安卓平台上要这么写 "file:///android_asset/")
 
 #### Bundle Exclude Resources
+`bundle_exclude_resources`
 项目中排除的以逗号分隔的资源列表.
+也就是说, 这些资源会被从 `bundle_resources` 设置的基础上被剔除.
 
 ---
 
@@ -114,16 +121,16 @@ $ adb shell cat /mnt/sdcard/Android/data/com.defold.dmengine/files/log.txt
 ### Render
 
 #### Clear Color Red
-清除红色通道, 建立游戏窗口和渲染脚本中使用. 1.2.167 版新增.
+清除红色通道, 建立游戏窗口和渲染脚本中使用.
 
 #### Clear Color Green
-清除绿色通道, 建立游戏窗口和渲染脚本中使用. 1.2.167 版新增.
+清除绿色通道, 建立游戏窗口和渲染脚本中使用.
 
 #### Clear Color Blue
-清除蓝色通道, 建立游戏窗口和渲染脚本中使用. 1.2.167 版新增.
+清除蓝色通道, 建立游戏窗口和渲染脚本中使用.
 
 #### Clear Color ALpha
-清除alpha通道, 建立游戏窗口和渲染脚本中使用. 1.2.167 版新增.
+清除alpha通道, 建立游戏窗口和渲染脚本中使用.
 
 ---