Skip to content

Commit 6a758dc

Browse files
committed
Resolved issues with OpenJDK compatibility
OracleJDK no longer receiving updates, code compatible with OpenJDK8
1 parent 9158aee commit 6a758dc

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
JavaGame [![GitHub release](https://img.shields.io/github/release/redomar/JavaGame.svg?style=flat-square&label=Alpha)](https://github.com/redomar/JavaGame/releases/latest) [![Travis-CI Build Status](https://img.shields.io/travis/redomar/JavaGame.svg?style=flat-square)](https://travis-ci.org/redomar/JavaGame) [![GitHub license](https://img.shields.io/badge/license-AGPLv3-red.svg?style=flat-square)](https://raw.githubusercontent.com/Redomar/JavaGame/master/LICENSE)
1+
JavaGame [![GitHub release](https://img.shields.io/github/release/redomar/JavaGame.svg?style=flat-square&label=Alpha)](https://github.com/redomar/JavaGame/releases/latest) [![JDK version](https://img.shields.io/badge/JDK-OpenJDK%208-007396?style=flat-square&logo=Java)](https://openjdk.java.net/install/) [![Travis-CI Build Status](https://img.shields.io/travis/redomar/JavaGame.svg?style=flat-square)](https://travis-ci.org/redomar/JavaGame) [![GitHub license](https://img.shields.io/badge/license-AGPLv3-red.svg?style=flat-square)](https://raw.githubusercontent.com/Redomar/JavaGame/master/LICENSE):
22
==
33

44
#### What is JavaGame?

src/com/redomar/game/Game.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,11 @@ public void init() {
365365
input = new InputHandler(this); // Input begins to record key presses
366366
setMouse(new MouseHandler(this)); // Mouse tracking and clicking is now recorded
367367
setWindow(new WindowHandler(this));
368-
setMap("/levels/custom_level.png");
368+
try{
369+
setMap("/levels/custom_level.png");
370+
} catch (Exception e){
371+
System.err.println(e);
372+
}
369373
setMap(1); // 1 corresponds to custom_level
370374

371375
game.setVendor(new Vendor(level, "Vendor", 215, 215, 304, 543));

src/com/redomar/game/InputHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private void quitGame() {
147147
Game.getPlayer().getSanitisedUsername());
148148
Game.setRunning(false);
149149
Game.getFrame().dispose();
150-
System.exit(1);
150+
System.exit(0);
151151
}
152152

153153
public void untoggle(boolean toggle) {

src/com/redomar/game/menu/Menu.java

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class Menu implements Runnable {
2727
private static boolean gameOver = false;
2828

2929
private static DedicatedJFrame frame;// = new DedicatedJFrame(WIDTH, HEIGHT,
30+
private static final JDialog dialog = new JDialog();
3031
// SCALE, NAME);
3132
private Font font = new Font();
3233
private MouseListener Mouse = new Mouse();
@@ -55,26 +56,27 @@ public static void play() {
5556
Thread.sleep(125);
5657
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
5758
String multiMsg = "Sorry but multiplayer has been disabled on this version.\nIf you would like multiplayer checkout Alpha 1.6";
58-
JOptionPane.showMessageDialog(Game.getGame(), multiMsg,
59+
dialog.setAlwaysOnTop(true);
60+
JOptionPane.showMessageDialog(dialog, multiMsg,
5961
"Multiplayer Warning", JOptionPane.WARNING_MESSAGE);
6062
// Game.setJdata_Host(JOptionPane.showConfirmDialog(Game.getGame(),
6163
// "Do you want to be the HOST?"));
6264
Game.setJdata_Host(1);
6365
if (Game.getJdata_Host() != 1) { // Game.getJdata_Host() == 1
64-
Game.setJdata_IP(JOptionPane.showInputDialog(Game.getGame(),
66+
Game.setJdata_IP(JOptionPane.showInputDialog(dialog,
6567
"Enter the name \nleave blank for local"));
6668
}
6769
Thread.sleep(125);
6870
splash.setProgress(70, "Acquiring data: Username");
69-
String s = JOptionPane.showInputDialog(Game.getGame(),
71+
String s = JOptionPane.showInputDialog(dialog,
7072
"Enter a name");
7173
if (s != null) {
7274
Game.setJdata_UserName(s);
7375
}
7476
Thread.sleep(125);
7577
splash.setProgress(90, "Collecting Player Data");
7678
Object[] options = {"African", "Caucasian"};
77-
int n = JOptionPane.showOptionDialog(frame,
79+
int n = JOptionPane.showOptionDialog(dialog,
7880
"Choose a race for the character to be", "Choose a race",
7981
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
8082
null, options, options[0]);
@@ -85,7 +87,7 @@ public static void play() {
8587
}
8688
Thread.sleep(250);
8789
Object[] options1 = {"Orange", "Black"};
88-
int n1 = JOptionPane.showOptionDialog(frame,
90+
int n1 = JOptionPane.showOptionDialog(dialog,
8991
"Which Colour do you want the shirt to be?",
9092
"Choose a shirt Colour", JOptionPane.YES_NO_OPTION,
9193
JOptionPane.QUESTION_MESSAGE, null, options1, options1[0]);
@@ -245,33 +247,27 @@ private void paintButtons(boolean start, boolean exit, Graphics g) {
245247
g.setColor(new Color(0xFFBB4400));
246248
g.fillRect(35, 40, (frame.getWidth() - 67), 113);
247249
g.setColor(getDeSelected());
248-
g.fillRect(35, 40, (frame.getWidth() - 70), 110);
249-
g.setColor(Color.BLACK);
250-
g.drawString("Start", 220, 95);
251250
} else {
252251
g.setColor(new Color(0xFFDD6600));
253252
g.fillRect(35, 40, (frame.getWidth() - 67), 113);
254253
g.setColor(getSelected());
255-
g.fillRect(35, 40, (frame.getWidth() - 70), 110);
256-
g.setColor(Color.BLACK);
257-
g.drawString("Start", 220, 95);
258254
}
255+
g.fillRect(35, 40, (frame.getWidth() - 70), 110);
256+
g.setColor(Color.BLACK);
257+
g.drawString("Start", 220, 95);
259258
// EXIT
260259
if (!exit) {
261260
g.setColor(new Color(0xFFBB4400));
262261
g.fillRect(35, 170, (frame.getWidth() - 67), 113);
263262
g.setColor(getDeSelected());
264-
g.fillRect(35, 170, (frame.getWidth() - 70), 110);
265-
g.setColor(Color.BLACK);
266-
g.drawString("Exit", 220, 220);
267263
} else {
268264
g.setColor(new Color(0xFFDD6600));
269265
g.fillRect(35, 170, (frame.getWidth() - 67), 113);
270266
g.setColor(getSelected());
271-
g.fillRect(35, 170, (frame.getWidth() - 70), 110);
272-
g.setColor(Color.BLACK);
273-
g.drawString("Exit", 220, 220);
274267
}
268+
g.fillRect(35, 170, (frame.getWidth() - 70), 110);
269+
g.setColor(Color.BLACK);
270+
g.drawString("Exit", 220, 220);
275271
}
276272

277273
public Color getSelected() {

0 commit comments

Comments
 (0)