Mercurial > hg > ristipolku
comparison game/Engine.java @ 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 | 64b04c0eccce |
children | 1ba6f56203f2 |
comparison
equal
deleted
inserted
replaced
153:71205451ef57 | 154:48b91eabc029 |
---|---|
295 { | 295 { |
296 if (nextPiece != null) | 296 if (nextPiece != null) |
297 { | 297 { |
298 // Draw next piece | 298 // Draw next piece |
299 AffineTransform save = g.getTransform(); | 299 AffineTransform save = g.getTransform(); |
300 nextPiece.paint(g, 830, 325, 90); | 300 nextPiece.paint(g, G.screenDim.width * 0.85f - 90.0f/2.0f, G.screenDim.height * 0.43f, 90.0f); |
301 g.setTransform(save); | 301 g.setTransform(save); |
302 } | 302 } |
303 } | 303 } |
304 else | 304 else |
305 { | 305 { |
315 g.setPaint(Color.white); | 315 g.setPaint(Color.white); |
316 g.drawString(text, (G.screenDim.width - textWidth) / 2 + (float) f, G.screenDim.height / 2 + (float) f); | 316 g.drawString(text, (G.screenDim.width - textWidth) / 2 + (float) f, G.screenDim.height / 2 + (float) f); |
317 } | 317 } |
318 | 318 |
319 // Score | 319 // Score |
320 String text = ""+ String.format("%05d", gameScore); | |
321 int textWidth = G.metrics[2].stringWidth(text); | |
320 g.setFont(G.fonts[2]); | 322 g.setFont(G.fonts[2]); |
321 g.setPaint(Color.white); | 323 g.setPaint(Color.white); |
322 g.drawString(""+ String.format("%05d", gameScore), G.screenDim.width - 230, 220); | 324 g.drawString(text, (G.screenDim.width * 0.85f) - textWidth / 2, G.screenDim.height * 0.3f); |
323 | |
324 } | 325 } |
325 | 326 |
326 public boolean contains(float x, float y) | 327 public boolean contains(float x, float y) |
327 { | 328 { |
328 return (x >= getScaledX() && | 329 return (x >= getScaledX() && |