List of usage examples for com.badlogic.gdx.graphics GL10 GL_COLOR_BUFFER_BIT
int GL_COLOR_BUFFER_BIT
To view the source code for com.badlogic.gdx.graphics GL10 GL_COLOR_BUFFER_BIT.
Click Source Link
From source file:app.badlogicgames.superjumper.GameScreen.java
License:Apache License
public void draw() { GLCommon gl = Gdx.gl;/*from w ww . j a va2 s . co m*/ 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(); }
From source file:app.badlogicgames.superjumper.HelpScreen.java
License:Apache License
public void draw() { GLCommon gl = Gdx.gl;/*from www. j a v a2 s . co m*/ 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); }
From source file:app.badlogicgames.superjumper.HighscoresScreen.java
License:Apache License
public void draw() { GLCommon gl = Gdx.gl;//from w w w .j a v a2 s.co m 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(); }
From source file:app.badlogicgames.superjumper.MainMenuScreen.java
License:Apache License
public void draw() { GLCommon gl = Gdx.gl;// w ww . j a v a 2 s . com 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(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;/*from www .ja va2 s .c o m*/ 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(); 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;//from w ww . ja v a2s.com 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.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(); } }
From source file:application.concretion.GameScreenController.java
License:Open Source License
@Override public void render() { // log.log(); // Clean the screen Gdx.gl.glClearColor(1, 1, 1, 1);// w w w. j a va 2 s . c o m Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT | GL10.GL_STENCIL_BUFFER_BIT); // Update and draw the screen currentScreen.update(Gdx.graphics.getDeltaTime()); currentScreen.draw(Gdx.graphics.getDeltaTime()); // Check if the current screen is done and set the next screen if return // null means that is not done nextScreen = currentScreen.nextScreen(); if (nextScreen != null) { // Dispose the resources of the current screen currentScreen.dispose(); // Set the next screen currentScreen = nextScreen; } }
From source file:apps101.libgdx_demo.Game.java
License:Open Source License
@Override public void render() { Gdx.gl.glClearColor(0.199f, 0.398f, 0.598f, 0.4f); // OpenGL code to make the screen blue Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // OpenGL code to clear the screen camera.update();//from w ww. j a v a 2s. c o m /** Render the smileyface image and helloworld image **/ batch.setProjectionMatrix(camera.combined); batch.begin(); batch.draw(smileyface, rect_smiley.x, rect_smiley.y); batch.draw(helloworld, rect_hello.x, rect_hello.y); batch.end(); /** Simple technique to detect user input on the touch screen **/ if (Gdx.input.isTouched()) { Vector3 touchPos = new Vector3(); touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0); camera.unproject(touchPos); /** center the smiley face on the touch (x,y) coordinates **/ rect_smiley.x = touchPos.x - 128 / 2; rect_smiley.y = touchPos.y - 128 / 2; } }
From source file:aurelienribon.texturepackergui.Canvas.java
License:Apache License
@Override public void render() { if (previousPageRequested) { previousPageRequested = false;// w w w. ja va 2 s .c o m index = index - 1 < 0 ? sprites.size() - 1 : index - 1; } if (nextPageRequested) { nextPageRequested = false; index = index + 1 >= sprites.size() ? 0 : index + 1; } if (packReloadRequested) { packReloadRequested = false; index = 0; camera.position.set(0, 0, 0); camera.update(); sprites.clear(); if (atlas != null) atlas.dispose(); if (packFile != null && packFile.exists()) { try { atlas = new TextureAtlas(packFile); List<Texture> textures = new ArrayList<Texture>(); for (AtlasRegion region : atlas.getRegions()) { if (!textures.contains(region.getTexture())) textures.add(region.getTexture()); } for (Texture tex : textures) { Sprite sp = new Sprite(tex); sp.setOrigin(sp.getWidth() / 2, sp.getHeight() / 2); sp.setPosition(-sp.getOriginX(), -sp.getOriginY()); sprites.add(sp); } } catch (GdxRuntimeException ex) { atlas = null; sprites.clear(); callback.atlasError(); } } } // Render Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); float w = Gdx.graphics.getWidth(); float h = Gdx.graphics.getHeight(); float tw = bgTex.getWidth(); float th = bgTex.getHeight(); batch.getProjectionMatrix().setToOrtho2D(0, 0, w, h); batch.begin(); batch.disableBlending(); batch.draw(bgTex, 0f, 0f, w, h, 0f, 0f, w / tw, h / th); batch.enableBlending(); batch.end(); batch.setProjectionMatrix(camera.combined); batch.begin(); if (!sprites.isEmpty()) sprites.get(index).draw(batch); batch.end(); batch.getProjectionMatrix().setToOrtho2D(0, 0, w, h); batch.begin(); font.setColor(Color.WHITE); lblNextPage.draw(batch); lblPreviousPage.draw(batch); infoLabel.draw(batch); if (sprites.isEmpty()) font.draw(batch, "No page to show", 10, 65); else font.draw(batch, "Page " + (index + 1) + " / " + sprites.size(), 10, 65); font.draw(batch, String.format(Locale.US, "Zoom: %.0f %%", 100f / camera.zoom), 10, 45); font.draw(batch, "Fps: " + Gdx.graphics.getFramesPerSecond(), 10, 25); batch.end(); }
From source file:com.andlabs.games.ouyatennis.OuyaTennis.java
License:Apache License
@Override public void render() { // Clear the screen, update the camera and make the sprite batch // use its matrices. Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); _camera.update();/*from www .java2s. c o m*/ //_camera.apply(Gdx.gl10); Gdx.gl.glViewport((int) _viewport.x, (int) _viewport.y, (int) _viewport.width, (int) _viewport.height); // Start rendering _batch.begin(); _batch.setProjectionMatrix(_camera.combined); // Update and render current state if (_currentState != null) { _currentState.update(Gdx.graphics.getDeltaTime()); _currentState.render(); } // Render mouse on top if (Gdx.app.getType() != ApplicationType.Android) { _mousePos.x = Gdx.input.getX(); _mousePos.y = Gdx.input.getY(); _camera.unproject(_mousePos); _batch.draw(_imgMouse, _mousePos.x, _mousePos.y); } _batch.end(); // Perform pending memory unloading, safely performPendingAssetsUnloading(); // Perform pending state changes, memory safe performPendingStateChange(); }