This repository has been archived on 2022-10-01. You can view files and clone it, but cannot push or open issues or pull requests.
EEEEEEEEEEEEEEEAAAAAAAAAA-A.../core/src/com/game/App.java

88 lines
2.3 KiB
Java
Raw Normal View History

2016-02-08 18:08:43 +00:00
package com.game;
import com.badlogic.gdx.Game;
2016-02-08 18:08:43 +00:00
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.assets.AssetManager;
2016-02-12 19:13:05 +00:00
import com.badlogic.gdx.assets.loaders.FileHandleResolver;
import com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver;
2016-02-08 18:08:43 +00:00
import com.badlogic.gdx.graphics.OrthographicCamera;
2016-02-12 19:13:05 +00:00
import com.badlogic.gdx.graphics.g2d.BitmapFont;
2016-02-08 18:08:43 +00:00
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
2016-02-12 19:13:05 +00:00
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGeneratorLoader;
import com.badlogic.gdx.graphics.g2d.freetype.FreetypeFontLoader;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
2016-02-08 18:08:43 +00:00
import com.game.Misc.Vars;
import com.game.Screens.Loading;
2016-02-12 19:13:05 +00:00
import com.game.Screens.Menu;
2016-02-08 18:08:43 +00:00
public class App extends Game {
2016-02-08 18:08:43 +00:00
private float accum;
// Batches
2016-02-08 18:08:43 +00:00
private SpriteBatch sb;
private ShapeRenderer sr;
// Cameras
2016-02-12 19:13:05 +00:00
//private OrthographicCamera cam;
//private OrthographicCamera hudCam;
2016-02-08 18:08:43 +00:00
// Managers
private AssetManager assetManager;
//private StateManager sm;
2016-02-08 18:08:43 +00:00
@Override
public void create() {
assetManager = new AssetManager();
// Create batches
2016-02-08 18:08:43 +00:00
sb = new SpriteBatch();
sr = new ShapeRenderer();
2016-02-12 19:13:05 +00:00
sr.setAutoShapeType(true);
2016-02-08 18:08:43 +00:00
// Create Main + HUD cameras
2016-02-12 19:13:05 +00:00
//cam = new OrthographicCamera();
//cam.setToOrtho(false, Vars.SCREEN_WIDTH, Vars.SCREEN_HEIGHT);
//hudCam = new OrthographicCamera();
//hudCam.setToOrtho(false, Vars.SCREEN_WIDTH, Vars.SCREEN_HEIGHT);
this.setScreen(new Loading(this));
2016-02-08 18:08:43 +00:00
}
@Override
public void render () {
super.render();
2016-02-12 19:13:05 +00:00
if(Gdx.input.isKeyPressed(Input.Keys.M))
{
this.setScreen(new Menu(this));
}
/*accum += Gdx.graphics.getDeltaTime();
2016-02-08 18:08:43 +00:00
while (accum >= Vars.STEP) {
accum -= Vars.STEP;
2016-02-09 00:05:48 +00:00
sm.handleInput();
2016-02-08 18:08:43 +00:00
sm.update(Vars.STEP);
sm.render();
}*/
2016-02-08 18:08:43 +00:00
if(Gdx.input.isKeyPressed(Input.Keys.ESCAPE)) { Gdx.app.exit(); }
2016-02-08 18:08:43 +00:00
}
@Override
public void dispose () {
super.dispose();
2016-02-12 19:13:05 +00:00
assetManager.dispose();
sb.dispose();
sr.dispose();
2016-02-08 18:08:43 +00:00
}
public SpriteBatch getSpriteBatch() { return sb; }
public ShapeRenderer getSr() { return sr; }
2016-02-12 19:13:05 +00:00
//public OrthographicCamera getCam() { return cam; }
//public OrthographicCamera getHudCam() { return hudCam; }
public AssetManager getAssetManager() { return assetManager; }
2016-02-08 18:08:43 +00:00
}