當前位置: 首頁>>代碼示例>>Java>>正文


Java Rectangle.getHeight方法代碼示例

本文整理匯總了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;
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:26,代碼來源:B2DFactory.java

示例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);
}
 
開發者ID:opensourcegamedev,項目名稱:SpaceChaos,代碼行數:31,代碼來源:SpriteBatcherUtils.java

示例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);
}
 
開發者ID:MMORPG-Prototype,項目名稱:MMORPG_Prototype,代碼行數:8,代碼來源:PixelCollisionMapTests.java

示例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();
	}
}
 
開發者ID:MMORPG-Prototype,項目名稱:MMORPG_Prototype,代碼行數:14,代碼來源:PixelCollisionMapTests.java


注:本文中的com.badlogic.gdx.math.Rectangle.getHeight方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。