You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/FAQ.md
+141-61
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,35 @@
1
-
# I get `ResourceNotFound("/myfile", ...)` even though it's in the resource dir!
1
+
# Table of Contents
2
+
3
+
***[Errors](#errors)**
4
+
*[I get `ResourceNotFound("/myfile", ...)` even though it's in the resource dir!](#errors_resource)
5
+
*[Why do I get `WindowError("Could not create GL context")` when I try to run my game?](#errors_window)
6
+
***[Graphics and GUIs](#gfx)**
7
+
*[Can I do 3D stuff?](#gfx_3d)
8
+
*[How do I make a GUI?](#gfx_gui)
9
+
*[Resolution independence](#gfx_resolution)
10
+
***[Libraries](#libraries)**
11
+
*[Can I use `specs`, `legion` or another entity-component system?](#library_ecs)
12
+
***[Performance](#performance)**
13
+
*[Image/sound loading and font rendering is slow!](#perf_slow1)
14
+
*[Text rendering is still slow!](#perf_text)
15
+
*[That's lame, can't I just compile my game in debug mode but ggez with optimizations on?](#perf_debug)
16
+
*[Drawing a few hundred images or shapes is slow!](#perf_drawing)
17
+
***[Platform-specific](#platforms)**
18
+
*[How do I build on platform X?](#platform_build)
19
+
*[Is Mac/iOS supported?](#platform_mac)
20
+
***[Contributing to ggez](#contributing)**
21
+
*[If I write X, will you include it in ggez?](#contribute_inclusion)
22
+
***[Miscellaneous](#misc)**
23
+
*[How do I load my `conf.toml` file?](#misc_conf)
24
+
*[I get a console window when I launch my executable on Windows](#misc_win_console)
25
+
26
+
---
27
+
28
+
# Errors
29
+
30
+
<aname="errors_resource">
31
+
32
+
## I get `ResourceNotFound("/myfile", ...)` even though it's in the resource dir!
2
33
3
34
Okay, first, look at [the docs](https://docs.rs/ggez/) for the
4
35
`filesystem` module. That should say exactly where it should look for
@@ -19,7 +50,9 @@ If you want to add a non-standard location to the resources lookup
19
50
path, you can use `Filesystem::mount()` or
20
51
`ContextBuilder::add_resource_path()`; see the examples for examples.
21
52
22
-
# Why do I get `WindowError("Could not create GL context")` when I try to run my game?
53
+
<aname="errors_window">
54
+
55
+
## Why do I get `WindowError("Could not create GL context")` when I try to run my game?
23
56
24
57
Basically this means "the graphics driver couldn't give ggez the
25
58
graphics settings it's asking for". This usually means "the graphics
@@ -44,7 +77,58 @@ written in the appropriate version of GLSL (which is a bit of a WIP)
44
77
and there's no promises that things like `SpriteBatch` and `Canvas`
45
78
will work.
46
79
47
-
# Image/sound loading and font rendering is slow!
80
+
<aname="gfx">
81
+
82
+
# Graphics and GUIs
83
+
84
+
<aname="gfx_3d">
85
+
86
+
## Can I do 3D stuff?
87
+
88
+
Yes; ggez uses `gfx-rs` for its drawing, and you can access the underlying `gfx-rs` drawing functions to draw whatever you want without disrupting ggez's drawing state. See the `cube` example.
89
+
90
+
In general, ggez is designed to focus on 2D graphics. We want it to be possible for you to create a 3D engine using ggez for everything EXCEPT drawing, but we don't really want to make a full 3D drawing engine. If you want 3D drawing and don't feel like doing it yourself, check out [Amethyst](https://crates.io/crates/amethyst).
91
+
92
+
<aname="gfx_gui">
93
+
94
+
## How do I make a GUI?
95
+
96
+
As of 2017 we know of no good ui options thus far besides "implement
97
+
it yourself" or "write a backend for Conrod or something so it can
98
+
draw using ggez".
99
+
100
+
Contributions are welcome! ;-)
101
+
102
+
<aname="gfx_resolution">
103
+
104
+
## Resolution independence
105
+
106
+
By default ggez uses a pixel coordinate system but you can change that
and scaling your `Image`s with `graphics::DrawParam`.
114
+
115
+
<aname="libraries">
116
+
117
+
# Libraries
118
+
119
+
<aname="library_ecs">
120
+
121
+
## Can I use `specs`, `legion` or another entity-component system?
122
+
123
+
Sure! ggez doesn't include such a thing itself, since it's more or less out of scope for this, but it is specifically
124
+
designed to make it easy to Lego together with other tools. The [game template](https://github.com/ggez/game-template) repo
125
+
demonstrates how to use ggez with `specs` for ECS, `warmy` for resource loading, and other nice crates. This template is available with `legion` in place of `specs` as well [here](https://github.com/Quetzal2/game-template).
126
+
127
+
# Performance
128
+
129
+
<aname="perf_slow1">
130
+
131
+
## Image/sound loading and font rendering is slow!
48
132
49
133
Are you running in debug or release mode? Rust in general is very
50
134
slow in debug mode. This causes problems because there is currently no
@@ -70,30 +154,43 @@ opt-level = 2: 430 fps
70
154
opt-level = 3: 450 fps
71
155
```
72
156
73
-
# Text rendering is still slow!
157
+
<aname="perf_text">
158
+
159
+
## Text rendering is still slow!
74
160
75
161
Rendering text to a bitmap is actually pretty computationally expensive. If you call `Text::new()` every single frame it's going to take a relatively large amount of time, and larger bitmaps and more text will take longer.
76
162
77
163
Ideally you'd be able to use a glyph cache to render letters to a texture once, and then just create a mesh that uses the bits of that texture to draw text. There's a couple partial implementations, such as the [gfx_glyph crate](https://crates.io/crates/gfx_glyph).
78
164
79
-
# That's lame, can't I just compile my game in debug mode but ggez with optimizations on?
165
+
<aname="perf_debug">
166
+
167
+
## That's lame, can't I just compile my game in debug mode but ggez with optimizations on?
80
168
81
169
Actually, as of rustc 1.41, you can! See
82
170
<https://doc.rust-lang.org/cargo/reference/profiles.html#overrides> for info
83
171
on how to do that.
84
172
85
-
# Drawing a few hundred images or shapes is slow!
173
+
<aname="perf_drawing">
174
+
175
+
## Drawing a few hundred images or shapes is slow!
86
176
87
177
Again, debug mode is slow. Plus, each single draw call has some overhead. If building in release mode still isn't fast enough, then look into using `SpriteBatch` to draw a bunch of chunks from a spritesheet (also known as an atlas). If you're drawing geometry, instead of using `graphics::rectangle()` or `graphics::circle()` and such, which create a new `Mesh` on each call and then throw it away, create and store a `Mesh` and draw it many times, or use a `MeshBuilder` to build a single `Mesh` out of many separate shapes.
Apple will be supported when they treat programmers trying to use
99
196
their systems as something other than third-class citizens. See
@@ -107,61 +204,13 @@ requests for Mac-specific bugs will be accepted as long as they don't
107
204
break anything else. In the mean time, consider writing your software
108
205
for a company that doesn't treat you like dirt.
109
206
110
-
# Can I do 3D stuff?
111
-
112
-
Yes; ggez uses `gfx-rs` for its drawing, and you can access the underlying `gfx-rs` drawing functions to draw whatever you want without disrupting ggez's drawing state. See the `cube` example.
113
-
114
-
In general, ggez is designed to focus on 2D graphics. We want it to be possible for you to create a 3D engine using ggez for everything EXCEPT drawing, but we don't really want to make a full 3D drawing engine. If you want 3D drawing and don't feel like doing it yourself, check out [Amethyst](https://crates.io/crates/amethyst).
115
-
116
-
# How do I make a GUI?
117
-
118
-
As of 2017 we know of no good ui options thus far besides "implement
119
-
it yourself" or "write a backend for Conrod or something so it can
120
-
draw using ggez".
121
-
122
-
Contributions are welcome! ;-)
123
-
124
-
# How do I load my `conf.toml` file?
125
-
126
-
When you create a `Context` it will automatically look for a
127
-
`conf.toml` file in any of the resource directories and, if it finds
128
-
one, use that to override all the defaults you give it.
129
-
130
-
The `files` example should demonstrate this, and more.
131
-
132
-
# I get a console window when I launch my executable on Windows
133
-
134
-
You can disable the console entirely by adding the following at
135
-
the top of your `main.rs` file:
136
-
137
-
```rust
138
-
#![windows_subsystem ="windows"]
139
-
```
140
-
141
-
If you wish, you can also disable it only in release mode:
and scaling your `Image`s with `graphics::DrawParam`.
157
-
158
-
# Can I use `specs`, `legion` or another entity-component system?
207
+
<aname="contributing">
159
208
160
-
Sure! ggez doesn't include such a thing itself, since it's more or less out of scope for this, but it is specifically
161
-
designed to make it easy to Lego together with other tools. The [game template](https://github.com/ggez/game-template) repo
162
-
demonstrates how to use ggez with `specs` for ECS, `warmy` for resource loading, and other nice crates. This template is available with `legion` in place of `specs` as well [here](https://github.com/Quetzal2/game-template).
209
+
# Contributing
163
210
164
-
# If I write X, will you include it in ggez?
211
+
<aname="contribute_inclusion">
212
+
213
+
## If I write X, will you include it in ggez?
165
214
166
215
Maybe, if it's something that fits in with ggez's goals: a simple and flexible 2D game framework with a LÖVE-ish API,
167
216
which provides all the basics you need in one package without dictating too much about the more complicated tools.
@@ -187,3 +236,34 @@ ggez on crates.io and get things that are officially supported by the maintainer
187
236
example, search for `gfx` on `crates.io` and see how messy the results are.
188
237
189
238
For a fuller discussion of this, see [issue #373](https://github.com/ggez/ggez/issues/373).
239
+
240
+
<aname="misc">
241
+
242
+
# Miscellaneous
243
+
244
+
<aname="misc_conf">
245
+
246
+
## How do I load my `conf.toml` file?
247
+
248
+
When you create a `Context` it will automatically look for a
249
+
`conf.toml` file in any of the resource directories and, if it finds
250
+
one, use that to override all the defaults you give it.
251
+
252
+
The `files` example should demonstrate this, and more.
253
+
254
+
<aname="misc_win_console">
255
+
256
+
## I get a console window when I launch my executable on Windows
257
+
258
+
You can disable the console entirely by adding the following at
259
+
the top of your `main.rs` file:
260
+
261
+
```rust
262
+
#![windows_subsystem ="windows"]
263
+
```
264
+
265
+
If you wish, you can also disable it only in release mode:
0 commit comments