ru.kvachenko.stoneclicker.screens.LoadingScreen.java Source code

Java tutorial

Introduction

Here is the source code for ru.kvachenko.stoneclicker.screens.LoadingScreen.java

Source

/*
 * Copyright (c) 2016 Kvachenko A. [feedback@kvachenko.ru]
 *
 * This file is part of program StoneClicker.
 *
 * This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *   See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package ru.kvachenko.stoneclicker.screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
import javafx.scene.Scene;

/**
 * @author Sasha Kvachenko
 *         Created on 02.09.2016.
 *         <p>
 *         File description.
 */
public class LoadingScreen implements Screen {
    private Stage mainStage;
    private Image loadingImage;

    public LoadingScreen() {
        mainStage = new Stage(new ScreenViewport());
        //loadingImage = new Image(new Texture(Gdx.files.internal("android/assets/images/loading.png")));
        loadingImage = new Image(new Texture(Gdx.files.internal("images/loading.png")));
        mainStage.addActor(loadingImage);
    }

    @Override
    public void dispose() {
        mainStage.dispose();
    }

    @Override
    public void show() {

    }

    @Override
    public void render(float delta) {
        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        mainStage.draw();
    }

    @Override
    public void resize(int width, int height) {
        mainStage.getViewport().update(width, height, true);
        loadingImage.setPosition(width - loadingImage.getWidth(), 0);
    }

    @Override
    public void pause() {

    }

    @Override
    public void resume() {

    }

    @Override
    public void hide() {

    }
}