1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Initial support for themes, sound improvements

This commit is contained in:
tobspr
2020-05-16 09:49:00 +02:00
parent 236859baa1
commit 7870f011b8
20 changed files with 137 additions and 41 deletions

View File

@@ -4,13 +4,7 @@ import { DrawParameters } from "../../core/draw_parameters";
import { types } from "../../savegame/serialization";
import { BaseItem } from "../base_item";
import { enumColors, enumColorsToHexCode } from "../colors";
/** @enum {string} */
const enumColorToMapBackground = {
[enumColors.red]: "#ffbfc1",
[enumColors.green]: "#cbffc4",
[enumColors.blue]: "#bfdaff",
};
import { THEME } from "../theme";
export class ColorItem extends BaseItem {
static getId() {
@@ -39,7 +33,7 @@ export class ColorItem extends BaseItem {
}
getBackgroundColorAsResource() {
return enumColorToMapBackground[this.color];
return THEME.map.resources[this.color];
}
/**
@@ -75,8 +69,8 @@ export class ColorItem extends BaseItem {
context.scale((dpi * w) / 12, (dpi * h) / 12);
context.fillStyle = enumColorsToHexCode[this.color];
context.strokeStyle = "rgba(100,102, 110, 1)";
context.lineWidth = 2;
context.strokeStyle = THEME.items.outline;
context.lineWidth = 2 * THEME.items.outlineWidth;
context.beginCircle(2, -1, 3);
context.stroke();
context.fill();

View File

@@ -2,6 +2,7 @@ import { DrawParameters } from "../../core/draw_parameters";
import { types } from "../../savegame/serialization";
import { BaseItem } from "../base_item";
import { ShapeDefinition } from "../shape_definition";
import { THEME } from "../theme";
export class ShapeItem extends BaseItem {
static getId() {
@@ -33,6 +34,10 @@ export class ShapeItem extends BaseItem {
this.definition = definition;
}
getBackgroundColorAsResource() {
return THEME.map.resources.shape;
}
/**
* @param {number} x
* @param {number} y