Merge branch 'develop' of https://github.com/ProjectGroepA2/Arcade into infoPanel
@@ -17,6 +17,7 @@ public class NetworkHandler implements Runnable{
|
|||||||
|
|
||||||
private String host;
|
private String host;
|
||||||
private int port;
|
private int port;
|
||||||
|
private long fistpressed;
|
||||||
|
|
||||||
private boolean running;
|
private boolean running;
|
||||||
private Thread t;
|
private Thread t;
|
||||||
@@ -111,7 +112,7 @@ public class NetworkHandler implements Runnable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(control[7] == 0 && control[8] == 0){
|
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);
|
JoystickHandler.j.setPosition(Position.UP_LEFT);
|
||||||
jth.onJoystickMoved(JoystickHandler.j);
|
jth.onJoystickMoved(JoystickHandler.j);
|
||||||
@@ -140,10 +141,18 @@ public class NetworkHandler implements Runnable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if(control[7] == 0){
|
else if(control[7] == 0){
|
||||||
if(JoystickHandler.j.getPos() != Position.UP)
|
if(JoystickHandler.j.getPos() != Position.UP || JoystickHandler.REPEAT)
|
||||||
{
|
{
|
||||||
JoystickHandler.j.setPosition(Position.UP);
|
if(JoystickHandler.j.getPos() != Position.UP)
|
||||||
jth.onJoystickMoved(JoystickHandler.j);
|
{
|
||||||
|
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){
|
else if(control[8] == 0){
|
||||||
@@ -161,13 +170,21 @@ public class NetworkHandler implements Runnable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(control[10] == 0){
|
else if(control[10] == 0){
|
||||||
if(JoystickHandler.j.getPos() != Position.DOWN)
|
if(JoystickHandler.j.getPos() != Position.DOWN || JoystickHandler.REPEAT)
|
||||||
{
|
{
|
||||||
JoystickHandler.j.setPosition(Position.DOWN);
|
if(JoystickHandler.j.getPos() != Position.DOWN){
|
||||||
jth.onJoystickMoved(JoystickHandler.j);
|
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 {
|
}else {
|
||||||
if(JoystickHandler.j.getPos() != Position.CENTER){
|
if(JoystickHandler.j.getPos() != Position.CENTER){
|
||||||
|
fistpressed = 0;
|
||||||
JoystickHandler.j.setPosition(Position.CENTER);
|
JoystickHandler.j.setPosition(Position.CENTER);
|
||||||
jth.onJoystickMoved(JoystickHandler.j);
|
jth.onJoystickMoved(JoystickHandler.j);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,8 +177,8 @@ public class ButtonHandler implements KeyListener{
|
|||||||
buttons.add(new Button(1, 2, ntw));
|
buttons.add(new Button(1, 2, ntw));
|
||||||
buttons.add(new Button(2, 1, ntw));
|
buttons.add(new Button(2, 1, ntw));
|
||||||
buttons.add(new Button(3, 0, ntw));
|
buttons.add(new Button(3, 0, ntw));
|
||||||
buttons.add(new Button(4, 3, ntw));
|
buttons.add(new Button(4, -1, ntw));
|
||||||
buttons.add(new Button(5, 4, ntw));
|
buttons.add(new Button(5, 3, ntw));
|
||||||
buttons.add(new Button(6, 5, ntw));
|
buttons.add(new Button(6, 4, ntw));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,9 @@ public class SQLConnector
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
result.next();
|
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) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -36,8 +36,8 @@ public class Window extends JFrame {
|
|||||||
setSize(WIDTH, HEIGHT);
|
setSize(WIDTH, HEIGHT);
|
||||||
|
|
||||||
//Create Events
|
//Create Events
|
||||||
// Window.ON_RASP = ON_RASP;
|
Window.ON_RASP = ON_RASP;
|
||||||
// if(ON_RASP){ //Only on the raspberry pi
|
if(ON_RASP){ //Only on the raspberry pi
|
||||||
// GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
// GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||||
// GraphicsDevice[] devices = graphicsEnvironment.getScreenDevices();
|
// GraphicsDevice[] devices = graphicsEnvironment.getScreenDevices();
|
||||||
//
|
//
|
||||||
@@ -47,15 +47,15 @@ public class Window extends JFrame {
|
|||||||
// devices[0].setFullScreenWindow(this);
|
// devices[0].setFullScreenWindow(this);
|
||||||
// }
|
// }
|
||||||
// //Remove cursor
|
// //Remove cursor
|
||||||
// BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
|
BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
|
||||||
// Cursor blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, new Point(0, 0), "blank cursor");
|
Cursor blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, new Point(0, 0), "blank cursor");
|
||||||
// this.setCursor(blankCursor);
|
this.setCursor(blankCursor);
|
||||||
// }
|
}
|
||||||
|
|
||||||
ButtonHandler bth = new ButtonHandler();
|
ButtonHandler bth = new ButtonHandler();
|
||||||
JoystickHandler jsh = new JoystickHandler();
|
JoystickHandler jsh = new JoystickHandler();
|
||||||
|
|
||||||
|
|
||||||
final SQLConnector sql = new SQLConnector();
|
final SQLConnector sql = new SQLConnector();
|
||||||
|
|
||||||
NetworkHandler ntw = new NetworkHandler("10.42.0.5", 1113, bth, jsh);
|
NetworkHandler ntw = new NetworkHandler("10.42.0.5", 1113, bth, jsh);
|
||||||
@@ -85,8 +85,8 @@ public class Window extends JFrame {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Create EventListeners
|
//Create EventListeners
|
||||||
addKeyListener(bth);
|
addKeyListener(bth);
|
||||||
addKeyListener(jsh);
|
addKeyListener(jsh);
|
||||||
bth.addButtonListener(control);
|
bth.addButtonListener(control);
|
||||||
jsh.addJoystickListener(control);
|
jsh.addJoystickListener(control);
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import control.button.ButtonHandler;
|
|||||||
|
|
||||||
public class GameModel {
|
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 GameStateManager gsm;
|
||||||
private NetworkHandler ntw;
|
private NetworkHandler ntw;
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import model.SongHandler;
|
|||||||
import control.GameStateManager;
|
import control.GameStateManager;
|
||||||
import control.GameStateManager.State;
|
import control.GameStateManager.State;
|
||||||
import control.button.ButtonEvent;
|
import control.button.ButtonEvent;
|
||||||
|
import control.button.ButtonHandler;
|
||||||
import control.joystick.JoystickEvent;
|
import control.joystick.JoystickEvent;
|
||||||
import data.io.SQLConnector;
|
import data.io.SQLConnector;
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ public class HelpState extends GameState {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
|
ButtonHandler.getButton(2).setColor(GameModel.colors[2]);
|
||||||
sh.play();
|
sh.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -417,7 +417,7 @@ public class MenuState extends GameState {
|
|||||||
g2.setFont(textFont);
|
g2.setFont(textFont);
|
||||||
|
|
||||||
boolean highscoresFound = true;
|
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));
|
List<Highscore> highscores = sql.getHighscoresToday(selectedToSong(selected), sh.getCurrentSong().getSongs().get(difSelect));
|
||||||
if(highscores.isEmpty())
|
if(highscores.isEmpty())
|
||||||
@@ -428,10 +428,10 @@ public class MenuState extends GameState {
|
|||||||
highscoresFound = false;
|
highscoresFound = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
g2.drawString("All Time Highscores", 30, 300);
|
g2.drawString("All Time Highscores", 30, 235);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
g2.drawString("Daily Highscore", 30, 300);
|
g2.drawString("Daily Highscore", 30, 235);
|
||||||
g2.setFont(textFont2);
|
g2.setFont(textFont2);
|
||||||
|
|
||||||
if(highscoresFound)
|
if(highscoresFound)
|
||||||
@@ -442,7 +442,7 @@ public class MenuState extends GameState {
|
|||||||
{
|
{
|
||||||
Highscore hi = highscores.get(i);
|
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
|
else
|
||||||
@@ -530,4 +530,4 @@ public class MenuState extends GameState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -69,6 +69,14 @@ public class TitleState extends GameState {
|
|||||||
xKast %= 4;
|
xKast %= 4;
|
||||||
g2.drawImage(kast.getSubimage(xKast * 300, 0, 300, 400), 100, 300, 300, 400, null);
|
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
|
@Override
|
||||||
|
|||||||
@@ -29,9 +29,11 @@ public class DifficultyButton {
|
|||||||
g2.setColor(Color.WHITE);
|
g2.setColor(Color.WHITE);
|
||||||
g2.fillRect(0, 0, 300, 75);
|
g2.fillRect(0, 0, 300, 75);
|
||||||
g2.setColor(Color.ORANGE);
|
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);
|
g2.setColor(color);
|
||||||
Font textFont2 = new Font("OCR A Extended", Font.BOLD, 50);
|
Font textFont2 = new Font("OCR A Extended", Font.BOLD, 50);
|
||||||
g2.setFont(textFont2);
|
g2.setFont(textFont2);
|
||||||
|
|||||||