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


Java ShapeType類代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType的典型用法代碼示例。如果您正苦於以下問題:Java ShapeType類的具體用法?Java ShapeType怎麽用?Java ShapeType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ShapeType類屬於com.badlogic.gdx.graphics.glutils.ShapeRenderer包,在下文中一共展示了ShapeType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: popShapeCommandCell

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
final StructShapeCommand popShapeCommandCell() {
	if(currShapePos >= shapeCommandQueues.size) {
		return null;
	}
	
	stackCommand.clear();
	stackCommand.drawType = (DrawType) shapeCommandQueues.get(currShapePos++);
	stackCommand.color = (Color) shapeCommandQueues.get(currShapePos++);
	// 如果color是null則使用默認顏色
	if(stackCommand.color == null) {
		stackCommand.color = getDisplayedColor();
	}
	stackCommand.shapeType = (ShapeType) shapeCommandQueues.get(currShapePos++);
	stackCommand.borderWidth = (float) shapeCommandQueues.get(currShapePos++);
	int dataLen = (int) shapeCommandQueues.get(currShapePos++);
	for(int i = 0; i < dataLen; ++i) {
		stackCommand.vertexArray.add((Float) shapeCommandQueues.get(currShapePos++));
	}
	return stackCommand;
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:21,代碼來源:DrawNode.java

示例2: draw

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
public void draw(SpriteBatch spriteBatch) {
	
	// Draw HUD Element if it needs to be drawn
	if (showHUDElement) {

		shapeRenderer.begin(ShapeType.Filled);
		// Change HP color to yellow between 20% and 10% and red at 10% and lower
		if (healthLeft >= (totalHealth * 0.4)) {
			healthBarColor = Color.GREEN;
		}
		else if (healthLeft < (totalHealth * 0.4) && healthLeft > (totalHealth * 0.2)) {
			healthBarColor = Color.YELLOW;
		} else if (healthLeft < (totalHealth * 0.2)) {
			healthBarColor = Color.RED;
		}
		shapeRenderer.setColor(healthBarColor);
		shapeRenderer.rect(x, y, healthLeft - 1, height);
		shapeRenderer.end();
		
		shapeRenderer.begin(ShapeType.Line);
		shapeRenderer.setColor(Color.WHITE);
		shapeRenderer.rect(x, y, width, height);
		shapeRenderer.end();
	}
	
}
 
開發者ID:ja-brouil,項目名稱:StarshipFighters,代碼行數:27,代碼來源:HealthBar.java

示例3: drawPolygonOutline

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
/**
 * Internal method.
 * 
 * <p>Implements drawing the outline of an open and
 * closed polygon outline.</p>
 * 
 * @see #drawPolygon(float, float...)
 * @see #drawOpenPolygon(float, float...)
 */
private void drawPolygonOutline(float lineThickness, boolean close, float... points) {
    if (points.length < 6) {
        return; // Won't draw anything; does not have at least 3 edges.
    }

    if (points.length % 2 != 0) {
        throw new IllegalArgumentException("uneven point");
    }

    this.startDrawingShape();
    if (renderer.getCurrentType() != ShapeType.Filled) {
        renderer.set(ShapeType.Filled);
    }

    for (int i = 2; i < points.length; i++) {
        if (i % 2 == 0) {
            this.drawLine(points[i - 2], points[i - 1], points[i], points[i + 1],
                lineThickness);
        }
    }

    if (close)
        this.drawLine(points[points.length - 2], points[points.length - 1], points[0],
            points[1], lineThickness);
}
 
開發者ID:Xemiru,項目名稱:Undertailor,代碼行數:35,代碼來源:MultiRenderer.java

示例4: renderSelectionRectangle

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
/**
 * Draws the selection rectangle using the supplied renderer if selection is
 * currently in progress.
 * 
 * @param renderer
 */
private void renderSelectionRectangle() {

	Rectangle selection = gameState.getPlayerCharacterController()
			.getSelectionRectangle();
	if (selection != null
			&& Math.abs(selection.getHeight()) > Configuration
					.getSelectionTolerance()
			&& Math.abs(selection.getWidth()) > Configuration
					.getSelectionTolerance()) {
		// need to call the setter to make sure the matrix gets marked as dirty
		shapeRenderer.setProjectionMatrix(shapeRenderer
				.getProjectionMatrix().setToOrtho2D(0, 0,
						Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
		shapeRenderer.begin(ShapeType.Line);
		shapeRenderer.setColor(Color.GREEN);
		shapeRenderer.rect(selection.x, selection.y, selection.width,
				selection.height);
		shapeRenderer.end();
	}
}
 
開發者ID:mganzarcik,項目名稱:fabulae,代碼行數:27,代碼來源:GameMapRenderer.java

示例5: renderGrid

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
private void renderGrid() {
	shapeRenderer.setColor(Color.PINK);
	shapeRenderer.begin(ShapeType.Line);
	
	int halfArea = 200;
	float width = viewport.getWorldWidth();
	float height = viewport.getWorldHeight();
	
	shapeRenderer.line(-width * halfArea, 0.0f, width * halfArea, 0.0f);
	shapeRenderer.line(0.0f, -height * halfArea, 0.0f, height * halfArea);
	
	shapeRenderer.setColor(Color.WHITE);
	
	for (int i = -halfArea; i < halfArea; ++i) {
		if (i == 0) continue;
		shapeRenderer.line(-width * halfArea, i, width * halfArea, i);
		shapeRenderer.line(i, -height * halfArea, i, height * halfArea);
	}
	
	shapeRenderer.end();
}
 
開發者ID:saltares,項目名稱:libgdxjam,代碼行數:22,代碼來源:RenderingSystem.java

示例6: renderCameraDebug

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
private void renderCameraDebug()  {
	shapeRenderer.setProjectionMatrix(viewport.getCamera().combined);
	shapeRenderer.setColor(Color.YELLOW);
	shapeRenderer.begin(ShapeType.Line);
	shapeRenderer.rect(
		cameraFocusRect.x,
		cameraFocusRect.y,
		cameraFocusRect.width, 
		cameraFocusRect.height
	);
	shapeRenderer.setColor(Color.RED);
	shapeRenderer.rect(
		cameraTarget.x - 0.05f,
		cameraTarget.y - 0.05f,
		0.1f,
		0.1f
	);
	shapeRenderer.end();
}
 
開發者ID:saltares,項目名稱:libgdxjam,代碼行數:20,代碼來源:RenderingSystem.java

示例7: draw

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
@Override
 public void draw() {
     super.draw();

     if(boss != null) {
         renderer.begin();
         moonImpactMeter.draw(renderer);
         renderer.end();
     }
     
     if(isStageClear()) {
         Gdx.gl.glEnable(GL20.GL_BLEND);
     	renderer.begin(ShapeType.Filled);
     	renderer.setColor(screenFadeActor.getColor());
     	renderer.rect(screenFadeActor.getX(), screenFadeActor.getY(), screenFadeActor.getWidth(), screenFadeActor.getHeight());
     	renderer.end();
         Gdx.gl.glDisable(GL20.GL_BLEND);
     }
     
     if(debug) {
      uiBatch.begin();
font.draw(uiBatch, screenLogger.toString(), 50, 300);
screenLogger.setLength(0);
uiBatch.end();
     }
 }
 
開發者ID:broken-shotgun,項目名稱:throw-the-moon,代碼行數:27,代碼來源:GameStage.java

示例8: draw

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
public void draw(SpriteBatch batch) {
	renderer.setAutoShapeType(true);
	renderer.begin();
	renderer.setColor(Color.WHITE);
	for (int i = 0; i < map.length; i++) {
		for (int j = map[0].length - 1; j >= 0; j--) {
			renderer.set(filled[i][j] ? ShapeType.Filled : ShapeType.Line);
			renderer.setColor(filled[i][j] ? Color.WHITE : Color.GRAY);
			renderer.rect(i * sz + 50, j * sz + 50, sz, sz);
		}
	}
	renderer.set(ShapeType.Filled);
	renderer.setColor(Color.GREEN);
	renderer.rect(entrance.x * sz + 50, entrance.y * sz + 50, sz, sz);
	renderer.setColor(Color.YELLOW);
	renderer.rect(exit.x * sz + 50, exit.y * sz + 50, sz, sz);
	renderer.end();
}
 
開發者ID:adketuri,項目名稱:umbracraft,代碼行數:19,代碼來源:MapGenerator.java

示例9: render

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
public void render(ShapeRenderer renderer) {
    renderer.setColor(Constants.PLAYER_COLOR);
    renderer.set(ShapeType.Filled);
    renderer.circle(position.x, position.y, Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_HEAD_SEGMENTS);

    Vector2 torsoTop = new Vector2(position.x, position.y - Constants.PLAYER_HEAD_RADIUS);
    Vector2 torsoBottom = new Vector2(torsoTop.x, torsoTop.y - 2 * Constants.PLAYER_HEAD_RADIUS);

    renderer.rectLine(torsoTop, torsoBottom, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoTop.x, torsoTop.y,
            torsoTop.x + Constants.PLAYER_HEAD_RADIUS, torsoTop.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);
    renderer.rectLine(
            torsoTop.x, torsoTop.y,
            torsoTop.x - Constants.PLAYER_HEAD_RADIUS, torsoTop.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoBottom.x, torsoBottom.y,
            torsoBottom.x + Constants.PLAYER_HEAD_RADIUS, torsoBottom.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoBottom.x, torsoBottom.y,
            torsoBottom.x - Constants.PLAYER_HEAD_RADIUS, torsoBottom.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);
}
 
開發者ID:udacity,項目名稱:ud405,代碼行數:26,代碼來源:Player.java

示例10: renderPlayerData

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
public void renderPlayerData() {
	game.spriteBatch.begin();
	game.scoreFont.setColor(Color.WHITE);
	game.scoreFont.draw(game.spriteBatch, "Score: " + Data.SCORE, 600, 500);
	game.scoreFont.draw(game.spriteBatch, "Coins collected:  "
			+ Data.COINS_COLLECTED, 450, 500);
	game.spriteBatch.end();

	game.healthBar.setAutoShapeType(true);
	game.healthBar.begin();
	game.healthBar.set(ShapeType.Filled);
	game.healthBar.setColor(Color.WHITE);
	game.healthBar.rect(90, 465, 210, 40);
	game.healthBar.setColor(Color.RED);
	game.healthBar.rect(100, 470, Life.health * 2, 30);
	game.healthBar.end();
}
 
開發者ID:wasimbeniwale,項目名稱:ArxxusGame,代碼行數:18,代碼來源:PlayerDataRenderer.java

示例11: render

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
@Override
public void render(float delta) {
	Gdx.gl.glClearColor(0.1f, 0.1f, 0.1f, 1);
	Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

	game.spriteBatch.begin();
	game.scoreFont.setColor(Color.WHITE);
	game.scoreFont.draw(game.spriteBatch, "Player Name (Touch to Change)",
			50, 320);
	game.scoreFont.draw(game.spriteBatch,
			"Music Settings (Touch to Change)", 50, 370);
	game.spriteBatch.end();

	game.healthBar.setAutoShapeType(true);
	game.healthBar.begin();
	game.healthBar.setColor(Color.RED);
	game.healthBar.set(ShapeType.Filled);
	game.healthBar.rect(280, 300, 150, 30);
	game.healthBar.rect(280, 350, 150, 30);
	game.healthBar.end();

	act(delta);
	draw();
}
 
開發者ID:wasimbeniwale,項目名稱:ArxxusGame,代碼行數:25,代碼來源:SettingsScreen.java

示例12: render

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
@Override
public void render(float delta) {
    // TODO: Update Icicles
    icicles.update(delta);
    player.update(delta);

    iciclesViewport.apply(true);
    Gdx.gl.glClearColor(Constants.BACKGROUND_COLOR.r, Constants.BACKGROUND_COLOR.g, Constants.BACKGROUND_COLOR.b, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    renderer.setProjectionMatrix(iciclesViewport.getCamera().combined);
    renderer.begin(ShapeType.Filled);
    // TODO: Render Icicles
    icicles.render(renderer);
    player.render(renderer);
    renderer.end();

}
 
開發者ID:udacity,項目名稱:ud405,代碼行數:19,代碼來源:IciclesScreen.java

示例13: render

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
@Override
public void render(float delta) {
    // TODO: Call update() on player


    iciclesViewport.apply(true);
    Gdx.gl.glClearColor(Constants.BACKGROUND_COLOR.r, Constants.BACKGROUND_COLOR.g, Constants.BACKGROUND_COLOR.b, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    renderer.setProjectionMatrix(iciclesViewport.getCamera().combined);
    renderer.begin(ShapeType.Filled);
    renderer.setColor(Constants.ICICLE_COLOR);
    icicle.render(renderer);
    player.render(renderer);
    renderer.end();

}
 
開發者ID:udacity,項目名稱:ud405,代碼行數:18,代碼來源:IciclesScreen.java

示例14: render

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
@Override
public void render(float delta) {

    // TODO: Apply the viewport
    iciclesViewport.apply(true);

    // TODO: Clear the screen to the background color
    Gdx.gl.glClearColor(Constants.BACKGROUND_COLOR.r, Constants.BACKGROUND_COLOR.g, Constants.BACKGROUND_COLOR.b, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // TODO: Set the ShapeRenderer's projection matrix
    renderer.setProjectionMatrix(iciclesViewport.getCamera().combined);

    // TODO: Draw the Icicle

    renderer.begin(ShapeType.Filled);
    icicle.render(renderer);
    renderer.end();

}
 
開發者ID:udacity,項目名稱:ud405,代碼行數:21,代碼來源:IciclesScreen.java

示例15: render

import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; //導入依賴的package包/類
@Override
public void render() {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    renderer.begin(ShapeType.Filled);

    // Head
    renderer.circle(100, 100, 10);
    renderer.end();

    renderer.begin(ShapeType.Line);

    // Torso
    renderer.line(100, 50, 100, 100);

    // Legs
    renderer.line(85, 35, 100, 50);
    renderer.line(115, 35, 100, 50);

    // Arms
    renderer.line(85, 70, 100, 85);
    renderer.line(115, 70, 100, 85);
    renderer.end();
}
 
開發者ID:udacity,項目名稱:ud405,代碼行數:26,代碼來源:StickFigure.java


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