Java 类com.badlogic.gdx.graphics.glutils.ShapeRenderer 实例源码

项目:LD38-Compo    文件:LudumDare38.java   
private void drawMenu()
{

    shapeRenderer.begin();
    shapeRenderer.set(ShapeRenderer.ShapeType.Filled);
    shapeRenderer.rect(Gdx.graphics.getWidth() - 80, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(),
            Color.valueOf("#42f498"), Color.valueOf("#42f498"), Color.valueOf("#42f498"), Color.valueOf("#42f498"));
    shapeRenderer.set(ShapeRenderer.ShapeType.Line);
    shapeRenderer.line(Gdx.graphics.getWidth() - 80, 0, Gdx.graphics.getWidth() - 80, Gdx.graphics.getHeight(), Color.BLACK, Color.BLACK);

    shapeRenderer.end();

    batch.begin();
    for(int i = 0; i < menuTextures.size(); i++)
    {
        batch.draw(menuTextures.get(i),
                Gdx.graphics.getWidth() - 40 - menuTextures.get(i).getWidth()/2, Gdx.graphics.getHeight() - (menuTextures.get(i).getHeight() + MENU_PADDING_Y + i * 75),
                menuTextures.get(i).getWidth(), menuTextures.get(i).getHeight());
    }
    batch.end();
}
项目:libgdx_ui_editor    文件:EditingZone.java   
public void drawBg(Batch batch, float parentAlpha) {
    batch.end();
    Gdx.gl.glLineWidth(1.0f);
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    shapeRenderer.setProjectionMatrix(getStage().getCamera().combined);
    Matrix4 matrix = batch.getTransformMatrix();
    shapeRenderer.setTransformMatrix(matrix);

    shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
    BG.a = parentAlpha;
    shapeRenderer.setColor(BG);
    shapeRenderer.rect(getX(), getY(), getWidth(), getHeight());
    shapeRenderer.end();

    Gdx.gl.glDisable(GL20.GL_BLEND);
    batch.begin();
    batch.setColor(Color.WHITE.r, Color.WHITE.g, Color.WHITE.b, Color.WHITE.a * parentAlpha);
}
项目:NoRiskNoFun    文件:GameObjectMap.java   
GameObjectMap(AssetMap assetMap) {

        this.assetMap = assetMap;
        batch = new PolygonSpriteBatch();
        shapeRenderer = new ShapeRenderer();

        Pixmap pix = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
        pix.setColor(Color.WHITE);
        pix.fill();
        texture = new Texture(pix);

        regionMap = new HashMap<>();
        regionNameMap = new HashMap<>();

        initPolygonRegions();
    }
