当前位置: 首页>>代码示例>>Java>>正文


Java Rect.height方法代码示例

本文整理汇总了Java中com.watabou.utils.Rect.height方法的典型用法代码示例。如果您正苦于以下问题:Java Rect.height方法的具体用法?Java Rect.height怎么用?Java Rect.height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.watabou.utils.Rect的用法示例。


在下文中一共展示了Rect.height方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: curConnections

import com.watabou.utils.Rect; //导入方法依赖的package包/类
public int curConnections(int direction){
	if (direction == ALL) {
		return connected.size();

	} else {
		int total = 0;
		for (Room r : connected.keySet()){
			Rect i = intersect( r );
			if      (direction == LEFT && i.width() == 0 && i.left == left)         total++;
			else if (direction == TOP && i.height() == 0 && i.top == top)           total++;
			else if (direction == RIGHT && i.width() == 0 && i.right == right)      total++;
			else if (direction == BOTTOM && i.height() == 0 && i.bottom == bottom)  total++;
		}
		return total;
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:17,代码来源:Room.java

示例2: canConnect

import com.watabou.utils.Rect; //导入方法依赖的package包/类
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;
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:24,代码来源:Room.java

示例3: curConnections

import com.watabou.utils.Rect; //导入方法依赖的package包/类
public int curConnections(int direction){
	if (direction == ALL) {
		return connected.size();
		
	} else {
		int total = 0;
		for (Room r : connected.keySet()){
			Rect i = intersect( r );
			if      (direction == LEFT && i.width() == 0 && i.left == left)         total++;
			else if (direction == TOP && i.height() == 0 && i.top == top)           total++;
			else if (direction == RIGHT && i.width() == 0 && i.right == right)      total++;
			else if (direction == BOTTOM && i.height() == 0 && i.bottom == bottom)  total++;
		}
		return total;
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:17,代码来源:Room.java

示例4: canConnect

import com.watabou.utils.Rect; //导入方法依赖的package包/类
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;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:24,代码来源:Room.java

示例5: splitPlatforms

import com.watabou.utils.Rect; //导入方法依赖的package包/类
private void splitPlatforms( Rect curPlatform, ArrayList<Rect> allPlatforms ){
	int curArea = (curPlatform.width()+1) * (curPlatform.height()+1);

	//chance to split scales between 0% and 100% between areas of 25 and 36
	if (Random.Float() < (curArea-25)/11f){
		if (curPlatform.width() > curPlatform.height() ||
				(curPlatform.width() == curPlatform.height() && Random.Int(2) == 0)){

			//split the platform
			int splitX = Random.IntRange( curPlatform.left+2, curPlatform.right-2);
			splitPlatforms( new Rect( curPlatform.left, curPlatform.top, splitX-1, curPlatform.bottom) , allPlatforms);
			splitPlatforms( new Rect( splitX+1, curPlatform.top, curPlatform.right, curPlatform.bottom) , allPlatforms);

			//add a bridge between
			int bridgeY = Random.NormalIntRange(curPlatform.top, curPlatform.bottom);
			allPlatforms.add( new Rect( splitX - 1, bridgeY, splitX + 1, bridgeY));

		} else {

			//split the platform
			int splitY = Random.IntRange( curPlatform.top+2, curPlatform.bottom-2);
			splitPlatforms( new Rect( curPlatform.left, curPlatform.top, curPlatform.right, splitY-1) , allPlatforms);
			splitPlatforms( new Rect( curPlatform.left, splitY+1, curPlatform.right, curPlatform.bottom) , allPlatforms);

			//add a bridge between
			int bridgeX = Random.NormalIntRange(curPlatform.left, curPlatform.right);
			allPlatforms.add( new Rect( bridgeX, splitY-1, bridgeX, splitY+1));

		}
	} else {
		allPlatforms.add(curPlatform);
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:34,代码来源:PlatformRoom.java

示例6: addNeigbour

import com.watabou.utils.Rect; //导入方法依赖的package包/类
public boolean addNeigbour( Room other ) {
	if (neigbours.contains(other))
		return true;

	Rect i = intersect( other );
	if ((i.width() == 0 && i.height() >= 2) ||
			(i.height() == 0 && i.width() >= 2)) {
		neigbours.add( other );
		other.neigbours.add( this );
		return true;
	}
	return false;
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:14,代码来源:Room.java

示例7: addNeigbour

import com.watabou.utils.Rect; //导入方法依赖的package包/类
public void addNeigbour( Room other ) {
	
	Rect i = intersect( other );
	if ((i.width() == 0 && i.height() >= 3) ||
		(i.height() == 0 && i.width() >= 3)) {
		neigbours.add( other );
		other.neigbours.add( this );
	}
	
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:11,代码来源:Room.java

示例8: addNeigbour

import com.watabou.utils.Rect; //导入方法依赖的package包/类
public void addNeigbour( Room other ) {
	
	Rect i = intersect( other );
	if ((i.width() == 0 && i.height() >= 3) || 
		(i.height() == 0 && i.width() >= 3)) {
		neigbours.add( other );
		other.neigbours.add( this );
	}
	
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:11,代码来源:Room.java

示例9: addNeighbour

import com.watabou.utils.Rect; //导入方法依赖的package包/类
public void addNeighbour(Room other) {
	
	Rect i = intersect( other );
	if ((i.width() == 0 && i.height() >= 3) || 
		(i.height() == 0 && i.width() >= 3)) {
		neighbours.add(other);
		other.neighbours.add(this);
	}
	
}
 
开发者ID:ConsideredHamster,项目名称:YetAnotherPixelDungeon,代码行数:11,代码来源:Room.java

示例10: splitPlatforms

import com.watabou.utils.Rect; //导入方法依赖的package包/类
private void splitPlatforms( Rect curPlatform, ArrayList<Rect> allPlatforms ){
	int curArea = (curPlatform.width()+1) * (curPlatform.height()+1);
	
	//chance to split scales between 0% and 100% between areas of 25 and 36
	if (Random.Float() < (curArea-25)/11f){
		if (curPlatform.width() > curPlatform.height() ||
				(curPlatform.width() == curPlatform.height() && Random.Int(2) == 0)){
			
			//split the platform
			int splitX = Random.IntRange( curPlatform.left+2, curPlatform.right-2);
			splitPlatforms( new Rect( curPlatform.left, curPlatform.top, splitX-1, curPlatform.bottom) , allPlatforms);
			splitPlatforms( new Rect( splitX+1, curPlatform.top, curPlatform.right, curPlatform.bottom) , allPlatforms);
			
			//add a bridge between
			int bridgeY = Random.NormalIntRange(curPlatform.top, curPlatform.bottom);
			allPlatforms.add( new Rect( splitX - 1, bridgeY, splitX + 1, bridgeY));
			
		} else {
			
			//split the platform
			int splitY = Random.IntRange( curPlatform.top+2, curPlatform.bottom-2);
			splitPlatforms( new Rect( curPlatform.left, curPlatform.top, curPlatform.right, splitY-1) , allPlatforms);
			splitPlatforms( new Rect( curPlatform.left, splitY+1, curPlatform.right, curPlatform.bottom) , allPlatforms);
			
			//add a bridge between
			int bridgeX = Random.NormalIntRange(curPlatform.left, curPlatform.right);
			allPlatforms.add( new Rect( bridgeX, splitY-1, bridgeX, splitY+1));
			
		}
	} else {
		allPlatforms.add(curPlatform);
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:34,代码来源:PlatformRoom.java

示例11: addNeigbour

import com.watabou.utils.Rect; //导入方法依赖的package包/类
public boolean addNeigbour( Room other ) {
	if (neigbours.contains(other))
		return true;
	
	Rect i = intersect( other );
	if ((i.width() == 0 && i.height() >= 2) ||
		(i.height() == 0 && i.width() >= 2)) {
		neigbours.add( other );
		other.neigbours.add( this );
		return true;
	}
	return false;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:14,代码来源:Room.java

示例12: addNeighbor

import com.watabou.utils.Rect; //导入方法依赖的package包/类
public void addNeighbor(Room other ) {
	
	Rect i = intersect( other );
	if ((i.width() == 0 && i.height() >= 3) || 
		(i.height() == 0 && i.width() >= 3)) {
		neighbours.add( other );
		other.neighbours.add( this );
	}
	
}
 
开发者ID:NYRDS,项目名称:pixel-dungeon-remix,代码行数:11,代码来源:Room.java

示例13: addNeigbour

import com.watabou.utils.Rect; //导入方法依赖的package包/类
public boolean addNeigbour( Room other ) {
	if (neigbours.contains(other))
		return true;
	
	Rect i = intersect( other );
	if ((i.width() == 0 && i.height() >= 2) ||
			(i.height() == 0 && i.width() >= 2)) {
		neigbours.add( other );
		other.neigbours.add( this );
		return true;
	}
	return false;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:14,代码来源:Room.java

示例14: createWalls

import com.watabou.utils.Rect; //导入方法依赖的package包/类
private void createWalls( Level level, Rect area ){
	if (Math.max(area.width()+1, area.height()+1) < 5
			|| Math.min(area.width()+1, area.height()+1) < 3){
		return;
	}

	int tries = 10;

	//splitting top/bottom
	if (area.width() > area.height() || (area.width() == area.height() && Random.Int(2) == 0)){

		do{
			int splitX = Random.IntRange(area.left+2, area.right-2);

			if (level.map[splitX + level.getWidth()*(area.top-1)] == Terrain.WALL
					&& level.map[splitX + level.getWidth()*(area.bottom+1)] == Terrain.WALL){
				tries = 0;

				Painter.drawLine(level, new Point(splitX, area.top), new Point(splitX, area.bottom), Terrain.WALL);

				int spaceTop = Random.IntRange(area.top, area.bottom-1);
				Painter.set(level, splitX, spaceTop, Terrain.EMPTY);
				Painter.set(level, splitX, spaceTop+1, Terrain.EMPTY);

				createWalls(level, new Rect(area.left, area.top, splitX-1, area.bottom));
				createWalls(level, new Rect(splitX+1, area.top, area.right, area.bottom));
			}

		} while (--tries > 0);

		//splitting left/right
	} else {

		do{
			int splitY = Random.IntRange(area.top+2, area.bottom-2);

			if (level.map[area.left-1 + level.getWidth()*splitY] == Terrain.WALL
					&& level.map[area.right+1 + level.getWidth()*splitY] == Terrain.WALL){
				tries = 0;

				Painter.drawLine(level, new Point(area.left, splitY), new Point(area.right, splitY), Terrain.WALL);

				int spaceLeft = Random.IntRange(area.left, area.right-1);
				Painter.set(level, spaceLeft, splitY, Terrain.EMPTY);
				Painter.set(level, spaceLeft+1, splitY, Terrain.EMPTY);

				createWalls(level, new Rect(area.left, area.top, area.right, splitY-1));
				createWalls(level, new Rect(area.left, splitY+1, area.right, area.bottom));
			}

		} while (--tries > 0);

	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:55,代码来源:SegmentedRoom.java

示例15: joinRooms

import com.watabou.utils.Rect; //导入方法依赖的package包/类
protected boolean joinRooms( Level l, Room r, Room n ) {

		if (!(r instanceof EmptyRoom && n instanceof EmptyRoom)) {
			return false;
		}

		Rect w = r.intersect( n );
		if (w.left == w.right) {

			if (w.bottom - w.top < 3) {
				return false;
			}

			if (w.height()+1 == Math.max( r.height(), n.height() )) {
				return false;
			}

			if (r.width() + n.width() > 10) {
				return false;
			}

			w.top += 1;
			w.bottom -= 0;

			w.right++;

			Painter.fill( l, w.left, w.top, 1, w.height(), Terrain.EMPTY );

		} else {

			if (w.right - w.left < 3) {
				return false;
			}

			if (w.width()+1 == Math.max( r.width(), n.width() )) {
				return false;
			}

			if (r.height() + n.height() > 10) {
				return false;
			}

			w.left += 1;
			w.right -= 0;

			w.bottom++;

			Painter.fill( l, w.left, w.top, w.width(), 1, Terrain.EMPTY );
		}

		return true;
	}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:53,代码来源:RegularPainter.java


注:本文中的com.watabou.utils.Rect.height方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。