Merge branch 'develop' of https://github.com/ProjectGroepA2/Arcade into infoPanel

This commit is contained in:
Bilel Bghiel
2015-07-09 13:55:14 +02:00
13 changed files with 59 additions and 28 deletions
+24 -7
View File
@@ -17,6 +17,7 @@ public class NetworkHandler implements Runnable{
private String host;
private int port;
private long fistpressed;
private boolean running;
private Thread t;
@@ -111,7 +112,7 @@ public class NetworkHandler implements Runnable{
}
if(control[7] == 0 && control[8] == 0){
if(JoystickHandler.j.getPos() != Position.UP_LEFT)
if(JoystickHandler.j.getPos() != Position.UP_LEFT )
{
JoystickHandler.j.setPosition(Position.UP_LEFT);
jth.onJoystickMoved(JoystickHandler.j);
@@ -140,10 +141,18 @@ public class NetworkHandler implements Runnable{
}
else if(control[7] == 0){
if(JoystickHandler.j.getPos() != Position.UP)
if(JoystickHandler.j.getPos() != Position.UP || JoystickHandler.REPEAT)
{
JoystickHandler.j.setPosition(Position.UP);
jth.onJoystickMoved(JoystickHandler.j);
if(JoystickHandler.j.getPos() != Position.UP)
{
fistpressed = System.currentTimeMillis();
JoystickHandler.j.setPosition(Position.UP);
jth.onJoystickMoved(JoystickHandler.j);
}
if((fistpressed + 500) < System.currentTimeMillis()){
JoystickHandler.j.setPosition(Position.UP);
jth.onJoystickMoved(JoystickHandler.j);
}
}
}
else if(control[8] == 0){
@@ -161,13 +170,21 @@ public class NetworkHandler implements Runnable{
}
}
else if(control[10] == 0){
if(JoystickHandler.j.getPos() != Position.DOWN)
if(JoystickHandler.j.getPos() != Position.DOWN || JoystickHandler.REPEAT)
{
JoystickHandler.j.setPosition(Position.DOWN);
jth.onJoystickMoved(JoystickHandler.j);
if(JoystickHandler.j.getPos() != Position.DOWN){
fistpressed = System.currentTimeMillis();
JoystickHandler.j.setPosition(Position.DOWN);
jth.onJoystickMoved(JoystickHandler.j);
}
if((fistpressed + 500) < System.currentTimeMillis()){
JoystickHandler.j.setPosition(Position.DOWN);
jth.onJoystickMoved(JoystickHandler.j);
}
}
}else {
if(JoystickHandler.j.getPos() != Position.CENTER){
fistpressed = 0;
JoystickHandler.j.setPosition(Position.CENTER);
jth.onJoystickMoved(JoystickHandler.j);
}
+3 -3
View File
@@ -177,8 +177,8 @@ public class ButtonHandler implements KeyListener{
buttons.add(new Button(1, 2, ntw));
buttons.add(new Button(2, 1, ntw));
buttons.add(new Button(3, 0, ntw));
buttons.add(new Button(4, 3, ntw));
buttons.add(new Button(5, 4, ntw));
buttons.add(new Button(6, 5, ntw));
buttons.add(new Button(4, -1, ntw));
buttons.add(new Button(5, 3, ntw));
buttons.add(new Button(6, 4, ntw));
}
}
+3 -1
View File
@@ -62,7 +62,9 @@ public class SQLConnector
try {
result.next();
hsc = new Highscore(si, result.getString("username"), result.getInt("score"), result.getDate("date").getTime());
if(result != null)
hsc = new Highscore(si, result.getString("username"), result.getInt("score"), result.getDate("date").getTime());
} catch (SQLException e) {
e.printStackTrace();
}
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 108 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 36 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

+9 -9
View File
@@ -36,8 +36,8 @@ public class Window extends JFrame {
setSize(WIDTH, HEIGHT);
//Create Events
// Window.ON_RASP = ON_RASP;
// if(ON_RASP){ //Only on the raspberry pi
Window.ON_RASP = ON_RASP;
if(ON_RASP){ //Only on the raspberry pi
// GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
// GraphicsDevice[] devices = graphicsEnvironment.getScreenDevices();
//
@@ -47,15 +47,15 @@ public class Window extends JFrame {
// devices[0].setFullScreenWindow(this);
// }
// //Remove cursor
// BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
// Cursor blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, new Point(0, 0), "blank cursor");
// this.setCursor(blankCursor);
// }
BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
Cursor blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, new Point(0, 0), "blank cursor");
this.setCursor(blankCursor);
}
ButtonHandler bth = new ButtonHandler();
JoystickHandler jsh = new JoystickHandler();
final SQLConnector sql = new SQLConnector();
NetworkHandler ntw = new NetworkHandler("10.42.0.5", 1113, bth, jsh);
@@ -85,8 +85,8 @@ public class Window extends JFrame {
});
//Create EventListeners
addKeyListener(bth);
addKeyListener(jsh);
addKeyListener(bth);
addKeyListener(jsh);
bth.addButtonListener(control);
jsh.addJoystickListener(control);
+1 -1
View File
@@ -9,7 +9,7 @@ import control.button.ButtonHandler;
public class GameModel {
public static Color[] colors = { Color.GREEN, Color.YELLOW, Color.RED, Color.MAGENTA, Color.CYAN, Color.ORANGE };
public static Color[] colors = { Color.GREEN, Color.YELLOW, Color.RED, Color.MAGENTA, Color.CYAN, Color.BLUE };
private GameStateManager gsm;
private NetworkHandler ntw;
private int count = 0;
+2
View File
@@ -15,6 +15,7 @@ import model.SongHandler;
import control.GameStateManager;
import control.GameStateManager.State;
import control.button.ButtonEvent;
import control.button.ButtonHandler;
import control.joystick.JoystickEvent;
import data.io.SQLConnector;
@@ -36,6 +37,7 @@ public class HelpState extends GameState {
@Override
public void init() {
ButtonHandler.getButton(2).setColor(GameModel.colors[2]);
sh.play();
}
+5 -5
View File
@@ -417,7 +417,7 @@ public class MenuState extends GameState {
g2.setFont(textFont);
boolean highscoresFound = true;
int HIGHSCORES_TO_DISPLAY = 5;
int HIGHSCORES_TO_DISPLAY = 7;
List<Highscore> highscores = sql.getHighscoresToday(selectedToSong(selected), sh.getCurrentSong().getSongs().get(difSelect));
if(highscores.isEmpty())
@@ -428,10 +428,10 @@ public class MenuState extends GameState {
highscoresFound = false;
}
else
g2.drawString("All Time Highscores", 30, 300);
g2.drawString("All Time Highscores", 30, 235);
}
else
g2.drawString("Daily Highscore", 30, 300);
g2.drawString("Daily Highscore", 30, 235);
g2.setFont(textFont2);
if(highscoresFound)
@@ -442,7 +442,7 @@ public class MenuState extends GameState {
{
Highscore hi = highscores.get(i);
g2.drawString(hi.getName() + " - " + hi.getScore(), 30, 350 + i*100);
g2.drawString(" " + (i+1) + "# " + hi.getName() + " - " + hi.getScore(), 30, 290 + i*80);
}
}
else
@@ -530,4 +530,4 @@ public class MenuState extends GameState {
}
}
}
}
+8
View File
@@ -69,6 +69,14 @@ public class TitleState extends GameState {
xKast %= 4;
g2.drawImage(kast.getSubimage(xKast * 300, 0, 300, 400), 100, 300, 300, 400, null);
}
g2.drawImage(background, 0, 0, 1280, 1024, null);
int image_x = ((frame / 6) % 6) * 49;
g2.drawImage(pressStart.getSubimage(image_x, 0, 49, 26), 640-122, 512, 245, 130, null);
xKast = indexKast/10;
xKast%=4;
//g2.drawImage(kast.getSubimage(xKast*300,0,300,400), 640-122,650,300,400,null);
g2.drawImage(kast.getSubimage(xKast*600,0,600,800), 490,624,300,400,null);
}
@Override
+4 -2
View File
@@ -29,9 +29,11 @@ public class DifficultyButton {
g2.setColor(Color.WHITE);
g2.fillRect(0, 0, 300, 75);
g2.setColor(Color.ORANGE);
g2.drawRect(0, 0, 300, 75);
//g2.drawRect(0-2, 0-2, 304, 79);
// g2.drawRect(0, 0, 300, 75);
// g2.drawRect(0-2, 0-2, 304, 79);
g2.drawRect(0, 0, 304, 79);
g2.drawRect(2, 2, 300, 75);
g2.setColor(color);
Font textFont2 = new Font("OCR A Extended", Font.BOLD, 50);
g2.setFont(textFont2);