2019-12-23 12:07:24 -07:00
|
|
|
package com.me.pacman;
|
|
|
|
|
|
|
|
import com.badlogic.gdx.ApplicationAdapter;
|
|
|
|
import com.badlogic.gdx.Gdx;
|
|
|
|
import com.badlogic.gdx.graphics.GL20;
|
|
|
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
|
|
|
import com.badlogic.gdx.graphics.Texture;
|
|
|
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
|
|
|
import com.badlogic.gdx.math.Matrix4;
|
|
|
|
import com.badlogic.gdx.utils.viewport.FitViewport;
|
|
|
|
import com.badlogic.gdx.utils.viewport.Viewport;
|
|
|
|
|
|
|
|
public class PacDude extends ApplicationAdapter {
|
|
|
|
|
|
|
|
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 = 248;
|
|
|
|
|
|
|
|
public OrthographicCamera cam;
|
|
|
|
public Viewport viewport;
|
|
|
|
|
|
|
|
public SpriteBatch batch;
|
2019-12-23 13:11:18 -07:00
|
|
|
public Texture level;
|
|
|
|
public Texture logo;
|
2019-12-23 12:07:24 -07:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void create () {
|
|
|
|
cam = new OrthographicCamera();
|
|
|
|
viewport = new FitViewport(LEVEL_WIDTH, LEVEL_HEIGHT, cam);
|
|
|
|
viewport.apply(true);
|
|
|
|
|
|
|
|
batch = new SpriteBatch();
|
2019-12-23 13:11:18 -07:00
|
|
|
level = new Texture("level.png");
|
|
|
|
logo = new Texture("logo.png");
|
|
|
|
logo.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
|
2019-12-23 12:07:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void render () {
|
|
|
|
Gdx.gl.glClearColor(0, 0, 0, 1);
|
|
|
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
|
|
|
batch.begin();
|
2019-12-23 13:11:18 -07:00
|
|
|
batch.draw(level, 0, 0);
|
|
|
|
batch.draw(logo, 0, 124, 224, 120);
|
2019-12-23 12:07:24 -07:00
|
|
|
batch.end();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void resize(int width, int height) {
|
|
|
|
viewport.update(width, height);
|
|
|
|
|
|
|
|
batch.setProjectionMatrix(cam.combined);
|
|
|
|
|
|
|
|
super.resize(width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void dispose () {
|
|
|
|
batch.dispose();
|
2019-12-23 13:11:18 -07:00
|
|
|
level.dispose();
|
2019-12-23 12:07:24 -07:00
|
|
|
}
|
|
|
|
}
|