public void draw (float deltaTime) { GLCommon gl = Gdx.gl; gl.glClear(GL10.GL_COLOR_BUFFER_BIT); renderer.render(); guiCam.update(); batcher.setProjectionMatrix(guiCam.combined); batcher.enableBlending(); batcher.begin(); switch (state) { case GAME_READY: presentReady(); break; case GAME_RUNNING: presentRunning(); break; case GAME_PAUSED: presentPaused(); break; case GAME_LEVEL_END: presentLevelEnd(); break; case GAME_OVER: presentGameOver(); break; } batcher.end(); }
@Override public void renderGL1(GL10 gl, float gameTime) { gl.glEnable(GL10.GL_TEXTURE_2D); gl.glEnable(GL10.GL_LIGHTING); gl.glColor4f(color.r, color.g, color.b, color.a); texture.bind(); gl.glPushMatrix(); gl.glTranslatef(position.x, position.y, position.z); gl.glRotatef(rotate.x, 1, 0, 0); gl.glRotatef(rotate.y, 0, 1, 0); gl.glRotatef(rotate.z, 0, 0, 1); gl.glScalef(scale.x, scale.y, scale.z); model.render(); gl.glPopMatrix(); }
@Override public void render() { float delta = Gdx.graphics.getDeltaTime(); if (durAccum > 0f) { durAccum -= delta; if (durAccum <= 0f) { currentScreen.hide(); currentScreen.remove(); currentScreen = nextScreen; currentScreen.setTouchable(Touchable.enabled); currentScreen.setPosition(0f, 0f); nextScreen = null; } } Gdx.gl.glClearColor(clearColor.r, clearColor.g, clearColor.b, clearColor.a); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); stage.act(delta); stage.draw(); }
public void drawPause() { if (paused) { Gdx.gl.glEnable(GL10.GL_BLEND); Gdx.gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); shapeRenderer.setProjectionMatrix(camera.combined); shapeRenderer.begin(ShapeType.Filled); shapeRenderer.setColor(0f, 0f, 0f, 0.2f); shapeRenderer.rect(0, 0, imageProvider.getScreenWidth(), imageProvider.getScreenHeight()); shapeRenderer.end(); Gdx.gl.glDisable(GL10.GL_BLEND); batch.setProjectionMatrix(camera.combined); batch.begin(); batch.draw(restart, unpauseBounds.x, unpauseBounds.y); batch.draw(backButton, pausedBackBounds.x, pausedBackBounds.y, pausedBackBounds.width, pausedBackBounds.height); batch.end(); } }
public void displayUnlockMessage(SpriteBatch batch) { endSlateAlpha = 0; Gdx.gl.glEnable(GL10.GL_BLEND); Gdx.gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); shapeRenderer.setProjectionMatrix(camera.combined); shapeRenderer.begin(ShapeType.Filled); shapeRenderer.setColor(0f, 0f, 0f, 0.3f); shapeRenderer.rect(0, 0, imageProvider.getScreenWidth(), imageProvider.getScreenHeight()); shapeRenderer.end(); Gdx.gl.glDisable(GL10.GL_BLEND); batch.setProjectionMatrix(camera.combined); batch.begin(); batch.setColor(batch.getColor().r, batch.getColor().g, batch.getColor().b, 1); unlockPodium.render(batch); batch.draw(characterUnlocked, 10, imageProvider.getScreenHeight() - 19, characterUnlocked.getWidth() / 2, characterUnlocked.getHeight() / 2); batch.end(); if (System.currentTimeMillis() - unlockTime > 1000) if (Gdx.input.isTouched()) shouldDrawCharacterUnlock = false; }
@Override public void render() { Gdx.gl10.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); Gdx.gl10.glClearColor(0.5f, 0.5f, 0.5f, 1.0f); for (int i = 0; i < cameras.length; i++) { adjustCamera(i); drawShapes(i); } int width = Gdx.graphics.getWidth(); int height = Gdx.graphics.getHeight(); // All - Draw borders Border.draw(width, height); // camera descriptions drawCameraDescription(width, height); }
@Override public void render(float delta) { Gdx.gl.glClearColor(0f, 0f, 0f, 1f); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); tweenManager.update(delta); stage.act(delta); batch.begin(); background.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); background.draw(batch); minions.draw(batch); batch.end(); stage.draw(); }
public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); stage.act(delta); coinLabel.setText("Spendable Coins: " + prefs.getLong("currency", 0)); desTextLabel.setText(description); priceLabel.setText(price); desTitleLabel.setText(title); ownedLabel.setText(owned); batch.begin(); stage.draw(); batch.end(); }
@Override public void render() { Gdx.gl.glClearColor(0, 0.6f, 1, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); if (Gdx.input.isKeyPressed(Keys.ESCAPE)) { Gdx.app.exit(); } stage.act(); gui.act(); stage.draw(); gui.draw(); }
@Override public void render(float arg0) { Gdx.gl.glClearColor(0, 0, 0, 1); //Limpio la pantalla en el bucle render todo el rato. Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // Muestra un men� de inicio game.batch.begin(); game.batch.draw(fondo, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); //Pinto los textos y en qu� posicion y las coordenadas donde quiero pintarlo. game.font.draw(game.batch, "", 100, 375); game.font.draw(game.batch, "Pulsa ESC para volver al men� principal.", 120, 20); game.batch.end(); /* * Si el usuario toca la pantalla se inicia la partida */ if (Gdx.input.isKeyPressed(Keys.ESCAPE)) { game.setScreen(new MainMenuScreen(game)); dispose(); } }
@Override public void render(float delta) { if (elapsed < DELAY) { float shade = 0.8f - elapsed / 1f; Gdx.gl.glClearColor(shade, shade, shade, 0); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); } else { if (elapsed + delta > DELAY) { Gdx.input.setInputProcessor(new GameOverInputProcessor()); } game.fall(); GameRenderer.instance.render(game); GameRenderer.instance.renderStartText("High score:", Integer.toString(highScore)); } elapsed += delta; }
@Override public void render(float delta) { Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); Gdx.gl.glEnable(GL20.GL_BLEND_SRC_ALPHA); batch.begin(); // bitmapfont.draw(batch, "Version OPENGL : " + Gdx.gl.glGetString(GL20.GL_VERSION), 6, 291); // bitmapfont.draw(batch, "Graphics CARD : " + Gdx.gl.glGetString(GL20.GL_RENDERER), 6, 305); // bitmapfont.draw(batch, "OpenGL 2.0 ? : " + Gdx.graphics.isGL20Available(), 6, 321); // bitmapfont.draw(batch, "JAVA HEAP : " + Gdx.app.getJavaHeap() / 10E4, 6, 191); // bitmapfont.draw(batch, "FPS : " + Gdx.graphics.getFramesPerSecond(), 6, 210); meshCreator.drawMesh(); // comment this line and uncomment bitmapfont.draw to print infos but without the triangle... batch.end(); }
@Override public void render(float delta) { if (am.update()){ /*init music/sound here*/ setTextures(); game.play.create(); game.setScreen(game.play); } progress = am.getProgress(); Gdx.gl.glClearColor(1f, 1f, 1f, 1f); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); }
@Override public void render(float delta) { if(gameRunning) { timeManager.addTime(delta); if(Gdx.input.isKeyPressed(Keys.DOWN) || Gdx.input.isKeyPressed(Keys.RIGHT) || Gdx.input.isKeyPressed(Keys.LEFT) || Gdx.input.isTouched()) { timeManager.timeKeyPressed(delta); } } Gdx.gl.glClearColor(0f, 0f, 0.2f, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); Gdx.gl.glEnable(GL10.GL_BLEND); batch.setProjectionMatrix(camera.combined); batch.begin(); //batch.draw(background, w/2 - background.getWidth()/2, h/2 - background.getHeight()/2); batch.end(); stage.act(delta); stage.draw(); }
@Override public void render(SpriteBatch spriteBatch, OrthographicCamera camera) { shapeRenderer.setProjectionMatrix(this.camera.combined); if (shouldRenderGridLines) { renderGridLines(); } renderGridObjects(spriteBatch); Gdx.graphics.getGLCommon().glEnable(GL10.GL_BLEND); if (activeOverlay == Overlays.NOISE_LEVEL) { renderNoiseLevelOverlay(); } else if (activeOverlay != null) { renderGenericOverlay(activeOverlay); } if (shouldRenderTransitLines && transitLines.size() > 0) { for (TransitLine transitLine : transitLines) { transitLine.render(shapeRenderer); } } Gdx.graphics.getGLCommon().glDisable(GL10.GL_BLEND); }
private void renderGridLines() { GLCommon gl = Gdx.graphics.getGLCommon(); gl.glEnable(GL10.GL_BLEND); shapeRenderer.begin(ShapeType.Line); shapeRenderer.setColor(1f, 1f, 1f, 0.15f); for (int i = 0; i <= gameGrid.getGridSize().x; i++) { shapeRenderer.line(i * GRID_UNIT_SIZE, 0, i * GRID_UNIT_SIZE, gameGrid.getGridSize().y * GRID_UNIT_SIZE); } for (int i = 0; i <= gameGrid.getGridSize().y; i++) { shapeRenderer.line(0, i * GRID_UNIT_SIZE, gameGrid.getGridSize().x * GRID_UNIT_SIZE, i * GRID_UNIT_SIZE); } shapeRenderer.end(); gl.glDisable(GL10.GL_BLEND); }
static Pixmap captureFromBuffer(int x, int y, int w, int h, boolean flipY) { Gdx.gl.glPixelStorei(GL10.GL_PACK_ALIGNMENT, 1); final Pixmap pixmap = new Pixmap(w, h, Pixmap.Format.RGBA8888); ByteBuffer pixels = pixmap.getPixels(); Gdx.gl.glReadPixels(x, y, w, h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, pixels); final int numBytes = w * h * 4; byte[] lines = new byte[numBytes]; if (flipY) { final int numBytesPerLine = w * 4; for (int i = 0; i < h; i++) { pixels.position((h - i - 1) * numBytesPerLine); pixels.get(lines, i * numBytesPerLine, numBytesPerLine); } pixels.clear(); pixels.put(lines); } else { pixels.clear(); pixels.get(lines); } return pixmap; }
@Override public void draw(SpriteBatch batch, float parentAlpha) { try { batch.end(); Gdx.gl.glEnable(GL10.GL_BLEND); Gdx.gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); shader.begin(); shader.setUniformMatrix("u_transformMatrix", transformMatrix.setToRotation(0, 0, 1, getRotation())); shader.setUniformMatrix("u_projectionViewMatrix", getStage().getCamera().combined); mesh.render(shader, GL10.GL_TRIANGLES); shader.end(); Gdx.gl.glDisable(GL10.GL_BLEND); batch.begin(); } catch (IllegalArgumentException iae) { // shader is probably waiting to be reloaded after a context change. ACRA.getErrorReporter().handleException(iae); } }
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0.2f, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // Muestra un menú de inicio game.spriteBatch.begin(); game.fuente.draw(game.spriteBatch, "Bienvenido a Drop!!!!", 100, 150); game.fuente.draw(game.spriteBatch, "Pulsa para empezar", 100, 130); game.fuente.draw(game.spriteBatch, "Pulsa 'ESCAPE' para SALIR", 100, 110); game.spriteBatch.end(); /* * Si el usuario toca la pantalla se inicia la partida */ if (Gdx.input.isTouched()) { game.setScreen(new GameScreen(game)); dispose(); } if (Gdx.input.isKeyPressed(Keys.ESCAPE)) { dispose(); System.exit(0); } }
@Override public void render(float dt) { // Pinta el fondo de la pantalla de azul oscuro (RGB + alpha) Gdx.gl.glClearColor(0, 0, 0.2f, 1); // Limpia la pantalla Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); /* Comprueba la entrada del usuario, actualiza * la posición de los elementos del game y * dibuja en pantalla */ if (!pause) { spriteManager.checkInput(dt); spriteManager.update(dt); } // La pantalla debe se redibujada aunque el game está pausado spriteManager.draw(); }
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0.2f, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); camera.update(); // Redimensiona la pantalla a la resolución de la cámara game.spriteBatch.setProjectionMatrix(camera.combined); game.spriteBatch.begin(); game.font.setScale(2); game.font.draw(game.spriteBatch, "Robin 2D", 100, 500); game.font.draw(game.spriteBatch, "Pulsa cualquier tecla para jugar", 100, 450); game.font.draw(game.spriteBatch, "Pulsa ESCAPE para salir", 100, 400); game.spriteBatch.end(); if (Gdx.input.isKeyPressed(Keys.ESCAPE)) { dispose(); System.exit(0); } else if (Gdx.input.isKeyPressed(Keys.ANY_KEY)) { game.setScreen(new GameScreen(game)); dispose(); } }
@Override public void render() { float dt = Gdx.graphics.getDeltaTime(); // Pinta el fondo de la pantalla de azul oscuro (RGB + alpha) Gdx.gl.glClearColor(0, 0, 0.2f, 1); // Limpia la pantalla Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); handleInput(dt); update(dt); spriteBatch.begin(); frog.render(spriteBatch); cocodrile.render(spriteBatch); spriteBatch.end(); }
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0.2f, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); camara.update(); juego.spriteBatch.setProjectionMatrix(camara.combined); // Muestra un menú de inicio juego.spriteBatch.begin(); juego.fuente.draw(juego.spriteBatch, "Bienvenido a Drop!!!!", 100, 150); juego.fuente.draw(juego.spriteBatch, "Pulsa para empezar", 100, 120); juego.spriteBatch.end(); /* * Si el usuario toca la pantalla se inicia la partida */ if (Gdx.input.isTouched()) { juego.setScreen(new GameScreen(juego)); dispose(); } }
@Override public void render(float delta) { // Pinta el fondo de la pantalla de azul oscuro (RGB + alpha) Gdx.gl.glClearColor(0, 0, 0.2f, 1); // Limpia la pantalla Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // Actualiza la cámara camara.update(); /* Comprueba la entrada del usuario, actualiza * la posición de los elementos del juego y * dibuja en pantalla */ if (!pausa) { comprobarInput(); actualizar(); } // La pantalla debe se redibujada aunque el juego está pausado dibujar(); }
@Override public void render(float dt) { // Pinta el fondo de la pantalla de azul oscuro (RGB + alpha) Gdx.gl.glClearColor(0, 0, 0.2f, 1); // Limpia la pantalla Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // Actualiza la cámara game.camera.update(); /* Comprueba la entrada del usuario, actualiza * la posición de los elementos del juego y * dibuja en pantalla */ if (!paused) { handleInput(dt); spriteManager.update(dt); } spriteManager.render(); }
@Override public void render(float delta) { // Pinta el fondo de la pantalla de azul oscuro (RGB + alpha) Gdx.gl.glClearColor(0, 0, 0.2f, 1); // Limpia la pantalla Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // Actualiza la cámara camara.update(); /* Comprueba la entrada del usuario, actualiza * la posición de los elementos del juego y * dibuja en pantalla */ if (!pausa) { spriteManager.comprobarInput(); spriteManager.actualizar(); } // La pantalla debe se redibujada aunque el juego está pausado spriteManager.dibujar(); }
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0.2f, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // Muestra un menú de inicio game.spriteBatch.begin(); game.font.draw(game.spriteBatch, "Bienvenido a Arkanoidx!!!!", 100, 150); game.font.draw(game.spriteBatch, "Pulsa para empezar", 100, 130); game.font.draw(game.spriteBatch, "Pulsa 'ESCAPE' para SALIR", 100, 110); game.spriteBatch.end(); /* * Si el usuario toca la pantalla se inicia la partida */ if (Gdx.input.isTouched()) { game.setScreen(new GameScreen(game)); dispose(); } if (Gdx.input.isKeyPressed(Keys.ESCAPE)) { dispose(); System.exit(0); } }
@Override public void render(float dt) { // Pinta el fondo de la pantalla de azul oscuro (RGB + alpha) Gdx.gl.glClearColor(0, 0, 0.2f, 1); // Limpia la pantalla Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); /* Comprueba la entrada del usuario, actualiza * la posición de los elementos del game y * dibuja en pantalla */ if (!paused) { handleInput(dt); spriteManager.update(dt); } spriteManager.render(); }
@Override public void render() { UpgradeHandler.tick(); Util.updateRuntime(); //pre-render stuffs trueY = (Gdx.graphics.getHeight() - Gdx.input.getY()) * trueHeight / Gdx.graphics.getHeight(); trueX = (Gdx.input.getX()) * trueWidth / Gdx.graphics.getWidth(); Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); ClickHandler.tick(); //begin rendering stuffs batch.begin(); List<Button> buttons = ButtonHandler.buttons; for(int i = 0; i < buttons.size(); i++){ buttons.get(i).tick(); buttons.get(i).render(batch); } try { CookieManager.tick(batch); } catch (Exception e) { System.out.println("ERRROOOOOORRRR with getting a button by ID"); } //t.tick(); batch.end(); //post rendering stuffs }
public void draw (float deltaTime) { GLCommon gl = Gdx.gl; gl.glClear(GL10.GL_COLOR_BUFFER_BIT); guiCam.update(); batcher.setProjectionMatrix(guiCam.combined); batcher.disableBlending(); batcher.begin(); batcher.draw(helpRegion, 0, 0, 320, 480); batcher.end(); batcher.enableBlending(); batcher.begin(); batcher.draw(Assets.arrow, 320, 0, -64, 64); batcher.end(); gl.glDisable(GL10.GL_BLEND); }
public void draw (float deltaTime) { GLCommon gl = Gdx.gl; gl.glClearColor(1, 0, 0, 1); gl.glClear(GL10.GL_COLOR_BUFFER_BIT); guiCam.update(); batcher.setProjectionMatrix(guiCam.combined); batcher.disableBlending(); batcher.begin(); batcher.draw(Assets.backgroundRegion, 0, 0, 320, 480); batcher.end(); batcher.enableBlending(); batcher.begin(); batcher.draw(Assets.logo, 160 - 274 / 2, 480 - 10 - 142, 274, 142); batcher.draw(Assets.mainMenu, 10, 200 - 110 / 2, 300, 110); batcher.draw(Settings.soundEnabled ? Assets.soundOn : Assets.soundOff, 0, 0, 64, 64); batcher.end(); }
public void draw (float deltaTime) { GLCommon gl = Gdx.gl; gl.glClear(GL10.GL_COLOR_BUFFER_BIT); guiCam.update(); batcher.setProjectionMatrix(guiCam.combined); batcher.disableBlending(); batcher.begin(); batcher.draw(Assets.backgroundRegion, 0, 0, 320, 480); batcher.end(); batcher.enableBlending(); batcher.begin(); batcher.draw(Assets.highScoresRegion, 10, 360 - 16, 300, 33); float y = 230; for (int i = 4; i >= 0; i--) { Assets.font.draw(batcher, highScores[i], xOffset, y); y += Assets.font.getLineHeight(); } batcher.draw(Assets.arrow, 0, 0, 64, 64); batcher.end(); }