Package org.rsbot.event.impl

Source Code of org.rsbot.event.impl.TMousePosition

package org.rsbot.event.impl;

import org.rsbot.bot.Bot;
import org.rsbot.client.Client;
import org.rsbot.client.input.Mouse;
import org.rsbot.event.listeners.TextPaintListener;
import org.rsbot.util.StringUtil;

import java.awt.*;

public class TMousePosition implements TextPaintListener {
  private final Client client;

  public TMousePosition(final Bot bot) {
    client = bot.getClient();
  }

  public int drawLine(final Graphics render, int idx) {
    final Mouse mouse = client.getMouse();
    if (mouse != null) {
      final int mouse_x = mouse.getX();
      final int mouse_y = mouse.getY();
      final String off = mouse.isPresent() ? "" : " (off)";
      StringUtil.drawLine(render, idx++, "Mouse Position: (" + mouse_x + "," + mouse_y + ")" + off);
    }
    return idx;
  }
}
TOP

Related Classes of org.rsbot.event.impl.TMousePosition

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.