Add CreditsScreen Template.

This commit is contained in:
Jan Philipp Timme 2014-12-09 16:07:59 +01:00
parent f08d5ef6f5
commit 52152eccc1
4 changed files with 51 additions and 1 deletions

View File

@ -47,7 +47,7 @@ public class ConcurrentLinkedList<T> {
while(element.equals(currentNode.getValue()) == false && currentNode.hasNext()) {
currentNode = currentNode.next();
}
if(currentNode.getValue().equals(element)) {
if(currentNode.getValue() != null && currentNode.getValue().equals(element)) {
currentNode.setValue(null);
return;
}

View File

@ -0,0 +1,47 @@
package de.teamteamteam.spacescooter.screen;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import de.teamteamteam.spacescooter.brain.GameConfig;
import de.teamteamteam.spacescooter.control.Keyboard;
import de.teamteamteam.spacescooter.entity.enemy.EnemyOne;
/**
* This is the Screen where you can look at all those awesome guys who created this game. :D
*/
public class CreditsScreen extends Screen {
/**
* Default Constructor
*/
public CreditsScreen(Screen parent) {
super(parent);
}
/**
* Draw the Credits :)
*/
@Override
protected void paint(Graphics2D g) {
g.setColor(new Color(0,0,120));
g.fillRect(0, 0, GameConfig.windowWidth, GameConfig.windowHeight);
g.setColor(Color.WHITE);
g.setFont(new Font("Monospace", 0, 50));
String text = "#yolo";
g.drawString(text, (GameConfig.windowWidth - g.getFontMetrics().stringWidth(text))/2, 150);
}
/**
* In case the Loader is done, immediately fire up the MainMenuScreen.
*/
@Override
protected void update() {
if(Keyboard.isKeyDown(KeyEvent.VK_ENTER) || Keyboard.isKeyDown(KeyEvent.VK_SPACE)) {
this.parent.setOverlay(new MainMenuScreen(this.parent));
}
}
}

View File

@ -108,6 +108,7 @@ public class MainMenuScreen extends Screen {
this.parent.setOverlay(new HighscoreScreen(this.parent));
break;
case 3:
this.parent.setOverlay(new CreditsScreen(this.parent));
break;
case 4:
System.exit(0);

View File

@ -241,6 +241,8 @@ public abstract class Screen {
if(this.processSetOverlayCall) {
if(this.overlay != null) {
this.overlay.cleanup();
} else {
this.cleanup();
}
if(this.newOverlay == null) {
Screen.currentScreen = this;