Mercurial > hg > ristipolku
diff game/Engine.java @ 32:e480579cc460
More work on debugging the path resolving.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 03 Feb 2011 18:22:16 +0200 |
parents | 60a4579a79df |
children | aa15b2c556b4 |
line wrap: on
line diff
--- a/game/Engine.java Thu Feb 03 00:00:09 2011 +0200 +++ b/game/Engine.java Thu Feb 03 18:22:16 2011 +0200 @@ -95,6 +95,8 @@ class IDMButton { + BufferedImage imgUp, imgPressed; + public IDMButton(float x, float y, String text) { } @@ -167,7 +169,7 @@ return (x >= 0 && x < boardSize && y >= 0 && y < boardSize && board[x][y] == null); } - public void pieceRotate(boolean dir) + public void pieceRotate(Piece.RotateDir dir) { if (current != null) current.rotate(dir); @@ -279,6 +281,8 @@ SoundElement[] sounds; + Piece testi; int con = 0; + public SoundElement snd(Sound snd) { return sounds[snd.ordinal()]; @@ -293,6 +297,8 @@ gameFrames = 0; startTime = new Date().getTime(); + testi = new Piece(PieceType.LOCKED); + // Load resources try @@ -374,6 +380,8 @@ g2.drawImage(lautaBGScaled, 0, 0, null); lauta.paint(g2, 100, 150, 60); + testi.paint(g2, 50f,50f,100f); + // Scores g2.setFont(font1); g2.setPaint(Color.white); @@ -381,7 +389,9 @@ // Other elements long currTime = new Date().getTime(); - g2.drawString("fps = "+ ((currTime - startTime) / gameFrames), dim.width - 120, 20); + g2.drawString("fps = "+ ((gameFrames * 1000) / (currTime - startTime)), dim.width - 120, 20); + + g2.drawString("con = "+ con, 20, 30); } public void startThreads() @@ -442,12 +452,12 @@ { case KeyEvent.VK_LEFT: case KeyEvent.VK_UP: - lauta.pieceRotate(false); + lauta.pieceRotate(Piece.RotateDir.LEFT); break; case KeyEvent.VK_RIGHT: case KeyEvent.VK_DOWN: - lauta.pieceRotate(true); + lauta.pieceRotate(Piece.RotateDir.RIGHT); break; case KeyEvent.VK_ENTER: @@ -474,6 +484,11 @@ repaint(); gameFrames++; } + + // debugataan + con = ((int) (gameClock / 100)) & 7; + testi.clearActiveConnections(); + testi.setActiveConnection(con); // Sleep for a moment try {