libGDX does not change the screen color or draw actors from a Screen class

0

You see, I'm creating a scenario with liBGDX , following a tutorial, in which I want to change the screen color and draw actors, however I can not do any of the 2 things, I can only clean the screen from the method renderde MainGame but not the class on the screen, I have exactly the same code as the one in the tutorial but when compiling it looks black when it should look light blue:

Maingame:

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class Maingame extends Game {
    @Override
    public void create () {
        setScreen(new MaingameScreen(this));

    }

    @Override
    public void render () {

    }


    @Override
    public void dispose () {

    }
}

MaingameScreen:

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.scenes.scene2d.Stage;

public class MaingameScreen extends BaseScreen {

    public MaingameScreen(Maingame game){
        super(game);
    }
    private Stage stage;

    public void show() {
        stage = new Stage();

    }


    public void render(float delta) {
        Gdx.gl.glClearColor(0.4f, 0.5f, 0.8f, 1f);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    stage.draw();
    stage.act();

    }

    public void hide() {
        stage.dispose();

    }


    public void dispose() {
        // TODO Auto-generated method stub

    }


}

BAseScreen:

import com.badlogic.gdx.Screen;

public class BaseScreen implements Screen {
    protected Maingame game;




public BaseScreen(Maingame game){
    this.game = game;
}
    @Override
    public void show() {
        // TODO Auto-generated method stub

    }

    @Override
    public void render(float delta) {
        // TODO Auto-generated method stub

    }

    @Override
    public void resize(int width, int height) {
        // 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 hide() {
        // TODO Auto-generated method stub

    }

    @Override
    public void dispose() {
        // TODO Auto-generated method stub

    }

}

The tutorial I'm looking at is this

  

Why does not it work for me?

    
asked by BitShifter 26.01.2018 в 22:06
source

0 answers