29 |
import gzz.gfx.gl.*; |
import gzz.gfx.gl.*; |
30 |
import java.util.*; |
import java.util.*; |
31 |
|
|
32 |
|
import java.awt.event.ActionEvent; |
33 |
|
import java.awt.event.ActionListener; |
34 |
|
import java.awt.AWTEventMulticaster; |
35 |
|
|
36 |
|
|
37 |
public class GLUpdateManager extends AbstractUpdateManager { |
public class GLUpdateManager extends AbstractUpdateManager { |
38 |
public static final String rcsid = "$Id$"; |
public static final String rcsid = "$Id$"; |
39 |
private static boolean dbg = false; |
private static boolean dbg = false; |
40 |
private static void p(String s) { if(dbg) pa(s); } |
private static void p(String s) { if(dbg) pa(s); } |
41 |
private static void pa(String s) { System.err.println(s); } |
private static void pa(String s) { System.err.println(s); } |
42 |
|
|
43 |
|
// can be switched from jython.. |
44 |
|
public static boolean demoMode = false; |
45 |
|
|
46 |
public GLUpdateManager(Runnable r) { super(r); } |
public GLUpdateManager(Runnable r) { super(r); } |
47 |
|
|
48 |
static void startGLUpdateManager(Runnable r) { |
static void startGLUpdateManager(Runnable r) { |
61 |
return true; |
return true; |
62 |
} |
} |
63 |
|
|
64 |
|
/* for demo-events at the end of doIdle() */ |
65 |
|
private ActionListener actionListener = null; |
66 |
|
public synchronized void addActionListener(ActionListener l) { |
67 |
|
actionListener = AWTEventMulticaster.add(actionListener, l); |
68 |
|
} |
69 |
|
private void processEvent(ActionEvent e) { |
70 |
|
if (actionListener != null) { |
71 |
|
actionListener.actionPerformed(e); |
72 |
|
} |
73 |
|
} |
74 |
|
public static GLUpdateManager getInstance() { return (GLUpdateManager)instance; } |
75 |
|
|
76 |
protected boolean doIdle() { |
protected boolean doIdle() { |
77 |
|
if(demoMode) processEvent( |
78 |
|
new ActionEvent(this, ActionEvent.ACTION_LAST, "DEMO_EVENT")); |
79 |
|
|
80 |
if(super.doIdle()) return true; |
if(super.doIdle()) return true; |
81 |
GL.freeQueue(); |
GL.freeQueue(); |
82 |
return false; |
return false; |