List of usage examples for com.badlogic.gdx.graphics GL20 GL_COLOR_BUFFER_BIT
int GL_COLOR_BUFFER_BIT
To view the source code for com.badlogic.gdx.graphics GL20 GL_COLOR_BUFFER_BIT.
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 ava 2 s. c o m*/ // 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 ww .ja v a2s .c om 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;/*from w ww.j a v a 2 s . co m*/ 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); /* */ 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 av a2s. c o m*/ batch.setProjectionMatrix(cam.combined); renderBackground(); renderObjects(); }
From source file:at.hid.tabletopsimulator.screens.About.java
License:Apache License
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(delta); stage.draw(); }
From source file:at.juggle.games.counting.screens.CountingGameScreen.java
License:Apache License
@Override public void render(float delta) { moveY += delta * 12;//from w ww .j av a 2 s.c om animationTime += delta * 8; handleInput(); // camera: cam.update(); batch.setProjectionMatrix(cam.combined); Gdx.gl.glClearColor(0.3f, 0.3f, 0.3f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); // draw bgImage batch.draw(backgroundImage, 0, 0, CountingGame.GAME_WIDTH, CountingGame.GAME_HEIGHT); model.drawGameState(batch, delta, buttonFont); xplode.draw(batch, delta); // draw moving text: // for (int i = 0; i < credits.length; i++) { // creditsFont.draw(batch, credits[i], CountingGame.GAME_WIDTH/8, moveY - i*creditsFont.getLineHeight()*1.5f); // } // draw gradient batch.end(); }
From source file:at.juggle.games.counting.screens.CreditsScreen.java
License:Apache License
@Override public void render(float delta) { moveY += delta * 100;/*from www . java 2s .co m*/ handleInput(); // camera: cam.update(); batch.setProjectionMatrix(cam.combined); Gdx.gl.glClearColor(0.3f, 0.3f, 0.3f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); // draw bgImage batch.draw(backgroundImage, 0, 0, CountingGame.GAME_WIDTH, CountingGame.GAME_HEIGHT); // draw moving text: for (int i = 0; i < credits.length; i++) { creditsFont.draw(batch, credits[i], CountingGame.GAME_WIDTH / 8, moveY - i * creditsFont.getLineHeight() * 1.5f); } // draw gradient batch.draw(gradientBottom, 0, 0, CountingGame.GAME_WIDTH, gradientBottom.getHeight()); batch.draw(gradientTop, 0, CountingGame.GAME_HEIGHT - gradientTop.getHeight(), CountingGame.GAME_WIDTH, gradientTop.getHeight()); batch.end(); }
From source file:at.juggle.games.counting.screens.LoadingScreen.java
License:Apache License
@Override public void render(float delta) { if (parentGame.getAssetManager().update()) { parentGame.getScreenManager().setCurrentState(ScreenManager.ScreenState.Menu); }/*from w w w.j a va2 s. c o m*/ // camera: cam.update(); batch.setProjectionMatrix(cam.combined); // determine the current frame: animationFrameShownAlready += delta; if (animationFrameShownAlready > animationFrameShownFor) { animationFrame = (animationFrame + 1) % loadingFrames.length; animationFrameShownAlready = 0f; } Gdx.gl.glClearColor(0.3f, 0.3f, 0.3f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); batch.draw(loadingFrames[animationFrame], CountingGame.GAME_WIDTH / 2 - loadingFrames[animationFrame].getRegionWidth() / 2, CountingGame.GAME_HEIGHT / 2 - loadingFrames[animationFrame].getRegionHeight() / 2); batch.end(); }
From source file:at.juggle.games.counting.screens.MenuScreen.java
License:Apache License
@Override public void render(float delta) { handleInput();/*from w ww .ja v a2 s.c o m*/ // camera: cam.update(); batch.setProjectionMatrix(cam.combined); Gdx.gl.glClearColor(0.3f, 0.3f, 0.3f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); // draw bgImage ... batch.draw(backgroundImage, 0, 0, CountingGame.GAME_WIDTH, CountingGame.GAME_HEIGHT); for (int i = 0; i < background.length; i++) { for (int j = 0; j < background.length; j++) { if (i != j && background[i] != null && background[j] != null) { Vector2 dist = background[j].dist(background[i]); if (dist.len() < background[j].getHeight()) { float d = (background[i].getHeight() - dist.len()) / background[i].getHeight(); background[j].setPosition(background[j].getX() + dist.x * d, background[j].getY() + dist.y * d); background[i].setPosition(background[i].getX() - dist.x * d, background[i].getY() - dist.y * d); } } } background[i].setY(background[i].getY() + delta * 100f * background[i].getSpeed()); background[i].draw(batch, delta); if (background[i].getY() > CountingGame.GAME_HEIGHT * 1.1f) background[i].setPosition( CountingGame.GAME_WIDTH / 2f + ((float) (Math.random() * CountingGame.GAME_WIDTH / 2f)), -((float) (Math.random() * CountingGame.GAME_HEIGHT))); } // draw buttons ... startMengen.draw(batch); startZaehlen.draw(batch); // draw Strings ... for (int i = 2; i < menuStrings.length; i++) { if (i == currentMenuItem) menuFont.setColor(0.2f, 0.2f, 0.8f, 1f); else menuFont.setColor(0f, 0f, 0f, 1f); String menuString = menuStrings[i]; if (menuString.startsWith(ballons)) menuString += ": " + getNumberOfBallons() + " max."; else if (menuString.startsWith(difficulty)) menuString += ": " + ((CountingGame.difficulty == 0) ? "einfach" : ((CountingGame.difficulty == 1) ? "mittel" : "schwer")); menuFont.draw(batch, menuString, offsetLeft, CountingGame.GAME_HEIGHT - offsetTop - i * offsetY); } batch.end(); }
From source file:at.juggle.games.counting.screens.SortingGameScreen.java
License:Apache License
@Override public void render(float delta) { handleInput();/*from w w w . j a va2 s.c om*/ // camera: cam.update(); batch.setProjectionMatrix(cam.combined); Gdx.gl.glClearColor(0.3f, 0.3f, 0.3f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); // draw bgImage batch.draw(backgroundImage, 0, 0, CountingGame.GAME_WIDTH, CountingGame.GAME_HEIGHT); model.drawGameState(batch, delta, buttonFont); xplode.draw(batch, delta); // draw moving text: // for (int i = 0; i < credits.length; i++) { // creditsFont.draw(batch, credits[i], CountingGame.GAME_WIDTH/8, moveY - i*creditsFont.getLineHeight()*1.5f); // } // draw gradient batch.end(); }