doodle/pkg/shmem/globals.go
Noah Petherbridge 47cca8c7c6 Palette Editor and Doodad Dropper Windows
* Start the program window maximized with the `-w maximized` CLI option.
* Move the Doodad Palette off the right-side dock of the Editor Scene and
  into its own pop-up window: the DoodadDropper.
* Shrink the width of the Color Palette panel and show only the colors in
  the buttons. The name of the swatch is available in the mouse-over tooltip.
* Added an "Edit" button to the Color Palette. It opens a Palette Editor
  window where you can rename, change colors and attributes of existing colors
  OR insert new colors into your palette. (Deleting colors not yet supported).
* level.Chunker gets a Redraw method: invalidates all cached textures of all
  chunks forcing the level to redraw itself, possibly with an updated palette.
2020-07-09 19:38:37 -07:00

41 lines
994 B
Go

package shmem
import (
"fmt"
"git.kirsle.net/go/render"
)
// Shared globals for easy access throughout the app.
// Not an ideal place to keep things but *shrug*
var (
// Tick is incremented by the main game loop each frame.
Tick uint64
// Current position of the cursor relative to the window.
Cursor render.Point
// Current render engine (i.e. SDL2 or HTML5 Canvas)
// The level.Chunk.ToBitmap() uses this to cache a texture image.
CurrentRenderEngine render.Engine
// Globally available Flash() function so we can emit text to the Doodle UI.
Flash func(string, ...interface{})
// Globally available Prompt() function.
Prompt func(string, func(string))
// Ajax file cache for WASM use.
AjaxCache map[string][]byte
)
func init() {
AjaxCache = map[string][]byte{}
// Default Flash function in case the app misconfigures it. Output to the
// console in an obvious way.
Flash = func(tmpl string, v ...interface{}) {
fmt.Printf("[shmem.Flash] "+tmpl+"\n", v...)
}
}