From 07074046e616bbbc3716a4a7070222d03cf73c61 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 5 May 2020 14:28:37 -0400 Subject: [PATCH] Cleanup --- core/assets/fonts/tech.ttf | Bin 0 -> 11336 bytes core/src/mindustry/game/EventType.java | 97 +++++------------- core/src/mindustry/graphics/Drawf.java | 23 +++++ core/src/mindustry/input/Placement.java | 8 +- .../maps/generators/BasicGenerator.java | 6 +- core/src/mindustry/ui/Fonts.java | 5 + 6 files changed, 56 insertions(+), 83 deletions(-) create mode 100644 core/assets/fonts/tech.ttf diff --git a/core/assets/fonts/tech.ttf b/core/assets/fonts/tech.ttf new file mode 100644 index 0000000000000000000000000000000000000000..273716fb71ef083285ad69a203af4cd09a986c6b GIT binary patch literal 11336 zcmZQzWME+6VrXDsW>D}C);D6A#-YW)z`ciofgvF|H?iO!&;N7=28J~Z42)OOb1KtR z&3C+JVBoP~V32FbNKH(M7x+Jcfq|)kfq}s+BO^7Dnc@E*1_q`b3=9k^8M!4DLI3}+ zWnf^s!@$7Uk&~aC$iU#Vnt?%U4+8^ZPi|sG0YlRNgA5ETDGUq@3VDgSscIj4UNJDR zv@kHRTNLCMmoPB>|I5I@BLk9WU|?WkU|?WoU|XJ^ggb&zS!22iv!a4;}IS^&qohVqi9sJ3)LBPdxz`)?ccn`{EWRPIeg0h(y_?VoaY-R>MrT{3Lg+YU<4$5X_ z5Mx>fWwS9zFztb|*%>OBu0Yuw3|h=SP&Oxn9&;I#&BYMKyadYTX3%5)2W9gxB(Uf} z*}Mz^EIm**A43ew9VlCvA&Aui!e(S(5Mb?c&M&Ae%1qBFQSi-7&Pa4pknu~+FDy+h z$(L2|%P&vNRxmO!G;&ES$}UMw&QS1i2?|P0FU?6Ta?8&v2`(urO)gPDmPKYOK$V82 z78Pga=P4NK8Nj4lW8SqpN%)RCVG<%z`#Nu`-N zB?{%4B^eNlz{YSv4K6P)*8>}#kzW8Z8Y&DH0xJXwB3YlApI5A3oRMFyZ*FL6VPNT8 z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W`5+F9je;9oN#s~it7!w#d{#QT-LKqi-dK#c!94Joz{rF$; zf5X2AjNpt6uIa%3fc7CV(iSKqGhSd|01tIsK(yqcj)SKuc#9sIR>5NcSke|KEr2}p z7n;*S9s)J6VdgO~fL*D8Xgfj5bg28l>7JS4F9Rr@L##rSWw`7FB?yomFgwBN86*fc z8qwPR4;ygqX?j=29-ack{cBFqisM?eS@bB2yRh; zLmAqh#b^UQ_`d+$c!q>I{n~)wa*wF~FnH`7UW$PAf!iP$B^)?)fZIs0bOy<DG91*?fwo5ntgQ%gEvUQzTe7<^$!O{}qfJj0vDV z26VCt)MZm(2w>=7!&fN0Q= z&%YTApvE_7>Hsvf0ctmaQUP%g@J*&fPsN|4+8^>3IhX62?GPm3!2JZWPL`*Gfq~}@0|Rda0|W0F z1_s^_3=Di43=Did3=Dib7#R3v7#R3l7#R33Ffa(nFfa(zFfa(5U|tSFJ`@p~;9>c&Oeu05Of`frUB7}iKVh00*#1jSvNe>1F$qft) zl7AQ&q&yfHq*gF6NPS^okal5Ukgj21kUqn}Aj8AJAXC7=AoGTSLDqtSLAHZ|LG}a# OgX|jy200zjT3`S;(_%3I literal 0 HcmV?d00001 diff --git a/core/src/mindustry/game/EventType.java b/core/src/mindustry/game/EventType.java index 036a7417e2..03a40e9c13 100644 --- a/core/src/mindustry/game/EventType.java +++ b/core/src/mindustry/game/EventType.java @@ -33,10 +33,31 @@ public class EventType{ } public static class WinEvent{} - public static class LoseEvent{} - public static class LaunchEvent{} + public static class ResizeEvent{} + public static class MapMakeEvent{} + public static class MapPublishEvent{} + public static class SaveLoadEvent{} + public static class ClientCreateEvent{} + public static class ServerLoadEvent{} + public static class ContentReloadEvent{} + public static class DisposeEvent{} + public static class PlayEvent{} + public static class ResetEvent{} + public static class WaveEvent{} + /** Called when the player places a line, mobile or desktop.*/ + public static class LineConfirmEvent{} + /** Called when a turret recieves ammo, but only when the tutorial is active! */ + public static class TurretAmmoDeliverEvent{} + /** Called when a core recieves ammo, but only when the tutorial is active! */ + public static class CoreItemDeliverEvent{} + /** Called when the player opens info for a specific block.*/ + public static class BlockInfoEvent{} + /** Called when the client game is first loaded. */ + public static class ClientLoadEvent{} + /** Called when a game begins and the world is loaded. */ + public static class WorldLoadEvent{} public static class LaunchItemEvent{ public final ItemStack stack; @@ -46,10 +67,6 @@ public class EventType{ } } - public static class MapMakeEvent{} - - public static class MapPublishEvent{} - public static class CommandIssueEvent{ public final Tilec tile; public final UnitCommand command; @@ -91,63 +108,6 @@ public class EventType{ } } - public static class SaveLoadEvent{ - - } - - public static class ClientCreateEvent{ - - } - - /** Called when the client game is first loaded. */ - public static class ClientLoadEvent{ - - } - - public static class ServerLoadEvent{ - - } - - public static class ContentReloadEvent{ - - } - - public static class DisposeEvent{ - - } - - public static class PlayEvent{ - - } - - public static class ResetEvent{ - - } - - public static class WaveEvent{ - - } - - /** Called when the player places a line, mobile or desktop.*/ - public static class LineConfirmEvent{ - - } - - /** Called when a turret recieves ammo, but only when the tutorial is active! */ - public static class TurretAmmoDeliverEvent{ - - } - - /** Called when a core recieves ammo, but only when the tutorial is active! */ - public static class CoreItemDeliverEvent{ - - } - - /** Called when the player opens info for a specific block.*/ - public static class BlockInfoEvent{ - - } - /** Called when the player withdraws items from a block. */ public static class WithdrawEvent{ public final Tilec tile; @@ -210,11 +170,6 @@ public class EventType{ } } - /** Called when a game begins and the world is loaded. */ - public static class WorldLoadEvent{ - - } - /** Called from the logic thread. Do not access graphics here! */ public static class TileChangeEvent{ public final Tile tile; @@ -323,10 +278,6 @@ public class EventType{ } } - public static class ResizeEvent{ - - } - //TODO rename public static class MechChangeEvent{ public final Playerc player; @@ -383,7 +334,6 @@ public class EventType{ public static class PlayerIpBanEvent{ public final String ip; - public PlayerIpBanEvent(String ip){ this.ip = ip; } @@ -392,7 +342,6 @@ public class EventType{ public static class PlayerIpUnbanEvent{ public final String ip; - public PlayerIpUnbanEvent(String ip){ this.ip = ip; } diff --git a/core/src/mindustry/graphics/Drawf.java b/core/src/mindustry/graphics/Drawf.java index 20f80e2478..cc42e6ee1d 100644 --- a/core/src/mindustry/graphics/Drawf.java +++ b/core/src/mindustry/graphics/Drawf.java @@ -17,6 +17,29 @@ import static mindustry.Vars.*; public class Drawf{ + //an experiment, to be removed + public static void runes(float x, float y, int[] text){ + int height = 6, width = 5; + float scale = 3; + float th = height * scale, tw = width * scale; + float skewx = width * scale, skewy = 0; + + Draw.color(Pal.accent); + + for(int i = 0; i < text.length; i++){ + float ox = x + i*tw*width; + + for(int j = 0; j < width * height; j++){ + int cx = j % width, cy = j / width; + float rx = ox + cx * tw + skewx * cy, ry = y + cy * th; + + if((text[i] & (1 << j)) != 0){ + Fill.quad(rx, ry, rx + tw, ry, rx + tw + skewx, ry + th + skewy, rx + skewx, ry + th + skewy); + } + } + } + } + public static float text(){ float z = Draw.z(); if(renderer.pixelator.enabled()){ diff --git a/core/src/mindustry/input/Placement.java b/core/src/mindustry/input/Placement.java index f3cd55048d..f1c9d131b6 100644 --- a/core/src/mindustry/input/Placement.java +++ b/core/src/mindustry/input/Placement.java @@ -1,14 +1,12 @@ package mindustry.input; import arc.*; -import arc.struct.*; import arc.math.*; import arc.math.geom.*; +import arc.struct.*; import arc.util.pooling.*; import mindustry.world.*; -import java.util.*; - import static mindustry.Vars.*; public class Placement{ @@ -97,10 +95,10 @@ public class Placement{ int nodeLimit = 1000; int totalNodes = 0; - PriorityQueue queue = new PriorityQueue<>(10, (a, b) -> Float.compare(costs.get(a.pos(), 0f) + distanceHeuristic(a.x, a.y, end.x, end.y), costs.get(b.pos(), 0f) + distanceHeuristic(b.x, b.y, end.x, end.y))); + PQueue queue = new PQueue<>(10, (a, b) -> Float.compare(costs.get(a.pos(), 0f) + distanceHeuristic(a.x, a.y, end.x, end.y), costs.get(b.pos(), 0f) + distanceHeuristic(b.x, b.y, end.x, end.y))); queue.add(start); boolean found = false; - while(!queue.isEmpty() && totalNodes++ < nodeLimit){ + while(!queue.empty() && totalNodes++ < nodeLimit){ Tile next = queue.poll(); float baseCost = costs.get(next.pos(), 0f); if(next == end){ diff --git a/core/src/mindustry/maps/generators/BasicGenerator.java b/core/src/mindustry/maps/generators/BasicGenerator.java index cf9c1c0e36..f756a149b0 100644 --- a/core/src/mindustry/maps/generators/BasicGenerator.java +++ b/core/src/mindustry/maps/generators/BasicGenerator.java @@ -9,8 +9,6 @@ import mindustry.*; import mindustry.content.*; import mindustry.world.*; -import java.util.*; - import static mindustry.Vars.*; public abstract class BasicGenerator implements WorldGenerator{ @@ -319,10 +317,10 @@ public abstract class BasicGenerator implements WorldGenerator{ Tile end = tiles.getn(endX, endY); GridBits closed = new GridBits(width, height); IntFloatMap costs = new IntFloatMap(); - PriorityQueue queue = new PriorityQueue<>(tiles.width * tiles.height / 4, Structs.comparingFloat(a -> costs.get(a.pos(), 0f) + dh.cost(a.x, a.y, end.x, end.y))); + PQueue queue = new PQueue<>(tiles.width * tiles.height / 4, Structs.comparingFloat(a -> costs.get(a.pos(), 0f) + dh.cost(a.x, a.y, end.x, end.y))); queue.add(start); boolean found = false; - while(!queue.isEmpty()){ + while(!queue.empty()){ Tile next = queue.poll(); float baseCost = costs.get(next.pos(), 0f); if(next == end){ diff --git a/core/src/mindustry/ui/Fonts.java b/core/src/mindustry/ui/Fonts.java index 7c847c0838..05317bc276 100644 --- a/core/src/mindustry/ui/Fonts.java +++ b/core/src/mindustry/ui/Fonts.java @@ -32,6 +32,7 @@ public class Fonts{ public static BitmapFont outline; public static BitmapFont chat; public static BitmapFont icon; + public static BitmapFont tech; public static int getUnicode(String content){ return unicodeIcons.get(content, 0); @@ -135,6 +136,10 @@ public class Fonts{ }}; Core.assets.load("outline", BitmapFont.class, new FreeTypeFontLoaderParameter("fonts/font.ttf", param)).loaded = t -> Fonts.outline = (BitmapFont)t; + + Core.assets.load("tech", BitmapFont.class, new FreeTypeFontLoaderParameter("fonts/tech.ttf", new FreeTypeFontParameter(){{ + size = 18; + }})).loaded = f -> Fonts.tech = (BitmapFont)f; } /** Merges the UI and font atlas together for better performance. */