Skip to content

Commit 3138317

Browse files
committed
fix manuals
1 parent 6b6cde4 commit 3138317

16 files changed

+156
-25
lines changed

docs/en/manuals/camera.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ Orthographic Projection
4848
Orthographic Zoom
4949
: (**Orthographic camera only**) - The zoom used for the orthographic projection (> 1 = zoom in, < 1 = zoom out).
5050

51+
Orthographic Mode
52+
: (**Orthographic camera only**) - Controls how the orthographic camera determines zoom relative to the window size and your design resolution (the values in `game.project``display.width/height`).
53+
- `Fixed` (uses constant zoom): Uses the current `Orthographic Zoom` value as-is.
54+
- `Auto Fit` (contain): Automatically adjusts zoom so the full design area fits inside the window. May show extra content on sides or top/bottom.
55+
- `Auto Cover` (cover): Automatically adjusts zoom so the design area covers the entire window. May crop on sides or top/bottom.
56+
Available only when `Orthographic Projection` is enabled.
57+
5158

5259
## Using the camera
5360

@@ -83,9 +90,11 @@ The scripting `camera` module has multiple functions that can be used to manipul
8390
camera.get_aspect_ratio(camera) -- get aspect ratio
8491
camera.get_far_z(camera) -- get far z
8592
camera.get_fov(camera) -- get field of view
93+
camera.get_orthographic_mode(camera) -- get orthographic mode (one of camera.ORTHO_MODE_*)
8694
camera.set_aspect_ratio(camera, ratio) -- set aspect ratio
8795
camera.set_far_z(camera, far_z) -- set far z
8896
camera.set_near_z(camera, near_z) -- set near z
97+
camera.set_orthographic_mode(camera, camera.ORTHO_MODE_AUTO_FIT) -- set orthographic mode
8998
... And so forth
9099
```
91100

@@ -125,7 +134,7 @@ The view matrix provided by the camera defines the position and orientation of t
125134

126135
### Render script
127136

128-
Starting with Defold 1.9.6, when using the default render script Defold will automatically set the last enabled camera that should be used for rendering. Before this change, a script somewhere in the project needed to explicitly send the `use_camera_projection` message to the renderer to notify it that the view and projection from camera components should be used. This is no longer necessary, but it is still possible to do so for backwards compatibility purposes.
137+
When using the default render script Defold will automatically set the last enabled camera that should be used for rendering. Before this change, a script somewhere in the project needed to explicitly send the `use_camera_projection` message to the renderer to notify it that the view and projection from camera components should be used. This is no longer necessary, but it is still possible to do so for backwards compatibility purposes.
129138

130139
Alternatively, you can set a specific camera that should be used for rendering in a render script. This could be useful in cases where you need to control more specifically which camera should be used for rendering, for example in a multiplayer game.
131140

@@ -163,6 +172,22 @@ You can zoom in and out when using an orthographic camera by changing the *Ortho
163172
go.set("#camera", "orthographic_zoom", 2)
164173
```
165174

175+
When using an orthographic camera you can also switch how zoom is determined using the `Orthographic Mode` setting or via script:
176+
177+
```lua
178+
-- get current mode (one of camera.ORTHO_MODE_FIXED, _AUTO_FIT, _AUTO_COVER)
179+
local mode = camera.get_orthographic_mode("#camera")
180+
181+
-- switch to auto-fit (contain) to always keep the full design area visible
182+
camera.set_orthographic_mode("#camera", camera.ORTHO_MODE_AUTO_FIT)
183+
184+
-- switch to auto-cover to ensure the design area covers the window
185+
camera.set_orthographic_mode("#camera", camera.ORTHO_MODE_AUTO_COVER)
186+
187+
-- switch back to fixed mode to control zoom manually via orthographic_zoom
188+
camera.set_orthographic_mode("#camera", camera.ORTHO_MODE_FIXED)
189+
```
190+
166191
### Adaptive zoom
167192

168193
The concept behind adaptive zoom is to adjust the camera zoom value when the resolution of the display change from the initial resolution set in *game.project*.
@@ -202,6 +227,8 @@ end
202227

