Android Open Source - AndriyVoronaSpaceAttack W Screen






From Project

Back to project page AndriyVoronaSpaceAttack.

License

The source code is released under:

GNU General Public License

If you think the Android project AndriyVoronaSpaceAttack listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.vorona.game;
// w w  w.  j av a2s. c o  m
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.utils.Timer;
import com.badlogic.gdx.utils.Timer.Task;
import com.badlogic.gdx.utils.viewport.ScalingViewport;

public class WScreen implements Screen {
  
  
  Timer t;
  
  Stage stage;
  
  Assets assets;

  private FontWriter fl1;

  private FontWriter fl2;

  private FontWriter fl3;
    
  public WScreen(final VoronaGame game, OrthographicCamera camera, int width, int height, Assets assets, ScalingViewport view){
    
    stage = new Stage(view);
    
    this.assets = assets;
    assets.addStage(stage);
    
    fl1 = new FontWriter(100);
    fl2 = new FontWriter(50);
    fl3 = new FontWriter(20);
    t = new Timer();
  }

  @Override
  public void render(float delta) {
    // TODO Auto-generated method stub
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    stage.act(delta);
    stage.draw();
    fl1.printLeft("WIN!!!", Color.GREEN, 50, 50, stage);
    fl2.printLeft("" + assets.spaceShip.score, Color.ORANGE, 100, 100 + 50 + 10, stage);
    fl3.printLeft("asteroids was hited", Color.ORANGE, 100, 100 + 50 + 10 + 50 + 10, stage);
    
  }

  @Override
  public void resize(int width, int height) {
    // TODO Auto-generated method stub

  }

  @Override
  public void show() {
    // TODO Auto-generated method stub
    Gdx.input.setInputProcessor(stage);
    assets.addStage(stage);
    t.scheduleTask(new Task() {
      float opas = 0.0f;
      @Override
      public void run() {
        // TODO Auto-generated method stub
        Gdx.gl.glClearColor(0.4f, 0, 0, opas+=0.01f);
      }
    }, 0, 0.01f, 100);
    
    t.scheduleTask(new Task() {
      
      @Override
      public void run() {
        // TODO Auto-generated method stub
        stage.addListener(new InputListener(){
          @Override
          public boolean touchDown(InputEvent event, float x, float y,
              int pointer, int button) {
            // TODO Auto-generated method stub
            assets.game.setMenuScreen();
            return true;
          }
        });
      }
    }, 3);
    
  }

  @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() {
    // TODO Auto-generated method stub
    stage.dispose();
  }

}




Java Source Code List

com.vorona.game.AScreen.java
com.vorona.game.Assets.java
com.vorona.game.DScreen.java
com.vorona.game.FontWriter.java
com.vorona.game.GScreen.java
com.vorona.game.LScreen.java
com.vorona.game.MScreen.java
com.vorona.game.VoronaGame.java
com.vorona.game.WScreen.java
com.vorona.game.WaitTimer.java
com.vorona.game.android.AndroidLauncher.java
com.vorona.game.desktop.DesktopLauncher.java