blob: c8dad2ed2bf9018ec4522553652fcbc06d159151 (
plain)
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
63
64
65
66
67
68
69
70
71
72
|
package subconscious.graphics;
import subconscious.Game;
import subconscious.Actor;
import subconscious.graphics.widget.ActorInfo;
import subconscious.graphics.widget.TerrainInfo;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.MouseEvent;
@SuppressWarnings("serial")
public class BattleScene extends MapScene {
protected ActorInfo actorInfoWidget;
protected TerrainInfo terrainInfoWidget;
public BattleScene(Game game, String label) {
super(game, label);
}
@Override
public void build() {
this.actorInfoWidget = new ActorInfo("actorinfo");
this.addWidget(this.actorInfoWidget);
this.terrainInfoWidget = new TerrainInfo("terraininfo");
this.addWidget(this.terrainInfoWidget);
}
@Override
protected void render(Graphics2D g) {
super.render(g);
}
@Override
public void update(long deltaNanoTime) {
}
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
}
@Override
public void mouseMoved(MouseEvent e) {
super.mouseMoved(e);
Point tileUnderCursor = this.tileAtCoordinates(e.getPoint());
if (tileUnderCursor == null) {
this.terrainInfoWidget.unsetTile();
return;
}
// System.out.println(this.map.getTile(tileUnderCursor.x, tileUnderCursor.y).type);
// update ActorInfo widget
for (Actor actor : this.map.getActors()) {
this.actorInfoWidget.unsetActor();
if (actor.getPoint().equals(tileUnderCursor)) {
this.actorInfoWidget.setActor(actor);
break;
}
}
// update tileType widget
this.terrainInfoWidget.setTile(this.map.getTile(tileUnderCursor));
}
}
|