Back to project page AndriyVoronaSpaceAttack.
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.
package com.vorona.game; // w ww .j a v a 2s . 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 DScreen implements Screen { Stage stage; Assets assets; FontWriter fl1; FontWriter fl2; FontWriter fl3; Timer t; public DScreen(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(200); fl2 = new FontWriter(100); fl3 = new FontWriter(50); 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("DEAD.", Color.BLACK, 50, 50, stage); fl2.printLeft(("" + assets.spaceShip.score), Color.ORANGE, 100, 200 + 50 + 10, stage); fl3.printLeft("asteroids was hited", Color.ORANGE, 50, 200 + 100 + 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(); } }