source: advance-wars/src/com/medievaltech/gui/Text.java@ bb2fa26

Last change on this file since bb2fa26 was abe7b3d, checked in by dportnoy <devnull@…>, 14 years ago

Changed the package names from com.example.* to com.medievaltech.*

  • Property mode set to 100644
File size: 614 bytes
Line 
1package com.medievaltech.gui;
2
3import android.graphics.Canvas;
4import android.graphics.Paint;
5
6public class Text extends GUIObject {
7 private String text;
8 private Paint textPaint;
9 private float vOffset;
10
11 public Text(String newText, int newX, int newY, int newWidth, int newHeight, Paint textPaint) {
12 super(newX, newY, newWidth, newHeight, null);
13
14 this.textPaint = textPaint;
15 text = newText;
16 vOffset = -(textPaint.getFontMetrics().ascent+textPaint.getFontMetrics().descent)/2;
17 }
18
19 public void draw(Canvas c) {
20 c.drawText(text, x+width/2, y+height/2+vOffset, textPaint);
21 }
22}
Note: See TracBrowser for help on using the repository browser.