diff options
author | Jason Mitchell <mitchej@gmail.com> | 2021-01-24 11:55:26 -0800 |
---|---|---|
committer | Jason Mitchell <mitchej@gmail.com> | 2021-01-24 11:55:26 -0800 |
commit | 7308c3ef90505fe6ad9d39b458867eab0ca62a03 (patch) | |
tree | d6a289fb4a55ef27de7cb32cc3f91d6b272228c1 /src/main/java/com/detrav/gui/textures/DetravMapTexture.java | |
parent | eb7e8585e4496cf14893c618f53418905a32fb70 (diff) | |
download | GT5-Unofficial-7308c3ef90505fe6ad9d39b458867eab0ca62a03.tar.gz GT5-Unofficial-7308c3ef90505fe6ad9d39b458867eab0ca62a03.tar.bz2 GT5-Unofficial-7308c3ef90505fe6ad9d39b458867eab0ca62a03.zip |
Double click text selection to invert background
Diffstat (limited to 'src/main/java/com/detrav/gui/textures/DetravMapTexture.java')
-rw-r--r-- | src/main/java/com/detrav/gui/textures/DetravMapTexture.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/com/detrav/gui/textures/DetravMapTexture.java b/src/main/java/com/detrav/gui/textures/DetravMapTexture.java index 56db8717c7..cc866f8d85 100644 --- a/src/main/java/com/detrav/gui/textures/DetravMapTexture.java +++ b/src/main/java/com/detrav/gui/textures/DetravMapTexture.java @@ -20,6 +20,7 @@ public class DetravMapTexture extends AbstractTexture { private String selected = "All"; public int width = -1; public int height = -1; + public boolean invert = false; public DetravMapTexture(ProspectingPacket aPacket) { @@ -27,7 +28,8 @@ public class DetravMapTexture extends AbstractTexture { } private BufferedImage getImage() { - int wh = (packet.size * 2 + 1) * 16; + final int backgroundColor = invert ? Color.GRAY.getRGB() : Color.WHITE.getRGB(); + final int wh = (packet.size * 2 + 1) * 16; BufferedImage image = new BufferedImage(wh, wh, BufferedImage.TYPE_INT_ARGB); WritableRaster raster = image.getRaster(); @@ -36,7 +38,7 @@ public class DetravMapTexture extends AbstractTexture { int playerJ = packet.posZ - (packet.chunkZ - packet.size) * 16 - 1; for (int i = 0; i < wh; i++) { for (int j = 0; j < wh; j++) { - image.setRGB(i, j, Color.WHITE.getRGB()); + image.setRGB(i, j, backgroundColor); if (packet.map[i][j] != null) { if (packet.ptype == 0 || packet.ptype == 1) { for (short meta : packet.map[i][j].values()) { @@ -90,10 +92,15 @@ public class DetravMapTexture extends AbstractTexture { height = packet.getSize(); } } + + public void loadTexture(IResourceManager resourceManager, boolean invert){ + this.invert = invert; + loadTexture(resourceManager); + } - public void loadTexture(IResourceManager resourceManager, String selected){ + public void loadTexture(IResourceManager resourceManager, String selected, boolean invert){ this.selected = selected; - loadTexture(resourceManager); + loadTexture(resourceManager, invert); } public int glBindTexture() { |