doodle/pkg/level/palette_defaults.go
Noah Petherbridge d4e6d9babb 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

Note: this commit introduces instability and crashes:

* New `asyncSetup()` functions run on a goroutine, but SDL2 texture
  calls must run on the main thread.
* Chunker avoids this by caching bitmaps, not textures.
* Wallpaper though is unstable, sometimes works, sometimes has graphical
  glitches, sometimes crashes the game.
* Wallpaper.Load() and the *Texture() functions are where it crashes.
2021-07-18 21:19:52 -07:00

120 lines
2.1 KiB
Go

package level
import (
"git.kirsle.net/go/render"
)
// Some choice of palettes.
var (
DefaultPaletteNames = []string{
"Default",
"Colored Pencil",
"Blueprint",
}
DefaultPalettes = map[string]*Palette{
"Default": {
Swatches: []*Swatch{
{
Name: "solid",
Color: render.MustHexColor("#777"),
Solid: true,
Pattern: "noise.png",
},
{
Name: "decoration",
Color: render.MustHexColor("#CCC"),
Pattern: "noise.png",
},
{
Name: "fire",
Color: render.Red,
Fire: true,
Pattern: "marker.png",
},
{
Name: "water",
Color: render.MustHexColor("#09F"),
Water: true,
Pattern: "ink.png",
},
},
},
"Colored Pencil": {
Swatches: []*Swatch{
{
Name: "grass",
Color: render.DarkGreen,
Solid: true,
Pattern: "noise.png",
},
{
Name: "dirt",
Color: render.MustHexColor("#960"),
Solid: true,
Pattern: "noise.png",
},
{
Name: "stone",
Color: render.Grey,
Solid: true,
Pattern: "noise.png",
},
{
Name: "sandstone",
Color: render.RGBA(215, 114, 44, 255),
Solid: true,
Pattern: "perlin-noise.png",
},
{
Name: "fire",
Color: render.Red,
Fire: true,
Pattern: "marker.png",
},
{
Name: "water",
Color: render.RGBA(0, 153, 255, 255),
Water: true,
Pattern: "ink.png",
},
},
},
"Blueprint": {
Swatches: []*Swatch{
{
Name: "solid",
Color: render.RGBA(254, 254, 254, 255),
Solid: true,
Pattern: "noise.png",
},
{
Name: "decoration",
Color: render.Grey,
Pattern: "noise.png",
},
{
Name: "fire",
Color: render.RGBA(255, 80, 0, 255),
Fire: true,
Pattern: "marker.png",
},
{
Name: "water",
Color: render.RGBA(0, 153, 255, 255),
Water: true,
Pattern: "ink.png",
},
{
Name: "electric",
Color: render.RGBA(255, 255, 0, 255),
Solid: true,
Pattern: "marker.png",
},
},
},
}
)