From 79bf77f4becd473b7f9f187e7caba5dbaa1404f9 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 31 Jul 2021 18:23:22 -0400 Subject: [PATCH] WIP team icons --- core/assets-raw/sprites/teams/team-crux.png | Bin 0 -> 479 bytes core/assets-raw/sprites/teams/team-derelict.png | Bin 0 -> 608 bytes core/assets-raw/sprites/teams/team-sharded.png | Bin 0 -> 404 bytes core/assets/bundles/bundle.properties | 2 +- core/assets/icons/icons.properties | 3 +++ .../src/mindustry/entities/comp/BuildingComp.java | 5 +++-- core/src/mindustry/game/Team.java | 1 + core/src/mindustry/ui/Fonts.java | 7 +++++++ tools/src/mindustry/tools/Generators.java | 13 +++++++++++++ tools/src/mindustry/tools/ImagePacker.java | 4 ++++ 10 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 core/assets-raw/sprites/teams/team-crux.png create mode 100644 core/assets-raw/sprites/teams/team-derelict.png create mode 100644 core/assets-raw/sprites/teams/team-sharded.png diff --git a/core/assets-raw/sprites/teams/team-crux.png b/core/assets-raw/sprites/teams/team-crux.png new file mode 100644 index 0000000000000000000000000000000000000000..4fb6783a5b49b3fdced9de4860670f644459bb28 GIT binary patch literal 479 zcmV<50U-W~P)Px$nMp)JRA_6TW-OZg^|5yI0!@Z%efLJ-gs7NwS-m174n>x^t`HrNMWPDacd4IlN0|n>ihF3rXMa$}fS3v_CUR@2Zga$U7 z6cxN08dz{{EI8(mhK!n)o`wtF1q~#;x*FaI4J4Zs6}%f75RINPARW+va00_JF|w1R zR*nZ=nd8{P zwy6#~V2CwuSIzO}f}cuNc=fn?F7c|xoWL+N7xi7*nZPjhZ~u(brpHs=b&N)TT)#4R VR6xSYBdGuY002ovPDHLkV1nRP+=u`G literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/teams/team-derelict.png b/core/assets-raw/sprites/teams/team-derelict.png new file mode 100644 index 0000000000000000000000000000000000000000..38ac90dcb1ad7df85191e10d4c509c68634ec97e GIT binary patch literal 608 zcmV-m0-ybfP)Px%8c9S!RA_m6Or6gw(O{5V1M4Tf# zn`k1Ta0zi#eD z?izmz-uo>}v}Y_8;okbo6g}c%>d!Th3ViAt1w?$` zP4&^?rT06Euo2giytd~)U!i@_;l=LIjcQ zw!@f9TF4{kCc?8edl&|E_S0Xz|*zym|r- zI8Y&?M<}u!e0000Px$PDw;TRA_M9b31rS0AA%u7sjoGaC z-dk&@J$vunyWiDbr)%#n9OYMN1$m12o=CNPy7-wurF^QmXYeZdH1WuRGvrgmM+V&n zAs^=fH@n$;u! zy%|@6-8G{NG6t=XA1clqkS*^nTrHg3?XlH)ikJhjdR-P&{Qej{mpS#=y$=smN;78o z%x?TtbgEYkP}Os(OAND@0*r@OMpomMHz~#|Z%d6=K8P@?MMm4*IriztH?)60|{9@Lq1v>NXqKf-?zB-9VuqZXGsIeS$#%6QyL&- y^*i#}(f}!|kH|Bm0b*A7$g`w{5JCtc9?2KLaX>vL4JF3_0000{ public final int id; public final Color color; public final Color[] palette; + public String emoji = ""; public boolean hasPalette; public String name; diff --git a/core/src/mindustry/ui/Fonts.java b/core/src/mindustry/ui/Fonts.java index 7beff27396..bbd55bbd95 100644 --- a/core/src/mindustry/ui/Fonts.java +++ b/core/src/mindustry/ui/Fonts.java @@ -21,6 +21,7 @@ import arc.util.*; import mindustry.*; import mindustry.core.*; import mindustry.ctype.*; +import mindustry.game.*; import mindustry.gen.*; import java.util.*; @@ -155,6 +156,12 @@ public class Fonts{ } } }); + + for(Team team : Team.baseTeams){ + if(Core.atlas.has("team-" + team.name)){ + team.emoji = stringIcons.get(team.name, ""); + } + } } /** Called from a static context for use in the loading screen.*/ diff --git a/tools/src/mindustry/tools/Generators.java b/tools/src/mindustry/tools/Generators.java index c78e7dbb5f..dd2867172a 100644 --- a/tools/src/mindustry/tools/Generators.java +++ b/tools/src/mindustry/tools/Generators.java @@ -390,6 +390,19 @@ public class Generators{ } }); + generate("team-icons", () -> { + for(Team team : Team.all){ + if(has("team-" + team.name)){ + int rgba = team == Team.derelict ? Color.valueOf("b7b8c9").rgba() : team.color.rgba(); + Pixmap base = get("team-" + team.name); + base.each((x, y) -> base.setRaw(x, y, Color.muli(base.getRaw(x, y), rgba))); + + delete("team-" + team.name); + save(base.outline(Pal.gray, 3), "../ui/team-" + team.name); + } + } + }); + generate("unit-icons", () -> content.units().each(type -> { if(type.isHidden()) return; //hidden units don't generate diff --git a/tools/src/mindustry/tools/ImagePacker.java b/tools/src/mindustry/tools/ImagePacker.java index 0df257f52f..68a06a2f66 100644 --- a/tools/src/mindustry/tools/ImagePacker.java +++ b/tools/src/mindustry/tools/ImagePacker.java @@ -236,6 +236,10 @@ public class ImagePacker{ base.draw(image, 0, 0, image.width, image.height, base.width/2 - wx/2, base.height/2 - wy/2, wx, wy, true, true); } + static void delete(String name){ + ((GenRegion)Core.atlas.find(name)).path.delete(); + } + static void replace(String name, Pixmap image){ Fi.get(name + ".png").writePng(image); ((GenRegion)Core.atlas.find(name)).path.delete();