- public static void init() {
- if (singleton != null) return;
- singleton = Platform.getScheduler();
- singleton.run();
+
+ /** adds a task to the front of the queue (guaranteed to run next) */
+ public static void addAtFront(Task t) { singleton.runnable.prepend(t); }
+
+ public static void init() { if (singleton == null) (singleton = Platform.getScheduler()).run(); }
+
+ private static Task current = null;
+ public static Task current() { return current; }
+
+ /** synchronizd so that we can safely call it from an event-delivery thread, in-context */
+ public static synchronized void renderAll() {
+ for(int i=0; i<Surface.allSurfaces.size(); i++) {
+ Surface s = ((Surface)Surface.allSurfaces.elementAt(i));
+ do { s.render(); } while(s.abort);
+ }