[Picross-commit] SF.net SVN: picross:[124] branches/engine_split/android/src/picross/ specific
Status: Pre-Alpha
Brought to you by:
yvan_norsa
From: <yva...@us...> - 2013-01-16 10:16:34
|
Revision: 124 http://sourceforge.net/p/picross/code/124 Author: yvan_norsa Date: 2013-01-16 10:16:31 +0000 (Wed, 16 Jan 2013) Log Message: ----------- UI stuff Modified Paths: -------------- branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java branches/engine_split/android/src/picross/specific/ui/MenuUI.java Modified: branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java 2013-01-16 09:37:19 UTC (rev 123) +++ branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java 2013-01-16 10:16:31 UTC (rev 124) @@ -82,8 +82,7 @@ * @param sizes grid sizes */ public void displaySizes(MenuController listener, List<Dimensions> sizes) { - // FIXME - //this.removeAll(); + this.removeAllButtons(); int x = 150; int y = 150; @@ -108,6 +107,7 @@ // FIXME //this.repaint(); + this.invalidate(); } /** @@ -117,7 +117,6 @@ * @param levels levels to display */ public void displayLevels(MenuController listener, List<String> levels) { - // FIXME this.removeAllButtons(); // FIXME @@ -145,7 +144,8 @@ .getButton()); */ - this.add(this.createSimpleButton(level, event, listener));//, x, y);//); + //this.add(this.createSimpleButton(level, event, listener)); + this.addSimpleButton(level, event, listener, x, y); /* if (i != (nbLevels - 1)) { panel.add(Box.createRigidArea(new Dimension(0, 20))); @@ -172,6 +172,8 @@ this.revalidate(); this.repaint(); */ + + this.invalidate(); } /** Modified: branches/engine_split/android/src/picross/specific/ui/MenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-16 09:37:19 UTC (rev 123) +++ branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-16 10:16:31 UTC (rev 124) @@ -64,6 +64,7 @@ import android.graphics.Color; import android.graphics.Paint; +import android.graphics.Rect; /** * Base class for menus. @@ -137,12 +138,20 @@ canvas.drawBitmap(this.image, 0, 0, null); - for (PicrossLabel button : this.buttons) { + //for (PicrossLabel button : this.buttons) { + for (int i = 0; i < this.buttons.size(); i++) { + PicrossLabel button = this.buttons.get(i); + canvas.drawBitmap(button.getIcon(), button.getX(), button.getY(), null); if (button instanceof PicrossButton && ((PicrossButton) button).getText() != null) { - canvas.drawText(((PicrossButton) button).getText(), button.getX() + (button.getWidth() / 2), button.getY() - + (button.getHeight() / 2), paint); + Rect textBounds = new Rect(); + paint.getTextBounds(((PicrossButton) button).getText(), 0, ((PicrossButton) button).getText().length(), textBounds); + int textWidth = (int) textBounds.width(); + int textHeight = (int) textBounds.height(); + + canvas.drawText(((PicrossButton) button).getText(), button.getX() + (button.getWidth() / 2) - (textWidth / 2), button.getY() + + (button.getHeight() / 2) + (textHeight / 2), paint); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |