use of com.watabou.utils.Point in project pixel-dungeon by watabou.
the class Painter method drawInside.
public static Point drawInside(Level level, Room room, Point from, int n, int value) {
Point step = new Point();
if (from.x == room.left) {
step.set(+1, 0);
} else if (from.x == room.right) {
step.set(-1, 0);
} else if (from.y == room.top) {
step.set(0, +1);
} else if (from.y == room.bottom) {
step.set(0, -1);
}
Point p = new Point(from).offset(step);
for (int i = 0; i < n; i++) {
if (value != -1) {
set(level, p, value);
}
p.offset(step);
}
return p;
}
use of com.watabou.utils.Point in project pixel-dungeon by watabou.
the class StandardPainter method paintStudy.
private static void paintStudy(Level level, Room room) {
fill(level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1, Terrain.BOOKSHELF);
fill(level, room.left + 2, room.top + 2, room.width() - 3, room.height() - 3, Terrain.EMPTY_SP);
for (Point door : room.connected.values()) {
if (door.x == room.left) {
set(level, door.x + 1, door.y, Terrain.EMPTY);
} else if (door.x == room.right) {
set(level, door.x - 1, door.y, Terrain.EMPTY);
} else if (door.y == room.top) {
set(level, door.x, door.y + 1, Terrain.EMPTY);
} else if (door.y == room.bottom) {
set(level, door.x, door.y - 1, Terrain.EMPTY);
}
}
set(level, room.center(), Terrain.PEDESTAL);
}
use of com.watabou.utils.Point in project pixel-dungeon by watabou.
the class LaboratoryPainter method paint.
public static void paint(Level level, Room room) {
fill(level, room, Terrain.WALL);
fill(level, room, 1, Terrain.EMPTY_SP);
Room.Door entrance = room.entrance();
Point pot = null;
if (entrance.x == room.left) {
pot = new Point(room.right - 1, Random.Int(2) == 0 ? room.top + 1 : room.bottom - 1);
} else if (entrance.x == room.right) {
pot = new Point(room.left + 1, Random.Int(2) == 0 ? room.top + 1 : room.bottom - 1);
} else if (entrance.y == room.top) {
pot = new Point(Random.Int(2) == 0 ? room.left + 1 : room.right - 1, room.bottom - 1);
} else if (entrance.y == room.bottom) {
pot = new Point(Random.Int(2) == 0 ? room.left + 1 : room.right - 1, room.top + 1);
}
set(level, pot, Terrain.ALCHEMY);
Alchemy alchemy = new Alchemy();
alchemy.seed(pot.x + Level.WIDTH * pot.y, 1);
level.blobs.put(Alchemy.class, alchemy);
int n = Random.IntRange(2, 3);
for (int i = 0; i < n; i++) {
int pos;
do {
pos = room.random();
} while (level.map[pos] != Terrain.EMPTY_SP || level.heaps.get(pos) != null);
level.drop(prize(level), pos);
}
entrance.set(Room.Door.Type.LOCKED);
level.addItemToSpawn(new IronKey());
}
use of com.watabou.utils.Point in project pixel-dungeon by watabou.
the class LibraryPainter method paint.
public static void paint(Level level, Room room) {
fill(level, room, Terrain.WALL);
fill(level, room, 1, Terrain.EMPTY);
Room.Door entrance = room.entrance();
Point a = null;
Point b = null;
if (entrance.x == room.left) {
a = new Point(room.left + 1, entrance.y - 1);
b = new Point(room.left + 1, entrance.y + 1);
fill(level, room.right - 1, room.top + 1, 1, room.height() - 1, Terrain.BOOKSHELF);
} else if (entrance.x == room.right) {
a = new Point(room.right - 1, entrance.y - 1);
b = new Point(room.right - 1, entrance.y + 1);
fill(level, room.left + 1, room.top + 1, 1, room.height() - 1, Terrain.BOOKSHELF);
} else if (entrance.y == room.top) {
a = new Point(entrance.x + 1, room.top + 1);
b = new Point(entrance.x - 1, room.top + 1);
fill(level, room.left + 1, room.bottom - 1, room.width() - 1, 1, Terrain.BOOKSHELF);
} else if (entrance.y == room.bottom) {
a = new Point(entrance.x + 1, room.bottom - 1);
b = new Point(entrance.x - 1, room.bottom - 1);
fill(level, room.left + 1, room.top + 1, room.width() - 1, 1, Terrain.BOOKSHELF);
}
if (a != null && level.map[a.x + a.y * Level.WIDTH] == Terrain.EMPTY) {
set(level, a, Terrain.STATUE);
}
if (b != null && level.map[b.x + b.y * Level.WIDTH] == Terrain.EMPTY) {
set(level, b, Terrain.STATUE);
}
int n = Random.IntRange(2, 3);
for (int i = 0; i < n; i++) {
int pos;
do {
pos = room.random();
} while (level.map[pos] != Terrain.EMPTY || level.heaps.get(pos) != null);
level.drop(prize(level), pos);
}
entrance.set(Room.Door.Type.LOCKED);
level.addItemToSpawn(new IronKey());
}
use of com.watabou.utils.Point in project pixel-dungeon by watabou.
the class ScrollPane method layout.
@Override
protected void layout() {
content.setPos(0, 0);
controller.x = x;
controller.y = y;
controller.width = width;
controller.height = height;
Point p = camera().cameraToScreen(x, y);
Camera cs = content.camera;
cs.x = p.x;
cs.y = p.y;
cs.resize((int) width, (int) height);
thumb.visible = height < content.height();
if (thumb.visible) {
thumb.scale.set(2, height * height / content.height());
thumb.x = right() - thumb.width();
thumb.y = y;
}
}
Aggregations