From ba97c81b554f7bb6e917097f2ad4dc816fd345e2 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sun, 18 Jul 2021 20:04:24 -0700 Subject: [PATCH] Loading Screen * pkg/loadscreen implements a global Loading Screen for loading heavy levels for playing or editing. * All chunks in a level are pre-rendered to bitmap before gameplay begins, which reduces stutter as chunks were being lazily rendered on first appearance before. * The loading screen can be played with in the developer console: $ loadscreen.Show() $ loadscreen.Hide() Along with ShowWithProgress(), SetProgress(float64) and IsActive() * Chunker: separate the concerns between Bitmaps an (SDL2) Textures. * Chunker.Prerender() converts a chunk to a bitmap (a Go image.Image) and caches it, only re-rendering if marked as dirty. * Chunker.Texture() will use the pre-cached bitmap if available to immediately produce the SDL2 texture. Other miscellaneous changes: * Added to the Colored Pencil palette: Sandstone * Added "perlin noise" brush pattern --- assets/pattern/perlin-noise.png | Bin 0 -> 1605 bytes pkg/balance/theme.go | 16 ++ pkg/doodle.go | 9 +- pkg/editor_scene.go | 59 +++++++- pkg/editor_ui.go | 27 ++-- pkg/level/chunk.go | 47 ++++-- pkg/level/chunker.go | 37 +++++ pkg/level/palette_defaults.go | 6 + pkg/modal/loadscreen/loadscreen.go | 231 +++++++++++++++++++++++++++++ pkg/modal/modal.go | 10 ++ pkg/pattern/pattern.go | 6 +- pkg/play_scene.go | 42 ++++++ pkg/shell.go | 8 + 13 files changed, 471 insertions(+), 27 deletions(-) create mode 100644 assets/pattern/perlin-noise.png create mode 100644 pkg/modal/loadscreen/loadscreen.go diff --git a/assets/pattern/perlin-noise.png b/assets/pattern/perlin-noise.png new file mode 100644 index 0000000000000000000000000000000000000000..920c0e73db105d8a6832d49c2dfcf3ecbc7325dc GIT binary patch literal 1605 zcmV-L2DEX>4Tx04R}tkv&MmKpe$iQ>7wR2Rn!eW~dHgK~%(1t5Adrp;l+0Yt2!bCVZf;JBE>hzEl0u6Z503ls?%w0>9U#<7Otad?08O{e zR3a{BvMXZf6(MvZh!G6R%ra&rDGA^4b&mjF?_xa5|J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