203228
A complete example of adaptive zoom can be seen in [this sample project](https://github.com/defold/sample-adaptive-zoom).
204229

230+
Note: With an orthographic camera you can now achieve contain/cover behavior without custom code by setting `Orthographic Mode` to `Auto Fit` (contain) or `Auto Cover` (cover). In these modes the effective zoom is computed automatically based on window size and your design resolution.
231+
205232

206233
### Following a game object
207234

@@ -264,13 +291,13 @@ A camera has a number of different properties that can be manipulated using `go.
264291
: The orthographic camera zoom (`number`).
265292

266293
`aspect_ratio`
267-
: Added in Defold 1.4.8. The ratio between the frustum width and height. Used when calculating the projection of a perspective camera. (`number`).
294+
: The ratio between the frustum width and height. Used when calculating the projection of a perspective camera. (`number`).
268295

269296
`view`
270-
: Added in Defold 1.4.8. The calculated view matrix of the camera. READ ONLY. (`matrix4`).
297+
: The calculated view matrix of the camera. READ ONLY. (`matrix4`).
271298

272299
`projection`
273-
: Added in Defold 1.4.8. The calculated projection matrix of the camera. READ ONLY. (`matrix4`).
300+
: The calculated projection matrix of the camera. READ ONLY. (`matrix4`).
274301

275302

276303
## Third-party camera solutions

docs/en/manuals/debugging-game-and-system-logs.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The game log shows all of the output from the engine, native extensions and your
1010
System logs are generated by the operating system and it can provide additional information that can help you pinpoint a problem. The system logs can contain stack traces for crashes and low memory warnings.
1111

1212
::: important
13-
The game log will only show information in debug builds. The log will be completely empty in release builds.
13+
Console/on-screen logging only shows information in Debug builds. In Release builds the console log is empty, but you can enable file logging in Release by setting the project setting "Write Log File" to "Always". See details below.
1414
:::
1515

1616
## Reading the game log from the editor
@@ -87,7 +87,13 @@ This will install the app on your device, start it and automatically attach a LL
8787

8888
## Reading the game log from the log file
8989

90-
If you enable the *Write Log* setting in *game.project*, any game output will be written to disk, to a file called "`log.txt`". Here is how you extract the file if you run the game on device:
90+
Use the project setting "Write Log File" in *game.project* to control file logging:
91+
92+
- "Never": Do not write a log file.
93+
- "Debug": Write a log file only for Debug builds.
94+
- "Always": Write a log file for both Debug and Release builds.
95+
96+
When enabled, any game output will be written to disk to a file named "`log.txt`". Here is how you extract the file if you run the game on device:
9197

9298
iOS
9399
: Connect your device to a computer with macOS and Xcode installed.
-69.5 KB
Binary file not shown.
1.98 KB
Loading
19.3 KB
Loading

docs/en/manuals/project-settings.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,14 @@ Publisher name.
6666
#### Developer
6767
Developer name.
6868

69-
#### Write Log
70-
When checked, the engine will write a log file. If running more than one instance from the editor the file will be named *instance_2_log.txt* with `2` being the instance index. If running a single instance or from a bundle the file will be named *log.txt* The location of the log file will be one of the following paths (tried in order):
69+
#### Write Log File
70+
Controls when the engine writes a log file. Options:
71+
72+
- "Never": Do not write a log file.
73+
- "Debug": Write a log file only for Debug builds.
74+
- "Always": Write a log file for both Debug and Release builds.
75+
76+
If running more than one instance from the editor the file will be named *instance_2_log.txt* with `2` being the instance index. If running a single instance or from a bundle the file will be named *log.txt*. The location of the log file will be one of the following paths (tried in order):
7177

7278
1. The path specified in *project.log_dir* (hidden setting)
7379
2. The system log path:

docs/en/manuals/render.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,20 @@ msg.post("@render:", "use_fixed_projection", { near = -1, far = 1, zoom = 2 })
137137

138138
When using the default render script and there are enabled [Camera components](/manuals/camera) available in the project, they will take precedence over any other view / projections set in the render script. To read more about how to work with camera components in render scripts, please consult the [Camera documentation](/manuals/camera).
139139

140+
Orthographic cameras support an `Orthographic Mode` that controls how the camera adapts to the window:
141+
- `Fixed` uses the camera’s `Orthographic Zoom` value.
142+
- `Auto Fit` (contain) keeps the full design area visible.
143+
- `Auto Cover` (cover) fills the window and may crop.
144+
145+
You can switch modes in the Editor or at runtime via the Camera API:
146+
147+
```lua
148+
-- Use auto-fit behavior with an orthographic camera
149+
camera.set_orthographic_mode("main:/go#camera", camera.ORTHO_MODE_AUTO_FIT)
150+
-- Query current mode
151+
local mode = camera.get_orthographic_mode("main:/go#camera")
152+
```
153+
140154
## Frustum culling
141155

142156
The render API in Defold lets developers perform something called frustum culling. When frustum culling is enabled any graphics that lies outside of a defined bounding box or frustum will be ignored. In a large game world where only a portion is visible at a time, frustum culling can dramatically reduce the amount of data that needs to be sent to the GPU for rendering, thus increasing performance and saving battery (on mobile devices). It is common to use the view and projection of the camera to create the bounding box. The default render script uses the view and projection (from the camera) to calculate a frustum.

docs/pl/manuals/project-settings.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,25 @@ Tytuł aplikacji
2121
#### Version
2222
Wersja aplikacji
2323

24-
#### Write Log
25-
Kiedy opcja zapisu logów jest zaznaczona, silnik zapisze wszystkie logi do pliku *log.txt* w głównej lokalizacji Twojego projektu. Gdy uruchomisz grę na systemie iOS, plik można będzie otworzyć przez iTunes w zakładce *Apps* w sekcji *File Sharing*. W systemie Android natomiast, plik jest przechowywany w zewnętrznej lokalizacji aplikacji (ang. app's external storage). Podczas uruchamiania aplikacji deweloperskiej *dmengine*, możesz podejrzeć logi używając komendy:
26-
27-
```bash
28-
$ adb shell cat /mnt/sdcard/Android/data/com.defold.dmengine/files/log.txt
29-
```
24+
#### Write Log File
25+
Określa, kiedy silnik zapisuje log do pliku. Opcje:
26+
27+
- "Never": nie zapisuj pliku logu.
28+
- "Debug": zapisuj plik logu tylko dla buildów Debug.
29+
- "Always": zapisuj plik logu zarówno dla buildów Debug, jak i Release.
30+
31+
Jeśli uruchamiasz więcej niż jedną instancję z edytora, plik będzie nazwany *instance_2_log.txt*, gdzie `2` to indeks instancji. Jeśli uruchamiasz pojedynczą instancję lub paczkę, plik będzie nazwany *log.txt*. Lokalizacja pliku logu będzie jedną z poniższych (sprawdzane w tej kolejności):
32+
33+
1. Ścieżka określona w *project.log_dir* (ukryte ustawienie)
34+
2. Systemowa ścieżka logów:
35+
* macOS/iOS: `NSDocumentDirectory`
36+
* Android: `Context.getExternalFilesDir()`
37+
* Inne: katalog aplikacji
38+
3. Ścieżka wsparcia aplikacji:
39+
* macOS/iOS: `NSApplicationSupportDirectory`
40+
* Windows: `CSIDL_APPDATA` (np. `C:\Users\<username>\AppData\Roaming`)
41+
* Android: `Context.getFilesDir()`
42+
* Linux: zmienna środowiskowa `HOME`
3043

3144
#### Compress Archive
3245
Umożliwia kompresowanie archiwów podczas budowania paczki. Zauważ, że dotyczy to wszystkich platform oprócz systemu Android, gdzie plik apk zawiera od razy skompresowane dane.

docs/ru/manuals/camera.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ Orthographic Projection
4848
Orthographic Zoom
4949
: (**Только для ортографической камеры**) — масштаб ортографической проекции (> 1 = приближение, < 1 = отдаление).
5050

51+
Orthographic Mode
52+
: (**Только для ортографической камеры**) — управляет тем, как ортографическая камера определяет зум относительно размера окна и ваших значений дизайна (`game.project``display.width/height`).
53+
- `Fixed` (постоянный зум): используется текущее значение `Orthographic Zoom`.
54+
- `Auto Fit` (вписать): автоматически подбирает зум так, чтобы вся дизайн-область помещалась в окно. Возможен дополнительный контент по бокам/сверху/снизу.
55+
- `Auto Cover` (заполнить): автоматически подбирает зум так, чтобы дизайн-область заполняла окно целиком. Возможна обрезка по бокам/сверху/снизу.
56+
Доступно только при включённой `Orthographic Projection`.
57+
5158

5259
## Использование камеры
5360

@@ -83,9 +90,11 @@ render.set_camera()
8390
camera.get_aspect_ratio(camera) -- получить соотношение сторон
8491
camera.get_far_z(camera) -- получить дальнюю плоскость отсечения
8592
camera.get_fov(camera) -- получить угол обзора
93+
camera.get_orthographic_mode(camera) -- получить ортографический режим (одно из camera.ORTHO_MODE_*)
8694
camera.set_aspect_ratio(camera, ratio) -- установить соотношение сторон
8795
camera.set_far_z(camera, far_z) -- установить дальнюю плоскость отсечения
8896
camera.set_near_z(camera, near_z) -- установить ближнюю плоскость отсечения
97+
camera.set_orthographic_mode(camera, camera.ORTHO_MODE_AUTO_FIT) -- установить ортографический режим
8998
... и другие
9099
```
91100

@@ -163,6 +172,22 @@ end
163172
go.set("#camera", "orthographic_zoom", 2)
164173
```
165174

175+
Также для ортографической камеры можно выбрать способ определения зума с помощью параметра `Orthographic Mode` или из кода:
176+
177+
```lua
178+
-- текущий режим (одно из: camera.ORTHO_MODE_FIXED, _AUTO_FIT, _AUTO_COVER)
179+
local mode = camera.get_orthographic_mode("#camera")
180+
181+
-- включить режим "вписать" (contain), чтобы дизайн-область всегда полностью помещалась в окно
182+
camera.set_orthographic_mode("#camera", camera.ORTHO_MODE_AUTO_FIT)
183+
184+
-- включить режим "заполнить" (cover), чтобы окно всегда было заполнено
185+
-- camera.set_orthographic_mode("#camera", camera.ORTHO_MODE_AUTO_COVER)
186+
187+
-- вернуть "фиксированный" режим и управлять масштабом вручную через orthographic_zoom
188+
-- camera.set_orthographic_mode("#camera", camera.ORTHO_MODE_FIXED)
189+
```
190+
166191
### Адаптивный зум
167192

168193
Адаптивный зум — это изменение значения зума камеры при изменении разрешения экрана относительно первоначального разрешения, заданного в *game.project*.
@@ -202,6 +227,8 @@ end
202227

203228
Полный пример адаптивного зума доступен в [этом примерном проекте](https://github.com/defold/sample-adaptive-zoom).
204229

230+
Примечание: Для ортографической камеры типичное поведение «вписать/заполнить» можно получить без пользовательского кода, установив `Orthographic Mode` в `Auto Fit` (вписать) или `Auto Cover` (заполнить). В этих режимах эффективный зум рассчитывается автоматически на основе размера окна и заданного разрешения дизайна.
231+
205232

206233
### Следование за игровым объектом
207234

@@ -264,13 +291,13 @@ end
264291
: Масштаб ортографической камеры (`number`).
265292

266293
`aspect_ratio`
267-
: Добавлено в Defold 1.4.8. Соотношение ширины и высоты усечённой пирамиды. Используется при вычислении проекции перспективной камеры. (`number`).
294+
: Соотношение ширины и высоты усечённой пирамиды. Используется при вычислении проекции перспективной камеры. (`number`).
268295

269296
`view`
270-
: Добавлено в Defold 1.4.8. Вычисленная матрица вида камеры. ТОЛЬКО ДЛЯ ЧТЕНИЯ. (`matrix4`).
297+
: Вычисленная матрица вида камеры. ТОЛЬКО ДЛЯ ЧТЕНИЯ. (`matrix4`).
271298

272299
`projection`
273-
: Добавлено в Defold 1.4.8. Вычисленная матрица проекции камеры. ТОЛЬКО ДЛЯ ЧТЕНИЯ. (`matrix4`).
300+
: Вычисленная матрица проекции камеры. ТОЛЬКО ДЛЯ ЧТЕНИЯ. (`matrix4`).
274301

275302

276303
## Сторонние решения для камеры

docs/ru/manuals/debugging-game-and-system-logs.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ brief: В этом руководстве объясняется, как чит
1010
Системные логи создаются операционной системой и могут содержать дополнительную информацию, которая может помочь вам выявить проблему. Системные логи могут содержать трассировки стека для сбоев и предупреждений о нехватке памяти.
1111

1212
::: important
13-
В логе игры будет отображаться информация только в отладочных сборках. В сборках релизов лог будет полностью пустым.
13+
Вывод в консоль/на экран показывается только в Debug-сборках. В Release-сборках консольный лог пуст, но вы можете включить запись лога в файл для Release, установив в настройках проекта параметр "Write Log File" в значение "Always". Подробнее см. ниже.
1414
:::
1515

1616
## Чтение лога игры из редактора
@@ -87,7 +87,13 @@ $ ios-deploy --debug --bundle <path_to_game.app> # ВНИМАНИЕ: не .ipa
8787

8888
## Чтение лога игры из файла лога
8989

90-
Если вы включите параметр *Write Log* в *game.project*, любой вывод игры будет записываться на диск в файл с именем "log.txt". Вот как можно извлечь файл, если вы запускаете игру на устройстве:
90+
Используйте параметр проекта "Write Log File" в *game.project*, чтобы управлять записью лога в файл:
91+
92+
- "Never": не записывать лог в файл.
93+
- "Debug": записывать файл лога только для Debug-сборок.
94+
- "Always": записывать файл лога как для Debug, так и для Release-сборок.
95+
96+
Если запись включена, весь вывод игры будет записываться на диск в файл "`log.txt`". Вот как можно извлечь файл, если вы запускаете игру на устройстве:
9197

9298
iOS
9399
: Подключите ваше устройство к компьютеру с установленными macOS и Xcode.

0 commit comments

Comments
 (0)