Java tutorial
// Copyright 2012 Anton Holm, Arez Arazu, Gustav Larsson // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package net.dat.killemall.screens; import com.badlogic.gdx.Game; 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.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; public class SplashScreen implements Screen { // Hmtar tillgnglig storlek p skrmen. float x = Gdx.graphics.getWidth(); float y = Gdx.graphics.getHeight(); private SpriteBatch spriteBatch; private Texture splashScreenTexture; private Texture splash1ScreenTexture; private Game KEAGame; public SplashScreen(Game ga) { KEAGame = ga; } @Override public void render(float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); spriteBatch.begin(); spriteBatch.draw(splash1ScreenTexture, 0, 0, x, y); spriteBatch.end(); // Om spelaren rr skrmen byter applikationen skrm // till main menu. if (Gdx.input.justTouched()) { KEAGame.setScreen(new MainMenuScreen(KEAGame)); } } @Override public void resize(int width, int height) { } //Hmtar aktuell spritebatch @Override public void show() { spriteBatch = new SpriteBatch(); splashScreenTexture = new Texture(Gdx.files.internal("images/splash.png")); splash1ScreenTexture = new Texture(Gdx.files.internal("images/splash1.png")); } @Override public void hide() { // TODO Auto-generated method stub } @Override public void pause() { // TODO Auto-generated method stub } @Override public void resume() { // TODO Auto-generated method stub } @Override public void dispose() { spriteBatch.dispose(); splashScreenTexture.dispose(); splash1ScreenTexture.dispose(); } }