Skip to content

Instantly share code, notes, and snippets.

@reime005
Created December 5, 2016 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reime005/553b3a327702cdb89e095e5d2d1ba996 to your computer and use it in GitHub Desktop.
Save reime005/553b3a327702cdb89e095e5d2d1ba996 to your computer and use it in GitHub Desktop.
Superclass for your stages in libGDX
package de.reimerm.hammerize;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.utils.Scaling;
import com.badlogic.gdx.utils.viewport.ScalingViewport;
/**
* Created by Marius Reimer on 15-Sep-16.
*/
public abstract class AbstractStage extends Stage {
public AbstractStage() {
super(new ScalingViewport(Scaling.stretch, 800, 480,
new OrthographicCamera(800, 480)));
getCamera().position.set(getCamera().viewportWidth / 2, getCamera().viewportHeight / 2, 0f);
getCamera().update();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment