comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet288.d @ 109:8ae65ae167f5

Updated swt win32 for DMD 1.063 and latest Tango trunk.
author Jacob Carlborg <doob@me.com>
date Wed, 15 Sep 2010 16:42:28 +0200
parents 93b0e7382fd5
children 9f4c18c268b2
comparison
equal deleted inserted replaced
108:b397a43d66d1 109:8ae65ae167f5
31 31
32 import java.lang.all; 32 import java.lang.all;
33 33
34 import tango.io.FilePath; 34 import tango.io.FilePath;
35 import tango.io.model.IFile; 35 import tango.io.model.IFile;
36 import tango.core.Thread; 36 //import tango.core.Thread;
37 import tango.io.Stdout; 37 import tango.io.Stdout;
38 import tango.util.Convert; 38 import tango.util.Convert;
39 import tango.core.Exception; 39 import tango.core.Exception;
40 40
41 static Display display; 41 static Display display;
86 image[i][j].dispose(); 86 image[i][j].dispose();
87 } 87 }
88 } 88 }
89 display.dispose (); 89 display.dispose ();
90 } 90 }
91 thread_joinAll(); 91 Thread.joinAll();
92 } 92 }
93 93
94 private static void loadAllImages(char[] directory, char[][] filenames) { 94 private static void loadAllImages(char[] directory, char[][] filenames) {
95 int numItems = filenames.length; 95 int numItems = filenames.length;
96 loader.length = numItems; 96 loader.length = numItems;
165 animateThread[ii] = new class(ii) Thread { 165 animateThread[ii] = new class(ii) Thread {
166 int imageDataIndex = 0; 166 int imageDataIndex = 0;
167 int id = 0; 167 int id = 0;
168 this(int _id) { 168 this(int _id) {
169 id = _id; 169 id = _id;
170 name = "Animation "~to!(char[])(ii); 170 //name = "Animation "~to!(char[])(ii);
171 isDaemon = true; 171 //isDaemon = true;
172 super(&run); 172 super(&run);
173 } 173 }
174 void run() { 174 void run() {
175 try { 175 try {
176 int repeatCount = loader[id].repeatCount; 176 int repeatCount = loader[id].repeatCount;
188 /* Sleep for the specified delay time (adding commonly-used slow-down fudge factors). */ 188 /* Sleep for the specified delay time (adding commonly-used slow-down fudge factors). */
189 try { 189 try {
190 int ms = imageDataArray[id][imageDataIndex].delayTime * 10; 190 int ms = imageDataArray[id][imageDataIndex].delayTime * 10;
191 if (ms < 20) ms += 30; 191 if (ms < 20) ms += 30;
192 if (ms < 30) ms += 10; 192 if (ms < 30) ms += 10;
193 Thread.sleep(0.001*ms); 193 Thread.sleep(1 * ms);
194 } catch (ThreadException e) { 194 } catch (ThreadException e) {
195 } 195 }
196 196
197 /* If we have just drawn the last image, decrement the repeat count and start again. */ 197 /* If we have just drawn the last image, decrement the repeat count and start again. */
198 if (imageDataIndex == imageDataArray[id].length - 1) repeatCount--; 198 if (imageDataIndex == imageDataArray[id].length - 1) repeatCount--;