package fr.iutfbleau.reticule;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.util.AttributeSet;
import android.view.View;

public class Reticule extends View {

    private final Paint peinture;
    private Point position;

    public Reticule(Context c, AttributeSet s) {
        super(c, s);
        this.peinture = new Paint();
        this.peinture.setColor(0xfff67828);
        this.peinture.setStrokeWidth(10);
        this.peinture.setStyle(Paint.Style.STROKE);
        this.position = new Point(500, 500);

    }

    @Override
    public void onDraw(Canvas c) {
        super.onDraw(c);
        c.drawCircle(this.position.x, this.position.y, 90, this.peinture);
        c.drawLine(this.position.x - 140, this.position.y, this.position.x + 140, this.position.y, this.peinture);
        c.drawLine(this.position.x, this.position.y - 140, this.position.x, this.position.y + 140, this.peinture);
    }

    public void deplacerReticule(int x, int y) {
        this.position.x = x;
        this.position.y = y;
    }

    public float getX() {
        return this.position.x;
    }

    public float getY() {
        return this.position.y;
    }
 }
