本文整理汇总了Java中com.badlogic.gdx.math.Rectangle.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.getHeight方法的具体用法?Java Rectangle.getHeight怎么用?Java Rectangle.getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.math.Rectangle
的用法示例。
在下文中一共展示了Rectangle.getHeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makePlatform
import com.badlogic.gdx.math.Rectangle; //导入方法依赖的package包/类
/**
* Creates a pivoted platform from the given object, at the given world.
*
* @param world The world were the platform will be.
* @param object The object used to initialize the platform.
* @return The Platform Model of the created platform.
*/
static PlatformModel makePlatform(World world, RectangleMapObject object) {
PlatformModel platform = new PlatformModel(world, object);
Boolean pivoted = object.getProperties().get("pivoted", boolean.class);
if (pivoted != null && pivoted == true) {
Rectangle rect = object.getRectangle();
RectangleMapObject anchorRect = new RectangleMapObject(
rect.getX() + rect.getWidth() / 2, rect.getY() + rect.getHeight() / 2, 1, 1
);
Body anchor = makeRectGround(world, anchorRect);
RevoluteJointDef jointDef = new RevoluteJointDef();
jointDef.initialize(anchor, platform.getBody(), platform.getBody().getWorldCenter());
world.createJoint(jointDef);
}
return platform;
}
示例2: drawRect
import com.badlogic.gdx.math.Rectangle; //导入方法依赖的package包/类
public static void drawRect(SpriteBatch batch, Rectangle hitbox, float thickness, Color color) {
// draw line
/*
* SpriteBatcherUtils.drawLine(batch, hitbox.getX(), hitbox.getY(),
* hitbox.getX() + hitbox.getWidth(), hitbox.getY(), color);
*
* //draw line SpriteBatcherUtils.drawLine(batch, hitbox.getX(),
* hitbox.getY(), hitbox.getX(), hitbox.getY() + hitbox.getHeight(),
* color);
*
* //draw line SpriteBatcherUtils.drawLine(batch, hitbox.getX(),
* hitbox.getY() + hitbox.getHeight(), hitbox.getX() +
* hitbox.getWidth(), hitbox.getY() + hitbox.getHeight(), color);
*
* //draw line SpriteBatcherUtils.drawLine(batch, hitbox.getX() +
* hitbox.getWidth(), hitbox.getY(), hitbox.getX() + hitbox.getWidth(),
* hitbox.getY() + hitbox.getHeight(), color);
*/
float x = hitbox.getX();
float y = hitbox.getY();
float width = hitbox.getWidth();
float height = hitbox.getHeight();
// draw border of rectangle
fillRectangle(batch, x, y, width, thickness, color);
fillRectangle(batch, x, y, thickness, height, color);
fillRectangle(batch, x + width - thickness, y, thickness, height, color);
fillRectangle(batch, x, y + height - thickness, width, thickness, color);
}
示例3: assertThereIsPlacedObject
import com.badlogic.gdx.math.Rectangle; //导入方法依赖的package包/类
private void assertThereIsPlacedObject(CollisionMap<PixelCollisionMapTestObject> collisionMap, Rectangle bounds,
PixelCollisionMapTestObject object)
{
for (int i = (int) bounds.getX(); i < bounds.getWidth() + bounds.getX(); i++)
for (int j = (int) bounds.getY(); j < bounds.getY() + bounds.getHeight(); j++)
assertThat(collisionMap.getObject(i, j)).isEqualTo(object);
}
示例4: assertNullAroundObject
import com.badlogic.gdx.math.Rectangle; //导入方法依赖的package包/类
private void assertNullAroundObject(CollisionMap<PixelCollisionMapTestObject> collisionMap, Rectangle bounds)
{
for (int i = (int) bounds.getX() - 1; i <= bounds.getX() + bounds.getWidth(); i++)
{
assertThat(collisionMap.getObject(i, (int) bounds.getY() - 1)).isNull();
assertThat(collisionMap.getObject(i, (int) (bounds.getY() + bounds.getHeight()))).isNull();
}
for (int i = (int) bounds.getY(); i <= bounds.getY() + bounds.getHeight(); i++)
{
assertThat(collisionMap.getObject((int) bounds.getX() - 1, i)).isNull();
assertThat(collisionMap.getObject((int) (bounds.getX() + bounds.getWidth()), i)).isNull();
}
}