Noah Petherbridge
cc1e441232
* Implement Brush Sizes for drawtool.Stroke and add a UI to the tools panel to control the brush size. * Brush sizes: 1, 2, 4, 8, 16, 24, 32, 48, 64 * Add the Eraser Tool to editor mode. It uses a default brush size of 16 and a max size of 32 due to some performance issues. * The Undo/Redo system now remembers the original color of pixels when you change them, so that Undo will set them back how they were instead of deleting the pixel entirely. Due to performance issues, this only happens when your Brush Size is 0 (drawing single-pixel shapes). * UI: Add an IntVariable option to ui.Label to bind showing the value of an int reference. Aforementioned performance issues: * When we try to remember whole rects of pixels for drawing thick shapes, it requires a ton of scanning for each step of the shape. Even de-duplicating pixel checks, tons of extra reads are constantly checked. * The Eraser is the only tool that absolutely needs to be able to remember wiped pixels AND have large brush sizes. The performance sucks and lags a bit if you erase a lot all at once, but it's a trade-off for now. * So pixels aren't remembered when drawing lines in your level with thick brushes, so the Undo action will simply delete your pixels and not reset them. Only the Eraser can bring back pixels.
79 lines
1.7 KiB
Go
79 lines
1.7 KiB
Go
package balance
|
|
|
|
import (
|
|
"git.kirsle.net/apps/doodle/lib/render"
|
|
"git.kirsle.net/apps/doodle/lib/ui"
|
|
)
|
|
|
|
// Theme and appearance variables.
|
|
var (
|
|
// Window and panel styles.
|
|
TitleConfig = ui.Config{
|
|
Background: render.MustHexColor("#FF9900"),
|
|
OutlineSize: 1,
|
|
OutlineColor: render.Black,
|
|
}
|
|
TitleFont = render.Text{
|
|
FontFilename: "DejaVuSans-Bold.ttf",
|
|
Size: 12,
|
|
Padding: 4,
|
|
Color: render.White,
|
|
Stroke: render.Red,
|
|
}
|
|
WindowBackground = render.MustHexColor("#cdb689")
|
|
WindowBorder = render.Grey
|
|
|
|
// Menu bar styles.
|
|
MenuBackground = render.Black
|
|
MenuFont = render.Text{
|
|
Size: 12,
|
|
PadX: 4,
|
|
}
|
|
|
|
// StatusFont is the font for the status bar.
|
|
StatusFont = render.Text{
|
|
Size: 12,
|
|
Padding: 4,
|
|
Color: render.Black,
|
|
}
|
|
|
|
// UIFont is the main font for UI labels.
|
|
UIFont = render.Text{
|
|
Size: 12,
|
|
Padding: 4,
|
|
Color: render.Black,
|
|
}
|
|
|
|
// LabelFont is the font for strong labels in UI.
|
|
LabelFont = render.Text{
|
|
Size: 12,
|
|
FontFilename: "DejaVuSans-Bold.ttf",
|
|
Padding: 4,
|
|
Color: render.Black,
|
|
}
|
|
|
|
// SmallMonoFont for cramped spaces like the +/- buttons on Toolbar.
|
|
SmallMonoFont = render.Text{
|
|
Size: 14,
|
|
PadX: 3,
|
|
FontFilename: "DejaVuSansMono.ttf",
|
|
Color: render.Black,
|
|
}
|
|
|
|
// Color for draggable doodad.
|
|
DragColor = render.MustHexColor("#0099FF")
|
|
|
|
// Link lines drawn between connected doodads.
|
|
LinkLineColor = render.Magenta
|
|
LinkLighten = 128
|
|
LinkAnimSpeed uint64 = 30 // ticks
|
|
|
|
PlayButtonFont = render.Text{
|
|
FontFilename: "DejaVuSans-Bold.ttf",
|
|
Size: 16,
|
|
Padding: 4,
|
|
Color: render.RGBA(255, 255, 0, 255),
|
|
Stroke: render.RGBA(100, 100, 0, 255),
|
|
}
|
|
)
|