Java tutorial
/** * eAdventure is a research project of the * e-UCM research group. * * Copyright 2005-2013 e-UCM research group. * * You can access a list of all the contributors to eAdventure at: * http://e-adventure.e-ucm.es/contributors * * e-UCM is a research group of the Department of Software Engineering * and Artificial Intelligence at the Complutense University of Madrid * (School of Computer Science). * * C Profesor Jose Garcia Santesmases sn, * 28040 Madrid (Madrid), Spain. * * For more info please visit: <http://e-adventure.e-ucm.es> or * <http://www.e-ucm.es> * * **************************************************************************** * * This file is part of eAdventure * * eAdventure is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * eAdventure 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with eAdventure. If not, see <http://www.gnu.org/licenses/>. */ package es.eucm.ead.engine; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.glutils.ShaderProgram; import com.badlogic.gdx.scenes.scene2d.Stage; public class Engine implements ApplicationListener { private GameLoop gameLoop; public GameLoop getGameLoop() { return gameLoop; } /** * Loads the game in the given path. This method will fail if the libgdx * application has not been initialized * * @param path * the path where the game is * @param internal * if the path is internal or absolute */ public void setLoadingPath(final String path, final boolean internal) { Gdx.app.postRunnable(new Runnable() { @Override public void run() { gameLoop.runGame(path, internal); } }); } @Override public void create() { // OpenGL settings ShaderProgram.pedantic = false; Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1.0f); // Load bindings Stage stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true); Gdx.input.setInputProcessor(stage); gameLoop = new EngineGameLoop(stage, new Assets(Gdx.files)); } @Override public void resize(int width, int height) { } @Override public void render() { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); gameLoop.act(Gdx.graphics.getDeltaTime()); } @Override public void pause() { } @Override public void resume() { } @Override public void dispose() { } }