forked from EB-wilson/JavaDynamilizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHotUpdateDemo.java
More file actions
50 lines (41 loc) · 948 Bytes
/
Copy pathHotUpdateDemo.java
File metadata and controls
50 lines (41 loc) · 948 Bytes
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
import dynamilize.DynamicClass;
import dynamilize.DynamicMaker;
public class HotUpdateDemo{
public static final DynamicClass Updater = DynamicClass.get("Updater");
static {
Updater.setFunction("update", (s, sup, a) -> {
sup.invokeFunc("update", a);
});
}
public static void main(String[] args){
World world = new World();
while(true){//主循环
world.update();
}
}
}
class World implements Module{
DynamicMaker maker = DynamicMaker.getDefault();
public Scene scene = new Scene();
public Entities entities = maker.newInstance(Entities.class, HotUpdateDemo.Updater).self();
@Override
public void update(){
scene.update();
entities.update();
}
}
class Scene implements Module{
@Override
public void update(){
//draw scene
}
}
class Entities implements Module{
@Override
public void update(){
//update status of entity
}
}
interface Module{
void update();
}