toolbar block icons centred in their 16px box (test for all icons), tutorials say where the objects tab is
This commit is contained in:
1 parent
52c70e817d
commit
322e36c0f3
7 files changed
+60
-8
No files matched your search
@@ -19,8 +19,8 @@ final class GeoIcons {
|
||||
private static final Color RED = new Color(0xD93F3F);
|
||||
|
||||
static void register() {
|
||||
Icons.register("prim-box", (g, fg) -> block(g, 2, 5, 12, 8, TOP, SIDE));
|
||||
Icons.register("prim-platform", (g, fg) -> block(g, 1, 4, 14, 4, TOP, SIDE));
|
||||
Icons.register("prim-box", (g, fg) -> block(g, 2, 1, 12, 8, TOP, SIDE));
|
||||
Icons.register("prim-platform", (g, fg) -> block(g, 1, 2.5, 14, 4, TOP, SIDE));
|
||||
Icons.register("prim-floor", (g, fg) -> {
|
||||
Path2D p = poly(1, 10, 8, 6.5, 15, 10, 8, 13.5);
|
||||
g.setColor(TOP);
|
||||
@@ -47,7 +47,7 @@ final class GeoIcons {
|
||||
g.setColor(fg);
|
||||
g.draw(p);
|
||||
});
|
||||
Icons.register("prim-pillar", (g, fg) -> block(g, 5, 2, 6, 12, STONE, STONE.darker()));
|
||||
Icons.register("prim-pillar", (g, fg) -> block(g, 5, 0.5, 6, 12, STONE, STONE.darker()));
|
||||
Icons.register("prim-cylinder", (g, fg) -> {
|
||||
g.setColor(STONE.darker());
|
||||
g.fill(new java.awt.geom.Rectangle2D.Double(2, 6, 12, 5));
|
||||
@@ -122,7 +122,7 @@ final class GeoIcons {
|
||||
Icons.register("prim-invbox", (g, fg) -> {
|
||||
g.setStroke(
|
||||
new BasicStroke(1.2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1, new float[] {2, 1.5f}, 0));
|
||||
outlineBlock(g, 2, 5, 12, 8, new Color(255, 60, 60, 60), RED);
|
||||
outlineBlock(g, 2, 1, 12, 8, new Color(255, 60, 60, 60), RED);
|
||||
});
|
||||
Icons.register("geo-collision", (g, fg) -> {
|
||||
Path2D p = poly(1, 10, 8, 6.5, 15, 10, 8, 13.5);
|
||||
@@ -221,6 +221,7 @@ final class GeoIcons {
|
||||
}
|
||||
|
||||
/** Isometric block: x, y of the top-left, width w, side height h. */
|
||||
/** An isometric block filling y .. y + w / 2 + h; keep that within the 16 × 16 icon box. */
|
||||
private static void block(Graphics2D g, double x, double y, double w, double h, Color top, Color side) {
|
||||
Color fg = g.getColor();
|
||||
double d = w / 4;
|
||||
|
||||
@@ -40,6 +40,11 @@ public final class Icons {
|
||||
|
||||
private Icons() {}
|
||||
|
||||
/** Names of all registered icons (sorted). */
|
||||
public static java.util.List<String> names() {
|
||||
return PAINTERS.keySet().stream().sorted().toList();
|
||||
}
|
||||
|
||||
public static void register(String name, Painter p) {
|
||||
PAINTERS.put(name, p);
|
||||
CACHE.keySet().removeIf(k -> k.startsWith(name + "@"));
|
||||
|
||||
Reference in new issue
Block a user