1 package com.jed.actor;
2
3 import com.jed.core.Displayable;
4 import com.jed.util.Vector2f;
5 import org.colapietro.lang.LangConstants;
6 import org.colapietro.lang.NotImplementedException;
7 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory;
9
10 import javax.annotation.Nonnull;
11
12
13
14
15
16
17
18
19
20
21
22 public abstract class Boundary implements Displayable {
23
24
25
26
27 private static final Logger LOGGER = LoggerFactory.getLogger(Boundary.class);
28
29
30
31
32 private AbstractEntity owner;
33
34
35
36
37 private final Vector2f position;
38
39
40
41
42 public final Vector2f[] vertices;
43
44
45
46
47
48 public abstract double getRightBound();
49
50
51
52
53
54 public abstract double getLeftBound();
55
56
57
58
59
60 public abstract double getUpperBound();
61
62
63
64
65
66 public abstract double getLowerBound();
67
68
69
70
71
72 public abstract int getWidth();
73
74
75
76
77
78 public abstract int getHeight();
79
80
81
82
83
84
85 Boundary(Vector2f position, Vector2f[] vertices) {
86 this.vertices = vertices;
87 this.position = position;
88 }
89
90
91
92
93
94 @Nonnull
95 public Vector2f getWorldPosition() {
96 return owner.getPosition().add(position);
97 }
98
99
100
101
102
103 @Nonnull
104 public Vector2f getNextWorldPosition() {
105 return getWorldPosition().add(owner.getMovement());
106 }
107
108
109
110
111
112 public Vector2f getPosition() {
113 return position;
114 }
115
116
117
118
119
120 public AbstractEntity getOwner() {
121 return owner;
122 }
123
124
125
126
127
128 public void setOwner(AbstractEntity owner) {
129 this.owner = owner;
130 }
131
132 @Override
133 public void render() throws NotImplementedException {
134 throw new NotImplementedException(LangConstants.NOT_IMPLEMENTED_YET_MESSAGE);
135 }
136
137 @Override
138 public void drawChildVertex2f(float x, float y) throws NotImplementedException {
139 throw new NotImplementedException(LangConstants.NOT_IMPLEMENTED_YET_MESSAGE);
140 }
141 }