Java tutorial
/* * This file is part of Jump Don't Die * Copyright (C) 2015 Dani Rodrguez <danirod@outlook.com> * * 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.arkanoid.Screens; import com.badlogic.gdx.Screen; import com.arkanoid.ArkanoidGame; /** * This is the default screen. Every screen overrides this screen. This screen has two purposes. * One is to override every method so that they are not required by other screens. The second * is to provide some common boilerplate code for every screen. */ public abstract class BaseScreen implements Screen { /** * Game instance. By making this protected and getting this value from the constructor, * every screen can be connected to the game, because every screen can access the game * instance. */ protected ArkanoidGame game; public BaseScreen(ArkanoidGame game) { this.game = game; } @Override public void show() { // This method is invoked when a screen is displayed. } @Override public void render(float delta) { // This method is invoked when a screen has to be rendered in a frame. // delta is the amount of seconds (order of 0.01 or so) between this and last frame. } @Override public void resize(int width, int height) { // This method is invoked when the game is resized (desktop). } @Override public void pause() { // This method is invoked when the game is paused. } @Override public void resume() { // This method is invoked when the game is resumed. } @Override public void hide() { // This method is invoked when the screen is no more displayed. } @Override public void dispose() { // This method is invoked when the game closes. } }