master
GammelJan 6 years ago
parent 196064b3a9
commit 31968aed39

@ -53,9 +53,9 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
batch = new SpriteBatch(); batch = new SpriteBatch();
Gdx.input.setInputProcessor(this); Gdx.input.setInputProcessor(this);
camera = new OrthographicCamera(1280, 720); camera = new OrthographicCamera();
fitViewport = new FitViewport(1280, 720, camera); camera.setToOrtho(false,1600,900);
fitViewport = new FitViewport(1600, 900, camera);
level = new Level(new Goal(700,400,200,80), new Projectile(0,0,0),200,200); level = new Level(new Goal(700,400,200,80), new Projectile(0,0,0),200,200);
stepTimer = new Timer(); stepTimer = new Timer();
@ -79,9 +79,10 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
@Override @Override
public void render(){ public void render(){
camera.update();
Gdx.gl.glClearColor(1f, 1f, 1f, 1f); Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
fitViewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true); batch.setProjectionMatrix(camera.combined);
batch.begin(); batch.begin();
if(ts != null) ts.render(batch); if(ts != null) ts.render(batch);
else if(ls != null) ls.render(batch); else if(ls != null) ls.render(batch);
@ -175,4 +176,8 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
return false; return false;
} }
@Override
public void resize(int width, int height) {
fitViewport.update(width,height,true);
}
} }

@ -9,8 +9,8 @@ public class DesktopLauncher {
public static void main (String[] arg) { public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
//config.fullscreen = true; //config.fullscreen = true;
config.height = 720; config.height = 900;
config.width = 1280; config.width = 1600;
new LwjglApplication(new Controller(), config); new LwjglApplication(new Controller(), config);
} }
} }

Loading…
Cancel
Save