Merge pull request #372 from UniquePassive/overlay-layers
Add overlay layers
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.api;
|
||||||
|
|
||||||
|
public interface BufferProvider
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -174,4 +174,6 @@ public interface Client
|
|||||||
|
|
||||||
List<Projectile> getProjectiles();
|
List<Projectile> getProjectiles();
|
||||||
|
|
||||||
|
|
||||||
|
BufferProvider getBufferProvider();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,10 +44,12 @@ import net.runelite.api.MessageNode;
|
|||||||
import net.runelite.api.PacketBuffer;
|
import net.runelite.api.PacketBuffer;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.Projectile;
|
import net.runelite.api.Projectile;
|
||||||
|
import net.runelite.api.Region;
|
||||||
import net.runelite.client.RuneLite;
|
import net.runelite.client.RuneLite;
|
||||||
import net.runelite.client.chat.ChatMessageManager;
|
import net.runelite.client.chat.ChatMessageManager;
|
||||||
import net.runelite.client.game.DeathChecker;
|
import net.runelite.client.game.DeathChecker;
|
||||||
import net.runelite.client.task.Scheduler;
|
import net.runelite.client.task.Scheduler;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayRenderer;
|
import net.runelite.client.ui.overlay.OverlayRenderer;
|
||||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||||
|
|
||||||
@@ -104,7 +106,39 @@ public class Hooks
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
renderer.render(graphics2d);
|
renderer.render(graphics2d, OverlayLayer.ALWAYS_ON_TOP);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.warn("Error during overlay rendering", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void drawRegion(Region region, int var1, int var2, int var3, int var4, int var5, int var6)
|
||||||
|
{
|
||||||
|
MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider();
|
||||||
|
BufferedImage image = (BufferedImage) bufferProvider.getImage();
|
||||||
|
Graphics2D graphics2d = (Graphics2D) image.getGraphics();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
renderer.render(graphics2d, OverlayLayer.UNDER_WIDGETS);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.warn("Error during overlay rendering", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void drawAfterWidgets()
|
||||||
|
{
|
||||||
|
MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider();
|
||||||
|
BufferedImage image = (BufferedImage) bufferProvider.getImage();
|
||||||
|
Graphics2D graphics2d = (Graphics2D) image.getGraphics();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
renderer.render(graphics2d, OverlayLayer.ABOVE_WIDGETS);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import net.runelite.api.Client;
|
|||||||
import net.runelite.api.Perspective;
|
import net.runelite.api.Perspective;
|
||||||
import net.runelite.api.Projectile;
|
import net.runelite.api.Projectile;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
|
||||||
public class AoeWarningOverlay extends Overlay
|
public class AoeWarningOverlay extends Overlay
|
||||||
@@ -53,6 +54,7 @@ public class AoeWarningOverlay extends Overlay
|
|||||||
public AoeWarningOverlay(@Nullable Client client, AoeWarningPlugin plugin, AoeWarningConfig config)
|
public AoeWarningOverlay(@Nullable Client client, AoeWarningPlugin plugin, AoeWarningConfig config)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setLayer(OverlayLayer.UNDER_WIDGETS);
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import net.runelite.api.widgets.Widget;
|
|||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
import net.runelite.api.widgets.WidgetItem;
|
import net.runelite.api.widgets.WidgetItem;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
|
|
||||||
@@ -85,9 +86,7 @@ public class DevToolsOverlay extends Overlay
|
|||||||
public DevToolsOverlay(@Nullable Client client, DevToolsPlugin plugin)
|
public DevToolsOverlay(@Nullable Client client, DevToolsPlugin plugin)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
setDrawOverBankScreen(true);
|
setLayer(OverlayLayer.ALWAYS_ON_TOP);
|
||||||
setDrawOverClickToPlayScreen(true);
|
|
||||||
setDrawOverLoginScreen(true);
|
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import net.runelite.api.NPC;
|
|||||||
import net.runelite.api.queries.NPCQuery;
|
import net.runelite.api.queries.NPCQuery;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
import net.runelite.client.util.QueryRunner;
|
import net.runelite.client.util.QueryRunner;
|
||||||
@@ -55,6 +56,7 @@ class FishingSpotOverlay extends Overlay
|
|||||||
public FishingSpotOverlay(QueryRunner queryRunner, FishingConfig config)
|
public FishingSpotOverlay(QueryRunner queryRunner, FishingConfig config)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setLayer(OverlayLayer.UNDER_WIDGETS);
|
||||||
this.queryRunner = queryRunner;
|
this.queryRunner = queryRunner;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import net.runelite.api.widgets.Widget;
|
|||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.ui.FontManager;
|
import net.runelite.client.ui.FontManager;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.http.api.item.ItemPrice;
|
import net.runelite.http.api.item.ItemPrice;
|
||||||
|
|
||||||
@@ -95,6 +96,7 @@ public class GroundItemsOverlay extends Overlay
|
|||||||
public GroundItemsOverlay(@Nullable Client client, GroundItemsConfig config)
|
public GroundItemsOverlay(@Nullable Client client, GroundItemsConfig config)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setLayer(OverlayLayer.UNDER_WIDGETS);
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import javax.inject.Inject;
|
|||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,6 +72,7 @@ public class TrapOverlay extends Overlay
|
|||||||
TrapOverlay(@Nullable Client client, HunterPlugin plugin, HunterConfig config)
|
TrapOverlay(@Nullable Client client, HunterPlugin plugin, HunterConfig config)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setLayer(OverlayLayer.UNDER_WIDGETS);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import net.runelite.api.NpcID;
|
|||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.queries.NPCQuery;
|
import net.runelite.api.queries.NPCQuery;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.util.QueryRunner;
|
import net.runelite.client.util.QueryRunner;
|
||||||
|
|
||||||
@@ -64,6 +65,7 @@ public class ImplingsOverlay extends Overlay
|
|||||||
public ImplingsOverlay(QueryRunner queryRunner, ImplingsConfig config)
|
public ImplingsOverlay(QueryRunner queryRunner, ImplingsConfig config)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setLayer(OverlayLayer.UNDER_WIDGETS);
|
||||||
this.queryRunner = queryRunner;
|
this.queryRunner = queryRunner;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ import static net.runelite.client.plugins.instancemap.WallOffset.NONE;
|
|||||||
import static net.runelite.client.plugins.instancemap.WallOffset.TOP_LEFT;
|
import static net.runelite.client.plugins.instancemap.WallOffset.TOP_LEFT;
|
||||||
import static net.runelite.client.plugins.instancemap.WallOffset.TOP_RIGHT;
|
import static net.runelite.client.plugins.instancemap.WallOffset.TOP_RIGHT;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
|
||||||
class InstanceMapOverlay extends Overlay
|
class InstanceMapOverlay extends Overlay
|
||||||
@@ -114,6 +115,7 @@ class InstanceMapOverlay extends Overlay
|
|||||||
InstanceMapOverlay(@Nullable Client client, InstanceMapConfig config, InstanceMapPlugin plugin)
|
InstanceMapOverlay(@Nullable Client client, InstanceMapConfig config, InstanceMapPlugin plugin)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setLayer(OverlayLayer.ALWAYS_ON_TOP);
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ class JewelleryCountOverlay extends Overlay
|
|||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
this.queryRunner = queryRunner;
|
this.queryRunner = queryRunner;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.setDrawOverBankScreen(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ class MouseHighlightOverlay extends Overlay
|
|||||||
this.client = client;
|
this.client = client;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.tooltipManager = tooltipManager;
|
this.tooltipManager = tooltipManager;
|
||||||
this.setDrawOverBankScreen(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
|
|
||||||
@@ -50,6 +51,7 @@ public class PlayerIndicatorsOverlay extends Overlay
|
|||||||
this.config = config;
|
this.config = config;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setLayer(OverlayLayer.UNDER_WIDGETS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ public class BindNeckOverlay extends Overlay
|
|||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
this.queryRunner = queryRunner;
|
this.queryRunner = queryRunner;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.setDrawOverBankScreen(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ public class RunecraftOverlay extends Overlay
|
|||||||
this.queryRunner = queryRunner;
|
this.queryRunner = queryRunner;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.setDrawOverBankScreen(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ public class RunepouchOverlay extends Overlay
|
|||||||
this.queryRunner = queryRunner;
|
this.queryRunner = queryRunner;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.setDrawOverBankScreen(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import net.runelite.api.Client;
|
|||||||
import net.runelite.api.Perspective;
|
import net.runelite.api.Perspective;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
@@ -47,6 +48,7 @@ public class TileIndicatorsOverlay extends Overlay
|
|||||||
this.config = config;
|
this.config = config;
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
setPriority(OverlayPriority.LOW);
|
setPriority(OverlayPriority.LOW);
|
||||||
|
setLayer(OverlayLayer.UNDER_WIDGETS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import net.runelite.api.Prayer;
|
|||||||
import net.runelite.api.Region;
|
import net.runelite.api.Region;
|
||||||
import net.runelite.api.Tile;
|
import net.runelite.api.Tile;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
|
|
||||||
@@ -71,6 +72,7 @@ public class VolcanicMineOverlay extends Overlay
|
|||||||
VolcanicMineOverlay(@Nullable Client client, VolcanicMinePlugin plugin, VolcanicMineConfig config)
|
VolcanicMineOverlay(@Nullable Client client, VolcanicMinePlugin plugin, VolcanicMineConfig config)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setLayer(OverlayLayer.UNDER_WIDGETS);
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|||||||
@@ -31,7 +31,5 @@ public abstract class Overlay implements RenderableEntity
|
|||||||
{
|
{
|
||||||
private OverlayPosition position = OverlayPosition.TOP_LEFT;
|
private OverlayPosition position = OverlayPosition.TOP_LEFT;
|
||||||
private OverlayPriority priority = OverlayPriority.NONE;
|
private OverlayPriority priority = OverlayPriority.NONE;
|
||||||
private boolean drawOverLoginScreen = false;
|
private OverlayLayer layer = OverlayLayer.ABOVE_WIDGETS;
|
||||||
private boolean drawOverBankScreen = false;
|
|
||||||
private boolean drawOverClickToPlayScreen = false;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, UniquePassive <https://github.com/uniquepassive>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.ui.overlay;
|
||||||
|
|
||||||
|
public enum OverlayLayer
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Render overlay above all game elements
|
||||||
|
*/
|
||||||
|
ALWAYS_ON_TOP,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render under all interfaces
|
||||||
|
*/
|
||||||
|
UNDER_WIDGETS,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render under the right-click menu
|
||||||
|
*/
|
||||||
|
ABOVE_WIDGETS
|
||||||
|
}
|
||||||
@@ -173,7 +173,7 @@ public class OverlayRenderer
|
|||||||
surfaceGraphics = subGraphics;
|
surfaceGraphics = subGraphics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(Graphics2D graphics)
|
public void render(Graphics2D graphics, OverlayLayer layer)
|
||||||
{
|
{
|
||||||
final Client client = clientProvider.get();
|
final Client client = clientProvider.get();
|
||||||
|
|
||||||
@@ -182,6 +182,16 @@ public class OverlayRenderer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (client.getGameState() != GameState.LOGGED_IN)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) != null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final Widget viewport = client.getViewportWidget();
|
final Widget viewport = client.getViewportWidget();
|
||||||
final Rectangle bounds = viewport != null
|
final Rectangle bounds = viewport != null
|
||||||
? new Rectangle(viewport.getBounds())
|
? new Rectangle(viewport.getBounds())
|
||||||
@@ -204,7 +214,7 @@ public class OverlayRenderer
|
|||||||
rightChatboxPoint.move(bounds.x + chatboxBounds.width - BORDER_RIGHT,bounds.y + bounds.height - BORDER_BOTTOM);
|
rightChatboxPoint.move(bounds.x + chatboxBounds.width - BORDER_RIGHT,bounds.y + bounds.height - BORDER_BOTTOM);
|
||||||
|
|
||||||
overlays.stream()
|
overlays.stream()
|
||||||
.filter(overlay -> shouldDrawOverlay(client, overlay))
|
.filter(overlay -> overlay.getLayer() == layer)
|
||||||
.forEach(overlay ->
|
.forEach(overlay ->
|
||||||
{
|
{
|
||||||
OverlayPosition overlayPosition = overlay.getPosition();
|
OverlayPosition overlayPosition = overlay.getPosition();
|
||||||
@@ -282,12 +292,4 @@ public class OverlayRenderer
|
|||||||
subGraphics.dispose();
|
subGraphics.dispose();
|
||||||
return dimension;
|
return dimension;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldDrawOverlay(Client client, Overlay overlay)
|
|
||||||
{
|
|
||||||
return client != null
|
|
||||||
&& (overlay.isDrawOverLoginScreen() || client.getGameState() == GameState.LOGGED_IN)
|
|
||||||
&& (overlay.isDrawOverClickToPlayScreen() || client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) == null)
|
|
||||||
&& (overlay.isDrawOverBankScreen() || client.getWidget(WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER) == null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.rs.api;
|
||||||
|
|
||||||
|
import net.runelite.api.BufferProvider;
|
||||||
|
|
||||||
|
public interface RSBufferProvider extends BufferProvider
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
package net.runelite.rs.api;
|
package net.runelite.rs.api;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import net.runelite.api.BufferProvider;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.mapping.Construct;
|
import net.runelite.mapping.Construct;
|
||||||
import net.runelite.mapping.Import;
|
import net.runelite.mapping.Import;
|
||||||
@@ -350,4 +351,8 @@ public interface RSClient extends RSGameEngine, Client
|
|||||||
@Import("isIgnored")
|
@Import("isIgnored")
|
||||||
@Override
|
@Override
|
||||||
boolean isIgnored(String name);
|
boolean isIgnored(String name);
|
||||||
|
|
||||||
|
@Import("rasterProvider")
|
||||||
|
@Override
|
||||||
|
BufferProvider getBufferProvider();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import java.awt.Image;
|
|||||||
import net.runelite.api.MainBufferProvider;
|
import net.runelite.api.MainBufferProvider;
|
||||||
import net.runelite.mapping.Import;
|
import net.runelite.mapping.Import;
|
||||||
|
|
||||||
public interface RSMainBufferProvider extends MainBufferProvider
|
public interface RSMainBufferProvider extends RSBufferProvider, MainBufferProvider
|
||||||
{
|
{
|
||||||
@Import("image")
|
@Import("image")
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user