public void draw(SpriteBatch batch) { batch.end(); stage.getBatch().setProjectionMatrix(stage.getCamera().combined); if (eff != null) { if (lastHeroPositionX == 0) lastHeroPositionX = (int) RPG.ctrl.hero.getHeadHero().position.x; else { if (lastHeroPositionX != RPG.ctrl.hero.getHeadHero().position.x) { if (lastHeroPositionX > RPG.ctrl.hero.getHeadHero().position.x) { // LEFT eff.getEmitters().get(0).getVelocity().setHigh(500, 500); } else { eff.getEmitters().get(0).getVelocity().setHigh(-500, -500); } } else { eff.getEmitters().get(0).getVelocity().setHigh(0, 0); } lastHeroPositionX = (int) RPG.ctrl.hero.getHeadHero().position.x; } eff.setPosition(0, GameUtil.getScreenHeight()); stage.getBatch().begin(); eff.draw(stage.getBatch(), Gdx.graphics.getDeltaTime()); stage.getBatch().end(); if (eff.isComplete()) eff.reset(); } batch.begin(); }
public void render() { spriteBatch .getProjectionMatrix() .setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); float delta = Gdx.graphics.getDeltaTime(); GL10 gl = Gdx.graphics.getGL10(); gl.glClear(GL10.GL_COLOR_BUFFER_BIT); spriteBatch.begin(); effect.draw(spriteBatch, delta); spriteBatch.end(); fpsCounter += delta; if (fpsCounter > 3) { fpsCounter = 0; int activeCount = emitters.get(emitterIndex).getActiveCount(); System.out.println( activeCount + "/" + particleCount + " particles, FPS: " + Gdx.graphics.getFramesPerSecond()); } }
@Override public void draw(SpriteBatch batch, float parentAlpha) { effect.draw(batch, 1 - parentAlpha); super.draw(batch, parentAlpha); }
@Override public void draw(SpriteBatch batch) { if (!active) return; effect.draw(batch); }
public void draw(SpriteBatch batch) { super.draw(batch); giantEffect.draw(batch, Gdx.graphics.getDeltaTime()); }
public void draw(SpriteBatch batch) { stage.draw(); SpriteBatch sb = (SpriteBatch) stage.getBatch(); sb.begin(); FontUtil.draw(sb, item.name, 22, Color.WHITE, 455, 134, 1000); FontUtil.draw(sb, item.illustration, 18, Color.DARK_GRAY, 459, 100, 490); scuse.draw(sb); if (sellist.isVisible()) sellist.draw(sb, 1); scfor.draw(sb); if (herolist.isVisible()) { herolist.draw(sb, 1); sb.flush(); if (herolist.getSelectedIndex() != -1 && herolist.getSelected().userObject != null && !(herolist.getSelected().userObject instanceof Image)) { Hero h = ((Hero) herolist.getSelected().userObject); render.begin(ShapeType.Filled); render.setColor(green); render.rect( 575, 142, (float) ((float) h.prop.get("hp") / (float) h.prop.get("maxhp")) * 176, 20); render.setColor(cblue); render.rect( 575, 105, (float) ((float) h.prop.get("mp") / (float) h.prop.get("maxmp")) * 176, 20); render.end(); FontUtil.draw( sb, h.prop.get("hp") + "/" + h.prop.get("maxhp"), 16, blue, 572 + 176 / 2 - FontUtil.getTextWidth(h.prop.get("hp") + "/" + h.prop.get("maxhp"), 20, -7) / 2, 158, 400, -5, 0); FontUtil.draw( sb, h.prop.get("mp") + "/" + h.prop.get("maxmp"), 16, blue, 572 + 176 / 2 - FontUtil.getTextWidth(h.prop.get("mp") + "/" + h.prop.get("maxmp"), 20, -7) / 2, 121, 400, -5, 0); FontUtil.draw( sb, "正常", 18, blue, 563 + 176 / 2 - FontUtil.getTextWidth("正常", 18) / 2, 196, 400); FontUtil.draw(sb, h.toString(), 18, Color.WHITE, 515, 227, 200); if (drawp) { add.draw(sb, Gdx.graphics.getDeltaTime()); drawp = !add.isComplete(); } else add.reset(); sb.draw(h.images[1].getRegion(), 810, 97); } sb.flush(); } if (group.isVisible()) { group.draw(batch, 1); String tmp = String.valueOf(currentCount); tmp = tmp.length() == 1 ? "00" + tmp : tmp.length() == 2 ? "0" + tmp : tmp; Image i1 = NumberUtil.get(tmp.substring(0, 1)); i1.setPosition(390, 275); i1.draw(sb); Image i2 = NumberUtil.get(tmp.substring(1, 2)); i2.setPosition(430, 275); i2.draw(sb); Image i3 = NumberUtil.get(tmp.substring(2, 3)); i3.setPosition(470, 275); i3.draw(sb); } sb.end(); }