h
This commit is contained in:
parent
958e6c720b
commit
3bdf85da14
@ -4,13 +4,21 @@ import java.sql.*;
|
|||||||
|
|
||||||
public class highscoreManager implements Runnable{
|
public class highscoreManager implements Runnable{
|
||||||
public Connection connect;
|
public Connection connect;
|
||||||
public int status;
|
|
||||||
public int counter;
|
public int counter;
|
||||||
|
|
||||||
|
public int status;
|
||||||
public static final int idle = 0;
|
public static final int idle = 0;
|
||||||
public static final int processing = 1;
|
public static final int processing = 1;
|
||||||
public static final int error = 2;
|
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(){
|
public highscoreManager(){
|
||||||
status = processing;
|
status = processing;
|
||||||
}
|
}
|
||||||
@ -36,14 +44,25 @@ public class highscoreManager implements Runnable{
|
|||||||
|
|
||||||
if(status == idle) {
|
if(status == idle) {
|
||||||
|
|
||||||
|
if(task != none) {
|
||||||
|
status = processing;
|
||||||
|
|
||||||
|
//get high scroes from remote database
|
||||||
|
result = new String[] {};
|
||||||
|
|
||||||
|
status = idle;
|
||||||
|
task = none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ import javax.swing.JPanel;
|
|||||||
import enemyAI.*;
|
import enemyAI.*;
|
||||||
import gui.*;
|
import gui.*;
|
||||||
|
|
||||||
|
|
||||||
public class mainThread extends JFrame implements KeyListener, ActionListener, MouseMotionListener, MouseListener, FocusListener{
|
public class mainThread extends JFrame implements KeyListener, ActionListener, MouseMotionListener, MouseListener, FocusListener{
|
||||||
|
|
||||||
public static int[] screen, bufferScreen;
|
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 static int mouseX, mouseY, centerScreenX, centerScreenY, currentMouseX, currentMouseY;
|
||||||
|
|
||||||
public mainThread(){
|
public mainThread(){
|
||||||
|
|
||||||
setTitle("Battle Tank 3");
|
setTitle("Battle Tank 3");
|
||||||
panel= (JPanel) this.getContentPane();
|
panel= (JPanel) this.getContentPane();
|
||||||
panel.setPreferredSize(new Dimension(768, 512));
|
panel.setPreferredSize(new Dimension(768, 512));
|
||||||
@ -228,9 +226,6 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M
|
|||||||
currentMouseX = MouseInfo.getPointerInfo().getLocation().x;
|
currentMouseX = MouseInfo.getPointerInfo().getLocation().x;
|
||||||
currentMouseY = MouseInfo.getPointerInfo().getLocation().y;
|
currentMouseY = MouseInfo.getPointerInfo().getLocation().y;
|
||||||
|
|
||||||
centerScreenX = getLocationOnScreen().x + 384;
|
|
||||||
centerScreenY = getLocationOnScreen().y + 256;
|
|
||||||
|
|
||||||
int deltaX = currentMouseX - centerScreenX;
|
int deltaX = currentMouseX - centerScreenX;
|
||||||
int deltaY = currentMouseY - centerScreenY;
|
int deltaY = currentMouseY - centerScreenY;
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ public class gameMenu {
|
|||||||
public static final int helpMenu = 2;
|
public static final int helpMenu = 2;
|
||||||
public static final int endGameMenu = 3;
|
public static final int endGameMenu = 3;
|
||||||
public static final int optionMenu = 4;
|
public static final int optionMenu = 4;
|
||||||
|
public static final int highscoreMenu = 5;
|
||||||
public int[] screen;
|
public int[] screen;
|
||||||
public int[] screenBlurBuffer;
|
public int[] screenBlurBuffer;
|
||||||
|
|
||||||
@ -29,6 +30,7 @@ public class gameMenu {
|
|||||||
public char[] easyDescription, normalDescription, hardDescription, helpPage1, helpPage2, helpPage3, helpPage4, mouseMode;
|
public char[] easyDescription, normalDescription, hardDescription, helpPage1, helpPage2, helpPage3, helpPage4, mouseMode;
|
||||||
|
|
||||||
public int currentHelpPage;
|
public int currentHelpPage;
|
||||||
|
public int highscoreLevel;
|
||||||
|
|
||||||
public ArrayList<button> buttons = new ArrayList<button>();
|
public ArrayList<button> buttons = new ArrayList<button>();
|
||||||
|
|
||||||
@ -49,6 +51,8 @@ public class gameMenu {
|
|||||||
Thread t = new Thread(theHighscoreManager);
|
Thread t = new Thread(theHighscoreManager);
|
||||||
t.start();
|
t.start();
|
||||||
|
|
||||||
|
highscoreLevel = 1;
|
||||||
|
|
||||||
String folder = "../images/";
|
String folder = "../images/";
|
||||||
loadTexture(folder + "title.png", titleImage, 216, 35);
|
loadTexture(folder + "title.png", titleImage, 216, 35);
|
||||||
loadTexture(folder + "58.jpg", lightTankImage, 44, 44);
|
loadTexture(folder + "58.jpg", lightTankImage, 44, 44);
|
||||||
@ -324,6 +328,31 @@ public class gameMenu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else if(menuStatus == highscoreMenu) {
|
||||||
|
if(postProcessingThread.escapeKeyPressed) {
|
||||||
|
menuStatus = mainMenu;
|
||||||
|
theHighscoreManager.task = theHighscoreManager.none;
|
||||||
|
if(theHighscoreManager.status == theHighscoreManager.idle) {
|
||||||
|
theHighscoreManager.result = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
drawTitle();
|
||||||
|
drawMenuFrame(420, 360);
|
||||||
|
|
||||||
|
if(theHighscoreManager.status == theHighscoreManager.processing) {
|
||||||
|
drawLoadingScreen(screen);
|
||||||
|
}else if(theHighscoreManager.status == theHighscoreManager.idle) {
|
||||||
|
if(theHighscoreManager.task == theHighscoreManager.none && theHighscoreManager.result == null) {
|
||||||
|
theHighscoreManager.task = theHighscoreManager.loadHighscores;
|
||||||
|
drawLoadingScreen(screen);
|
||||||
|
}else if(theHighscoreManager.task == theHighscoreManager.none && theHighscoreManager.result != null) {
|
||||||
|
//draw high scores
|
||||||
|
}
|
||||||
|
}else if(theHighscoreManager.status == theHighscoreManager.error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -332,6 +361,11 @@ public class gameMenu {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void drawLoadingScreen(int[] screen) {
|
||||||
|
textRenderer tRenderer = postProcessingThread.theTextRenderer;
|
||||||
|
tRenderer.drawMenuText(82,90,"busy".toCharArray(), screen, 255,255,255,0);
|
||||||
|
}
|
||||||
|
|
||||||
public void updateButtons() {
|
public void updateButtons() {
|
||||||
for(int i = 0; i < buttons.size(); i++) {
|
for(int i = 0; i < buttons.size(); i++) {
|
||||||
if(buttons.get(i).checkIfCursorIsOnTop(postProcessingThread.mouse_x, postProcessingThread.mouse_y)) {
|
if(buttons.get(i).checkIfCursorIsOnTop(postProcessingThread.mouse_x, postProcessingThread.mouse_y)) {
|
||||||
@ -351,6 +385,8 @@ public class gameMenu {
|
|||||||
currentHelpPage++;
|
currentHelpPage++;
|
||||||
}else if(buttons.get(i).name == "previousPage") {
|
}else if(buttons.get(i).name == "previousPage") {
|
||||||
currentHelpPage--;
|
currentHelpPage--;
|
||||||
|
}else if(buttons.get(i).name == "showHighscores") {
|
||||||
|
menuStatus = highscoreMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
postProcessingThread.buttonAction = buttons.get(i).name;
|
postProcessingThread.buttonAction = buttons.get(i).name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user