-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
155 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
/controller/ | ||
/model/ | ||
/view/ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 was deleted.
Oops, something went wrong.
File renamed without changes.
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,88 @@ | ||
package view; | ||
import model.*; | ||
import java.awt.Dimension; | ||
import java.awt.Graphics; | ||
import java.awt.Image; | ||
|
||
import java.awt.Point; | ||
|
||
import java.util.ArrayList; | ||
|
||
import javax.swing.ImageIcon; | ||
import javax.swing.JPanel; | ||
|
||
public class GameboardWindow extends JPanel { | ||
|
||
private static final long serialVersionUID = 1L; | ||
private Image img = new ImageIcon(this.getClass().getResource( | ||
"gameboard.png")).getImage(); | ||
|
||
private GameBoard board; // | ||
private Point[] points = new Point[40];// location of topleft corner of | ||
// buttons | ||
|
||
private ArrayList<Positioner> Positioners; | ||
|
||
public GameboardWindow(GameBoard board) { | ||
this.board = board; | ||
Dimension size = new Dimension(img.getWidth(null)+250, img.getHeight(null)); | ||
setPreferredSize(size); | ||
setMinimumSize(size); | ||
setMaximumSize(size); | ||
setSize(size); | ||
setLayout(null); | ||
|
||
setUpTiles(); | ||
|
||
Positioners = new ArrayList<Positioner>(); | ||
for (int i = 1; i <= 4; i++) { | ||
String path = "piece" + i + ".png"; | ||
Image img = new ImageIcon(this.getClass().getResource(path)) | ||
.getImage(); | ||
Positioners.add(new Positioner(img, 602, 602)); | ||
} | ||
} | ||
|
||
public void setUpTiles() { | ||
// implement the tiles into the graphical boardspace?? | ||
// Tile t1; | ||
// this.add(t1); | ||
// t1.setBounds(133,521,50,75); //xstart,ystart,width,height | ||
// points[1] = newPoint(133,521); | ||
|
||
|
||
// LocationButton b2 = new LocationButton("name", 21, board); | ||
// this.add(b2); | ||
// b2.setBounds(98, 10, 56, 88);// xStart, Ystart, width, height | ||
// points[21] = new Point(98, 10); | ||
|
||
|
||
|
||
} | ||
|
||
public void paintComponent(Graphics g) { | ||
g.drawImage(img, 0, 0, null); | ||
|
||
for (int i = 0; i < Positioners.size(); i++) { | ||
Positioner curr = Positioners.get(i); | ||
g.drawImage(curr.getImage(), curr.getX(), curr.getY(), null); | ||
} | ||
|
||
} | ||
|
||
public void update(ArrayList<Integer> locP) { | ||
for (int i = 0; i < locP.size(); i++) { | ||
int x = (int) points[locP.get(i)].getX(); | ||
int y = (int) points[locP.get(i)].getY(); | ||
|
||
Positioners.get(i).setX(x); | ||
Positioners.get(i).setY(y); | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
} |
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,38 @@ | ||
package view; | ||
|
||
import java.awt.Image; | ||
|
||
public class Positioner { | ||
|
||
private Image img; | ||
private int x, y; | ||
public Positioner(Image img, int x, int y){ | ||
this.img = img; | ||
this.x = x; | ||
this.y = y; | ||
} | ||
|
||
public int getX(){ | ||
return this.x; | ||
} | ||
|
||
public int getY(){ | ||
return this.y; | ||
} | ||
|
||
public Image getImage(){ | ||
return this.img; | ||
} | ||
|
||
public void setX(int x2){ | ||
this.x = x2; | ||
} | ||
|
||
public void setY(int y){ | ||
this.y = y; | ||
} | ||
|
||
public void setImage(Image newImage){ | ||
this.img = newImage; | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.