本文整理匯總了Java中com.badlogic.gdx.graphics.glutils.ShapeRenderer.line方法的典型用法代碼示例。如果您正苦於以下問題:Java ShapeRenderer.line方法的具體用法?Java ShapeRenderer.line怎麽用?Java ShapeRenderer.line使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.glutils.ShapeRenderer
的用法示例。
在下文中一共展示了ShapeRenderer.line方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: render
import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
@Override
public void render(float delta, ModelBatch modelBatch, ShapeRenderer shapeRenderer, Environment environment) {
super.render(delta, modelBatch, shapeRenderer, environment);
if(laserTime > 0) {
laserTime -= delta;
shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
shapeRenderer.setColor(1, 0, 0, 1);
shapeRenderer.line(transform.getTranslation(tempVector), laserTo);
shapeRenderer.end();
}
}
示例2: drawPath
import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
public static void drawPath(ArrayList<Node> path , ShapeRenderer sr , OrthographicCamera camera){
sr.setAutoShapeType(true);
sr.setProjectionMatrix(camera.combined);
sr.begin();
for(Node node : path){
Vector2 start = node.getParent() != null ? node.getParent().getCordinates().cpy().scl(32) : LevelManager.tileSpawn.getTileCenter();
sr.setColor(Color.WHITE);
sr.set(ShapeType.Line);
sr.line(start , node.getCordinates().cpy().scl(32));
}
sr.end();
}
示例3: debugRender
import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //導入方法依賴的package包/類
public void debugRender(ShapeRenderer shapeRenderer, SpriteBatch spriteBatch, BitmapFont font, Camera camera) {
// box
shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
shapeRenderer.setColor(Color.BLACK);
for (float x = 0; x < mapWidth; x++) {
for (float y = 0; y < mapHeight; y++) {
shapeRenderer.box(x, y, 0, 1f, 1f, 0f);
}
}
shapeRenderer.end();
// fps
spriteBatch.begin();
font.setColor(Color.RED);
font.draw(spriteBatch, Gdx.graphics.getFramesPerSecond() + "", 0, 15);
font.setColor(Color.WHITE);
// costs + cords
for (int x = 0; x < mapWidth; x++) {
for (int y = 0; y < mapHeight; y++) {
Vector2 point = new Vector2(x, y + 1);
CoordinateUtil.worldToTouch(point, camera);
font.draw(spriteBatch, cost[x][y] + "", point.x, point.y);
// point = new Vector2(x, y);
// CoordinateUtil.worldToTouch(point, camera);
// font.draw(spriteBatch, x + "", point.x, point.y);
//
// point = new Vector2(x + 1, y);
// CoordinateUtil.worldToTouch(point, camera);
// font.draw(spriteBatch, y + "", point.x, point.y);
}
}
spriteBatch.end();
// vector
shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
shapeRenderer.setColor(Color.RED);
for (int x = 0; x < mapWidth; x++) {
for (int y = 0; y < mapHeight; y++) {
Vector2 dir = direction[x][y];
dir = dir.cpy().scl(0.5f);
shapeRenderer.circle(x + 0.5f, y + 0.5f, 0.1f, 20);
shapeRenderer.line(x + 0.5f, y + 0.5f, x + dir.x + 0.5f, y + dir.y + 0.5f);
}
}
shapeRenderer.end();
}