Mercurial > hg > ristipolku
comparison Ristipolku.java @ 6:be0bf7544069
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 28 Jan 2011 18:42:16 +0200 |
parents | e0e8fd08331e |
children | 70714c229e23 |
comparison
equal
deleted
inserted
replaced
5:4890020bf856 | 6:be0bf7544069 |
---|---|
5 * Ohjelmointiprojekti 2010-2011 Java-kurssille T740306. | 5 * Ohjelmointiprojekti 2010-2011 Java-kurssille T740306. |
6 */ | 6 */ |
7 import java.awt.*; | 7 import java.awt.*; |
8 import java.awt.geom.*; | 8 import java.awt.geom.*; |
9 import java.awt.event.*; | 9 import java.awt.event.*; |
10 import javax.swing.*; | 10 //import javax.swing.*; |
11 import javax.imageio.*; | |
11 import java.util.*; | 12 import java.util.*; |
13 import java.io.*; | |
12 import game.*; | 14 import game.*; |
13 | 15 |
14 | 16 |
15 class PathInfo | 17 class PathInfo |
16 { | 18 { |
50 { | 52 { |
51 for (int y = 0; y < boardSize; y++) | 53 for (int y = 0; y < boardSize; y++) |
52 for (int x = 0; x < boardSize; x++) | 54 for (int x = 0; x < boardSize; x++) |
53 if (board[x][y] != null) | 55 if (board[x][y] != null) |
54 { | 56 { |
57 AffineTransform save = g.getTransform(); | |
58 | |
55 board[x][y].paint(g, | 59 board[x][y].paint(g, |
56 sx + (x * scale), | 60 sx + (x * scale), |
57 sy + (y * scale), | 61 sy + (y * scale), |
58 scale - scale / 10); | 62 scale - scale / 10); |
63 | |
64 g.setTransform(save); | |
59 } | 65 } |
60 } | 66 } |
61 | 67 |
62 private boolean isEmpty(int x, int y) | 68 private boolean isEmpty(int x, int y) |
63 { | 69 { |
82 } | 88 } |
83 | 89 |
84 public void pieceFinishTurn() | 90 public void pieceFinishTurn() |
85 { | 91 { |
86 if (current != null) | 92 if (current != null) |
87 current.setType(PieceType.NORMAL); | 93 current.setType(PieceType.LOCKED); |
88 | 94 |
89 if (isEmpty(cx, cy)) | 95 if (isEmpty(cx, cy)) |
90 { | 96 { |
91 current = new Piece(PieceType.ACTIVE); | 97 current = new Piece(PieceType.ACTIVE); |
92 lauta.setPiece(cx, cy, current); | 98 lauta.setPiece(cx, cy, current); |