项目:NoRiskNoFun    文件:GameObjectMap.java   
@Override
public void draw (Batch batch, float parentAlpha) {
    batch.end();

    Gdx.gl.glLineWidth(10);

    for (PolygonRegion region : polygonRegions) {

        this.batch.begin();
        this.batch.draw(region, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        this.batch.end();

        Polyline line = new Polyline(region.getVertices());
        line.setScale(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

        shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
        shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
        shapeRenderer.setColor(Color.BROWN);
        shapeRenderer.polyline(line.getTransformedVertices());
        shapeRenderer.end();
    }

    batch.begin();
}
项目:conquest    文件:Grabber.java   
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();
}
项目:SpaceChaos    文件:HUDOverlayScreen.java   
@Override
protected void onInit(ScreenBasedGame game, AssetManager assetManager) {
    // generate fonts
    this.font1 = BitmapFontFactory.createFont("./data/font/spartakus/SparTakus.ttf", 48, Color.WHITE, Color.BLUE,
            3);
    this.font2 = BitmapFontFactory.createFont("./data/font/spartakus/SparTakus.ttf", 48, Color.RED, Color.WHITE, 3);

    // load & get assets
    assetManager.load(TORPEDO_IMAGE_PATH, Texture.class);
    assetManager.finishLoadingAsset(TORPEDO_IMAGE_PATH);
    this.torpedoTexture = assetManager.get(TORPEDO_IMAGE_PATH, Texture.class);

    // create new Head-Up-Display
    this.hud = new HUD();
    this.filledBar = new FilledBar(this.font1);
    this.filledBar.setPosition(game.getViewportWidth() - 400, game.getViewportHeight() - 85);
    this.filledBar.setDimension(155, 35);
    this.hud.addWidget(this.filledBar);

    this.shapeRenderer = new ShapeRenderer();
}
项目:JGame    文件:Crafting.java   
public Crafting(int x, int y, int wid, int hei) {
    this.x = x;
    this.y = y;
    this.wid = wid;
    this.hei = hei;
    shapes = new ShapeRenderer();
    this.active = true;
    fontHandler = new FontHandler();

    layoutSave = new GlyphLayout(fontHandler.font32, "SAVE");
    widthSave = layoutSave.width;
    heightSave = layoutSave.height;

    layoutExit = new GlyphLayout(fontHandler.font32, "X");
    widthExit = layoutExit.width;
    heightExit = layoutExit.height;

}
项目:JGame    文件:MainMenu.java   
public MainMenu(JGame game) {
    this.game = game;
    this.batch = game.batch;
    playY = (game.screenY / 2) + 200;
    loadY = (game.screenY / 2) + 100;
    exitY = (game.screenY / 2);
    shapes = new ShapeRenderer();

    fontHandler = new FontHandler();

    layoutPlay = new GlyphLayout(fontHandler.font90, "PLAY");
    widthPlay = layoutPlay.width;
    heightPlay = layoutPlay.height;

    layoutLoad = new GlyphLayout(fontHandler.font90, "LOAD");
    widthLoad = layoutLoad.width;
    heightLoad = layoutLoad.height;

    layoutExit = new GlyphLayout(fontHandler.font90, "EXIT");
    widthExit = layoutExit.width;
    heightExit = layoutExit.height;

}
项目:SpaceChaos    文件:CollisionComponent.java   
public void drawCollisionBoxes(GameTime time, CameraWrapper camera, ShapeRenderer shapeRenderer, Color baseColor,
        Color inCollisionColor) {
    Color color = null;

    if (alreadyInCollision) {
        color = inCollisionColor;
    } else {
        color = baseColor;
    }

    // first, draw hull
    if (this.hullShape != null) {
        this.hullShape.drawShape(time, camera, shapeRenderer, color);
    }

    // draw inner shapes
    for (CShape shape : this.collisionShapes) {
        shape.drawShape(time, camera, shapeRenderer, color);
    }
}
项目:SpaceChaos    文件:FilledBar.java   
@Override
public void drawLayer1(GameTime time, ShapeRenderer shapeRenderer) {
    // draw background
    shapeRenderer.setColor(this.backgroundColor);
    shapeRenderer.rect(getX(), getY(), getWidth(), getHeight());

    float maxWidth = getWidth() - (paddingLeft + paddingRight);
    float maxHeight = getHeight() - (paddingTop + paddingBottom);

    float barWidth = maxWidth * percent;
    float barHeight = maxHeight;

    // draw foreground
    shapeRenderer.setColor(this.foregroundColor);
    shapeRenderer.rect(getX() + paddingBottom, getY() + paddingLeft, barWidth, barHeight);
}
项目:EarthInvadersGDX    文件:Game.java   
@Override
public void create() {
    saveFile = Gdx.files.local("bin/saves.dat");
    if (saveFile.exists()) {
        load();
    } else {
        currentDescriptor = newSaveFileDescriptor();
        save();
    }
    aspectRatio = (float) Gdx.graphics.getHeight() / (float) Gdx.graphics.getWidth();
    batch = new SpriteBatch();
    sr = new ShapeRenderer();
    setCurrentScreen(new SplashScreen());
    Gdx.graphics.requestRendering();
    Gdx.input.setInputProcessor(this);
    Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); //fixes red screen bug on startup
    Gdx.input.setCatchBackKey(true);
}
项目:EarthInvadersGDX    文件:MenuScreen.java   
@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();
}
项目:EarthInvadersGDX    文件:SplashScreen.java   
@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();
}
项目:projecttd    文件:HudScene.java   
public HudScene(SpriteBatch batch, ShapeRenderer shapeRenderer, ArcRenderer arcRenderer) {
    this.batch = batch;
    stage = new Stage();

    VisUI.load();

    Table table = new Table();
    table.top();
    table.setFillParent(true);

    scoreLabel = new Label("", new Label.LabelStyle(new BitmapFont(), Color.VIOLET));
    setScore(score);
    balanceLabel = new Label("", new Label.LabelStyle(new BitmapFont(), Color.VIOLET));
    setBalance(balance);

    table.add(scoreLabel).align(Align.left).expandX();
    table.add(balanceLabel).align(Align.right).expandX();

    stage.addActor(table);


    ringButton = new RingButton(shapeRenderer, arcRenderer);
    ringButton.setBounds(10, 10, 100, 100);
    stage.addActor(ringButton);
}
项目:nomoore    文件:MyGdxGame.java   
@Override
public void create() {
    if (androidInterface != null)
        androidInterface.tryToStopMusicApp();

    batch = new SpriteBatch();
    sr = new ShapeRenderer();

    camera = new OrthographicCamera();
    viewport = new FitViewport(Configuration.WINDOW_WIDTH, Configuration.WINDOW_HEIGHT, camera);
    camera.position.set(viewport.getWorldWidth() / 2 - (viewport.getWorldWidth() - 500) / 2, viewport.getWorldHeight() / 2 - (viewport.getWorldHeight() - 220) / 2, 0);
    camera.update();

    fade = new Sprite(new Texture("sprites/fade.png"));
    fade.setBounds(0, -100, viewport.getWorldWidth(), viewport.getWorldHeight() - 40);

    font = new BitmapFont(Gdx.files.internal("fonts/amiga4everpro2.fnt"));

    showModernTimesCutscene(); // start the game
}
项目:water2d-libgdx    文件:Water.java   
/**
 * Constructor that allows to specify if there is an effect of waves and splash particles.
 * @param waves Specifies whether the object will have waves
 * @param splashParticles Specifies whether the object will have splash particles
 */
