You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.3 KiB
Kotlin
59 lines
1.3 KiB
Kotlin
package net.idylls.tickle
|
|
|
|
import org.slf4j.LoggerFactory
|
|
|
|
import java.awt.Graphics2D
|
|
import java.awt.Dimension
|
|
import java.awt.Rectangle
|
|
import java.awt.Color
|
|
import java.awt.BasicStroke
|
|
|
|
import javax.inject.Inject
|
|
|
|
import net.runelite.api.Client
|
|
import net.runelite.client.ui.overlay.OverlayLayer
|
|
import net.runelite.client.ui.overlay.OverlayPosition
|
|
import net.runelite.client.ui.overlay.OverlayPriority
|
|
import net.runelite.client.ui.overlay.OverlayUtil
|
|
import net.runelite.api.Point
|
|
|
|
class Overlay
|
|
@Inject constructor(
|
|
val client: Client,
|
|
val plugin: TicklePlugin,
|
|
): net.runelite.client.ui.overlay.Overlay() {
|
|
val log = LoggerFactory.getLogger(TicklePlugin::class.java)
|
|
|
|
init {
|
|
this.position = OverlayPosition.DYNAMIC
|
|
this.layer = OverlayLayer.ALWAYS_ON_TOP
|
|
this.priority = OverlayPriority.MED
|
|
}
|
|
|
|
override public fun render(gfx: Graphics2D): Dimension? {
|
|
val mousePos = client.getMouseCanvasPosition()
|
|
val mousePos_ = Point(mousePos.getX() + 10, mousePos.getY() + 10)
|
|
|
|
renderTickTock(gfx, mousePos_)
|
|
|
|
return null
|
|
}
|
|
|
|
fun renderTickTock(gfx: Graphics2D, mousePos: Point) {
|
|
val color = when (plugin.ticksSinceLogin % 2) {
|
|
0 -> Color(255, 0, 0)
|
|
else -> Color(0, 255, 0)
|
|
}
|
|
|
|
val shape = Rectangle(mousePos.getX(), mousePos.getY(), 10, 10)
|
|
|
|
OverlayUtil.renderPolygon(
|
|
gfx,
|
|
shape,
|
|
null,
|
|
color,
|
|
BasicStroke(0.0f),
|
|
)
|
|
}
|
|
}
|