public void resize (int width, int height) { this.width = width; this.height = height; batch.getProjectionMatrix().setToOrtho2D(0, 0, width, height); }
public void resize (int width, int height) { this.width = width; this.height = height; batch.getProjectionMatrix().setToOrtho2D(0, 0, width, height); }
@Override public void resize (int width, int height) { batch.getProjectionMatrix().setToOrtho2D(0, 0, width, height); }
@Override public void resize (int width, int height) { Gdx.app.log("FullscreenTest", "resized: " + width + ", " + height); batch.getProjectionMatrix().setToOrtho2D(0, 0, width, height); }
public void resize (int width, int height) { renderer.getProjectionMatrix().setToOrtho2D(0, 0, width, height); renderer.updateMatrices(); } }
@Override public void resize (int width, int height) { spriteBatch.getProjectionMatrix().setToOrtho2D(0, 0, width, height); camera.viewportWidth = width; camera.viewportHeight = height; camera.update(); } }
@Override public void resize (int width, int height) { stage.getViewport().update(width, height, true); batch.getProjectionMatrix().setToOrtho2D(0, 0, width, height); } }
public void resize (int width, int height) { batch.getProjectionMatrix().setToOrtho2D(0, 0, width, height); shapes.setProjectionMatrix(batch.getProjectionMatrix()); }
public ShapeRenderer (int maxVertices, ShaderProgram defaultShader) { if (defaultShader == null) { renderer = new ImmediateModeRenderer20(maxVertices, false, true, 0); } else { renderer = new ImmediateModeRenderer20(maxVertices, false, true, 0, defaultShader); } projectionMatrix.setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); matrixDirty = true; }
public ShapeRenderer (int maxVertices, ShaderProgram defaultShader) { if (defaultShader == null) { renderer = new ImmediateModeRenderer20(maxVertices, false, true, 0); } else { renderer = new ImmediateModeRenderer20(maxVertices, false, true, 0, defaultShader); } projectionMatrix.setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); matrixDirty = true; }
public void resize (int width, int height) { renderer.setProjectionMatrix(new Matrix4().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight())); }
public void resize (int width, int height) { renderer.setProjectionMatrix(new Matrix4().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight())); }
public void resize (int width, int height) { spriteBatch.getProjectionMatrix().setToOrtho2D(0, 0, width, height); renderer.setProjectionMatrix(spriteBatch.getProjectionMatrix()); stage.getViewport().update(width, height, true); }
public void render () { spriteBatch.getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); float delta = Gdx.graphics.getDeltaTime(); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); spriteBatch.begin(); effect.draw(spriteBatch, delta); spriteBatch.end(); fpsCounter += delta; if (fpsCounter > 3) { fpsCounter = 0; Gdx.app.log("libgdx", "current sprite: " + currentSprite + ", FPS: " + Gdx.graphics.getFramesPerSecond()); } }
public void create () { batch = new SpriteBatch(); sceneMatrix = new Matrix4().setToOrtho2D(0, 0, 480, 320); textMatrix = new Matrix4().setToOrtho2D(0, 0, 480, 320); atlas = new TextureAtlas(Gdx.files.internal("data/issue_pack"), Gdx.files.internal("data/")); texture = new Texture(Gdx.files.internal("data/resource1.jpg"), true); texture.setFilter(TextureFilter.MipMap, TextureFilter.Nearest); setTextureFilter(0); setModeString(); sprite = atlas.createSprite("map"); sprite2 = new Sprite(texture, 0, 0, 855, 480); font = new BitmapFont(Gdx.files.internal("data/font.fnt"), Gdx.files.internal("data/font.png"), false); Gdx.input.setInputProcessor(new InputAdapter() { public boolean touchDown (int x, int y, int pointer, int newParam) { mode++; if (mode == filters.length * 2) mode = 0; setTextureFilter(mode / 2); setModeString(); return false; } }); }
/** Creates a cache with the specified size and OpenGL ES 2.0 shader. * @param size The maximum number of images this cache can hold. The memory required to hold the images is allocated up front. * Max of 8191 if indices are used. * @param useIndices If true, indexed geometry will be used. */ public SpriteCache (int size, ShaderProgram shader, boolean useIndices) { this.shader = shader; if (useIndices && size > 8191) throw new IllegalArgumentException("Can't have more than 8191 sprites per batch: " + size); mesh = new Mesh(true, size * (useIndices ? 4 : 6), useIndices ? size * 6 : 0, new VertexAttribute(Usage.Position, 2, ShaderProgram.POSITION_ATTRIBUTE), new VertexAttribute(Usage.ColorPacked, 4, ShaderProgram.COLOR_ATTRIBUTE), new VertexAttribute(Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE + "0")); mesh.setAutoBind(false); if (useIndices) { int length = size * 6; short[] indices = new short[length]; short j = 0; for (int i = 0; i < length; i += 6, j += 4) { indices[i + 0] = (short)j; indices[i + 1] = (short)(j + 1); indices[i + 2] = (short)(j + 2); indices[i + 3] = (short)(j + 2); indices[i + 4] = (short)(j + 3); indices[i + 5] = (short)j; } mesh.setIndices(indices); } projectionMatrix.setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); }
public void create () { batch = new SpriteBatch(); batch.setProjectionMatrix(new Matrix4().setToOrtho2D(0, 0, 855, 480)); atlas = new TextureAtlas(Gdx.files.internal("data/issue_pack"), Gdx.files.internal("data/")); sprite = atlas.createSprite("map"); font = new BitmapFont(Gdx.files.internal("data/font.fnt"), Gdx.files.internal("data/font.png"), false); Gdx.gl.glClearColor(0, 1, 0, 1); }
public void render () { spriteBatch.getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); float delta = Gdx.graphics.getDeltaTime(); Gdx.gl.glClear(GL20.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(); Gdx.app.log("libgdx", activeCount + "/" + particleCount + " particles, FPS: " + Gdx.graphics.getFramesPerSecond()); } }
@Override public void render () { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); batch.setProjectionMatrix(camera.combined); batch.begin(); batch.draw(img2, -100, 0); batch.draw(img1, 0, 0); batch.end(); batch.getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); batch.begin(); font.draw(batch, "fps: " + Gdx.graphics.getFramesPerSecond(), 0, 30); batch.end(); }
public void render () { ui.act(); spriteBatch.getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); float delta = Gdx.graphics.getDeltaTime(); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); spriteBatch.begin(); for (ParticleEffect e : effects) e.draw(spriteBatch, delta); spriteBatch.end(); fpsCounter += delta; if (fpsCounter > 3) { fpsCounter = 0; String log = effects.size + " particle effects, FPS: " + Gdx.graphics.getFramesPerSecond() + ", Render calls: " + spriteBatch.renderCalls; Gdx.app.log("libgdx", log); logLabel.setText(log); } ui.draw(); }