diff --git a/build-project.sh b/build-project.sh index cc1f786..6dcd456 100644 --- a/build-project.sh +++ b/build-project.sh @@ -1 +1,4 @@ -#!/bin/bash \ No newline at end of file +cd hellsgamers +mvn clean install +read -p //enter to exit + diff --git a/src/main/java/Snake/Controller.java b/src/main/java/Snake/Controller.java new file mode 100644 index 0000000..43058fe --- /dev/null +++ b/src/main/java/Snake/Controller.java @@ -0,0 +1,6 @@ +package Snake; + +public class Controller { + + +} diff --git a/src/main/java/Snake/TextView.java b/src/main/java/Snake/TextView.java new file mode 100644 index 0000000..e68bacf --- /dev/null +++ b/src/main/java/Snake/TextView.java @@ -0,0 +1,64 @@ +package Snake; + +import java.awt.*; + +public class TextView implements Drawable +{ + public enum AnchorType { Left, Center, Right }; + + private String text; + + private Point position; + + private boolean visible; + + private AnchorType anchor; + + public TextView(String text, Point position) + { + this(text, position, true); + } + + public TextView(String text, Point position, boolean visible) + { + this.text = text; + this.position = position; + this.visible = visible; + this.anchor = AnchorType.Center; + } + + public void setText(String newText) + { + text = newText; + } + + public void setVisibility(boolean visibility) + { + visible = visibility; + } + + public void setAnchor(AnchorType newAnchor) + { + anchor = newAnchor; + } + + + @Override + public void draw(Graphics g) + { + if(visible) + { + FontMetrics fontMetrics = g.getFontMetrics(); + int x = position.x; + int y = position.y + fontMetrics.getHeight() / 2; + + if (anchor == AnchorType.Center) + x -= fontMetrics.stringWidth(text) / 2; + else if (anchor == AnchorType.Right) + x -= fontMetrics.stringWidth(text); + + g.setColor(Color.WHITE); + g.drawString(text, x, y); + } + } +} diff --git a/target/hellsgamers-1.0-SNAPSHOT.jar b/target/hellsgamers-1.0-SNAPSHOT.jar index 3ae873c..4d7fbd0 100644 Binary files a/target/hellsgamers-1.0-SNAPSHOT.jar and b/target/hellsgamers-1.0-SNAPSHOT.jar differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties index d4eaa29..4df9572 100644 --- a/target/maven-archiver/pom.properties +++ b/target/maven-archiver/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven -#Sun Jan 29 13:17:20 CET 2023 +#Mon Feb 06 20:43:15 CET 2023 groupId=Hellsgamers artifactId=hellsgamers version=1.0-SNAPSHOT diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index 44ba78e..cb38d8f 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1 +1,22 @@ +Snake\TextView.class +MenuPanel.class +PingPong\Score.class +PingPong\GamePanel.class +Snake\Window.class +Snake\Snake$1.class +MenuPanel$GameFrame.class +PingPong\Ball.class +Snake\TextView$AnchorType.class +MenuPanel$AL.class Main.class +PingPong\Paddle.class +Snake\Apple.class +Snake\Snake.class +PingPong\GameFrame.class +Snake\Controller.class +Snake\Drawable.class +MenuFrame.class +Snake\Snake$SnakeDirection.class +Snake\SnakeView.class +Snake\AppleView.class +Snake\GameView.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 66c2fd5..8dba2b3 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1 +1,17 @@ -C:\Users\Berkan\IdeaProjects\hellsgamers\src\main\java\Main.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\MenuPanel.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\PingPong\Paddle.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\PingPong\Ball.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\AppleView.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\Controller.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\PingPong\GamePanel.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\Snake.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\MenuFrame.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\Apple.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\Window.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Main.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\SnakeView.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\TextView.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\PingPong\Score.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\GameView.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\PingPong\GameFrame.java +C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\Drawable.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst deleted file mode 100644 index e69de29..0000000