diff options
-rw-r--r-- | src/com/fourisland/fourpuzzle/window/MessageWindow.java | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/com/fourisland/fourpuzzle/window/MessageWindow.java b/src/com/fourisland/fourpuzzle/window/MessageWindow.java index 172ba0d..ca916a3 100644 --- a/src/com/fourisland/fourpuzzle/window/MessageWindow.java +++ b/src/com/fourisland/fourpuzzle/window/MessageWindow.java | |||
@@ -31,7 +31,6 @@ public class MessageWindow implements Renderable { | |||
31 | private static final int SPACER = 4; | 31 | private static final int SPACER = 4; |
32 | private static final int HEIGHT = (4*(Display.getFontMetrics().getHeight()+SPACER)); | 32 | private static final int HEIGHT = (4*(Display.getFontMetrics().getHeight()+SPACER)); |
33 | 33 | ||
34 | String message; | ||
35 | private volatile List<String> messages; | 34 | private volatile List<String> messages; |
36 | int width; | 35 | int width; |
37 | BufferedImage cacheBase; | 36 | BufferedImage cacheBase; |
@@ -41,20 +40,23 @@ public class MessageWindow implements Renderable { | |||
41 | Interval in = Interval.createTickInterval(4); | 40 | Interval in = Interval.createTickInterval(4); |
42 | private MessageWindow(String message) | 41 | private MessageWindow(String message) |
43 | { | 42 | { |
44 | this.message = message; | ||
45 | width = Game.WIDTH - Window.Default.getFullWidth(0); | 43 | width = Game.WIDTH - Window.Default.getFullWidth(0); |
46 | |||
47 | cacheBase = Window.Default.getImage(width, HEIGHT); | 44 | cacheBase = Window.Default.getImage(width, HEIGHT); |
45 | |||
46 | initalizeMessages(message); | ||
48 | } | 47 | } |
49 | 48 | ||
50 | boolean hasFace = false; | 49 | boolean hasFace = false; |
51 | BufferedImage face; | 50 | BufferedImage face; |
52 | private MessageWindow(String message, String faceSet, int face) | 51 | private MessageWindow(String message, String faceSet, int face) |
53 | { | 52 | { |
54 | this(message); | 53 | width = Game.WIDTH - Window.Default.getFullWidth(0); |
54 | cacheBase = Window.Default.getImage(width, HEIGHT); | ||
55 | 55 | ||
56 | this.face = FaceSet.getFaceSet(faceSet).getImage(face); | 56 | this.face = FaceSet.getFaceSet(faceSet).getImage(face); |
57 | hasFace = true; | 57 | hasFace = true; |
58 | |||
59 | initalizeMessages(message); | ||
58 | } | 60 | } |
59 | 61 | ||
60 | private static void displayMessage(final MessageWindow mw) throws InterruptedException | 62 | private static void displayMessage(final MessageWindow mw) throws InterruptedException |
@@ -84,16 +86,12 @@ public class MessageWindow implements Renderable { | |||
84 | 86 | ||
85 | public static void displayMessage(String message) throws InterruptedException | 87 | public static void displayMessage(String message) throws InterruptedException |
86 | { | 88 | { |
87 | MessageWindow temp = new MessageWindow(message); | 89 | displayMessage(new MessageWindow(message)); |
88 | temp.initalizeMessages(message); | ||
89 | displayMessage(temp); | ||
90 | } | 90 | } |
91 | 91 | ||
92 | public static void displayMessage(String message, String faceSet, int face) throws InterruptedException | 92 | public static void displayMessage(String message, String faceSet, int face) throws InterruptedException |
93 | { | 93 | { |
94 | MessageWindow temp = new MessageWindow(message, faceSet, face); | 94 | displayMessage(new MessageWindow(message, faceSet, face)); |
95 | temp.initalizeMessages(message); | ||
96 | displayMessage(temp); | ||
97 | } | 95 | } |
98 | 96 | ||
99 | private void initalizeMessages(String message) | 97 | private void initalizeMessages(String message) |
@@ -150,11 +148,6 @@ public class MessageWindow implements Renderable { | |||
150 | 148 | ||
151 | public void render(Graphics2D g2) | 149 | public void render(Graphics2D g2) |
152 | { | 150 | { |
153 | if (messages == null) | ||
154 | { | ||
155 | initalizeMessages(message); | ||
156 | } | ||
157 | |||
158 | int y = MessageWindowLocation.Bottom.getY(); | 151 | int y = MessageWindowLocation.Bottom.getY(); |
159 | 152 | ||
160 | Display.setFont(g2); | 153 | Display.setFont(g2); |