Mercurial > hg > ristipolku
diff game/Engine.java @ 51:f81f76458b92
Work on widgets.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 23 Feb 2011 02:49:07 +0200 |
parents | 496e616ff09d |
children | 01851bae3da3 |
line wrap: on
line diff
--- a/game/Engine.java Tue Feb 22 11:45:40 2011 +0200 +++ b/game/Engine.java Wed Feb 23 02:49:07 2011 +0200 @@ -91,7 +91,7 @@ // sndPlaced = soundManager.getSound("sounds/placed.wav"); } - public void paint(Graphics2D g, int sx, int sy, float scale) + public void paint(Graphics2D g, float sx, float sy, float scale) { for (int y = 0; y < boardSize; y++) for (int x = 0; x < boardSize; x++) @@ -116,7 +116,6 @@ { board[x][y].animate(time); } - } public void pieceRotate(Piece.RotateDir dir) @@ -252,8 +251,6 @@ Sound musa; IDMContainer widgets; - BtnNewGame btnNewGame; - BtnSwapPiece btnSwapPiece; public Engine() { @@ -294,11 +291,9 @@ // UI IDM widgets widgets = new IDMContainer(); - btnNewGame = new BtnNewGame(); - widgets.add(btnNewGame); - - btnSwapPiece = new BtnSwapPiece(); - widgets.add(btnSwapPiece); + + widgets.add(new BtnNewGame(0.75f, 0.75f)); + widgets.add(new BtnSwapPiece(0.75f, 0.85f)); // Game startNewGame(); @@ -349,10 +344,8 @@ gimg.drawImage(lautaBG, 0, 0, dim.width, dim.height, null); lautaDim = dim; + widgets.setScale(dim.width, dim.height); System.out.print("scale changed\n"); - - btnNewGame.move(dim.width - 200, dim.height - 150); - btnSwapPiece.move(dim.width - 200, dim.height - 400); } // Background, pieces @@ -463,9 +456,9 @@ class BtnNewGame extends IDMButton { - public BtnNewGame() + public BtnNewGame(float x, float y) { - super(0, 0, KeyEvent.VK_ESCAPE, font1, "New Game"); + super(x, y, KeyEvent.VK_ESCAPE, font1, "Uusi peli"); } public void clicked() @@ -476,9 +469,9 @@ class BtnSwapPiece extends IDMButton { - public BtnSwapPiece() + public BtnSwapPiece(float x, float y) { - super(0, 0, KeyEvent.VK_SPACE, font1, "Swap Piece"); + super(x, y, KeyEvent.VK_SPACE, font1, "Vaihda"); } public void clicked()