From 0afa327fdaebc0edb58b054b6f7d6b77cdcb5f3a Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Fri, 28 Nov 2014 19:12:55 +0100 Subject: [PATCH] Create package brain, move everything there that memorizes data. --- src/de/teamteamteam/spacescooter/GameFrame.java | 2 +- src/de/teamteamteam/spacescooter/Main.java | 2 +- .../spacescooter/background/ScrollingBackground.java | 2 +- .../teamteamteam/spacescooter/{gui => brain}/Credits.java | 2 +- .../spacescooter/{utility => brain}/GameConfig.java | 2 +- .../spacescooter/{datastructure => brain}/Score.java | 2 +- .../spacescooter/{entity => brain}/StaticValue.java | 2 +- src/de/teamteamteam/spacescooter/entity/Entity.java | 2 +- src/de/teamteamteam/spacescooter/entity/LivingEntity.java | 7 +++---- src/de/teamteamteam/spacescooter/entity/Player.java | 3 ++- .../teamteamteam/spacescooter/entity/enemy/EnemyBoss.java | 2 +- .../teamteamteam/spacescooter/entity/enemy/EnemyThree.java | 2 +- .../teamteamteam/spacescooter/entity/enemy/EnemyTwo.java | 2 +- .../teamteamteam/spacescooter/entity/item/ItemCredit.java | 2 +- src/de/teamteamteam/spacescooter/entity/shot/Shot.java | 2 +- src/de/teamteamteam/spacescooter/gui/ScoreBar.java | 2 +- src/de/teamteamteam/spacescooter/level/Level.java | 2 +- .../teamteamteam/spacescooter/screen/GameOverScreen.java | 2 +- .../teamteamteam/spacescooter/screen/GamePausedScreen.java | 2 +- src/de/teamteamteam/spacescooter/screen/LoadingScreen.java | 3 ++- .../teamteamteam/spacescooter/screen/MainMenuScreen.java | 2 +- src/de/teamteamteam/spacescooter/screen/ShopScreen.java | 6 +++--- .../spacescooter/utility/GraphicsSettings.java | 2 ++ src/de/teamteamteam/spacescooter/utility/Loader.java | 1 + 24 files changed, 31 insertions(+), 27 deletions(-) rename src/de/teamteamteam/spacescooter/{gui => brain}/Credits.java (94%) rename src/de/teamteamteam/spacescooter/{utility => brain}/GameConfig.java (92%) rename src/de/teamteamteam/spacescooter/{datastructure => brain}/Score.java (94%) rename src/de/teamteamteam/spacescooter/{entity => brain}/StaticValue.java (93%) diff --git a/src/de/teamteamteam/spacescooter/GameFrame.java b/src/de/teamteamteam/spacescooter/GameFrame.java index 55a3d49..d9b752d 100644 --- a/src/de/teamteamteam/spacescooter/GameFrame.java +++ b/src/de/teamteamteam/spacescooter/GameFrame.java @@ -9,9 +9,9 @@ import java.awt.image.BufferStrategy; import javax.swing.JFrame; +import de.teamteamteam.spacescooter.brain.GameConfig; import de.teamteamteam.spacescooter.control.Keyboard; import de.teamteamteam.spacescooter.screen.Screen; -import de.teamteamteam.spacescooter.utility.GameConfig; /** * The game will take place in this beautiful window. diff --git a/src/de/teamteamteam/spacescooter/Main.java b/src/de/teamteamteam/spacescooter/Main.java index fab4942..94116eb 100644 --- a/src/de/teamteamteam/spacescooter/Main.java +++ b/src/de/teamteamteam/spacescooter/Main.java @@ -3,12 +3,12 @@ package de.teamteamteam.spacescooter; import java.awt.EventQueue; import java.lang.reflect.InvocationTargetException; +import de.teamteamteam.spacescooter.brain.GameConfig; import de.teamteamteam.spacescooter.screen.LoadingScreen; import de.teamteamteam.spacescooter.screen.Screen; import de.teamteamteam.spacescooter.screen.SuperScreen; import de.teamteamteam.spacescooter.thread.PaintThread; import de.teamteamteam.spacescooter.thread.UpdateThread; -import de.teamteamteam.spacescooter.utility.GameConfig; import de.teamteamteam.spacescooter.utility.GraphicsSettings; import de.teamteamteam.spacescooter.utility.Loader; diff --git a/src/de/teamteamteam/spacescooter/background/ScrollingBackground.java b/src/de/teamteamteam/spacescooter/background/ScrollingBackground.java index fa0b939..697fd80 100644 --- a/src/de/teamteamteam/spacescooter/background/ScrollingBackground.java +++ b/src/de/teamteamteam/spacescooter/background/ScrollingBackground.java @@ -2,7 +2,7 @@ package de.teamteamteam.spacescooter.background; import java.awt.Graphics2D; -import de.teamteamteam.spacescooter.utility.GameConfig; +import de.teamteamteam.spacescooter.brain.GameConfig; public class ScrollingBackground extends Background { diff --git a/src/de/teamteamteam/spacescooter/gui/Credits.java b/src/de/teamteamteam/spacescooter/brain/Credits.java similarity index 94% rename from src/de/teamteamteam/spacescooter/gui/Credits.java rename to src/de/teamteamteam/spacescooter/brain/Credits.java index 84720b8..552b076 100644 --- a/src/de/teamteamteam/spacescooter/gui/Credits.java +++ b/src/de/teamteamteam/spacescooter/brain/Credits.java @@ -1,4 +1,4 @@ -package de.teamteamteam.spacescooter.gui; +package de.teamteamteam.spacescooter.brain; /** * TODO: Intelligently merge this with Score class. diff --git a/src/de/teamteamteam/spacescooter/utility/GameConfig.java b/src/de/teamteamteam/spacescooter/brain/GameConfig.java similarity index 92% rename from src/de/teamteamteam/spacescooter/utility/GameConfig.java rename to src/de/teamteamteam/spacescooter/brain/GameConfig.java index 23ab204..702a848 100644 --- a/src/de/teamteamteam/spacescooter/utility/GameConfig.java +++ b/src/de/teamteamteam/spacescooter/brain/GameConfig.java @@ -1,4 +1,4 @@ -package de.teamteamteam.spacescooter.utility; +package de.teamteamteam.spacescooter.brain; /** * This static class contains important game configuration. diff --git a/src/de/teamteamteam/spacescooter/datastructure/Score.java b/src/de/teamteamteam/spacescooter/brain/Score.java similarity index 94% rename from src/de/teamteamteam/spacescooter/datastructure/Score.java rename to src/de/teamteamteam/spacescooter/brain/Score.java index d9f633a..31138df 100644 --- a/src/de/teamteamteam/spacescooter/datastructure/Score.java +++ b/src/de/teamteamteam/spacescooter/brain/Score.java @@ -1,4 +1,4 @@ -package de.teamteamteam.spacescooter.datastructure; +package de.teamteamteam.spacescooter.brain; /** * Score Class to represent the Player's Score diff --git a/src/de/teamteamteam/spacescooter/entity/StaticValue.java b/src/de/teamteamteam/spacescooter/brain/StaticValue.java similarity index 93% rename from src/de/teamteamteam/spacescooter/entity/StaticValue.java rename to src/de/teamteamteam/spacescooter/brain/StaticValue.java index 5c51c7f..e79feb7 100644 --- a/src/de/teamteamteam/spacescooter/entity/StaticValue.java +++ b/src/de/teamteamteam/spacescooter/brain/StaticValue.java @@ -1,4 +1,4 @@ -package de.teamteamteam.spacescooter.entity; +package de.teamteamteam.spacescooter.brain; /** * TODO: Rename and merge with other classes containing single static information. diff --git a/src/de/teamteamteam/spacescooter/entity/Entity.java b/src/de/teamteamteam/spacescooter/entity/Entity.java index d2ac507..22e3e3c 100644 --- a/src/de/teamteamteam/spacescooter/entity/Entity.java +++ b/src/de/teamteamteam/spacescooter/entity/Entity.java @@ -4,10 +4,10 @@ import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; +import de.teamteamteam.spacescooter.brain.GameConfig; import de.teamteamteam.spacescooter.entity.spi.Paintable; import de.teamteamteam.spacescooter.entity.spi.Updateable; import de.teamteamteam.spacescooter.screen.Screen; -import de.teamteamteam.spacescooter.utility.GameConfig; import de.teamteamteam.spacescooter.utility.Loader; /** diff --git a/src/de/teamteamteam/spacescooter/entity/LivingEntity.java b/src/de/teamteamteam/spacescooter/entity/LivingEntity.java index 41a6705..301f69c 100644 --- a/src/de/teamteamteam/spacescooter/entity/LivingEntity.java +++ b/src/de/teamteamteam/spacescooter/entity/LivingEntity.java @@ -1,13 +1,12 @@ package de.teamteamteam.spacescooter.entity; -import de.teamteamteam.spacescooter.datastructure.Score; - +import de.teamteamteam.spacescooter.brain.Credits; +import de.teamteamteam.spacescooter.brain.GameConfig; +import de.teamteamteam.spacescooter.brain.Score; import de.teamteamteam.spacescooter.entity.enemy.Enemy; import de.teamteamteam.spacescooter.entity.shot.Shot; import de.teamteamteam.spacescooter.entity.spi.Collidable; import de.teamteamteam.spacescooter.entity.spi.Hittable; -import de.teamteamteam.spacescooter.gui.Credits; -import de.teamteamteam.spacescooter.utility.GameConfig; /** * A LivingEntity is an Entity that is able to take damage and to collide with diff --git a/src/de/teamteamteam/spacescooter/entity/Player.java b/src/de/teamteamteam/spacescooter/entity/Player.java index 8cc7649..e3988c6 100644 --- a/src/de/teamteamteam/spacescooter/entity/Player.java +++ b/src/de/teamteamteam/spacescooter/entity/Player.java @@ -2,13 +2,14 @@ package de.teamteamteam.spacescooter.entity; import java.awt.event.KeyEvent; +import de.teamteamteam.spacescooter.brain.GameConfig; +import de.teamteamteam.spacescooter.brain.StaticValue; import de.teamteamteam.spacescooter.control.Keyboard; import de.teamteamteam.spacescooter.control.KeyboardListener; import de.teamteamteam.spacescooter.entity.item.Item; import de.teamteamteam.spacescooter.entity.shot.Shot; import de.teamteamteam.spacescooter.entity.spi.Collidable; import de.teamteamteam.spacescooter.sound.SoundSystem; -import de.teamteamteam.spacescooter.utility.GameConfig; /** * Class that represents the Player, and handle all the KeyboardActions diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java index 3912984..e84ad88 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java @@ -1,8 +1,8 @@ package de.teamteamteam.spacescooter.entity.enemy; +import de.teamteamteam.spacescooter.brain.GameConfig; import de.teamteamteam.spacescooter.entity.explosion.MultiExplosion; import de.teamteamteam.spacescooter.gui.BossBar; -import de.teamteamteam.spacescooter.utility.GameConfig; import de.teamteamteam.spacescooter.utility.Random; public class EnemyBoss extends Enemy{ diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java index 89a9547..f234f4d 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java @@ -1,10 +1,10 @@ package de.teamteamteam.spacescooter.entity.enemy; +import de.teamteamteam.spacescooter.brain.GameConfig; import de.teamteamteam.spacescooter.entity.Player; import de.teamteamteam.spacescooter.entity.explosion.MultiExplosion; import de.teamteamteam.spacescooter.entity.item.Item; import de.teamteamteam.spacescooter.screen.GameScreen; -import de.teamteamteam.spacescooter.utility.GameConfig; import de.teamteamteam.spacescooter.utility.Random; public class EnemyThree extends Enemy{ diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java index cd170a4..9e0a9c6 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java @@ -1,7 +1,7 @@ package de.teamteamteam.spacescooter.entity.enemy; +import de.teamteamteam.spacescooter.brain.GameConfig; import de.teamteamteam.spacescooter.entity.explosion.ExplosionTwo; -import de.teamteamteam.spacescooter.utility.GameConfig; import de.teamteamteam.spacescooter.utility.Random; public class EnemyTwo extends Enemy{ diff --git a/src/de/teamteamteam/spacescooter/entity/item/ItemCredit.java b/src/de/teamteamteam/spacescooter/entity/item/ItemCredit.java index a6286cf..08848a5 100644 --- a/src/de/teamteamteam/spacescooter/entity/item/ItemCredit.java +++ b/src/de/teamteamteam/spacescooter/entity/item/ItemCredit.java @@ -1,7 +1,7 @@ package de.teamteamteam.spacescooter.entity.item; +import de.teamteamteam.spacescooter.brain.Credits; import de.teamteamteam.spacescooter.entity.Player; -import de.teamteamteam.spacescooter.gui.Credits; public class ItemCredit extends Item { diff --git a/src/de/teamteamteam/spacescooter/entity/shot/Shot.java b/src/de/teamteamteam/spacescooter/entity/shot/Shot.java index 92170b4..1085e76 100644 --- a/src/de/teamteamteam/spacescooter/entity/shot/Shot.java +++ b/src/de/teamteamteam/spacescooter/entity/shot/Shot.java @@ -1,11 +1,11 @@ package de.teamteamteam.spacescooter.entity.shot; +import de.teamteamteam.spacescooter.brain.GameConfig; import de.teamteamteam.spacescooter.entity.CollidableEntity; import de.teamteamteam.spacescooter.entity.Player; import de.teamteamteam.spacescooter.entity.enemy.Enemy; import de.teamteamteam.spacescooter.entity.spi.Collidable; import de.teamteamteam.spacescooter.sound.SoundSystem; -import de.teamteamteam.spacescooter.utility.GameConfig; import de.teamteamteam.spacescooter.utility.Random; /** diff --git a/src/de/teamteamteam/spacescooter/gui/ScoreBar.java b/src/de/teamteamteam/spacescooter/gui/ScoreBar.java index 0e01908..463a8d5 100644 --- a/src/de/teamteamteam/spacescooter/gui/ScoreBar.java +++ b/src/de/teamteamteam/spacescooter/gui/ScoreBar.java @@ -5,7 +5,7 @@ import java.awt.Font; import java.awt.Graphics2D; import de.teamteamteam.spacescooter.entity.Entity; -import de.teamteamteam.spacescooter.datastructure.Score; +import de.teamteamteam.spacescooter.brain.Score; public class ScoreBar extends Entity { diff --git a/src/de/teamteamteam/spacescooter/level/Level.java b/src/de/teamteamteam/spacescooter/level/Level.java index 966afce..bf00cb4 100644 --- a/src/de/teamteamteam/spacescooter/level/Level.java +++ b/src/de/teamteamteam/spacescooter/level/Level.java @@ -1,6 +1,7 @@ package de.teamteamteam.spacescooter.level; import de.teamteamteam.spacescooter.background.StarBackground; +import de.teamteamteam.spacescooter.brain.GameConfig; import de.teamteamteam.spacescooter.entity.Entity; import de.teamteamteam.spacescooter.entity.Player; import de.teamteamteam.spacescooter.entity.enemy.EnemyBoss; @@ -8,7 +9,6 @@ import de.teamteamteam.spacescooter.entity.enemy.EnemyOne; import de.teamteamteam.spacescooter.entity.enemy.EnemyThree; import de.teamteamteam.spacescooter.entity.enemy.EnemyTwo; import de.teamteamteam.spacescooter.screen.GameScreen; -import de.teamteamteam.spacescooter.utility.GameConfig; import de.teamteamteam.spacescooter.utility.Loader; import de.teamteamteam.spacescooter.utility.Random; diff --git a/src/de/teamteamteam/spacescooter/screen/GameOverScreen.java b/src/de/teamteamteam/spacescooter/screen/GameOverScreen.java index b7334d8..760a7a2 100644 --- a/src/de/teamteamteam/spacescooter/screen/GameOverScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/GameOverScreen.java @@ -6,10 +6,10 @@ import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; +import de.teamteamteam.spacescooter.brain.GameConfig; import de.teamteamteam.spacescooter.control.Keyboard; import de.teamteamteam.spacescooter.entity.Player; import de.teamteamteam.spacescooter.gui.Button; -import de.teamteamteam.spacescooter.utility.GameConfig; import de.teamteamteam.spacescooter.utility.Loader; /** diff --git a/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java b/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java index da0abca..84dc43b 100644 --- a/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java @@ -6,10 +6,10 @@ import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; +import de.teamteamteam.spacescooter.brain.GameConfig; import de.teamteamteam.spacescooter.control.Keyboard; import de.teamteamteam.spacescooter.entity.Player; import de.teamteamteam.spacescooter.gui.Button; -import de.teamteamteam.spacescooter.utility.GameConfig; import de.teamteamteam.spacescooter.utility.Loader; /** diff --git a/src/de/teamteamteam/spacescooter/screen/LoadingScreen.java b/src/de/teamteamteam/spacescooter/screen/LoadingScreen.java index 71143b2..4c97f78 100644 --- a/src/de/teamteamteam/spacescooter/screen/LoadingScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/LoadingScreen.java @@ -3,7 +3,8 @@ package de.teamteamteam.spacescooter.screen; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; -import de.teamteamteam.spacescooter.utility.GameConfig; + +import de.teamteamteam.spacescooter.brain.GameConfig; /** * This is the LoadingScreen, which is displayed when the game is started. diff --git a/src/de/teamteamteam/spacescooter/screen/MainMenuScreen.java b/src/de/teamteamteam/spacescooter/screen/MainMenuScreen.java index 934075c..72a5b00 100644 --- a/src/de/teamteamteam/spacescooter/screen/MainMenuScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/MainMenuScreen.java @@ -6,11 +6,11 @@ import java.awt.Graphics2D; import java.awt.event.KeyEvent; import de.teamteamteam.spacescooter.background.StarBackground; +import de.teamteamteam.spacescooter.brain.GameConfig; import de.teamteamteam.spacescooter.control.Keyboard; import de.teamteamteam.spacescooter.entity.Player; import de.teamteamteam.spacescooter.gui.Button; import de.teamteamteam.spacescooter.sound.SoundSystem; -import de.teamteamteam.spacescooter.utility.GameConfig; /** * This Screen show the games main menu. diff --git a/src/de/teamteamteam/spacescooter/screen/ShopScreen.java b/src/de/teamteamteam/spacescooter/screen/ShopScreen.java index 5bb6692..575b423 100644 --- a/src/de/teamteamteam/spacescooter/screen/ShopScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/ShopScreen.java @@ -6,13 +6,13 @@ import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; +import de.teamteamteam.spacescooter.brain.Credits; +import de.teamteamteam.spacescooter.brain.GameConfig; +import de.teamteamteam.spacescooter.brain.StaticValue; import de.teamteamteam.spacescooter.control.Keyboard; import de.teamteamteam.spacescooter.entity.Player; -import de.teamteamteam.spacescooter.entity.StaticValue; import de.teamteamteam.spacescooter.gui.Button; -import de.teamteamteam.spacescooter.gui.Credits; import de.teamteamteam.spacescooter.gui.ShopOffer; -import de.teamteamteam.spacescooter.utility.GameConfig; import de.teamteamteam.spacescooter.utility.Loader; public class ShopScreen extends Screen { diff --git a/src/de/teamteamteam/spacescooter/utility/GraphicsSettings.java b/src/de/teamteamteam/spacescooter/utility/GraphicsSettings.java index 9c9f1a1..e604843 100644 --- a/src/de/teamteamteam/spacescooter/utility/GraphicsSettings.java +++ b/src/de/teamteamteam/spacescooter/utility/GraphicsSettings.java @@ -4,6 +4,8 @@ import java.awt.DisplayMode; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; +import de.teamteamteam.spacescooter.brain.GameConfig; + /** * GraphicsSettings allows to fetch the current graphical settings in order * to determine a sane refresh rate and the current screen resolution. diff --git a/src/de/teamteamteam/spacescooter/utility/Loader.java b/src/de/teamteamteam/spacescooter/utility/Loader.java index 891ddb4..7c07651 100644 --- a/src/de/teamteamteam/spacescooter/utility/Loader.java +++ b/src/de/teamteamteam/spacescooter/utility/Loader.java @@ -11,6 +11,7 @@ import javax.imageio.ImageIO; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.UnsupportedAudioFileException; +import de.teamteamteam.spacescooter.brain.GameConfig; import de.teamteamteam.spacescooter.level.LevelConfig; import de.teamteamteam.spacescooter.level.LevelConfigParser; import de.teamteamteam.spacescooter.screen.LoadingScreen;