Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.sandholm.max.airplane;
- import com.badlogic.gdx.Gdx;
- import com.badlogic.gdx.Screen;
- import com.badlogic.gdx.files.FileHandle;
- import com.badlogic.gdx.graphics.g2d.BitmapFont;
- import com.badlogic.gdx.graphics.g2d.SpriteBatch;
- import com.badlogic.gdx.scenes.scene2d.Stage;
- import com.badlogic.gdx.scenes.scene2d.ui.Skin;
- import com.badlogic.gdx.scenes.scene2d.ui.Table;
- public abstract class AbstractScreen implements Screen {
- protected final AirplaneGame game;
- protected final BitmapFont font;
- protected final SpriteBatch batch;
- protected final Stage stage;
- private Table table;
- private Skin skin;
- public AbstractScreen(AirplaneGame game ) {
- this.game = game;
- this.font = new BitmapFont();
- this.batch = new SpriteBatch();
- this.stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true, batch);
- //this.stage
- }
- @Override
- public void render(float delta) {
- //Gdx.gl.glViewport((int) viewport.x, (int) viewport.y, (int) viewport.width, (int) viewport.height);
- //Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
- //Gdx.gl.glClear( GL20.GL_COLOR_BUFFER_BIT );
- stage.act( delta );
- stage.draw();
- }
- protected Skin getSkin()
- {
- if( skin == null ) {
- FileHandle skinFile = Gdx.files.internal( "uiskin/uiskin.json" );
- skin = new Skin( skinFile );
- }
- return skin;
- }
- protected Table getTable()
- {
- if( table == null ) {
- table = new Table(getSkin());
- table.setFillParent( true );
- stage.addActor( table );
- }
- return table;
- }
- @Override
- public void resize(int width, int height) {
- }
- @Override
- public void show() {
- // TODO Auto-generated method stub
- }
- @Override
- public void hide() {
- // TODO Auto-generated method stub
- }
- @Override
- public void pause() {
- // TODO Auto-generated method stub
- }
- @Override
- public void resume() {
- // TODO Auto-generated method stub
- }
- @Override
- public void dispose() {
- stage.dispose();
- font.dispose();
- batch.dispose();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement