66 lines
1.5 KiB
Java
66 lines
1.5 KiB
Java
package com.me.pacman;
|
|
|
|
import com.badlogic.gdx.Game;
|
|
import com.badlogic.gdx.Gdx;
|
|
import com.badlogic.gdx.assets.AssetManager;
|
|
import com.badlogic.gdx.graphics.GL20;
|
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
|
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
|
import com.badlogic.gdx.utils.viewport.FitViewport;
|
|
import com.badlogic.gdx.utils.viewport.Viewport;
|
|
import com.me.pacman.state.MenuState;
|
|
|
|
public class PacDude extends Game {
|
|
|
|
public static final String TITLE = "Pac-Dude";
|
|
public static final String VERSION = "v0.0.1";
|
|
|
|
public static final int LEVEL_WIDTH = 224;
|
|
public static final int LEVEL_HEIGHT = 288;
|
|
|
|
public AssetManager assets;
|
|
public SpriteBatch batch;
|
|
public ShapeRenderer sr;
|
|
|
|
public OrthographicCamera cam;
|
|
public Viewport viewport;
|
|
|
|
@Override
|
|
public void create () {
|
|
cam = new OrthographicCamera();
|
|
viewport = new FitViewport(LEVEL_WIDTH, LEVEL_HEIGHT, cam);
|
|
viewport.apply(true);
|
|
|
|
assets = new AssetManager();
|
|
batch = new SpriteBatch();
|
|
sr = new ShapeRenderer();
|
|
|
|
setScreen(new MenuState(this));
|
|
}
|
|
|
|
@Override
|
|
public void render () {
|
|
Gdx.gl.glClearColor(0, 0, 0, 1);
|
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
|
|
|
super.render();
|
|
}
|
|
|
|
@Override
|
|
public void resize(int width, int height) {
|
|
viewport.update(width, height);
|
|
|
|
batch.setProjectionMatrix(cam.combined);
|
|
sr.setProjectionMatrix(cam.combined);
|
|
|
|
super.resize(width, height);
|
|
}
|
|
|
|
@Override
|
|
public void dispose () {
|
|
batch.dispose();
|
|
assets.dispose();
|
|
}
|
|
}
|