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: v3/dev-guide/README.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
This evolving guide is written for those who wish to help with Phaser 3. I must stress, this isn't a guide on how to use Phaser 3, or to make games, it's a guide on how to set-up your dev environment so you can assist us in _building Phaser 3 itself_, along with the basics of the internal structure.
4
4
5
-
All of the following is subject to change as V3 evolves, but is correct as of today: 5th January 2017.
5
+
All of the following is subject to change as V3 evolves, but is correct as of today: 10th April 2017.
6
6
7
7
## Set-up Your Environment
8
8
@@ -34,17 +34,22 @@ Later in this guide I'll explain how Webpack is configured.
34
34
35
35
Now you can build Phaser 3, it's time to run the Examples.
36
36
37
+
** Please note: Not all examples run! The API is changing frequently, so older examples broke as this happened. We will tidy them all up before release **
38
+
37
39
1. Make sure you can access the Phaser 3 Examples Runner in your browser. If your local server is running on 127.0.0.1 then try to load `http://127.0.0.1/phaser3-examples/public/` and make sure the page loads. It should look something like this:
38
40
39
41

40
42
41
-
2. From the list, scroll down, and pick `021 - image from atlas`. The Phaser 3 Sandbox editor should appear with the code on the left and a blank window on the right. You likely do this already, but I strongly suggest you perform all testing with the browsers Dev Tools open. In Chrome this will ensure the cache doesn't mess things up, and that you see errors and debug info.
43
+
2. Click any folder to enter that section of the examples. You'll see a list of icons with the example title below them.
44
+
45
+
If you click the icon it will load the example into the runner.
46
+
If you click the text it will load it into the sandbox editor.
42
47
43
-
3. Click 'Run Code'. The example should load in the right-pane (in this case it'll show a selection of sprites from a texture atlas)
48
+
Try picking a folder such as 'Animation' and then click the text below the 'Single Sprite Sheet' icon. The Phaser 3 Sandbox editor should appear with the code on the left and a blank window on the right. You likely do this already, but I strongly suggest you perform all testing with the browsers Dev Tools open. In Chrome this will ensure the cache doesn't mess things up, and that you see errors and debug info.
44
49
45
-

50
+
3. Click 'Run Code'. The example should load in the right-pane (in this example below you can see a selection of sprites from a texture atlas)
46
51
47
-
Note: The red background in the grab above is for debugging. You may not see this when you run it. What's important is that you do actually see the Sprites, and it doesn't throw any errors.
52
+

48
53
49
54
4. If it doesn't run, check the console for errors, check your paths, and see if anything is missing.
50
55
@@ -275,8 +280,8 @@ Every time RAF ticks it calls the following (in order)
275
280
1.`Game.step` is called, which calls ...
276
281
2.`Game.mainloop.step` which checks frame rate, updates delta values, etc
277
282
3. This calls `State.sys.begin` once for all _active_ States
278
-
4.While the frame delta is within range it calls `State.sys.update`
279
-
5.This iterates all `State.children`, and calls `update` if they exist
283
+
4.This iterates all `State.children`, and calls `preUpdate` if they exist
284
+
5.While the frame delta is within range it calls `State.sys.update`
280
285
6. It then calls `State.update` (dev level callback)
281
286
7. When the loop exits (because the frameDelta is > the step size) it ..
282
287
8.`Renderer.preRender` which resets the canvas, cls, then ...
@@ -296,10 +301,11 @@ In a tree form it maps to the following:
296
301
|
297
302
+- All Active States:
298
303
+- State.sys.begin (called once per active state)
304
+
|
305
+
+- Iterates State.children, if child exists, call child.preUpdate
299
306
+- While (frameDelta within step range)
300
307
|
301
308
+- State.sys.update
302
-
+- Iterates State.children, if child exists, call child.update
303
309
+- State.update
304
310
|
305
311
+- Renderer.preRender
@@ -318,12 +324,6 @@ In a tree form it maps to the following:
318
324
+- State.sys.end (resets frame delta and panic flags)
319
325
```
320
326
321
-
322
-
323
-
324
327
The above is subject to change heavily! There are currently lots of empty function calls in there (State.sys.update for example), so we may well optimize this path considerably.
325
328
326
329
In essence though the concept is: Once per frame we update all the timing values, update the core systems, update the children, and repeat this until our step value is high enough, then we render everything.
0 commit comments