Skip to content
Permalink
Browse files

Fixed an issue where the Mouse could be used while in game

  • Loading branch information
jdm13003 committed Apr 27, 2016
1 parent 62f0528 commit f9ae420929f8234c8aeb3d6cc7c794f274676be1
Showing with 34 additions and 30 deletions.
  1. +1 −1 src/main/Game.java
  2. +33 −29 src/main/MouseInput.java
@@ -103,7 +103,7 @@ public void init()
e.printStackTrace();
}
addKeyListener(new KeyboardInput(this));
this.addMouseListener(new MouseInput());
this.addMouseListener(new MouseInput(this));
tp = new Skins(this);
c = new Controller(tp, this);
menu = new Menu();
@@ -4,55 +4,59 @@
import java.awt.event.MouseListener;

public class MouseInput implements MouseListener{

private Game game;

public MouseInput(Game game){
this.game = game;
}
public void mouseClicked(MouseEvent arg0) {
// TODO Auto-generated method stub

}

public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub

}

public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub

}

public void mousePressed(MouseEvent e) {
int mx = e.getX();
int my = e.getY();

if(mx >= 265 && mx <= 535 && my >= 225 && my <= 275)
{
Game.numberOfPlayers = 1;
Game.padraicmode = false;
Game.State = Game.STATE.GAME;
if(game.State == game.State.MENU){
if(mx >= 265 && mx <= 535 && my >= 225 && my <= 275)
{
Game.numberOfPlayers = 1;
Game.padraicmode = false;
Game.State = Game.STATE.GAME;
}
else if(mx >= 285 && mx <= 515 && my >= 325 && my <= 375)
{
Game.numberOfPlayers = 2;
Game.padraicmode = false;
Game.State = Game.STATE.GAME;
}
else if(mx >= 365 && mx <= 435 && my >= 425 && my <= 475)
{
System.exit(1);
}
else if(mx >= 610 && mx <= 650 && my >= 540 && my <= 580)
{
Game.numberOfPlayers = 1;
Game.padraicmode = true;
Game.State = Game.STATE.GAME;
}
}
else if(mx >= 285 && mx <= 515 && my >= 325 && my <= 375)
{
Game.numberOfPlayers = 2;
Game.padraicmode = false;
Game.State = Game.STATE.GAME;
}
else if(mx >= 365 && mx <= 435 && my >= 425 && my <= 475)
{
System.exit(1);
}
else if(mx >= 610 && mx <= 650 && my >= 540 && my <= 580)
{
Game.numberOfPlayers = 1;
Game.padraicmode = true;
Game.State = Game.STATE.GAME;
}



}

public void mouseReleased(MouseEvent arg0) {
// TODO Auto-generated method stub

}

}

0 comments on commit f9ae420

Please sign in to comment.
You can’t perform that action at this time.