22.10
This commit is contained in:
@@ -1,76 +1,76 @@
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.Circle;
|
||||
import javafx.scene.shape.Shape;
|
||||
import javafx.event.Event;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
public class MuehleButton {
|
||||
|
||||
public Game game;
|
||||
|
||||
public int relativeX;
|
||||
public int relativeY;
|
||||
|
||||
public double absoluteX;
|
||||
public double absoluteY;
|
||||
|
||||
public Color color = Color.BLUE;
|
||||
|
||||
public double radius;
|
||||
|
||||
public Circle circle;
|
||||
|
||||
public int id;
|
||||
|
||||
public boolean isActive = true;
|
||||
|
||||
public MuehleButton(int id,int relX, int relY, double absX, double absY, Game game) {
|
||||
this.id = id;
|
||||
|
||||
relativeX = relX;
|
||||
relativeY = relY;
|
||||
|
||||
absoluteX = absX;
|
||||
absoluteY = absY;
|
||||
|
||||
radius = 20;
|
||||
this.color = color;
|
||||
circle = new Circle(absoluteX, absoluteY, radius);
|
||||
circle.setFill(this.color);
|
||||
|
||||
this.game = game;
|
||||
|
||||
circle.addEventHandler(MouseEvent.MOUSE_RELEASED, mouse_click_target);
|
||||
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
public Shape getShape() {
|
||||
return circle;
|
||||
|
||||
}
|
||||
public void setActive(boolean value) {
|
||||
isActive = value;
|
||||
if(value == true) {
|
||||
circle.setFill(this.color);
|
||||
}
|
||||
else {
|
||||
//circle.setFill(Color.rgb(0,0,0,0));
|
||||
circle.setFill(Color.rgb(0,255,0));
|
||||
}
|
||||
}
|
||||
|
||||
EventHandler<MouseEvent> mouse_click_target = new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent event) {
|
||||
if (isActive) {
|
||||
MouseClick();
|
||||
} // end of if
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public void MouseClick() {
|
||||
game.chip_button_clicked(this);
|
||||
}
|
||||
|
||||
} // end of MuehleButton
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.Circle;
|
||||
import javafx.scene.shape.Shape;
|
||||
import javafx.event.Event;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
public class MuehleButton {
|
||||
|
||||
public Game game;
|
||||
|
||||
public int relativeX;
|
||||
public int relativeY;
|
||||
|
||||
public double absoluteX;
|
||||
public double absoluteY;
|
||||
|
||||
public Color color = Color.BLUE;
|
||||
|
||||
public double radius;
|
||||
|
||||
public Circle circle;
|
||||
|
||||
public int id;
|
||||
|
||||
public boolean isActive = true;
|
||||
|
||||
public MuehleButton(int id,int relX, int relY, double absX, double absY, Game game) {
|
||||
this.id = id;
|
||||
|
||||
relativeX = relX;
|
||||
relativeY = relY;
|
||||
|
||||
absoluteX = absX;
|
||||
absoluteY = absY;
|
||||
|
||||
radius = 20;
|
||||
this.color = color;
|
||||
circle = new Circle(absoluteX, absoluteY, radius);
|
||||
circle.setFill(this.color);
|
||||
|
||||
this.game = game;
|
||||
|
||||
circle.addEventHandler(MouseEvent.MOUSE_RELEASED, mouse_click_target);
|
||||
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
public Shape getShape() {
|
||||
return circle;
|
||||
|
||||
}
|
||||
public void setActive(boolean value) {
|
||||
isActive = value;
|
||||
if(value == true) {
|
||||
circle.setFill(this.color);
|
||||
}
|
||||
else {
|
||||
//circle.setFill(Color.rgb(0,0,0,0));
|
||||
circle.setFill(Color.rgb(0,255,0));
|
||||
}
|
||||
}
|
||||
|
||||
EventHandler<MouseEvent> mouse_click_target = new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent event) {
|
||||
if (isActive) {
|
||||
MouseClick();
|
||||
} // end of if
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public void MouseClick() {
|
||||
game.chip_button_clicked(this);
|
||||
}
|
||||
|
||||
} // end of MuehleButton
|
||||
|
||||
Reference in New Issue
Block a user