public Water(boolean waves, boolean splashParticles) {

    this.waves = waves;
    this.splashParticles = splashParticles;
    this.fixturePairs = new HashSet<Pair<Fixture, Fixture>>();
    this.setDebugMode(false);

    if (waves) {
        textureWater = new TextureRegion(new Texture(Gdx.files.internal("water.png")));
        polyBatch = new PolygonSpriteBatch();
    }

    if (splashParticles) {
        textureDrop = new Texture(Gdx.files.internal("drop.png"));
        spriteBatch = new SpriteBatch();
        particles = new ArrayList<Particle>();
    }

    shapeBatch = new ShapeRenderer();
    shapeBatch.setColor(0, 0.5f, 1, 1);
}
项目:Klooni1010    文件:PauseMenuStage.java   
@Override
public void draw() {
    if (shown) {
        // Draw an overlay rectangle with not all the opacity
        // This is the only place where ShapeRenderer is OK because the batch hasn't started
        Gdx.gl.glEnable(GL20.GL_BLEND);
        shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
        Color color = new Color(Klooni.theme.bandColor);
        color.a = 0.1f;
        shapeRenderer.setColor(color);
        shapeRenderer.rect(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        shapeRenderer.end();
    }

    super.draw();
}
项目:StarshipFighters    文件:HealthBar.java   
public HealthBar(float x, float y, float healthLeft, float height, boolean showHUDElement) {
    super(x, y, showHUDElement);

    this.x = x;
    this.y = y;
    this.showHUDElement = showHUDElement;
    this.height = height;
    this.healthLeft = healthLeft;
    width = healthLeft;
    totalHealth = healthLeft;

    // Start Color
    healthBarColor = Color.GREEN;

    // Shape Renderer
    shapeRenderer = new ShapeRenderer();

}
项目:school-game    文件:IngameMenu.java   
/**
 * Initialisierung.
 *
 * @param game Zugriff auf die Spielinstanz
 * @param level Zugriff auf die aktive Levelinstanz
 */
public IngameMenu(SchoolGame game, Level level)
{
    this.game = game;
    this.level = level;

    titleFont = game.getTitleFont();
    textFont = game.getDefaultFont();
    smallFont = game.getLongTextFont();

    selectSound = game.getAudioManager().createSound("menu", "select.wav", true);
    changeSound = game.getAudioManager().createSound("menu", "change.wav", true);

    batch = new SpriteBatch();
    shapeRenderer = new ShapeRenderer();

    localeBundle = level.getLocaleBundle();

    fontLayout = new GlyphLayout();

    projection = new Matrix4();
}
项目:Onyx    文件:GameManager.java   
/**
 * Sets whether the {@link ShapeRenderer} instance is rendering or not.<br/>
 * Use when a {@link SpriteBatch} needs to render pixmaps, without causing<br/>
 * OpenGL conflicts.
 *
 * @param v the desired state
 */
public static void setIsShapeRendering(boolean v) {
    if (v) {
        if (batch.isDrawing() && ! renderer.isDrawing()) {
            batch.end();
            spriteCache = true;
        }
        if (! renderer.isDrawing()) renderer.begin(ShapeRenderer.ShapeType.Line);
    } else {
        if (renderer.isDrawing()) renderer.end();
        if (spriteCache && ! batch.isDrawing()) {
            batch.begin();
            spriteCache = false;
        }
    }
}
项目:MyRoom    文件:GameRenderer.java   
public GameRenderer(GameWorld world, int gameHeight, int midPointY) {
    myWorld = world;

    this.gameHeight = gameHeight;
    this.midPointY = midPointY;

    cam = new OrthographicCamera();
    cam.setToOrtho(true, 136, gameHeight);

    batcher = new SpriteBatch();
    batcher.setProjectionMatrix(cam.combined);
    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setProjectionMatrix(cam.combined);

    // Call helper methods to initialize instance variables.
    initGameObjects();
    initAssets();
}
项目:cocos2d-java    文件:RenderCommand.java   
@Override
public void execute(Renderer render) {
    ShapeRenderer shapeRender = render.getShapeRenderer();
    if(!shapeRender.isDrawing()) {
        shapeRender.begin();
    }
    this._callback.onCommand(shapeRender);
}
项目:cocos2d-java    文件:DrawNode.java   
@Override
public void onCommand(ShapeRenderer shapeRenderer) {
    currShapePos = 0;
    StructShapeCommand cmd = popShapeCommandCell();
    while(cmd != null) {
        cmd.drawShape(shapeRenderer, _modelViewTransform);
        cmd = popShapeCommandCell();
    }
    batchCommand = false;   //绘制一次后,batch命令清除
}
项目:Toast-LibGDX    文件:Toast.java   
/**
 * Displays toast<br/>
 * Must be called at the end of {@link Game#render()}<br/>
 * @param delta {@link Graphics#getDeltaTime()}
 * @return activeness of the toast (true while being displayed, false otherwise)
 */
public boolean render(float delta) {
    timeToLive -= delta;

    if (timeToLive < 0) {
        return false;
    }

    renderer.begin(ShapeRenderer.ShapeType.Filled);
    renderer.circle(positionX, positionY + toastHeight / 2, toastHeight / 2);
    renderer.rect(positionX, positionY, toastWidth, toastHeight);
    renderer.circle(positionX + toastWidth, positionY + toastHeight / 2, toastHeight / 2);
    renderer.end();

    spriteBatch.begin();

    if (timeToLive > 0 && opacity > 0.15) {
        if (timeToLive < fadingDuration) {
            opacity = timeToLive / fadingDuration;
        }

        font.setColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a * opacity);
        font.draw(spriteBatch, msg, fontX, fontY, fontWidth, Align.center, true);
    }

    spriteBatch.end();

    return true;
}
项目:apps_small    文件:secondScreen.java   
public secondScreen (Game agame) {
    game = agame;
    batch = new SpriteBatch();
    img = new Texture("aklu.jpg");
    shapeRenderer = new ShapeRenderer();
    centerCircle = new Circle();
    leftCircle = new Circle();
    rightCircle = new Circle();
    myTouch = new Circle();
    camera = new OrthographicCamera();
    camera.setToOrtho(false, 800, 400);
    colorChanger = 0;
    counter = 0;

}
项目:apps_small    文件:MyGdxGame.java   
@Override
public void create () {
    batch = new SpriteBatch();
    img = new Texture("aklu.jpg");
       shapeRenderer = new ShapeRenderer();
       centerCircle = new Circle();
       leftCircle = new Circle();
       rightCircle = new Circle();
       myTouch = new Circle();
       camera = new OrthographicCamera();
       camera.setToOrtho(false, 800, 400);
       colorChanger = 0;
}
项目:libgdx_ui_editor    文件:MainWindow.java   
public MainWindow(String title) {
    setSize(480, 800);
    cubDrawable = DrawableUtil.getRectLineDrawable("icon/select.9.png");
    debug();
    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setAutoShapeType(true);

    EditorManager.getInstance().getEventBus().register(this);
    font = EditorManager.getInstance().getMainFont();
    this.addListener(clickListener);
    this.addCaptureListener(selectListener);
    this.addActor(selectedGroup);
}
项目:feup-lpoo-armadillo    文件:ShapeView.java   
/**
 * Draws the Shape in the screen, using the given renderer.
 *
 * @param renderer The Shape renderer.
 */
