|
@ -1,11 +1,12 @@ |
|
|
import PingPong.GamePanel; |
|
|
|
|
|
|
|
|
import BattleShip.BShip; |
|
|
|
|
|
import PingPong.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
import javax.swing.*; |
|
|
import java.awt.*; |
|
|
import java.awt.*; |
|
|
import java.awt.event.KeyAdapter; |
|
|
import java.awt.event.KeyAdapter; |
|
|
import java.awt.event.KeyEvent; |
|
|
import java.awt.event.KeyEvent; |
|
|
import java.awt.event.KeyListener; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class MenuPanel extends JPanel { |
|
|
public class MenuPanel extends JPanel { |
|
@ -21,28 +22,34 @@ public class MenuPanel extends JPanel { |
|
|
super.paintComponent(g); |
|
|
super.paintComponent(g); |
|
|
draw(g); |
|
|
draw(g); |
|
|
} |
|
|
} |
|
|
public void draw(Graphics g) { |
|
|
|
|
|
g.setColor(Color.WHITE); |
|
|
|
|
|
g.setFont(new Font("Consolas", Font.BOLD, 70)); |
|
|
|
|
|
g.drawString("GAME MENU", 330, 100); |
|
|
|
|
|
g.setFont(new Font("Consolas", Font.BOLD, 30)); |
|
|
|
|
|
g.drawString("Press 'ENTER' to start the game", 265, 200); |
|
|
|
|
|
g.setFont(new Font("Consolas", Font.PLAIN, 10)); |
|
|
|
|
|
g.drawString("Created by Hells Gamers", 450, 450); |
|
|
|
|
|
|
|
|
public void draw(Graphics g) { |
|
|
|
|
|
g.setColor(Color.WHITE); |
|
|
|
|
|
g.setFont(new Font("Consolas", Font.BOLD, 70)); |
|
|
|
|
|
g.drawString("GAME MENU", 330, 100); |
|
|
|
|
|
g.setFont(new Font("Consolas", Font.BOLD, 30)); |
|
|
|
|
|
g.drawString("Press 1 to start Pong Game", 265, 200); |
|
|
|
|
|
g.drawString("Press 2 to start BattleShip", 265, 250); |
|
|
|
|
|
g.drawString("Press 3 to start Snake Game", 265, 300); |
|
|
|
|
|
|
|
|
|
|
|
g.setFont(new Font("Consolas", Font.PLAIN, 10)); |
|
|
|
|
|
g.drawString("Created by HellsGamers", 450, 450); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public class AL extends KeyAdapter { |
|
|
public class AL extends KeyAdapter { |
|
|
|
|
|
|
|
|
public void keyPressed(KeyEvent e) { |
|
|
public void keyPressed(KeyEvent e) { |
|
|
if (e.getKeyCode() == KeyEvent.VK_1) { |
|
|
if (e.getKeyCode() == KeyEvent.VK_1) { |
|
|
new GameFrame(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new PingPong.GameFrame(); |
|
|
} |
|
|
} |
|
|
|
|
|
if (e.getKeyCode() == KeyEvent.VK_2) { |
|
|
|
|
|
BShip game = new BShip(); |
|
|
|
|
|
game.startGame(); |
|
|
|
|
|
} |
|
|
|
|
|
if (e.getKeyCode() == KeyEvent.VK_3) { |
|
|
|
|
|
new Snake.Game(); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private class GameFrame { |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |