aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/sowgro/npehero/gameplay/Target.java
blob: 45907d30e69d2d880b60cc07933eeac404e51a7f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//glowing block of color c (jfx node)

package net.sowgro.npehero.gameplay;

import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Text;

public class Target extends StackPane
{
    private Color col;
    private Color fill;
    private Text label;
    public Rectangle rect = new Rectangle();
    public Target(Color c, double a, double b, int r, String key)
    {
        label = new Text(key);
        label.getStyleClass().add("t3");
        label.scaleXProperty().bind(super.widthProperty().divide(50));
        label.scaleYProperty().bind(label.scaleXProperty());
        super.getChildren().addAll(rect,label);


        col = c;
        fill = new Color(c.darker().getRed(), c.darker().getGreen(), c.darker().getBlue(), 0.45);
        rect.setFill(fill);
        rect.setWidth(a);
        rect.setHeight(b);
        rect.setArcHeight(r);
        rect.setArcWidth(r);
        rect.setStroke(col);
        rect.setStrokeWidth(4);
    }

    public void setColor(Color c) {
        col = c;
        fill = new Color(c.darker().getRed(), c.darker().getGreen(), c.darker().getBlue(), 0.45);
        rect.setFill(fill);
        rect.setStroke(c);
    }

    public Color getFillColor() {
        return fill;
    }

    public Color getColor() {
        return col;
    }
}