diff options
Diffstat (limited to 'posts')
-rw-r--r-- | posts/SDL2_devlog.md | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/posts/SDL2_devlog.md b/posts/SDL2_devlog.md index eb11de8..04ac928 100644 --- a/posts/SDL2_devlog.md +++ b/posts/SDL2_devlog.md | |||
@@ -5,6 +5,27 @@ on the editor. The days are listed in reverse chronological | |||
5 | order, begin from the bottom, if this is your first time on | 5 | order, begin from the bottom, if this is your first time on |
6 | this page. | 6 | this page. |
7 | 7 | ||
8 | ### Day 18 | ||
9 | |||
10 | I added basic support for guides, they can be added and | ||
11 | activated from the `lisp` REPL. Another long standing | ||
12 | improvement I wanted to make was reworking the pixmap | ||
13 | drawing procedure. The old procedure draws a square for each | ||
14 | pixel in the pixmap, coloured according to its value in the | ||
15 | pixmap. Naturally, this means, for an **NxN** pixmap, there | ||
16 | are **N²** calls to SDL! I reworked this procedure to | ||
17 | compress each line of the pixmap using RLE (run length | ||
18 | encoding), and call out to SDL for each run in the line. | ||
19 | This drastically improved drawing speeds on larger grids. | ||
20 | The following is a comparison between the two procedures, | ||
21 | the leftmost picture is the rendered image, the middle | ||
22 | picture is the optimized drawing procedure (draws each run | ||
23 | instead of pixel), and the right most picture is the | ||
24 | primitive drawing procedure (draws each pixel): | ||
25 | |||
26 | ![Day 18](https://u.peppe.rs/U4B.png) | ||
27 | |||
28 | |||
8 | ### Day 17 | 29 | ### Day 17 |
9 | 30 | ||
10 | I decided to give the text-only statusline a touch up, by | 31 | I decided to give the text-only statusline a touch up, by |
@@ -23,7 +44,7 @@ let statusline = | |||
23 | let mut primary = Container::uninit() | 44 | let mut primary = Container::uninit() |
24 | .width(Size::Absolute(16)) | 45 | .width(Size::Absolute(16)) |
25 | .height(Size::Absolute(16)); | 46 | .height(Size::Absolute(16)); |
26 | 47 | ||
27 | container.place( | 48 | container.place( |
28 | &mut padding_box, | 49 | &mut padding_box, |
29 | HorAlign::Right, | 50 | HorAlign::Right, |