diff --git a/core/highscoreManager.java b/core/highscoreManager.java index a6e97d9..054c9b5 100644 --- a/core/highscoreManager.java +++ b/core/highscoreManager.java @@ -4,13 +4,21 @@ import java.sql.*; public class highscoreManager implements Runnable{ public Connection connect; - public int status; public int counter; + + public int status; public static final int idle = 0; public static final int processing = 1; public static final int error = 2; - + public int task; + public static final int none = 0; + public static final int loadHighscores = 1; + + public boolean isSleeping; + + public String[] result; + public highscoreManager(){ status = processing; } @@ -36,14 +44,25 @@ public class highscoreManager implements Runnable{ if(status == idle) { + if(task != none) { + status = processing; + + //get high scroes from remote database + result = new String[] {}; + + status = idle; + task = none; + } } + try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } + counter++; } diff --git a/core/mainThread.java b/core/mainThread.java index 55cef86..1df08ed 100644 --- a/core/mainThread.java +++ b/core/mainThread.java @@ -13,7 +13,6 @@ import javax.swing.JPanel; import enemyAI.*; import gui.*; - public class mainThread extends JFrame implements KeyListener, ActionListener, MouseMotionListener, MouseListener, FocusListener{ public static int[] screen, bufferScreen; @@ -69,7 +68,6 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M public static int mouseX, mouseY, centerScreenX, centerScreenY, currentMouseX, currentMouseY; public mainThread(){ - setTitle("Battle Tank 3"); panel= (JPanel) this.getContentPane(); panel.setPreferredSize(new Dimension(768, 512)); @@ -228,9 +226,6 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M currentMouseX = MouseInfo.getPointerInfo().getLocation().x; currentMouseY = MouseInfo.getPointerInfo().getLocation().y; - centerScreenX = getLocationOnScreen().x + 384; - centerScreenY = getLocationOnScreen().y + 256; - int deltaX = currentMouseX - centerScreenX; int deltaY = currentMouseY - centerScreenY; diff --git a/gui/gameMenu.java b/gui/gameMenu.java index 9cea146..d787ea1 100644 --- a/gui/gameMenu.java +++ b/gui/gameMenu.java @@ -16,6 +16,7 @@ public class gameMenu { public static final int helpMenu = 2; public static final int endGameMenu = 3; public static final int optionMenu = 4; + public static final int highscoreMenu = 5; public int[] screen; public int[] screenBlurBuffer; @@ -29,6 +30,7 @@ public class gameMenu { public char[] easyDescription, normalDescription, hardDescription, helpPage1, helpPage2, helpPage3, helpPage4, mouseMode; public int currentHelpPage; + public int highscoreLevel; public ArrayList