changeset 154:48b91eabc029

Improve scaling a bit, not completely functional yet.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 11 Apr 2013 20:34:45 +0300
parents 71205451ef57
children 1ba6f56203f2
files game/Engine.java
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/game/Engine.java	Thu Apr 11 20:17:13 2013 +0300
+++ b/game/Engine.java	Thu Apr 11 20:34:45 2013 +0300
@@ -297,7 +297,7 @@
             {
                 // Draw next piece
                 AffineTransform save = g.getTransform();
-                nextPiece.paint(g, 830, 325, 90);
+                nextPiece.paint(g, G.screenDim.width * 0.85f - 90.0f/2.0f, G.screenDim.height * 0.43f, 90.0f);
                 g.setTransform(save);
             }
         }
@@ -317,10 +317,11 @@
         }
 
         // Score
+        String text = ""+ String.format("%05d", gameScore);
+        int textWidth = G.metrics[2].stringWidth(text);
         g.setFont(G.fonts[2]);
         g.setPaint(Color.white);
-        g.drawString(""+ String.format("%05d", gameScore), G.screenDim.width - 230, 220);
-
+        g.drawString(text, (G.screenDim.width * 0.85f) - textWidth / 2, G.screenDim.height * 0.3f);
     }
 
     public boolean contains(float x, float y)