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: CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,9 @@
17
17
* FontMetrics can be used to measure strings, trim to fit, and more
18
18
* Dynamic Textures in the form of raw pixel maps are now supported. This should allow you to capture raw images off of a camera and display them without encoding/decoding
19
19
* leading spaces in a text primitive are now rendered
20
+
* Scene callbacks are all updated to support the OTP 21+ callback returns.
21
+
* Scenes now have the terminate callback.
22
+
* push_graph is deprecated in favor of returning {:push, graph} options form the callbacks
Copy file name to clipboardExpand all lines: guides/upgrading_to_v0.10.md
+100-2Lines changed: 100 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,15 @@
2
2
3
3
Version 0.10 of Scenic contains breaking changes, which will need to be updated in your app in order to run. This is all good through as it enables goodness in the forms of proper font metrics and dynamic raw pixel textures.
4
4
5
+
## Overview
6
+
7
+
Version v0.10 contains two fairly major changes in how things work.
8
+
9
+
*`Scenic.Cache` has been reorganized into asset-specific caches. **This is a breaking change.**
10
+
*`push_graph` is deprecated and replaced with a more functional-style return value. This is not a breaking change, but it throws warnings as going forward, the new return values are the way to go.
11
+
12
+
The changes to the cache are described first as they are breaking changes. The non-breaking push_graph deprecation will probably be more work to integrate, but you don't need to do it as immedately.
13
+
5
14
## Changes to the Cache
6
15
7
16
The most important (and immediate) change you need to deal with is to the cache. In order to handle static items with different life-cycle requirements, the cache has been broken out into multiple smaller caches, each for a specific type of content.
@@ -21,11 +30,100 @@ Note that caches are marked as either static or dynamic. Things that do not chan
21
30
22
31
The Dynamic.Texture cache is for images that change over time. For example, this could be an image coming off of a camera, or something that you generate directly in your own code. Note that Dynamic caches are more expensive overall as they will not get the same level of optimization in the future.
23
32
24
-
## Custom Fonts
33
+
###Custom Fonts
25
34
26
35
If you have used custom fonts in your application, you need to use a new process to get them to load and render.
27
36
28
37
1. use the `truetype_metrics` tool in hex to generate a `\*.metrics` file for your custom font. This will live in the same folder as your font.
29
38
2. Make sure the name of the font file itself ends with the hash of its content. If you use the `-d` option in `truetype_metrics`, then that will be done for you.
30
39
3. Load the font metrics file into the `Scenic.Cache.Static.FontMetrics` cache. The hash of this file is the hash that you will use to refer to the font in the graphs.
31
-
4. Load the font itself into the `Scenic.Cache.Static.Font`
40
+
4. Load the font itself into the `Scenic.Cache.Static.Font`
41
+
42
+
## Deprecation of push_graph()
43
+
44
+
The `push-graph/1` function is now deprecated. It still works, but has been replaced with a much more functional-style `{:push, graph}` return value.
45
+
46
+
This has several immediate benefits. The main advantage is that you can now use all the standard OTP 21+ callbacks, including handle_continue, timeouts and the like. If you call push_graph(), it sends a message back to the scene, so the timeouts will not work. The new form corrects this situation.
47
+
48
+
It also lowers the overall draw latency a little bit. There is one less passed-message for rendering to serialize on.
49
+
50
+
### Changes to make
51
+
52
+
Making the switch is fairly straight forward. A typical scene pattern with push_graph would look like this
This may not look like a very big change, but the impact is significant, and simpler under the covers.
104
+
105
+
The key is that you indicate that you want to push a graph by returning a `{:push, graph}` option when you exit any scene handler function. This optional value can be combined with `timeout` or `{:continue, term}` options as well (although not both at the same time...)
The [callbacks section of the scene documentation](Scenic.Scene.html#callbacks) is now properly filled out, so please refer to that for more information on each of the available return values.
0 commit comments