Skip to content
Snippets Groups Projects
Commit 5afd9936 authored by ALGLAVE Ivan's avatar ALGLAVE Ivan
Browse files

After 2 seconds, switch the screen to the MenuScreen

parent c945151b
No related branches found
No related tags found
No related merge requests found
...@@ -4,17 +4,22 @@ import com.badlogic.gdx.graphics.Color; ...@@ -4,17 +4,22 @@ import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.mygdx.game.singletons.FontManager; import com.mygdx.game.singletons.FontManager;
import java.util.Date;
/** /**
* Intro screen showing a preview of the game for a few seconds * Intro screen showing a preview of the game for a few seconds
*/ */
public class GameIntro extends GameScreen public class GameIntro extends GameScreen
{ {
long creationDate;
@Override @Override
public void buildStage() { public void buildStage() {
/*Label l = new Label("Intro screen", FontManager.getInstance().getLabelStyle(Color.BLACK)); /*Label l = new Label("Intro screen", FontManager.getInstance().getLabelStyle(Color.BLACK));
l.setPosition(50, 50); l.setPosition(50, 50);
addActor(l);*/ addActor(l);*/
creationDate = System.currentTimeMillis();
} }
@Override @Override
...@@ -22,6 +27,12 @@ public class GameIntro extends GameScreen ...@@ -22,6 +27,12 @@ public class GameIntro extends GameScreen
// Add logic // Add logic
if(System.currentTimeMillis() - creationDate > 2000)
{
// Intro screen is over
GameScreenManager.getInstance().showGameScreen(GameScreenEnum.GAME_MENU);
}
// Call the drawing methods of the parent to render the screen // Call the drawing methods of the parent to render the screen
super.render(delta); super.render(delta);
} }
......
...@@ -9,4 +9,9 @@ public class GameMenu extends GameScreen { ...@@ -9,4 +9,9 @@ public class GameMenu extends GameScreen {
public void buildStage() { public void buildStage() {
} }
@Override
public void render(float delta) {
super.render(delta);
}
} }
...@@ -25,7 +25,7 @@ public abstract class GameScreen extends Stage implements Screen { ...@@ -25,7 +25,7 @@ public abstract class GameScreen extends Stage implements Screen {
public void render(float delta) public void render(float delta)
{ {
// Clear screen // Clear screen
Gdx.gl.glClearColor(255, 0, 0, 1); Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
// Calling to Stage methods // Calling to Stage methods
super.act(delta); super.act(delta);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment