eu.rubenrosado.inmisericordia.MainGame.java Source code

Java tutorial

Introduction

Here is the source code for eu.rubenrosado.inmisericordia.MainGame.java

Source

/*
 * Inmisericordia
 * Copyright (C) 2014 Ruben Rosado <rrosadoalba@gmail.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 eu.rubenrosado.inmisericordia;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

import eu.rubenrosado.inmisericordia.screens.Loading;

/**
 * This class is called by the engine libgdx to manage the game
 * 
 * @author Ruben Rosado
 * 
 */
public class MainGame extends Game {

    public OrthographicCamera camera;
    public SpriteBatch batch;
    public float width, height;
    public AssetManager manager;
    public static final int BASEW = 800;
    public static final int BASEH = 480;

    public void create() {
        width = Gdx.graphics.getWidth();
        height = Gdx.graphics.getHeight();
        camera = new OrthographicCamera(width, height);
        batch = new SpriteBatch();
        batch.setProjectionMatrix(camera.combined);
        manager = new AssetManager();
        this.setScreen(new Loading(this));
    }

    public void dispose() {
        batch.dispose();
        manager.dispose();
    }

    public void render() {
        super.render();
    }

}