Example usage for com.badlogic.gdx.graphics GL20 glClear

List of usage examples for com.badlogic.gdx.graphics GL20 glClear

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics GL20 glClear.

Prototype

public void glClear(int mask);

Source Link

Usage

From source file:com.mygdx.g3il.screens.HelpScreen.java

License:Apache License

@Override
public void draw(float delta) {
    GL20 gl = Gdx.gl;
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    camera.update();//from w  w w  . j  a  v a 2  s. c o m
    game.batch.setProjectionMatrix(camera.combined);
    game.batch.disableBlending();
    game.batch.begin();
    game.batch.draw(background, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    game.batch.end();

    game.batch.enableBlending();
    game.batch.begin();
    game.batch.draw(board, camera.position.x, camera.position.y);
    game.batch.end();
}

From source file:com.mygdx.g3il.screens.HighscoresScreen.java

License:Apache License

@Override
public void draw(float delta) {
    GL20 gl = Gdx.gl;
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    camera.update();//from  w ww .  j  a v  a 2 s .  c om

    game.batch.setProjectionMatrix(camera.combined);
    game.batch.disableBlending();
    game.batch.begin();
    game.batch.draw(background, 0, 0, camera.viewportWidth, camera.viewportHeight);
    game.batch.end();

    game.batch.enableBlending();
    game.batch.begin();

    float y = Gdx.graphics.getHeight() / 100 * 30;
    for (int i = Settings.MAX_SCORES - 1; i >= 0; i--) {
        game.font.draw(game.batch, highScores[i] + GAMES, xOffset, y);
        y += game.font.getLineHeight();
    }

    final String text = "Highs Scores";
    y += game.font.getLineHeight() * 2;

    game.font.scale(1);
    game.font.draw(game.batch, text, camera.position.x - game.font.getBounds(text).width / 2, y);
    game.font.scale(-1);

    game.batch.draw(arrow, 32, 32);
    game.batch.end();
}

From source file:com.mygdx.game.superjumper.screen.HelpScreen.java

License:Apache License

public void draw() {
    GL20 gl = Gdx.gl;
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    guiCam.update();/*  w  w  w  .  j  ava2 s.  c  o m*/
    game.batcher.setProjectionMatrix(guiCam.combined);
    game.batcher.disableBlending();
    game.batcher.begin();
    game.batcher.draw(helpRegion, 0, 0);
    game.batcher.end();

    game.batcher.enableBlending();
    game.batcher.begin();
    game.batcher.draw(Assets.arrow, 320, 0, -64, 64);
    game.batcher.end();
}

From source file:com.mygdx.game.superjumper.screen.HelpScreen2.java

License:Apache License

public void draw() {
    GL20 gl = Gdx.gl;
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    guiCam.update();/*from   w w w . ja va2  s  . c  o  m*/

    game.batcher.setProjectionMatrix(guiCam.combined);
    game.batcher.disableBlending();
    game.batcher.begin();
    game.batcher.draw(helpRegion, 0, 0, 320, 480);
    game.batcher.end();

    game.batcher.enableBlending();
    game.batcher.begin();
    game.batcher.draw(Assets.arrow, 320, 0, -64, 64);
    game.batcher.end();

    gl.glDisable(GL20.GL_BLEND);
}

From source file:com.mygdx.game.superjumper.screen.HighscoresScreen.java

License:Apache License

public void draw() {
    GL20 gl = Gdx.gl;
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    guiCam.update();/*from  w  w w .j  a va2s  .  c o m*/

    game.batcher.setProjectionMatrix(guiCam.combined);
    game.batcher.disableBlending();
    game.batcher.begin();
    game.batcher.draw(Assets.backgroundRegion, 0, 0, 320, 480);
    game.batcher.end();

    game.batcher.enableBlending();
    game.batcher.begin();
    game.batcher.draw(Assets.highScoresRegion, 10, 360 - 16, 300, 33);

    float y = 230;
    for (int i = 4; i >= 0; i--) {
        Assets.font.draw(game.batcher, highScores[i], xOffset, y);
        y += Assets.font.getLineHeight();
    }

    game.batcher.draw(Assets.arrow, 0, 0, 64, 64);
    game.batcher.end();
}

From source file:com.mygdx.game.superjumper.screen.MainMenuScreen.java

License:Apache License

public void draw() {
    GL20 gl = Gdx.gl;
    gl.glClearColor(1, 0, 0, 1);/*from w  w w .j a  v a  2s .  c  o  m*/
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    guiCam.update();
    game.batcher.setProjectionMatrix(guiCam.combined);

    game.batcher.disableBlending();//??
    game.batcher.begin();
    game.batcher.draw(Assets.backgroundRegion, 0, 0, 320, 480);
    game.batcher.end();

    game.batcher.enableBlending();
    game.batcher.begin();
    game.batcher.draw(Assets.logo, 160 - 274 / 2, 480 - 10 - 142, 274, 142);
    game.batcher.draw(Assets.mainMenu, 10, 200 - 110 / 2, 300, 110);
    game.batcher.draw(Settings.soundEnabled ? Assets.soundOn : Assets.soundOff, 0, 0, 64, 64);
    game.batcher.end();
}

From source file:com.mygdx.janelas.Janela.java

@Override
public void render(float f) {
    GL20 gl = Gdx.gl;
    gl.glClearColor(0, 0, 0, 0);// w  w w . j  a v  a 2  s.  co m
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    camera.update();
    estagio.act(Gdx.graphics.getDeltaTime());

    estagio.draw();
    cliques();
    for (Botao botoe : botoes) {
        botoe.foiClicado(clicado);
    }
    processa();
}

From source file:com.o2d.pkayjava.editor.view.Overlap2DScreen.java

License:Apache License

@Override
public void render(float deltaTime) {
    if (paused) {
        return;//from   ww  w  .j  a  v  a  2 s  .  c o  m
    }
    GL20 gl = Gdx.gl;
    gl.glClearColor(bgColor.r, bgColor.g, bgColor.b, bgColor.a);
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    if (isDrawingBgLogo) {
        batch.begin();
        batch.setColor(1, 1, 1, 0.12f);
        batch.draw(bgLogo, screenSize.x / 2 - bgLogo.getWidth() / 2, screenSize.y / 2 - bgLogo.getHeight() / 2);
        batch.end();
    } else {
        if (sandboxBackUI != null)
            sandboxBackUI.render(deltaTime);
        if (engine != null) {
            engine.update(deltaTime);
        }
    }

    if (uiStage != null) {
        uiStage.act(deltaTime);
    }
    if (uiStage != null) {
        uiStage.draw();
    }
}

From source file:com.siondream.superjumper.MainMenuScreen.java

License:Apache License

public void draw() {
    GL20 gl = Gdx.gl;
    gl.glClearColor(1, 0, 0, 1);/*from   w w w.jav  a 2  s  .  c o m*/
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    guiCam.update();
    game.batcher.setProjectionMatrix(guiCam.combined);

    game.batcher.disableBlending();
    game.batcher.begin();
    game.batcher.draw(Assets.backgroundRegion, 0, 0, 320, 480);
    game.batcher.end();

    game.batcher.enableBlending();
    game.batcher.begin();
    game.batcher.draw(Assets.logo, 160 - 274 / 2, 480 - 10 - 142, 274, 142);
    game.batcher.draw(Assets.mainMenu, 10, 200 - 110 / 2, 300, 110);
    game.batcher.draw(Settings.soundEnabled ? Assets.soundOn : Assets.soundOff, 0, 0, 64, 64);
    game.batcher.end();
}

From source file:com.siondream.superjumper.SuperJumper.java

License:Apache License

@Override
public void render() {
    GL20 gl = Gdx.gl;
    gl.glClearColor(0.0f, 1.0f, 0.0f, 0.0f);
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    super.render();
}