Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
updated ui
- Loading branch information
Showing
9 changed files
with
182 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package model; | ||
|
||
public class Move { | ||
private Location source; | ||
private Location destination; | ||
|
||
public Move(Location source, Location destination) { | ||
this.setSource(source); | ||
this.setDestination(destination); | ||
} | ||
|
||
public Location getSource() { | ||
return source; | ||
} | ||
|
||
public void setSource(Location source) { | ||
this.source = source; | ||
} | ||
|
||
public Location getDestination() { | ||
return destination; | ||
} | ||
|
||
public void setDestination(Location destination) { | ||
this.destination = destination; | ||
} | ||
|
||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package view; | ||
|
||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
import java.awt.event.KeyEvent; | ||
import java.awt.event.KeyListener; | ||
import java.awt.event.MouseEvent; | ||
import java.awt.event.MouseListener; | ||
|
||
public class GameEventListener implements MouseListener, KeyListener, ActionListener { | ||
|
||
private GamePanel gamePanel; | ||
|
||
@Override | ||
public void mouseClicked(MouseEvent arg0) {} | ||
|
||
@Override | ||
public void mouseEntered(MouseEvent e) {} | ||
|
||
@Override | ||
public void mouseExited(MouseEvent e) {} | ||
|
||
@Override | ||
public void mousePressed(MouseEvent e) { | ||
Square square = (Square) e.getComponent(); | ||
if(square.hasPiece()) { | ||
gamePanel.setMoveSource(square); | ||
gamePanel.updateMoveMessage(); | ||
} else { | ||
gamePanel.setMoveDestination(square); | ||
gamePanel.updateMoveMessage(); | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public void mouseReleased(MouseEvent e) {} | ||
|
||
@Override | ||
public void keyPressed(KeyEvent arg0) {} | ||
|
||
@Override | ||
public void keyReleased(KeyEvent e) { | ||
if(e.getKeyCode() == KeyEvent.VK_ENTER && gamePanel.moveReady()) { | ||
System.out.println("Moving piece."); | ||
// TODO: Request a move from the controller. | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public void keyTyped(KeyEvent arg0) {} | ||
|
||
public void setGamePanel(GamePanel gamePanel) { | ||
this.gamePanel = gamePanel; | ||
} | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
System.exit(0); | ||
} | ||
} | ||
|
Oops, something went wrong.