public void draw(ShapeRenderer renderer) {
    if (rect == null) return;

    renderer.setColor(color);
    renderer.rect(center.x - rect.getWidth() / 2, center.y - rect.getHeight() / 2,
            rect.getWidth() / 2, rect.getHeight() / 2, rect.getWidth(), rect.getHeight(), 1, 1, rotation);
}
项目:feup-lpoo-armadillo    文件:GameScreen.java   
/**
 * Function responsible for drawing the the views corresponding to the shapes.
 */
private void drawShapeViews() {
    shapeRenderer.setProjectionMatrix(camera.combined);
    shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
    drawShapes();
    shapeRenderer.end();
}
项目:penguins-in-space    文件:RenderSystem.java   
public RenderSystem(Batch batch) {
    super(FAMILY);
    this.camera = new OrthographicCamera();
    viewport = new FitViewport(Asteroids.VIRTUAL_WIDTH, Asteroids.VIRTUAL_HEIGHT, camera);
    viewport.apply(true);
    this.batch = batch;
    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setColor(Color.RED);
    font = ServiceLocator.getAppComponent().getAssetService().getSkin(AssetService.SkinAsset.UISKIN).getFont("default-font");
}
项目:penguins-in-space    文件:RenderSystem.java   
@Override
public void update(float deltaTime) {
    batch.setProjectionMatrix(camera.combined);
    if (debug) shapeRenderer.setProjectionMatrix(camera.combined);
    camera.update();
    if (debug) shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
    batch.begin();
    super.update(deltaTime);
    batch.end();
    if (debug) shapeRenderer.end();
}
项目:conquest    文件:Hud.java   
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();
}
项目:conquest    文件:MatchScreen.java   
@Override
public void show() {
    renderer = new ShapeRenderer();
    renderer.setAutoShapeType(true);
    batch = new SpriteBatch();

    hud = new Hud();
    Pathway pathway = new Pathway(match.getTiles(), match.getPlayer());
    manager = new Manager(pathway);
    grabber = new Grabber(match.getTiles(), match.getCam(), manager, pathway, match.getPlayer());

    Gdx.input.setInputProcessor(new InputMultiplexer(manager.getStage(), grabber, match.getStage()));
}
项目:SpaceChaos    文件:GameScreen.java   
@Override
public void draw(GameTime time, SpriteBatch batch) {
    // draw skybox
    this.skyBox.draw(time, game.getCamera(), batch);

    // set camera projection matrix
    batch.setProjectionMatrix(game.getCamera().getCombined());

    // draw entities
    this.ecs.draw(time, game.getCamera(), batch);

    // reset shader
    batch.setShader(null);
    batch.setProjectionMatrix(game.getCamera().getCombined());

    // draw abilities and so on
    this.ecs.drawUILayer(time, game.getCamera(), batch);

    batch.flush();

    // reset shader, so default shader is used
    batch.setShader(null);

    batch.end();

    this.shapeRenderer.setProjectionMatrix(game.getCamera().getCombined());
    this.shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
    this.shapeRenderer.setColor(Color.BLACK);

    // draw collision boxes
    if (debug) {
        this.collisionManager.drawCollisionBoxes(time, game.getCamera(), shapeRenderer, COLLISION_BOX_COLOR,
                IN_COLLISION_COLOR);
    }

    this.shapeRenderer.end();

    batch.begin();
}
项目:SpaceChaos    文件:DefaultCollisionManager.java   
@Override
public void drawCollisionBoxes(GameTime time, CameraWrapper camera, ShapeRenderer shapeRenderer, Color color,
        Color inCollisionColor) {
    for (CollisionComponent component : this.collisionComponentList) {
        // draw collision shapes
        component.drawCollisionBoxes(time, camera, shapeRenderer, color, inCollisionColor);
    }
}
项目:SpaceChaos    文件:ActionBar.java   
@Override
public void drawLayer1(GameTime time, ShapeRenderer shapeRenderer) {
    // draw items
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            // update item
            if (items[i][j] != null) {
                items[i][j].drawLayer1(time, shapeRenderer);
            }
        }
    }
}
项目:projecttd    文件:GameScreen.java   
@Override
public void render(float delta) {
    try {
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        tiledMapRenderer.setView(camera);
        tiledMapRenderer.render();

        engine.update(delta);

        shapeRenderer.setProjectionMatrix(camera.combined);
        arcRenderer.setProjectionMatrix(camera.combined);

        if (debugRendering) {
            // touch pos
            shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
            shapeRenderer.setColor(Color.RED);
            shapeRenderer.circle(touchPoint.x, touchPoint.y, 0.1f, 16);
            shapeRenderer.end();

            // many things (tiles, fps, vector field, cost array)
            pathFindingSystem.debugRender(shapeRenderer, spriteBatch, font, camera);
            // more many things (turrets, targets)
            turretSystem.debugRender(shapeRenderer);
        }

        // ui
        hud.render();
    } catch (Exception ex) {
        System.err.println("exception while rendering screen");
        ex.printStackTrace();
    }
}
项目:Tower-Defense-Galaxy    文件:Laser.java   
@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();
    }
}
项目:TreasureHunting    文件:GameRenderer.java   
public GameRenderer(GameWorld world) {
    this.world = world;

    this.cam = new OrthographicCamera();
    cam.setToOrtho(true, com.home.knowhunt.screens.GameScreen.GAME_WIDTH, 204);

    batcher = new SpriteBatch();
    batcher.setProjectionMatrix(cam.combined);
    shapeRenderer = new ShapeRenderer();
    shapeRenderer.setProjectionMatrix(cam.combined);

    initGameObjects();
}
项目:ExamensArbeteTD    文件:LevelManager.java   
/**
     * For debugging pathfinding draws tile grid and fills with white where
     * enemies cannot go
     * 
     * @param camera
     *            need the camera to set the projection matrix
     **/
    public static void drawTiles(Camera camera) {

        Vector2 enemySpawnLoc = endLocactions.get(0);
        Vector2 enemyEndLoc = spawnLocations.get(0);

        tileSpawn = getTile((int) enemySpawnLoc.x / 32, (int) enemySpawnLoc.y / 32);
        tileEnd = getTile((int) enemyEndLoc.x / 32, (int) enemyEndLoc.y / 32);

        shapeRenderer.setAutoShapeType(true);
        shapeRenderer.begin();
        shapeRenderer.setProjectionMatrix(camera.combined);
        shapeRenderer.set(ShapeRenderer.ShapeType.Filled);
        shapeRenderer.setColor(0f, 1f, 0f, 1f);
        shapeRenderer.rect(tileSpawn.getCords().x, tileSpawn.getCords().y, 32, 32);
        shapeRenderer.setColor(1f, 0f, 1f, 1f);
        shapeRenderer.rect(tileEnd.getCords().x, tileEnd.getCords().y, 32, 32);
        shapeRenderer.set(ShapeRenderer.ShapeType.Line);
        shapeRenderer.end();
        for (int row = 0; row < LevelManager.tiles.length; row++) {
//          Tile rowTile = LevelManager.getTile(row, 0);
            for (int col = 0; col < LevelManager.tiles[0].length; col++) {
                Tile tile = LevelManager.getTile(row, col);
//              Tile colTile = LevelManager.getTile(0, col);
                if (tile == null)
                    continue;
                TileType type = tile.getType();
                shapeRenderer.begin();
                if (type == TileType.FLOOR) {
                    shapeRenderer.setColor(1, 1, 1, .2f);
                    shapeRenderer.rect(tile.getCords().x, tile.getCords().y, tile.getTileWidth(), tile.getTileHeight());
                } else {
                    // shapeRenderer.set(ShapeRenderer.ShapeType.Filled);
                    // shapeRenderer.setColor(.8f,0,0,.2f);
                    shapeRenderer.rect(tile.getCords().x, tile.getCords().y, tile.getTileWidth(), tile.getTileHeight());
                }
                shapeRenderer.end();
            }
        }
    }