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 w w . ja v a 2s . com 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.Stage; import com.badlogic.gdx.utils.viewport.ScalingViewport; public class GScreen implements Screen { Stage stage; Assets assets; FontWriter fl1; FontWriter fl2; private FontWriter fControl; private FontWriter fCtrNames; private FontWriter fCenter1; private FontWriter fCenter2; private int scrHeight; public GScreen(OrthographicCamera camera, int width, int height, Assets assets, ScalingViewport view){ stage = new Stage(view); this.assets = assets; assets.addStage(stage); assets.createGameScreen(); fl1 = new FontWriter(40); fl2 = new FontWriter(40); fControl = new FontWriter(120); fCtrNames = new FontWriter(30); fCenter1 = new FontWriter(30); fCenter2 = new FontWriter(30); scrHeight = height; } @Override public void render(float delta) { // TODO Auto-generated method stub Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(delta); stage.draw(); fl1.printLeft("Score: " + assets.spaceShip.score, Color.GREEN, 10, 20, stage); fl2.printRight(assets.spaceShip.lives + " :lives", Color.RED, 10, 20, stage); if(!assets.started) { Gdx.gl.glClearColor(0.1f, 0.1f, 0, 0.1f); fCenter1.printCenter("Tap on screen to start", Color.ORANGE, 200, assets.s); fCenter2.printCenter("To move the SpaceShip", Color.valueOf("37CFD6"), scrHeight - 120 - 100, assets.s); fCenter2.printCenter("tap on sides", Color.valueOf("37CFD6"), scrHeight - 87 - 100, assets.s); fCenter2.printCenter("of your phone screen", Color.valueOf("37CFD6"), scrHeight - 55 - 100, assets.s); fControl.printLeft("<", Color.WHITE, 0, scrHeight - 100, assets.s); fControl.printRight(">", Color.WHITE, 0, scrHeight - 100, assets.s); fCtrNames.printLeft("Move left", Color.OLIVE, 10, scrHeight - 100 - 30 - 5, assets.s); fCtrNames.printRight("Move right", Color.OLIVE, 10, scrHeight - 100 - 30 - 5, assets.s); } } @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); assets.showGameScreen(); } @Override public void hide() { // TODO Auto-generated method stub } @Override public void pause() { } @Override public void resume() { } @Override public void dispose() { // TODO Auto-generated method stub stage.dispose(); } }