-
Notifications
You must be signed in to change notification settings - Fork 0
/
Screen.java
49 lines (38 loc) · 917 Bytes
/
Screen.java
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
import java.util.ArrayList;
public abstract class Screen{
private ArrayList<GameObject> objects = new ArrayList<>();
public abstract void screenUpdate();
public abstract void display();
public Screen(){
// Bloxris.screens.add(this);
}
public void update(){
screenUpdate();
for(GameObject o : objects){
o.update();
}
}
public void renderObjects(){
for(GameObject o : objects){
o.render();
}
}
public Screen addObject(GameObject o){
objects.add(o);
return this;
}
public Screen addObjects(GameObject ... objects){
for(GameObject o : objects){
this.objects.add(o);
}
return this;
}
public ArrayList<GameObject> getObjects(){
return objects;
}
/**
* @return negative (<0) if not done, and the index of the desired screen if done
*/
public abstract int isDone();
public abstract void pressed(char c);
}