summary refs log tree commit diff stats
path: root/src/com/fourisland
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/fourisland')
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/Display.java2
-rw-r--r--src/com/fourisland/fourpuzzle/window/MessageWindow.java33
2 files changed, 22 insertions, 13 deletions
diff --git a/src/com/fourisland/fourpuzzle/Display.java b/src/com/fourisland/fourpuzzle/Display.java index ec835ab..0a9bfe1 100755 --- a/src/com/fourisland/fourpuzzle/Display.java +++ b/src/com/fourisland/fourpuzzle/Display.java
@@ -214,7 +214,7 @@ public class Display {
214 Logger.getLogger(Display.class.getName()).log(Level.SEVERE, null, ex); 214 Logger.getLogger(Display.class.getName()).log(Level.SEVERE, null, ex);
215 } 215 }
216 216
217 theFont = theFont.deriveFont(Font.PLAIN, 10); 217 theFont = theFont.deriveFont(Font.PLAIN, 9);
218 } 218 }
219 219
220 public static void setFont(Graphics2D g) 220 public static void setFont(Graphics2D g)
diff --git a/src/com/fourisland/fourpuzzle/window/MessageWindow.java b/src/com/fourisland/fourpuzzle/window/MessageWindow.java index 7947730..595fb55 100644 --- a/src/com/fourisland/fourpuzzle/window/MessageWindow.java +++ b/src/com/fourisland/fourpuzzle/window/MessageWindow.java
@@ -28,7 +28,15 @@ import java.util.concurrent.CountDownLatch;
28public class MessageWindow implements Renderable { 28public class MessageWindow implements Renderable {
29 29
30 private static final int SPACER = 4; 30 private static final int SPACER = 4;
31 private static final int HEIGHT = 4*(Display.createCanvas(1, 1).createGraphics().getFontMetrics().getHeight()+SPACER); 31 private static final int HEIGHT;
32
33 static
34 {
35 BufferedImage d = Display.createCanvas(1, 1);
36 Display.setFont(d.createGraphics());
37
38 HEIGHT = 3*(d.createGraphics().getFontMetrics().getHeight()+SPACER);
39 }
32 40
33 String message; 41 String message;
34 private volatile List<String> messages; 42 private volatile List<String> messages;
@@ -104,7 +112,7 @@ public class MessageWindow implements Renderable {
104 int length = width - SPACER; 112 int length = width - SPACER;
105 if (hasFace) 113 if (hasFace)
106 { 114 {
107 length -= (48 + (SPACER*2)); 115 length -= (48 + (SPACER*3));
108 } 116 }
109 117
110 String temp = message; 118 String temp = message;
@@ -162,22 +170,23 @@ public class MessageWindow implements Renderable {
162 170
163 g2.drawImage(cacheBase, 0, y, null); 171 g2.drawImage(cacheBase, 0, y, null);
164 172
173 int fw = g2.getFontMetrics().stringWidth(message);
165 int fh = g2.getFontMetrics().getHeight(); 174 int fh = g2.getFontMetrics().getHeight();
175 int tx = Window.Default.getLeftX();
166 int ty = Window.Default.getTopY()+fh-(SPACER/2)+y; 176 int ty = Window.Default.getTopY()+fh-(SPACER/2)+y;
167 int msgs = Math.min(messages.size(), 4); 177 int msgs = Math.min(messages.size(), 4);
168 int toPrint = upTo; 178 int toPrint = upTo;
179
180 if (hasFace)
181 {
182 g2.drawImage(face, tx+SPACER, ty-fh+SPACER, null);
183
184 tx += 48 + (SPACER*2);
185 }
186
169 for (int i=0;i<msgs;i++) 187 for (int i=0;i<msgs;i++)
170 { 188 {
171 String message = messages.get(i); 189 String message = messages.get(i);
172 int fw = g2.getFontMetrics().stringWidth(message);
173 int tx = Window.Default.getLeftX();
174
175 if (hasFace)
176 {
177 g2.drawImage(face, tx, y + ((HEIGHT/2)-24), null);
178
179 tx += 48 + SPACER;
180 }
181 190
182 g2.setPaint(new TexturePaint(SystemGraphic.getTextColor(), new Rectangle(tx, ty, fw, fh))); 191 g2.setPaint(new TexturePaint(SystemGraphic.getTextColor(), new Rectangle(tx, ty, fw, fh)));
183 g2.drawString(message.substring(0, Math.min(toPrint, message.length())), tx, ty); 192 g2.drawString(message.substring(0, Math.min(toPrint, message.length())), tx, ty);
@@ -191,7 +200,7 @@ public class MessageWindow implements Renderable {
191 { 200 {
192 upTo+=3; 201 upTo+=3;
193 } else { 202 } else {
194 g2.drawImage(SystemGraphic.getDownArrow(), (Window.Default.getFullWidth(width)/2)-5, y+HEIGHT-SPACER+(bounceArrow ? 1 : 0), null); 203 g2.drawImage(SystemGraphic.getDownArrow(), (Window.Default.getFullWidth(width)/2)-5, y+HEIGHT+SPACER+(bounceArrow ? 1 : 0), null);
195 204
196 if (in.isElapsed()) 205 if (in.isElapsed())
197 { 206 {