@Override public void render () { Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.draw(); Gdx.app.log("X", "FPS: " + Gdx.graphics.getFramesPerSecond()); SpriteBatch spriteBatch = (SpriteBatch)stage.getBatch(); Gdx.app.log("X", "render calls: " + spriteBatch.totalRenderCalls); spriteBatch.totalRenderCalls = 0; }
@Override public void render () { Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.draw(); Gdx.app.log("X", "FPS: " + Gdx.graphics.getFramesPerSecond()); SpriteBatch spriteBatch = (SpriteBatch)stage.getBatch(); Gdx.app.log("X", "render calls: " + spriteBatch.totalRenderCalls); spriteBatch.totalRenderCalls = 0; }
@Override public void render () { Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.draw(); Gdx.app.log("X", "FPS: " + Gdx.graphics.getFramesPerSecond()); SpriteBatch spriteBatch = (SpriteBatch)stage.getBatch(); Gdx.app.log("X", "render calls: " + spriteBatch.totalRenderCalls); spriteBatch.totalRenderCalls = 0; }
public void render () { Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(Gdx.graphics.getDeltaTime()); stage.draw(); long now = TimeUtils.nanoTime(); sampleFrames++; if (now - sampleStartTime > 1000000000) { if (sampleStartTime != 0) { int renderCalls = ((SpriteBatch)stage.getBatch()).renderCalls; Gdx.app.log("CpuSpriteBatch", "FPS: " + sampleFrames + ", render calls: " + renderCalls); } sampleStartTime = now; sampleFrames = 0; } }
if (text.length() > 4) text = text.substring(0, text.lastIndexOf('.') + 3); text = "duration: " + text + " s (ctrl + scroll to change)"; stage.getBatch().begin(); list.getStyle().font.draw(stage.getBatch(), text, bottomLeftX + graphSize / 2, bottomLeftY + graphSize + list.getStyle().font.getLineHeight(), 0, Align.center, false); stage.getBatch().end();
stage.getBatch().disableBlending(); Group root = stage.getRoot(); Array<Actor> actors = root.getChildren();
@Override public void render(boolean inGame, SpriteBatch guiBatch) { stage.getBatch().begin(); stage.getBatch().draw(background, 0, 0, stage.getWidth(), stage.getHeight(), 0, 0, stage.getWidth()/background.getWidth(), stage.getHeight()/background.getHeight()); stage.getBatch().end(); stage.draw(); }
public void draw() { Batch batch = stage.getBatch(); if(map.renderable && map.loaded()){ map.draw(batch);//画地图 stage.draw();//画UI } fg.draw(batch); msg.draw(batch); }
public Batch batchBegin() { Batch batch = super.getBatch(); batch.begin(); batch.setColor(Color.WHITE); oldTransform.set(batch.getTransformMatrix()); batch.setTransformMatrix(computeTransform()); return batch; }
public TextureRegion getBgIcon(String atlas, String region) { // check here for dispose instead in project loading because the opengl // context lost in new project thread if (disposeBgCache) { dispose(); disposeBgCache = false; } String s = atlas + "#" + region; TextureRegion icon = bgIconCache.get(s); if (icon == null) { Batch batch = getStage().getBatch(); batch.end(); try { icon = createBgIcon(atlas, region); } catch (Exception e) { EditorLogger.error("Error creating Background icon: " + atlas + "." + region); } if (icon == null) { EditorLogger.error("Error creating Background icon: " + atlas + "." + region); icon = Ctx.assetManager.getIcon("ic_no_scene"); } bgIconCache.put(s, icon); batch.begin(); } return icon; }
@Override public void render(float delta) { Klooni.theme.glClearBackground(); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(Math.min(Gdx.graphics.getDeltaTime(), MIN_DELTA)); stage.draw(); // After everything is drawn, showcase the current shop item SnapshotArray<Actor> children = shopGroup.getChildren(); if (children.size > 0) { final ShopCard card = (ShopCard) children.get(showcaseIndex); final Batch batch = stage.getBatch(); batch.begin(); // For some really strange reason, we need to displace the particle effect // by "buyBand.height", or it will render exactly that height below where // it should. // TODO Fix this - maybe use the same project matrix as stage.draw()? // batch.setProjectionMatrix(stage.getViewport().getCamera().combined) if (!card.showcase(batch, buyBand.getHeight())) { showcaseIndex = (showcaseIndex + 1) % children.size; } batch.end(); } if (Gdx.input.isKeyJustPressed(Input.Keys.BACK)) { goBack(); } }
@Override protected void initialize() { camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.setToOrtho(false); camera.update(); renderer = new ShapeRenderer(); stage = new Stage(); stage.getBatch().setProjectionMatrix(camera.combined); skin = new Skin(Gdx.files.classpath("net/mostlyoriginal/plugin/profiler/skin/uiskin.json")); // setup some static config like colors etc SystemProfilerGUI.GRAPH_H_LINE.set(Color.ORANGE); gui = new SystemProfilerGUI(skin, "default"); gui.setResizeBorder(8); gui.show(stage); gui.setWidth(Gdx.graphics.getWidth()); }
@Override protected void initialize() { camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.setToOrtho(false); camera.update(); renderer = new ShapeRenderer(); stage = new Stage(); stage.getBatch().setProjectionMatrix(camera.combined); skin = new Skin(Gdx.files.classpath("net/mostlyoriginal/plugin/profiler/skin/uiskin.json")); // setup some static config like colors etc SystemProfilerGUI.GRAPH_H_LINE.set(Color.ORANGE); gui = new SystemProfilerGUI(skin, "default"); gui.setResizeBorder(8); gui.show(stage); gui.setWidth(Gdx.graphics.getWidth()); }