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


Java Point类代码示例

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


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

示例1: paint

import com.watabou.utils.Point; //导入依赖的package包/类
public void paint(Level level ) {

		Painter.fill( level, this, Terrain.WALL );
		Painter.fill( level, this, 1, Terrain.EMPTY );

		Painter.fill( level, left+1, top+1, width()-2, 1, Terrain.WALL_DECO);
		Painter.fill( level, left+1, top+2, width()-2, 1, Terrain.WATER);

		Painter.set( level, left+width()/2, top+1, Terrain.LOCKED_EXIT);
		level.exit = level.pointToCell(new Point(left+width()/2, top+1));

		do {
			level.entrance = level.pointToCell(random(3));
		} while (level.findMob(level.entrance) != null);
		Painter.set( level, level.entrance, Terrain.ENTRANCE );

		for (Room.Door door : connected.values()) {
			door.set( Room.Door.Type.REGULAR );

			if (door.y == top){
				Painter.set( level, door.x, door.y+1, Terrain.WATER);
			}
		}

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

示例2: distanceBetweenPoints

import com.watabou.utils.Point; //导入依赖的package包/类
private int distanceBetweenPoints(Point a, Point b){
	//on the same side
	if (a.y == b.y || a.x == b.x){
		return Math.max(spaceBetween(a.x, b.x), spaceBetween(a.y, b.y));
	}

	//otherwise...
	//subtract 1 at the end to account for overlap
	return
			Math.min(spaceBetween(left, a.x) + spaceBetween(left, b.x),
					spaceBetween(right, a.x) + spaceBetween(right, b.x))
					+
					Math.min(spaceBetween(top, a.y) + spaceBetween(top, b.y),
							spaceBetween(bottom, a.y) + spaceBetween(bottom, b.y))
					-
					1;
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:18,代码来源:PerimeterRoom.java

示例3: canConnect

import com.watabou.utils.Point; //导入依赖的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: drawLine

import com.watabou.utils.Point; //导入依赖的package包/类
public static void drawLine( Level level, Point from, Point to, int value){
	float x = from.x;
	float y = from.y;
	float dx = to.x - from.x;
	float dy = to.y - from.y;

	boolean movingbyX = Math.abs(dx) >= Math.abs(dy);
	//normalize
	if (movingbyX){
		dy /= Math.abs(dx);
		dx /= Math.abs(dx);
	} else {
		dx /= Math.abs(dy);
		dy /= Math.abs(dy);
	}

	set(level, Math.round(x), Math.round(y), value);
	while((movingbyX && to.x != x) || (!movingbyX && to.y != y)){
		x += dx;
		y += dy;
		set(level, Math.round(x), Math.round(y), value);
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:24,代码来源:Painter.java

示例5: drawInside

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

示例6: placeDoors

import com.watabou.utils.Point; //导入依赖的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 );
			ArrayList<Point> doorSpots = new ArrayList<>();
			for (Point p : i.getPoints()){
				if (r.canConnect(p) && n.canConnect(p))
					doorSpots.add(p);
			}
			door = new Room.Door(Random.element(doorSpots));

			r.connected.put( n, door );
			n.connected.put( r, door );
		}
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:19,代码来源:RegularPainter.java

示例7: paintWater

import com.watabou.utils.Point; //导入依赖的package包/类
protected void paintWater( Level l, ArrayList<Room> rooms ){
	boolean[] lake = Patch.generate( l.getWidth(), l.getHeight(), waterFill, waterSmoothness, true );

	if (!rooms.isEmpty()){
		for (Room r : rooms){
			for (Point p : r.terrainModifiablePoints()){
				int i = l.pointToCell(p);
				if (lake[i] && l.map[i] == Terrain.EMPTY){
					l.map[i] = Terrain.WATER;
				}
			}
		}
	} else {
		for (int i = 0; i < l.getLength(); i ++) {
			if (lake[i] && l.map[i] == Terrain.EMPTY){
				l.map[i] = Terrain.WATER;
			}
		}
	}

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

示例8: layout

import com.watabou.utils.Point; //导入依赖的package包/类
@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;
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:23,代码来源:ScrollPane.java

示例9: drawInside

import com.watabou.utils.Point; //导入依赖的package包/类
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;
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:24,代码来源:Painter.java

示例10: paint

import com.watabou.utils.Point; //导入依赖的package包/类
public static void paint( Level level, Room room) {

		for (Room.Door door : room.connected.values()) {
			door.set( Room.Door.Type.REGULAR );
		}

		fill(level, room, Terrain.WALL);
		fill(level, room, 1, Terrain.EMPTY);

		RitualMarker vis = new RitualMarker();
		Point c = room.center();
		vis.pos(c.x - 1, c.y - 1);

		level.customTiles.add(vis);

		fill(level, c.x-1, c.y-1, 3, 3, Terrain.EMPTY_DECO);

		level.addItemToSpawn(new CeremonialCandle());
		level.addItemToSpawn(new CeremonialCandle());
		level.addItemToSpawn(new CeremonialCandle());
		level.addItemToSpawn(new CeremonialCandle());

		CeremonialCandle.ritualPos = c.x + (level.width() * c.y);
	}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:25,代码来源:RitualSitePainter.java

示例11: paint

import com.watabou.utils.Point; //导入依赖的package包/类
public static void paint( Level level, Room room ) {
	
	fill( level, room, Terrain.WALL );
	fill( level, room, 1, Terrain.CHASM );
	
	Room.Door door = room.entrance(); 
	door.set( Room.Door.Type.REGULAR );
	
	if (door.x == room.left) {
		for (int i=room.top + 1; i < room.bottom; i++) {
			drawInside( level, room, new Point( room.left, i ), Random.IntRange( 1, room.width() - 2 ), Terrain.EMPTY_SP );
		}
	} else if (door.x == room.right) {
		for (int i=room.top + 1; i < room.bottom; i++) {
			drawInside( level, room, new Point( room.right, i ), Random.IntRange( 1, room.width() - 2 ), Terrain.EMPTY_SP );
		}
	} else if (door.y == room.top) {
		for (int i=room.left + 1; i < room.right; i++) {
			drawInside( level, room, new Point( i, room.top ), Random.IntRange( 1, room.height() - 2 ), Terrain.EMPTY_SP );
		}
	} else if (door.y == room.bottom) {
		for (int i=room.left + 1; i < room.right; i++) {
			drawInside( level, room, new Point( i, room.bottom ), Random.IntRange( 1, room.height() - 2 ), Terrain.EMPTY_SP );
		}
	}
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:27,代码来源:WeakFloorPainter.java

示例12: paint

import com.watabou.utils.Point; //导入依赖的package包/类
public static void paint( Level level, Room room ) {

		fill( level, room, Terrain.WALL );
		fill( level, room, 1, Terrain.EMPTY );
		
		Point c = room.center();
		set( level, c.x, c.y, Terrain.WELL );
		
		@SuppressWarnings("unchecked")
		Class<? extends WellWater> waterClass = 
			(Class<? extends WellWater>)Random.element( WATERS );
		
		WellWater water = (WellWater)level.blobs.get( waterClass );
		if (water == null) {
			try {
				water = waterClass.newInstance();
			} catch (Exception e) {
				water = null;
			}
		}
		water.seed( c.x + Level.WIDTH * c.y, 1 );
		level.blobs.put( waterClass, water );
		
		room.entrance().set( Room.Door.Type.REGULAR );
	}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:26,代码来源:MagicWellPainter.java

示例13: paintStudy

import com.watabou.utils.Point; //导入依赖的package包/类
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 );
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:19,代码来源:StandardPainter.java

示例14: layout

import com.watabou.utils.Point; //导入依赖的package包/类
@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 );

       indicator.visible = height < content.height();
       if (indicator.visible) {
           indicator.scale.set( 2, height * height / content.height() );
           indicator.x = right() - indicator.width();
           indicator.y = y;
       }
}
 
开发者ID:ConsideredHamster,项目名称:YetAnotherPixelDungeon,代码行数:23,代码来源:ScrollPane.java

示例15: paint

import com.watabou.utils.Point; //导入依赖的package包/类
public static void paint( Level level, Room room ) {
	
	fill( level, room, Terrain.WALL );
	fill( level, room, 1, Terrain.CHASM );
	
	Room.Door door = room.entrance();
	door.set( Room.Door.Type.REGULAR );
	
	if (door.x == room.left) {
		for (int i=room.top + 1; i < room.bottom; i++) {
			drawInside( level, room, new Point( room.left, i ), Random.IntRange( 1, room.width() - 2 ), Terrain.EMPTY_SP );
		}
	} else if (door.x == room.right) {
		for (int i=room.top + 1; i < room.bottom; i++) {
			drawInside( level, room, new Point( room.right, i ), Random.IntRange( 1, room.width() - 2 ), Terrain.EMPTY_SP );
		}
	} else if (door.y == room.top) {
		for (int i=room.left + 1; i < room.right; i++) {
			drawInside( level, room, new Point( i, room.top ), Random.IntRange( 1, room.height() - 2 ), Terrain.EMPTY_SP );
		}
	} else if (door.y == room.bottom) {
		for (int i=room.left + 1; i < room.right; i++) {
			drawInside( level, room, new Point( i, room.bottom ), Random.IntRange( 1, room.height() - 2 ), Terrain.EMPTY_SP );
		}
	}
}
 
开发者ID:FthrNature,项目名称:unleashed-pixel-dungeon,代码行数:27,代码来源:WeakFloorPainter.java


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