feat(app): update icons

This commit is contained in:
2026-04-17 11:51:21 +03:00
parent 5cae80636b
commit 86345117f7
27 changed files with 61 additions and 40 deletions
+11 -8
View File
@@ -11,14 +11,16 @@ import ru.m.skin.ButtonSVGSkin;
class PuzzlezTheme extends Theme {
private static var ICONS:Map<String, String> = [
"close" => "times-circle-solid.svg",
"setting" => "cog-solid.svg",
"image" => "image-polaroid.svg",
"lock" => "lock-alt-solid.svg",
"restore" => "window-restore-solid.svg",
"compress" => "compress-solid.svg",
"expand" => "expand-solid.svg",
"spread" => "clone.svg",
"close" => "close-circle.svg",
"setting" => "cog.svg",
"image" => "image.svg",
"lock" => "lock.svg",
"lock-open" => "lock-open.svg",
"restore" => "window-restore.svg",
"compress" => "arrow-collapse-all.svg",
"expand" => "arrow-expand-all.svg",
"shuffle" => "shuffle.svg",
"spread" => "format-align-justify.svg",
];
public function new() {
@@ -41,6 +43,7 @@ class PuzzlezTheme extends Theme {
"geometry.height" => SizeValue.fromString("8h"),
"skin" => function() return new ButtonSVGSkin(),
"skin.color" => colors.light,
"skin.svgScale" => 16.0,
]));
for (key in ICONS.keys()) {
register(new Style('icon.${key}', ["skin.svg" => Assets.getText('resources/icon/${ICONS.get(key)}'),]));
@@ -1,6 +1,7 @@
package ru.m.puzzlez.settings;
import hw.storage.SharedObjectStorage;
import ru.m.puzzlez.proto.game.ImageId;
import ru.m.puzzlez.render.Background;
@:provide class Settings extends SharedObjectStorage {
@@ -10,8 +11,12 @@ import ru.m.puzzlez.render.Background;
public var background(get, set):Background;
private function defaultBackground():Background {
return Background.IMAGE(new ImageId().setSource('asset').setId('resources/texture/pool-table.png'));
}
private inline function get_background():Background {
return exists(BACKGROUND_KEY) ? read(BACKGROUND_KEY) : NONE;
return exists(BACKGROUND_KEY) ? read(BACKGROUND_KEY) : this.defaultBackground();
}
private inline function set_background(value:Background):Background {
@@ -22,7 +27,7 @@ import ru.m.puzzlez.render.Background;
public var locked(get, set):Bool;
private inline function get_locked():Bool {
return exists(LOCKED_KEY) ? read(LOCKED_KEY) : false;
return exists(LOCKED_KEY) ? read(LOCKED_KEY) : true;
}
private inline function set_locked(value:Bool):Bool {
@@ -22,11 +22,13 @@ views:
settings.locked = render.manager.locked;
cast(button, hw.view.form.ToggleButtonView).on = !render.manager.locked;
}
visible: false
- $type: hw.view.form.ButtonView
style: icon.restore
+onPress: ~render.manager.reset()
visible: false
- $type: hw.view.form.ButtonView
style: icon.spread
style: icon.shuffle
+onPress: ~shuffle()
- $type: hw.view.form.ButtonView
style: icon.spread
+2 -1
View File
@@ -13,6 +13,7 @@ using hw.color.ColorUtil;
@:style(null) public var svg:String;
@:style(0) public var color:Null<Color>;
@:style(false) public var solid:Null<Bool>;
@:style(0.8) public var svgScale:Null<Float>;
private var svgs:Map<ButtonState, SVG>;
private var needUpdate:Bool;
@@ -60,7 +61,7 @@ using hw.color.ColorUtil;
graphics.lineStyle(2, color.multiply(1.5));
}
// ToDo: padding
svg.render(graphics, 0, 0, Std.int(view.width * 0.8), Std.int(view.height * 0.8));
svg.render(graphics, 0, 0, Std.int(view.width * this.svgScale), Std.int(view.height * this.svgScale));
graphics.lineStyle();
graphics.endFill();
}