Add bounding/clickbox buttons to the devtools plugin
The first button (yellow square) will toggle drawing of 2D bounding boxes The second button (RGB cubeframe) will toggle 3D bounding box drawing The third button (cursor over red square) will toggle clickbox geometry drawing The fourth button (cursor over cubeframe) switches between "draw all 3D bounding boxes" and "draw bounding box for object under cursor" modes of the 3D bounding box drawing. T
This commit is contained in:
committed by
Adam
parent
74ae39258e
commit
e9e01c18f4
@@ -30,10 +30,13 @@ import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.GridLayout;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
@@ -61,6 +64,7 @@ public class DevToolsPanel extends PluginPanel
|
||||
private JButton renderDecorBtn = new JButton();
|
||||
private JButton renderInventoryBtn = new JButton();
|
||||
private JButton renderProjectilesBtn = new JButton();
|
||||
private JPanel boundsDebugPanel = new JPanel();
|
||||
|
||||
private JLabel textLbl = new JLabel();
|
||||
private JLabel textColorLbl = new JLabel();
|
||||
@@ -167,6 +171,9 @@ public class DevToolsPanel extends PluginPanel
|
||||
});
|
||||
container.add(renderProjectilesBtn);
|
||||
|
||||
boundsDebugPanel = createBoundsDebugMultiButton();
|
||||
container.add(boundsDebugPanel);
|
||||
|
||||
JButton settingsSnapshotBtn = new JButton("Get Settings");
|
||||
settingsSnapshotBtn.addActionListener(settingsTracker::snapshot);
|
||||
container.add(settingsSnapshotBtn);
|
||||
@@ -178,6 +185,70 @@ public class DevToolsPanel extends PluginPanel
|
||||
return container;
|
||||
}
|
||||
|
||||
private JPanel createBoundsDebugMultiButton()
|
||||
{
|
||||
ImageIcon bBox2DIcon;
|
||||
ImageIcon bBox3DIcon;
|
||||
ImageIcon clickBoxIcon;
|
||||
ImageIcon bBox3DMousoverIcon;
|
||||
|
||||
try
|
||||
{
|
||||
bBox2DIcon = new ImageIcon(ImageIO.read(DevToolsPlugin.class.getResourceAsStream("2D_bounding_box.png")));
|
||||
bBox3DIcon = new ImageIcon(ImageIO.read(DevToolsPlugin.class.getResourceAsStream("3D_bounding_box.png")));
|
||||
clickBoxIcon = new ImageIcon(ImageIO.read(DevToolsPlugin.class.getResourceAsStream("2D_clickbox_geometry.png")));
|
||||
bBox3DMousoverIcon = new ImageIcon(ImageIO.read(DevToolsPlugin.class.getResourceAsStream("mouseover_3D_bounding_box.png")));
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
log.warn("unable to load bounding box images", ex);
|
||||
return new JPanel();
|
||||
}
|
||||
|
||||
JPanel buttonPanel = new JPanel();
|
||||
buttonPanel.setLayout(new GridLayout(1, 4));
|
||||
JButton bBox2DButton = new JButton(bBox2DIcon);
|
||||
bBox2DButton.addActionListener(e ->
|
||||
{
|
||||
client.setDrawBoundingBoxes2D(!client.getDrawBoundingBoxes2D());
|
||||
highlightButton(bBox2DButton);
|
||||
});
|
||||
buttonPanel.add(bBox2DButton);
|
||||
|
||||
JButton bBox3DButton = new JButton(bBox3DIcon);
|
||||
bBox3DButton.addActionListener(e ->
|
||||
{
|
||||
client.setDrawBoundingBoxes3D(!client.getDrawBoundingBoxes3D());
|
||||
highlightButton(bBox3DButton);
|
||||
});
|
||||
buttonPanel.add(bBox3DButton);
|
||||
|
||||
JButton clickBoxButton = new JButton(clickBoxIcon);
|
||||
clickBoxButton.addActionListener(e ->
|
||||
{
|
||||
client.setdrawObjectGeometry2D(!client.getdrawObjectGeometry2D());
|
||||
highlightButton(clickBoxButton);
|
||||
});
|
||||
buttonPanel.add(clickBoxButton);
|
||||
|
||||
JButton mouseoverModeButton = new JButton(client.getBoundingBoxAlwaysOnMode() ? bBox3DIcon : bBox3DMousoverIcon);
|
||||
mouseoverModeButton.addActionListener(e ->
|
||||
{
|
||||
client.setBoundingBoxAlwaysOnMode(!client.getBoundingBoxAlwaysOnMode());
|
||||
if (client.getBoundingBoxAlwaysOnMode())
|
||||
{
|
||||
mouseoverModeButton.setIcon(bBox3DIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
mouseoverModeButton.setIcon(bBox3DMousoverIcon);
|
||||
}
|
||||
});
|
||||
buttonPanel.add(mouseoverModeButton);
|
||||
|
||||
return buttonPanel;
|
||||
}
|
||||
|
||||
private JPanel createWidgetTreePanel()
|
||||
{
|
||||
JPanel container = new JPanel();
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 233 B |
Binary file not shown.
|
After Width: | Height: | Size: 285 B |
Binary file not shown.
|
After Width: | Height: | Size: 430 B |
Binary file not shown.
|
After Width: | Height: | Size: 312 B |
Reference in New Issue
Block a user