Java Code Examples for com.watabou.utils.Rect#getPoints()
The following examples show how to use
com.watabou.utils.Rect#getPoints() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Room.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 6 votes |
public boolean canConnect( Room r ){ Rect i = intersect( r ); boolean foundPoint = false; for (Point p : i.getPoints()){ if (canConnect(p) && r.canConnect(p)){ foundPoint = true; break; } } if (!foundPoint) return false; if (i.width() == 0 && i.left == left) return canConnect(LEFT) && r.canConnect(LEFT); else if (i.height() == 0 && i.top == top) return canConnect(TOP) && r.canConnect(TOP); else if (i.width() == 0 && i.right == right) return canConnect(RIGHT) && r.canConnect(RIGHT); else if (i.height() == 0 && i.bottom == bottom) return canConnect(BOTTOM) && r.canConnect(BOTTOM); else return false; }
Example 2
Source File: RegularPainter.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 6 votes |
private void placeDoors( Room r ) { for (Room n : r.connected.keySet()) { Room.Door door = r.connected.get( n ); if (door == null) { Rect i = r.intersect( n ); ArrayList<Point> doorSpots = new ArrayList<>(); for (Point p : i.getPoints()){ if (r.canConnect(p) && n.canConnect(p)) doorSpots.add(p); } if (doorSpots.isEmpty()){ ShatteredPixelDungeon.reportException( new RuntimeException("Could not place a door! " + "r=" + r.getClass().getSimpleName() + " n=" + n.getClass().getSimpleName())); continue; } door = new Room.Door(Random.element(doorSpots)); r.connected.put( n, door ); n.connected.put( r, door ); } } }
Example 3
Source File: Room.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 6 votes |
public boolean canConnect( Room r ){ Rect i = intersect( r ); boolean foundPoint = false; for (Point p : i.getPoints()){ if (canConnect(p) && r.canConnect(p)){ foundPoint = true; break; } } if (!foundPoint) return false; if (i.width() == 0 && i.left == left) return canConnect(LEFT) && r.canConnect(LEFT); else if (i.height() == 0 && i.top == top) return canConnect(TOP) && r.canConnect(TOP); else if (i.width() == 0 && i.right == right) return canConnect(RIGHT) && r.canConnect(RIGHT); else if (i.height() == 0 && i.bottom == bottom) return canConnect(BOTTOM) && r.canConnect(BOTTOM); else return false; }
Example 4
Source File: RegularPainter.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 6 votes |
private void placeDoors( Room r ) { for (Room n : r.connected.keySet()) { Room.Door door = r.connected.get( n ); if (door == null) { Rect i = r.intersect( n ); ArrayList<Point> doorSpots = new ArrayList<>(); for (Point p : i.getPoints()){ if (r.canConnect(p) && n.canConnect(p)) doorSpots.add(p); } if (doorSpots.isEmpty()){ ShatteredPixelDungeon.reportException( new RuntimeException("Could not place a door! " + "r=" + r.getClass().getSimpleName() + " n=" + n.getClass().getSimpleName())); continue; } door = new Room.Door(Random.element(doorSpots)); r.connected.put( n, door ); n.connected.put( r, door ); } } }