com.binarytenshi.nopassing.NoPassing.java Source code

Java tutorial

Introduction

Here is the source code for com.binarytenshi.nopassing.NoPassing.java

Source

/*
 * Copyright:
 * This file was created by BinaryTENSHi and distributed
 * as part of NoPassing.
 *
 * NoPassing lies under a license which can be
 * found in the LICENSE file in the root directory
 * File created @ [26.12.2013, 19:04:40 CH timezone]
 */

package com.binarytenshi.nopassing;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.graphics.FPSLogger;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.binarytenshi.nopassing.core.CameraHandler;
import com.binarytenshi.nopassing.core.MapHandler;
import com.binarytenshi.nopassing.state.GameScreen;

public class NoPassing extends Game {
    public static NoPassing instance;

    private SpriteBatch batch;
    private FPSLogger fpsLogger;

    @Override
    public void create() {
        instance = this;
        batch = new SpriteBatch();
        fpsLogger = new FPSLogger();

        MapHandler.initialize(20, 20);
        CameraHandler.initialize();

        setScreen(GameScreen.Menu.getScreen());
    }

    @Override
    public void dispose() {
        batch.dispose();
    }

    @Override
    public void pause() {
    }

    @Override
    public void render() {
        super.render();

        fpsLogger.log();
    }

    @Override
    public void resize(int w, int h) {
        CameraHandler.resize(w, h);
    }

    @Override
    public void resume() {
    }

    public static SpriteBatch getSpriteBatch() {
        return instance.batch;
    }
}