From ca519a94afd7a27aef22004575c5ec8c7bd48a62 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 17 Jan 2020 18:29:18 -0500 Subject: [PATCH] Font improvements --- core/assets-raw/fontgen/config.json | 20 +++-- core/assets-raw/fontgen/icons/host.svg | 72 ++++++++++++++++++ core/assets/fonts/icon.ttf | Bin 31244 -> 31396 bytes core/src/mindustry/Vars.java | 2 +- core/src/mindustry/ui/Fonts.java | 11 ++- .../mindustry/ui/dialogs/DatabaseDialog.java | 8 +- .../mindustry/ui/dialogs/PausedDialog.java | 20 ++--- .../ui/fragments/PlacementFragment.java | 8 +- gradle.properties | 2 +- 9 files changed, 121 insertions(+), 22 deletions(-) create mode 100644 core/assets-raw/fontgen/icons/host.svg diff --git a/core/assets-raw/fontgen/config.json b/core/assets-raw/fontgen/config.json index d571bc5760..4f1803a429 100644 --- a/core/assets-raw/fontgen/config.json +++ b/core/assets-raw/fontgen/config.json @@ -404,12 +404,6 @@ "code": 61741, "src": "fontawesome" }, - { - "uid": "9396b2d8849e0213a0f11c5fd7fcc522", - "css": "host", - "code": 61614, - "src": "fontawesome" - }, { "uid": "51727ca007aa35ceabcaffc28934faee", "css": "book-open", @@ -779,6 +773,20 @@ "search": [ "book" ] + }, + { + "uid": "ceb9cde822ac23f35c3bd67a8d0c4fac", + "css": "host", + "code": 59437, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M11.4 56.8Q22.7 22.7 56.8 11.4 90.9 0 136.4 0 181.8 0 227.3 0 272.7 0 318.2 0 363.6 0 409.1 0 454.5 0 500 0 545.5 0 590.9 0 636.4 0 681.8 0 727.3 0 772.7 0 818.2 0 863.6 0 909.1 0 954.5 0 1000 0 1034.1 11.4 1068.2 22.7 1079.5 56.8 1090.9 90.9 1090.9 136.4 1090.9 181.8 1079.5 215.9 1068.2 250 1034.1 261.4 1000 272.7 954.5 272.7 909.1 272.7 863.6 272.7 818.2 272.7 772.7 272.7 727.3 272.7 681.8 272.7 636.4 272.7 590.9 272.7 545.5 272.7 500 272.7 454.5 272.7 409.1 272.7 363.6 272.7 318.2 272.7 272.7 272.7 227.3 272.7 181.8 272.7 136.4 272.7 90.9 272.7 56.8 261.4 22.7 250 11.4 215.9 0 181.8 0 136.4 0 90.9 11.4 56.8M409.1 181.8Q454.5 181.8 488.6 170.5 522.7 159.1 522.7 136.4 522.7 113.6 488.6 102.3 454.5 90.9 409.1 90.9 363.6 90.9 318.2 90.9 272.7 90.9 227.3 90.9 181.8 90.9 147.7 102.3 113.6 113.6 113.6 136.4 113.6 159.1 147.7 170.5 181.8 181.8 227.3 181.8 272.7 181.8 318.2 181.8 363.6 181.8 409.1 181.8M840.9 136.4Q840.9 159.1 863.6 159.1 886.4 159.1 886.4 136.4 886.4 113.6 863.6 113.6 840.9 113.6 840.9 136.4M11.4 420.5Q22.7 386.4 56.8 375 90.9 363.6 136.4 363.6 181.8 363.6 227.3 363.6 272.7 363.6 318.2 363.6 363.6 363.6 409.1 363.6 454.5 363.6 500 363.6 545.5 363.6 590.9 363.6 636.4 363.6 681.8 363.6 727.3 363.6 772.7 363.6 818.2 363.6 863.6 363.6 909.1 363.6 954.5 363.6 1000 363.6 1034.1 375 1068.2 386.4 1079.5 420.5 1090.9 454.5 1090.9 500 1090.9 545.5 1079.5 579.5 1068.2 613.6 1034.1 625 1000 636.4 954.5 636.4 909.1 636.4 863.6 636.4 818.2 636.4 772.7 636.4 727.3 636.4 681.8 636.4 636.4 636.4 590.9 636.4 545.5 636.4 500 636.4 454.5 636.4 409.1 636.4 363.6 636.4 318.2 636.4 272.7 636.4 227.3 636.4 181.8 636.4 136.4 636.4 90.9 636.4 56.8 625 22.7 613.6 11.4 579.5 0 545.5 0 500 0 454.5 11.4 420.5M409.1 545.5Q454.5 545.5 488.6 534.1 522.7 522.7 522.7 500 522.7 477.3 488.6 465.9 454.5 454.5 409.1 454.5 363.6 454.5 318.2 454.5 272.7 454.5 227.3 454.5 181.8 454.5 147.7 465.9 113.6 477.3 113.6 500 113.6 522.7 147.7 534.1 181.8 545.5 227.3 545.5 272.7 545.5 318.2 545.5 363.6 545.5 409.1 545.5M840.9 500Q840.9 522.7 863.6 522.7 886.4 522.7 886.4 500 886.4 477.3 863.6 477.3 840.9 477.3 840.9 500M11.4 784.1Q22.7 750 56.8 738.6 90.9 727.3 136.4 727.3 181.8 727.3 227.3 727.3 272.7 727.3 318.2 727.3 363.6 727.3 409.1 727.3 454.5 727.3 500 727.3 545.5 727.3 590.9 727.3 636.4 727.3 681.8 727.3 727.3 727.3 772.7 727.3 818.2 727.3 863.6 727.3 909.1 727.3 954.5 727.3 1000 727.3 1034.1 738.6 1068.2 750 1079.5 784.1 1090.9 818.2 1090.9 863.6 1090.9 909.1 1079.5 943.2 1068.2 977.3 1034.1 988.6 1000 1000 954.5 1000 909.1 1000 863.6 1000 818.2 1000 772.7 1000 727.3 1000 681.8 1000 636.4 1000 590.9 1000 545.5 1000 500 1000 454.5 1000 409.1 1000 363.6 1000 318.2 1000 272.7 1000 227.3 1000 181.8 1000 136.4 1000 90.9 1000 56.8 988.6 22.7 977.3 11.4 943.2 0 909.1 0 863.6 0 818.2 11.4 784.1M409.1 909.1Q454.5 909.1 488.6 897.7 522.7 886.4 522.7 863.6 522.7 840.9 488.6 829.5 454.5 818.2 409.1 818.2 363.6 818.2 318.2 818.2 272.7 818.2 227.3 818.2 181.8 818.2 147.7 829.5 113.6 840.9 113.6 863.6 113.6 886.4 147.7 897.7 181.8 909.1 227.3 909.1 272.7 909.1 318.2 909.1 363.6 909.1 409.1 909.1M840.9 863.6Q840.9 886.4 863.6 886.4 886.4 886.4 886.4 863.6 886.4 840.9 863.6 840.9 840.9 840.9 840.9 863.6", + "width": 1091 + }, + "search": [ + "host" + ] } ] } \ No newline at end of file diff --git a/core/assets-raw/fontgen/icons/host.svg b/core/assets-raw/fontgen/icons/host.svg new file mode 100644 index 0000000000..e927c7af2f --- /dev/null +++ b/core/assets-raw/fontgen/icons/host.svg @@ -0,0 +1,72 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/core/assets/fonts/icon.ttf b/core/assets/fonts/icon.ttf index e7773351b9aa4ed7d0ef9500108388fc21db0c3a..80724dac8883c01db9ea70a49989d9c151747f6a 100644 GIT binary patch delta 1474 zcmeDA!nous;{@gU8U_Z&00stzu;kpt0?p&=wlXj@h>m1)Ozdrx6t;N)Oni2jq2 znwTOfqq&QLA(e%Jfx#>zBQ=rZ5UU*nL#hn}1A|INZb?P@;jsVJ3=F9W3=E7ja`KZC z{j$td=U|>31kY8L=+ncKrw?o1H%g_W^iC&cmc%>jtmShpqRmlf#HP{Lp_LKU~pz&cmc%> zE({DWpqRmxf#C%dGq^D@yntc`cLs(RP|V=L!0-Z!89W&nUO+K}7X!l!C}!|xV0Zz= z3_c7DFQAygx1NFFg)am%_%SfNfMN!J28I_<%n-o9@B)e%0vQ-yKrurQ1H%g_W(a0r z_@D{F3?U2*A9Nv@A(VmPgB}DkgfTFD(1&1#a0Z4C8yFZqY%b@BQmyA?VECWK;>;Yx zAiyBQpvYjvV8`Ih5W6H77!HzyY-cPaxH2M1R&gCM^E zzhEkZ03V+~G6MqxGb;mgf)FDU10x#~VUx)}JA0KZd18+SauWwkWiLsDiYD#iaOk`+6SbU(Lr<=2rql1;Xv7L#nzK*(z zqJq4fgs7m5khH0hD65#ZupOhZqLCb<2p^-eqLLn?39FHriJCT}5}Syav8srXi4r4` zD(dkW!p-BN%WSOcA};Qt`{%5#i#X#ZM)-t?oyap$4bcM8 zEn;C}lf+JlJ4modL`k$rT1l>uyd;$*H9_i@^c?AZGIBC4vT?HKuZDz`%U6peVKAsiXED28PO(i9ezl+a`xFrW-C{U}RumU|^ibzzk;TFfcQ4F)%PK zVPIh_VqjoUV^CmVVPJcq^CIYj<_G-`>n6WoRN#1__d)Z6?uT`gd6;Y`J20_uGcu?# z)G-`mIL2^la{!YxOT8Wg!wWqI1_ltV&%p3PpMik^L>n+LyZ|{DL>n?Nyf9>7U;xoZ z3=A)f7#J8pv@rw23u6Wb1`ut+!0^I^fq?-;n=&xGFlAt10MTX)3@^+;;l{x5!W@Db zK(qw|!wU-rhI$4N!;*pFg(U+61BkX_V0dB0z`y{atr-|zSTis%fM^>Ah8H#r3=AOJ zmVx1gEdv7sh_+*3cwxuDzyPA{85myJGcYiKXa@#{7Y+;z3?SN(f#HQC0|Ntyc4A<7 z;l#ke0HU24>KR@*GcYhXGcdexfnWv@?aILL!j*x60YtkoFuZVMU|;~z?hFhs+!+`c zK(q$~!wU}v1_luA$-wZ!lYxN&M0+tXyzpXRU;xqH3=A*485kHqv=0Nr3m*ms1`zGb z!0^JCfq}udo`K28I`b3=9k)I*5VcMGyl6 zLl6VQ2TcfO2xegTpbNnaAq)&3^dOial!4)cJ_Iv_F)(~s2f+;C3=AJOFfe@BoX!!Y zy17xmM6I5Uf#Ls8<`>M|49pDd4BQOT4B8CV4Dk*zI*hE`CX8GxGK|ceB8+SdEba{4 z46H2NtZ@u13|yQnTnP-E49rZN%yA4%3>@rC90?5U42%ryjByMMY-}KBGO$H3uraXt zSeYB?YiX#dsS1LC01vCIwyL73qPn7~qH4XdsWPLe2phYilA5}yiJ7>fk(jWk2%9>T zZw}=vL;1#vMq*6XjA{R7U1PHOdxSCd`gKM*F}^D zejP?n)=2#@Ste~M unicodeIcons = new ObjectIntMap<>(); + public static BitmapFont def; public static BitmapFont outline; public static BitmapFont chat; public static BitmapFont icon; + public static int getUnicode(String content){ + return unicodeIcons.get(content, 0); + } + /** Called from a static context to make the cursor appear immediately upon startup.*/ public static void loadSystemCursors(){ SystemCursor.arrow.set(Core.graphics.newCursor("cursor")); @@ -62,12 +68,15 @@ public class Fonts{ while(scan.hasNextLine()){ String line = scan.nextLine(); String[] split = line.split("="); - String character = split[0], texture = split[1].split("\\|")[1]; + String[] nametex = split[1].split("\\|"); + String character = split[0], texture = nametex[1]; int ch = Integer.parseInt(character); TextureRegion region = Core.atlas.find(texture); if(region.getTexture() != uitex) throw new IllegalArgumentException("Font icon '" + texture + "' is not in the UI texture."); + unicodeIcons.put(nametex[0], ch); + Glyph glyph = new Glyph(); glyph.id = ch; glyph.srcX = 0; diff --git a/core/src/mindustry/ui/dialogs/DatabaseDialog.java b/core/src/mindustry/ui/dialogs/DatabaseDialog.java index 5d4c0806bc..f6bb5bb8f1 100644 --- a/core/src/mindustry/ui/dialogs/DatabaseDialog.java +++ b/core/src/mindustry/ui/dialogs/DatabaseDialog.java @@ -1,6 +1,7 @@ package mindustry.ui.dialogs; import arc.*; +import arc.input.*; import arc.struct.*; import arc.graphics.*; import arc.scene.event.*; @@ -65,7 +66,12 @@ public class DatabaseDialog extends FloatingDialog{ } if(unlocked(unlock)){ - image.clicked(() -> Vars.ui.content.show(unlock)); + image.clicked(() -> { + if(Core.input.keyDown(KeyCode.SHIFT_LEFT) && Fonts.getUnicode(unlock.name) != 0){ + Core.app.setClipboardText((char)Fonts.getUnicode(unlock.name) + ""); + } + Vars.ui.content.show(unlock); + }); image.addListener(new Tooltip(t -> t.background(Tex.button).add(unlock.localizedName))); } diff --git a/core/src/mindustry/ui/dialogs/PausedDialog.java b/core/src/mindustry/ui/dialogs/PausedDialog.java index 7bb9153d2a..60abddc270 100644 --- a/core/src/mindustry/ui/dialogs/PausedDialog.java +++ b/core/src/mindustry/ui/dialogs/PausedDialog.java @@ -35,29 +35,29 @@ public class PausedDialog extends FloatingDialog{ }); if(!mobile){ - float dw = 210f; - cont.defaults().width(dw).height(50).pad(5f); + float dw = 220f; + cont.defaults().width(dw).height(55).pad(5f); - cont.addButton("$back", this::hide).colspan(2).width(dw * 2 + 20f); + cont.addImageTextButton("$back", Icon.left, this::hide).colspan(2).width(dw * 2 + 20f); cont.row(); if(world.isZone()){ - cont.addButton("$techtree", ui.tech::show); + cont.addImageTextButton("$techtree", Icon.tree, ui.tech::show); }else{ - cont.addButton("$database", ui.database::show); + cont.addImageTextButton("$database", Icon.book, ui.database::show); } - cont.addButton("$settings", ui.settings::show); + cont.addImageTextButton("$settings", Icon.settings, ui.settings::show); if(!state.rules.tutorial){ if(!world.isZone() && !state.isEditor()){ cont.row(); - cont.addButton("$savegame", save::show); - cont.addButton("$loadgame", load::show).disabled(b -> net.active()); + cont.addImageTextButton("$savegame", Icon.save, save::show); + cont.addImageTextButton("$loadgame", Icon.upload, load::show).disabled(b -> net.active()); } cont.row(); - cont.addButton("$hostserver", () -> { + cont.addImageTextButton("$hostserver", Icon.host, () -> { if(net.server() && steam){ platform.inviteFriends(); }else{ @@ -72,7 +72,7 @@ public class PausedDialog extends FloatingDialog{ cont.row(); - cont.addButton("$quit", this::showQuitConfirm).colspan(2).width(dw + 10f).update(s -> s.setText(control.saves.getCurrent() != null && control.saves.getCurrent().isAutosave() ? "$save.quit" : "$quit")); + cont.addImageTextButton("$quit", Icon.exit, this::showQuitConfirm).colspan(2).width(dw + 20f).update(s -> s.setText(control.saves.getCurrent() != null && control.saves.getCurrent().isAutosave() ? "$save.quit" : "$quit")); }else{ cont.defaults().size(130f).pad(5); diff --git a/core/src/mindustry/ui/fragments/PlacementFragment.java b/core/src/mindustry/ui/fragments/PlacementFragment.java index d77ad977da..c7bf62ec3e 100644 --- a/core/src/mindustry/ui/fragments/PlacementFragment.java +++ b/core/src/mindustry/ui/fragments/PlacementFragment.java @@ -1,14 +1,15 @@ package mindustry.ui.fragments; import arc.*; -import arc.struct.*; import arc.graphics.*; +import arc.input.*; import arc.math.geom.*; import arc.scene.*; import arc.scene.event.*; import arc.scene.style.*; import arc.scene.ui.*; import arc.scene.ui.layout.*; +import arc.struct.*; import arc.util.*; import mindustry.content.*; import mindustry.entities.traits.BuilderTrait.*; @@ -19,7 +20,6 @@ import mindustry.graphics.*; import mindustry.input.*; import mindustry.type.*; import mindustry.ui.*; -import mindustry.ui.Cicon; import mindustry.world.*; import static mindustry.Vars.*; @@ -206,6 +206,10 @@ public class PlacementFragment extends Fragment{ if(unlocked(block)){ control.input.block = control.input.block == block ? null : block; selectedBlocks.put(currentCategory, control.input.block); + + if(Core.input.keyDown(KeyCode.SHIFT_LEFT) && Fonts.getUnicode(block.name) != 0){ + Core.app.setClipboardText((char)Fonts.getUnicode(block.name) + ""); + } } }).size(46f).group(group).name("block-" + block.name).get(); diff --git a/gradle.properties b/gradle.properties index 61a1990c17..8c9218035a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=1d6a93973f44e4ef310cd959168ed611f2dbfef9 +archash=2f9e4392cd2a2db1d0af4f191d2799ac0b71ed10