package com.ghost.technic.screen;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.ghost.technic.BattlefieldView;

public class BattlefieldScreen implements Screen {

    private final Stage stage;
    private final Skin skin;

    public BattlefieldScreen(Skin skin) {
        this.stage = new Stage(new FitViewport(1280, 720));
        this.skin = skin;

        // Add the battlefield view
        BattlefieldView battlefieldView = new BattlefieldView(skin);
        stage.addActor(battlefieldView);

        Gdx.input.setInputProcessor(stage);

        stage.setDebugAll(true);
    }

    @Override
    public void render(float delta) {
        ScreenUtils.clear(0f, 0f, 0f, 1f);
        stage.act(delta);
        stage.draw();
    }

    @Override public void resize(int width, int height) { stage.getViewport().update(width, height, true); }
    @Override public void show() {}
    @Override public void hide() {}
    @Override public void pause() {}
    @Override public void resume() {}
    @Override public void dispose() { stage.dispose(); }
}
