Java tutorial
/* * Logic-Builder. * Copyright (C) 2016 Jesse Prescott (BleedObsidian) * * 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 com.gmail.bleedobsidian.logicbuilder.screens.loading; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.utils.Timer; import com.badlogic.gdx.utils.Timer.Task; import com.gmail.bleedobsidian.logicbuilder.LogicBuilder; /** * Logic-Builder Loading screen. * * @author Jesse Prescott (BleedObsidian) */ public class LoadingScreen implements Screen { /** * SpriteBatch. */ private final SpriteBatch spriteBatch; /** * Logic-Builder Logo. */ private final Texture logicBuilderLogo; /** * New Loading Screen. */ public LoadingScreen() { this.spriteBatch = new SpriteBatch(); this.logicBuilderLogo = new Texture(Gdx.files.internal("Textures/Logo.png")); this.logicBuilderLogo.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); } @Override public void resume() { } /** * Update. * * @param fullScreenCamera Full Screen OrthographicCamera. * @param delta Delta Value. */ public void update(OrthographicCamera fullScreenCamera, float delta) { if (LogicBuilder.getInstance().getResourceManager().update()) { new Timer().scheduleTask(new Task() { @Override public void run() { LogicBuilder.getInstance().finishedLoading(); } }, 5); } } @Override public void render(float delta) { this.update(LogicBuilder.getInstance().getFullScreenCamera(), delta); Gdx.gl.glClearColor(1f, 1f, 1f, 1f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); this.spriteBatch.setProjectionMatrix(LogicBuilder.getInstance().getFullScreenCamera().combined); this.spriteBatch.begin(); this.spriteBatch.draw(this.logicBuilderLogo, (LogicBuilder.TARGET_WIDTH / 2) - (this.logicBuilderLogo.getWidth() / 2), (LogicBuilder.TARGET_HEIGHT / 2) - (this.logicBuilderLogo.getHeight() / 2)); this.spriteBatch.end(); } @Override public void pause() { } @Override public void resize(int width, int height) { } @Override public void show() { } @Override public void hide() { } @Override public void dispose() { this.spriteBatch.dispose(); this.logicBuilderLogo.dispose(); } }