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


Java Rect.width方法代码示例

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


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

示例1: paint

import com.watabou.utils.Rect; //导入方法依赖的package包/类
@Override
public void paint(Level level) {

	if (Math.min(width(), height()) > 3) {
		Painter.fill(level, this, 1, Terrain.CHASM);
	}

	super.paint(level);

	for (Room r : neigbours){
		if (r instanceof BridgeRoom || r instanceof WalkwayRoom){
			Rect i = intersect(r);
			if (i.width() != 0){
				i.left++;
				i.right--;
			} else {
				i.top++;
				i.bottom--;
			}
			Painter.fill(level, i.left, i.top, i.width()+1, i.height()+1, Terrain.CHASM);
		}
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:24,代码来源:WalkwayRoom.java

示例2: 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

示例3: 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

示例4: placeDoors

import com.watabou.utils.Rect; //导入方法依赖的package包/类
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 );
			if (i.width() == 0) {
				door = new Room.Door(
					i.left,
					Random.Int( i.top + 1, i.bottom ) );
			} else {
				door = new Room.Door(
					Random.Int( i.left + 1, i.right ),
					i.top);
			}

			r.connected.put( n, door );
			n.connected.put( r, door );
		}
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:22,代码来源:RegularLevel.java

示例5: placeDoors

import com.watabou.utils.Rect; //导入方法依赖的package包/类
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 );
			if (i.width() == 0) {
				door = new Room.Door( 
					i.left, 
					Random.Int( i.top + 1, i.bottom ) );
			} else {
				door = new Room.Door( 
					Random.Int( i.left + 1, i.right ),
					i.top);
			}

			r.connected.put( n, door );
			n.connected.put( r, door );
		}
	}
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:22,代码来源:RegularLevel.java

示例6: placeDoors

import com.watabou.utils.Rect; //导入方法依赖的package包/类
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 );
			if (i.width() == 0) {
				door = new Room.Door( 
					i.left, 
					Random.IntRange( i.top + 1, i.bottom - 1 ) );
			} else {
				door = new Room.Door( 
					Random.IntRange( i.left + 1, i.right - 1 ),
					i.top);
			}

			r.connected.put( n, door );
			n.connected.put( r, door );
		}
	}
}
 
开发者ID:ConsideredHamster,项目名称:YetAnotherPixelDungeon,代码行数:22,代码来源:RegularLevel.java

示例7: placeDoors

import com.watabou.utils.Rect; //导入方法依赖的package包/类
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 );
            if (i.width() == 0) {
                door = new Room.Door(
                        i.left,
                        Random.Int( i.top + 1, i.bottom ) );
            } else {
                door = new Room.Door(
                        Random.Int( i.left + 1, i.right ),
                        i.top);
            }

            r.connected.put( n, door );
            n.connected.put( r, door );
        }
    }
}
 
开发者ID:FthrNature,项目名称:unleashed-pixel-dungeon,代码行数:22,代码来源:InfiniteLevel.java

示例8: paint

import com.watabou.utils.Rect; //导入方法依赖的package包/类
@Override
public void paint(Level level) {
	
	if (Math.min(width(), height()) > 3) {
		Painter.fill(level, this, 1, Terrain.CHASM);
	}
	
	super.paint(level);
	
	for (Room r : neigbours){
		if (r instanceof BridgeRoom || r instanceof RingBridgeRoom || r instanceof WalkwayRoom){
			Rect i = intersect(r);
			if (i.width() != 0){
				i.left++;
				i.right--;
			} else {
				i.top++;
				i.bottom--;
			}
			Painter.fill(level, i.left, i.top, i.width()+1, i.height()+1, Terrain.CHASM);
		}
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:24,代码来源:WalkwayRoom.java

示例9: 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-gdx,代码行数:17,代码来源:Room.java

示例10: 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

示例11: placeDoors

import com.watabou.utils.Rect; //导入方法依赖的package包/类
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);
			if (i.width() == 0) {
				door = new Room.Door(
						i.left,
						Random.Int(i.top + 1, i.bottom));
			} else {
				door = new Room.Door(
						Random.Int(i.left + 1, i.right),
						i.top);
			}

			r.connected.put(n, door);
			n.connected.put(r, door);
		}
	}
}
 
开发者ID:NYRDS,项目名称:pixel-dungeon-remix,代码行数:22,代码来源:RegularLevel.java

示例12: paint

import com.watabou.utils.Rect; //导入方法依赖的package包/类
@Override
public void paint(Level level) {
	Painter.fill(level, this, 1, Terrain.CHASM);

	super.paint(level);

	for (Room r : neigbours){
		if (r instanceof BridgeRoom || r instanceof RingBridgeRoom || r instanceof WalkwayRoom){
			Rect i = intersect(r);
			if (i.width() != 0){
				i.left++;
				i.right--;
			} else {
				i.top++;
				i.bottom--;
			}
			Painter.fill(level, i.left, i.top, i.width()+1, i.height()+1, Terrain.CHASM);
		}
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:21,代码来源:RingBridgeRoom.java

示例13: 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

示例14: 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

示例15: 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


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