com.whynot.stClient.view.Splash.java Source code

Java tutorial

Introduction

Here is the source code for com.whynot.stClient.view.Splash.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.whynot.stClient.view;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

/**
 *
 * @author potapov
 */
public class Splash implements com.badlogic.gdx.Screen {
    private Sprite splash;
    private SpriteBatch batch;

    @Override
    public void render(float f) {
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        batch.begin();
        splash.draw(batch);
        batch.end();
    }

    @Override
    public void resize(int i, int i1) {
    }

    @Override
    public void show() {
        batch = new SpriteBatch();
        Texture text = new Texture("img/splash.png");
        splash = new Sprite(text);
        splash.setSize(Gdx.graphics.getWidth() / 3, Gdx.graphics.getHeight() / 3);
        splash.setPosition(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
    }

    @Override
    public void hide() {
    }

    @Override
    public void pause() {
    }

    @Override
    public void resume() {
    }

    @Override
    public void dispose() {
    }

}