[SOLVED!] Real-time Strategy Unit Highlighting

I’m trying to achieve something like the standard rectangle that appears when you highlight things on your desktop:

Via simple graphics rendering calls (g.drawRect/g.drawLine) etc.

This is something I’ve always thought about implementing :slight_smile: I’m now at that point in a project of mine (RTS) where I’d like to implement this in it.

I’ve never used Vector math but I’m guessing that’s what I’ll be needing, I’m posting this in hopes of getting some help on how I’d achieve this.

If anybody could help me / push me in the right direction that would be great :slight_smile:

EDIT: Solved! For those who were wondering:


		if (mouse1Down) {
			int mouseX = client.getController().mouseX;
			int mouseY = client.getController().mouseY;
			g.drawLine(clickX, clickY, mouseX, mouseY - (mouseY - clickY));
			g.drawLine(mouseX, mouseY - (mouseY - clickY), mouseX, mouseY);
			g.drawLine(clickX, clickY, clickX, mouseY);
			g.drawLine(clickX, mouseY, mouseX, mouseY);
		}