-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreenObject.java
More file actions
62 lines (50 loc) · 1.39 KB
/
screenObject.java
File metadata and controls
62 lines (50 loc) · 1.39 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
import java.awt.Color;
class ScreenObject {
private Coor position;
private Color color;
public ScreenObject() {
position = new Coor(Main.loaded.worldSize/2, Main.loaded.worldSize/2);
}
public ScreenObject(Color color){
this.color = color;
position = new Coor(Main.loaded.worldSize/2, Main.loaded.worldSize/2);
}
public ScreenObject(Coor position){
this.position = position;
}
public ScreenObject(Color color, Coor position) {
this.position = position;
this.color = color;
}
// setters
public void setPosX(int x) {
position.setX(x);
}
public void setPosY(int y) {
position.setY(y);
}
public void setPos(Coor coor){
this.position = coor;
}
public void setColor(Color color) {
this.color = color;
}
// getters
public Coor getPos() {
return position;
}
public int getPosY() {
return position.y();
}
public int getPosX() {
return position.x();
}
public Color getColor() {
return color;
}
public static Coor getPrintPos(int x, int y) {
Screens.SimulationWorldToScreen.setWorld(Screens.simulationPanel.getWidth(), Screens.simulationPanel.getHeight());
int[] ans = Screens.SimulationWorldToScreen.translate(new int[]{x,y});
return new Coor(ans[0], ans[1]);
}
}