Updated StructureLayer and GameMap for Remake of Icons, added extra building png icons resources.

This commit is contained in:
UnBuiltTree
2025-03-05 21:29:19 -06:00
parent 389e905813
commit 89326baa37
26 changed files with 21 additions and 12 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

+11 -11
View File
@@ -3,10 +3,10 @@ import { Theme } from "../../../core/configuration/Config";
import { Layer } from "./Layer"; import { Layer } from "./Layer";
import { EventBus } from "../../../core/EventBus"; import { EventBus } from "../../../core/EventBus";
import anchorIcon from "../../../../resources/images/AnchorIcon.png"; import anchorIcon from "../../../../resources/images/buildings/port1.png";
import missileSiloIcon from "../../../../resources/images/MissileSiloUnit.png"; import missileSiloIcon from "../../../../resources/images/buildings/silo1.png";
import shieldIcon from "../../../../resources/images/ShieldIcon.png"; import shieldIcon from "../../../../resources/images/buildings/fort0.png";
import cityIcon from "../../../../resources/images/CityIcon.png"; import cityIcon from "../../../../resources/images/buildings/city1.png";
import { GameView, UnitView } from "../../../core/game/GameView"; import { GameView, UnitView } from "../../../core/game/GameView";
import { Cell, UnitType } from "../../../core/game/Game"; import { Cell, UnitType } from "../../../core/game/Game";
import { GameUpdateType } from "../../../core/game/GameUpdates"; import { GameUpdateType } from "../../../core/game/GameUpdates";
@@ -30,8 +30,13 @@ export class StructureLayer implements Layer {
private readonly unitConfigs: Partial<Record<UnitType, UnitRenderConfig>> = { private readonly unitConfigs: Partial<Record<UnitType, UnitRenderConfig>> = {
[UnitType.Port]: { [UnitType.Port]: {
icon: anchorIcon, icon: anchorIcon,
borderRadius: 8, borderRadius: 8.525,
territoryRadius: 6, territoryRadius: 6.525,
},
[UnitType.City]: {
icon: cityIcon,
borderRadius: 8.525,
territoryRadius: 6.525,
}, },
[UnitType.MissileSilo]: { [UnitType.MissileSilo]: {
icon: missileSiloIcon, icon: missileSiloIcon,
@@ -43,11 +48,6 @@ export class StructureLayer implements Layer {
borderRadius: 8, borderRadius: 8,
territoryRadius: 6, territoryRadius: 6,
}, },
[UnitType.City]: {
icon: cityIcon,
borderRadius: 8,
territoryRadius: 6,
},
}; };
constructor( constructor(
+10 -1
View File
@@ -321,7 +321,16 @@ export function euclDistFN(
root: TileRef, root: TileRef,
dist: number, dist: number,
): (gm: GameMap, tile: TileRef) => boolean { ): (gm: GameMap, tile: TileRef) => boolean {
return (gm: GameMap, n: TileRef) => gm.euclideanDist(root, n) <= dist; return (gm: GameMap, n: TileRef) => {
// shifts the root tiles coordinates by -0.5 so that its “center”
// center becomes the corner of four pixels rather than the middle of one pixel.
// just makes things based off even pixels instead of odd. Used to use 9x9 icons now 10x10 icons etc...
const rootX = gm.x(root) - 0.5;
const rootY = gm.y(root) - 0.5;
const dx = gm.x(n) - rootX;
const dy = gm.y(n) - rootY;
return Math.sqrt(dx * dx + dy * dy) <= dist;
};
} }
export function manhattanDistFN( export function manhattanDistFN(