package com.jalenwinslow.game; 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.g2d.SpriteBatch; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.utils.viewport.ScreenViewport; public class Main extends ApplicationAdapter { public static int SCREEN_WIDTH, SCREEN_HEIGHT; SpriteBatch batch; private Handler handler; private Stage stage; private OrthographicCamera cam; @Override public void create () { batch = new SpriteBatch(); handler = new Handler(this); stage = new Stage(new ScreenViewport(), batch); stage.getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true); SCREEN_WIDTH = Gdx.graphics.getWidth()/12; //Original is divided by 10 SCREEN_HEIGHT = Gdx.graphics.getHeight()/12; cam = new OrthographicCamera(SCREEN_WIDTH, SCREEN_HEIGHT); cam.setToOrtho(false, cam.viewportWidth, cam.viewportHeight); handler.init(); cam.update(); } public void resize() { stage.getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.update(); } @Override public void render () { //Update handler.update(Gdx.graphics.getDeltaTime()); cam.update(); batch.setProjectionMatrix(cam.combined); //Render Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); handler.render(batch); batch.end(); //GUI Render (Stage) stage.draw(); } @Override public void dispose () { handler.dispose(); batch.dispose(); stage.dispose(); } //Getters and Setters public Stage getStage() {return stage;} public OrthographicCamera getCam() {return cam;} }