package MyMain;

import java.awt.AWTException;
import java.awt.Point;
import java.awt.Robot;
import java.awt.event.InputEvent;
public class FocusCanvas implements Runnable{

	Thread thread;
	CameraPointingGame cameraPointingGame;
	
	public FocusCanvas(CameraPointingGame cameraPointingGame){
		this.cameraPointingGame = cameraPointingGame;
		
	}
	
	public void threadStart(){
    	thread = new Thread(this);
    	thread.start();
	}
	
	public void run(){
		
    	try {
    		Thread.sleep(100);
    		Thread.sleep(100);
    		Thread.sleep(100);
    		Thread.sleep(100);
    		Thread.sleep(100);
    		Point point = this.cameraPointingGame.frame.getLocationOnScreen();
    		point.x += 400;
    		point.y += 300;
			Robot robot = new Robot();
			robot.mouseMove(point.x,point.y);
			robot.mousePress(InputEvent.BUTTON1_MASK);
			robot.mouseRelease(InputEvent.BUTTON1_MASK);
		} catch (AWTException | InterruptedException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
    	
		//cameraPointingGame.frame.setCursor(cameraPointingGame.cursor);
	}
}
