List of usage examples for com.badlogic.gdx Gdx gl
GL20 gl
To view the source code for com.badlogic.gdx Gdx gl.
Click Source Link
From source file:MyGdxGame.java
License:Apache License
@Override public void render() { // clear the screen Gdx.gl.glClearColor(0.7f, 0.7f, 1.0f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // get the delta time float deltaTime = Gdx.graphics.getDeltaTime(); // update the koala (process input, collision detection, position update) updateKoala(deltaTime);//from w w w. j a v a2 s .com // let the camera follow the koala, x-axis only camera.position.x = koala.position.x; camera.update(); // set the tile map rendere view based on what the // camera sees and render the map renderer.setView(camera); renderer.render(); // render the koala renderKoala(deltaTime); }
From source file:ac.uk.dmu.ash.game.screen.CreditsScreen.java
License:Open Source License
@Override public void render(float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); fpsLabel.setText("fps: " + Gdx.graphics.getFramesPerSecond()); spriteBatch.begin();/*from w w w. ja va 2 s .c o m*/ drawTextureCentre(assets, spriteBatch, "background", 0, 0); spriteBatch.end(); stage.act(Gdx.graphics.getDeltaTime()); stage.draw(); // Table.drawDebug(stage); // adds coloured outline to cells within the tables that are in the stage }
From source file:airfoil.Main.java
License:Open Source License
@Override public void render() { if (this.alive) { GLCommon gl = Gdx.gl; gl.glViewport(0, 0, this.width, this.height); gl.glClearColor(ColorClear.r, ColorClear.g, ColorClear.b, ColorClear.a); gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glEnable(GL20.GL_DEPTH_TEST); gl.glDepthFunc(GL20.GL_LESS);// ww w . j a va2 s. c om /* */ this.renderMeshLines(this.database.getMesh(this.geometry)); } }
From source file:app.badlogicgames.splitpong.multiplayer.WorldRenderer.java
License:Apache License
public void render() { Gdx.gl.glClearColor(0, 0, 0, 1); //esta Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // y esta linea limpian la pantalla cam.update();/*w w w .j a v a 2 s.c o m*/ batch.setProjectionMatrix(cam.combined); renderBackground(); renderObjects(); }
From source file:app.badlogicgames.superjumper.GameScreen.java
License:Apache License
public void draw() { GLCommon gl = Gdx.gl; gl.glClear(GL10.GL_COLOR_BUFFER_BIT); renderer.render();// ww w .j ava2 s . com 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(); }
From source file:app.badlogicgames.superjumper.HelpScreen.java
License:Apache License
public void draw() { GLCommon gl = Gdx.gl; gl.glClear(GL10.GL_COLOR_BUFFER_BIT); guiCam.update();/* w ww .j ava 2 s.c o m*/ 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); }
From source file:app.badlogicgames.superjumper.HighscoresScreen.java
License:Apache License
public void draw() { GLCommon gl = Gdx.gl; gl.glClear(GL10.GL_COLOR_BUFFER_BIT); guiCam.update();//w ww . j ava 2 s. c om 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(); }
From source file:app.badlogicgames.superjumper.MainMenuScreen.java
License:Apache License
public void draw() { GLCommon gl = Gdx.gl; gl.glClearColor(1, 0, 0, 1);//from w ww . j a va 2 s .com 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(Assets.multiplayer, 160 - 64, 100, 128, 32); batcher.draw(Settings.soundEnabled ? Assets.soundOn : Assets.soundOff, 0, 0, 64, 64); batcher.end(); if (System.nanoTime() - last > 2000000000) { Gdx.app.log("SuperJumper", "version: " + Gdx.app.getVersion() + ", memory: " + Gdx.app.getJavaHeap() + ", " + Gdx.app.getNativeHeap() + ", native orientation:" + Gdx.input.getNativeOrientation() + ", orientation: " + Gdx.input.getRotation() + ", accel: " + (int) Gdx.input.getAccelerometerX() + ", " + (int) Gdx.input.getAccelerometerY() + ", " + (int) Gdx.input.getAccelerometerZ() + ", apr: " + (int) Gdx.input.getAzimuth() + ", " + (int) Gdx.input.getPitch() + ", " + (int) Gdx.input.getRoll()); last = System.nanoTime(); } }
From source file:app.badlogicgames.superjumper.multiplayer.StartMultiplayerScreen.java
License:Apache License
public void draw() { GLCommon gl = Gdx.gl; gl.glClear(GL10.GL_COLOR_BUFFER_BIT); guiCam.update();/*from w w w. j av a 2 s . c o m*/ batcher.setProjectionMatrix(guiCam.combined); batcher.disableBlending(); batcher.begin(); batcher.draw(Assets.backgroundRegion, 0, 0, 320, 480); batcher.end(); batcher.enableBlending(); batcher.begin(); float y = 230; for (int i = msg.length - 1; i >= 0; i--) { float width = Assets.font.getBounds(msg[i]).width; Assets.font.draw(batcher, msg[i], 160 - width / 2, y); y += Assets.font.getLineHeight(); } batcher.draw(Assets.arrow, 0, 0, 64, 64); batcher.end(); }
From source file:app.badlogicgames.superjumper.RegisterScreen.java
License:Apache License
public void draw() { GLCommon gl = Gdx.gl; gl.glClearColor(1, 0, 0, 1);/*from w w w.j av a2 s. c om*/ 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.enterName, 10, 400, 128, 32); Assets.font.draw(batcher, ": " + Util.NAME, 140, 400 + Assets.font.getLineHeight()); batcher.draw(Assets.enterEmail, 10, 350, 128, 32); Assets.font.draw(batcher, ": " + Util.EMAIL, 140, 350 + Assets.font.getLineHeight()); batcher.draw(Assets.enterPass, 10, 300, 128, 32); Assets.font.draw(batcher, ": " + Util.PASSWORD, 140, 300 + Assets.font.getLineHeight()); batcher.draw(Assets.submit, 160 - 64, 100, 128, 32); Assets.font.draw(batcher, notification, 10, 50); batcher.end(); if (System.nanoTime() - last > 2000000000) { Gdx.app.log("SuperJumper", "version: " + Gdx.app.getVersion() + ", memory: " + Gdx.app.getJavaHeap() + ", " + Gdx.app.getNativeHeap() + ", native orientation:" + Gdx.input.getNativeOrientation() + ", orientation: " + Gdx.input.getRotation() + ", accel: " + (int) Gdx.input.getAccelerometerX() + ", " + (int) Gdx.input.getAccelerometerY() + ", " + (int) Gdx.input.getAccelerometerZ() + ", apr: " + (int) Gdx.input.getAzimuth() + ", " + (int) Gdx.input.getPitch() + ", " + (int) Gdx.input.getRoll()); last = System.nanoTime(); } }