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


Java ShapeRenderer.begin方法代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.glutils.ShapeRenderer.begin方法的典型用法代码示例。如果您正苦于以下问题:Java ShapeRenderer.begin方法的具体用法?Java ShapeRenderer.begin怎么用?Java ShapeRenderer.begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.graphics.glutils.ShapeRenderer的用法示例。


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

示例1: draw

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //导入方法依赖的package包/类
public void draw(ShapeRenderer renderer) {
    if (rect.width < 25 * cam.zoom || rect.height < 25 * cam.zoom) return;

    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    renderer.setProjectionMatrix(cam.combined);
    renderer.begin(ShapeRenderer.ShapeType.Filled);
    renderer.setColor(new Color(0x228b2255));
    renderer.rect(rect.x, rect.y, rect.width, rect.height);

    renderer.set(ShapeRenderer.ShapeType.Line);
    renderer.setColor(Color.BLACK);
    renderer.rect(rect.x, rect.y, rect.width, rect.height);
    renderer.end();
}
 
开发者ID:conquest,项目名称:conquest,代码行数:17,代码来源:Grabber.java

示例2: render

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch sb, ShapeRenderer sr) {
    sb.setProjectionMatrix(camera.combined);
    sr.setAutoShapeType(true);
    sr.setProjectionMatrix(camera.combined);
    //SHAPERENDERER
    sr.begin();
    sr.set(ShapeRenderer.ShapeType.Filled);
    sr.setColor(new Color(23 / 255f, 23 / 255f, 23 / 255f, 1f));
    sr.rect(0, 0, Game.WIDTH, Game.HEIGHT);
    for (int i = 0; i < background.length; i++) {
        background[i].renderSR(sr);
    }
    play.renderSR(sr);
    music.renderSR(sr);
    sr.end();

    //SPRITEBATCH
    sb.begin();
    sb.draw(logo, Game.WIDTH / 2 - (logo.getTexture().getWidth() * 10) / 2, Game.HEIGHT - 50 - logo.getHeight() * 10, logo.getWidth() * 10, logo.getHeight() * 10);
    play.renderSB(sb);
    music.renderSB(sb);
    betaText.draw(sb, "Beta Release - Copyright 2017 Gussio. All rights reserved. Visit https://gussio.nl/ for more info.", 10, 25);
    sb.end();
}
 
开发者ID:MrGussio,项目名称:EarthInvadersGDX,代码行数:26,代码来源:MenuScreen.java

示例3: render

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //导入方法依赖的package包/类
@Override
public void render(SpriteBatch sb, ShapeRenderer sr) {
    sb.setProjectionMatrix(camera.combined);
    sr.setAutoShapeType(true);
    sr.setProjectionMatrix(camera.combined);

    //BACKGROUND
    sr.begin();
    sr.set(ShapeRenderer.ShapeType.Filled);
    sr.setColor(Color.WHITE);
    sr.rect(0, 0, Game.WIDTH, Game.HEIGHT);
    sr.end();

    //LOGO
    sb.begin();
    sb.draw(logo, Game.WIDTH / 2 - logo.getWidth() * 20 / 2, Game.HEIGHT / 2 - logo.getHeight() * 20 / 2, logo.getWidth() * 20, logo.getHeight() * 20);
    sb.end();
}
 
开发者ID:MrGussio,项目名称:EarthInvadersGDX,代码行数:19,代码来源:SplashScreen.java

示例4: execute

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //导入方法依赖的package包/类
@Override
public void execute(Renderer render) {
	ShapeRenderer shapeRender = render.getShapeRenderer();
	if(!shapeRender.isDrawing()) {
		shapeRender.begin();
	}
	this._callback.onCommand(shapeRender);
}
 
开发者ID:mingwuyun,项目名称:cocos2d-java,代码行数:9,代码来源:RenderCommand.java

示例5: draw

import com.badlogic.gdx.graphics.glutils.ShapeRenderer; //导入方法依赖的package包/类
public void draw(ShapeRenderer renderer) {
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    renderer.setProjectionMatrix(stage.getCamera().combined);
    renderer.setColor(background);

    renderer.begin(ShapeRenderer.ShapeType.Filled);
    renderer.rect((Gdx.graphics.getWidth() - 125) / 2, 10, 125, 30);
    renderer.end();
    Gdx.gl.glDisable(GL20.GL_BLEND);

    stage.act();
    stage.draw();
}
 
开发者ID:conquest,项目名称:conquest,代码行数:16,代码来源:Hud.java

示例6: 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();
    }
}
 
开发者ID:justinmarentette11,项目名称:Tower-Defense-Galaxy,代码行数:12,代码来源:Laser.java

示例7: 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();
}
 
开发者ID:JoakimRW,项目名称:ExamensArbeteTD,代码行数:13,代码来源:PathFinder.java

示例8: 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();
    }
 
开发者ID:MiniDigger,项目名称:projecttd,代码行数:46,代码来源:PathFindingSystem.java


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